Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been searching the internet and I've come up with a lot of answers of how to store paypal API credentials(Used in Paypal Express Checkout.) They say to hash the credentials using salt. But what I don't understand is how and where to store the salt. If they get access to the salt, can't they just un-hash the credentials? That doesn't seem very secure to me. They say not to hard-code the API credentials, but any other way still seems really vulnerable. Thanks for taking the time to look at my questions. I'd really appreciate help.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Hashing them doesn't make a lot of sense, because by definition, once you hash something, you can't get it back (unhashing is not possible, but you can crack a hash using a rainbow table or brute force). Normally if you salt a hash, you store the salt along with the hash, so that it's possible to compare something to the hash; the only thing a salt does is makes rainbow attacks more difficult.

I suggest storing them in a file that is restricted somehow (readable only by root for instance). Then, your checkout service could read the file before dropping privileges, similar to how X.509 certificates are usually handled.

Hardcoding them is generally pretty vulnerable; it means that if for any reason someone can see your source, they have the credentials (eg. if the handler is set wrong).

share|improve this answer
    
Hey, thanks for replying! What exactly do you mean by, "dropping privilages"? And how would I go about making the file only accessible by root? –  Sequence Sep 15 '12 at 0:55
    
You can set its owner and group to root, and set it mode 600. A service drops root privileges when it calls setuid() and setgid() to a non-root user (these are C functions); I suggest asking on stackoverflow if you want to know how to make your daemon do this. –  Falcon Momot Sep 15 '12 at 0:58
    
So, you're saying to remove privilages when I don't need it, and give privilages when I do? I'm using Php by the way. –  Sequence Sep 15 '12 at 1:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.