Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

We need to be able to retrieve password. Hashing is one-way, we can't do that.

So we ended up using AES.

We want to know if the following schema is safe or not. I am only familiar with modulo PK encryption scheme, but I can't figure out the safeness here:

  1. p = encrypt(password, newIV, newSecret)
  2. s = encrypt(newSecret, newIV, password)

We basically encryp the newSecret with user password. So whenever retrieval is needed, user must supply the password and we then decrypt it and pass it to the user.

Is there any undo modulo thing like we would find in RSA-kind encryption/decryption scheme?

share|improve this question
3  
Why do you need to be able to decrypt a password? Sounds like an unusual system to me. –  Polynomial Feb 13 '13 at 2:03
    
@Polynomial because of constraints. Yes, it's weird. But forgive us, it is something that we can't undo. Again, the main question is whether there's a some undo when encrypting like this. –  CppLearner Feb 13 '13 at 2:08
    
Sorry, but that sounds highly irregular. What constraints? If you're asking about a secure way to do something, we need context. –  Polynomial Feb 13 '13 at 2:09
    
@Polynomial we have to pass the password to the 2nd system on behalf of the user. If we could do it with hashing and OAuth we would. This constraint is basically legacy. No worry, this is not some public thing. It's very internal, but we have to work around with it while rolling out a newer system. –  CppLearner Feb 13 '13 at 2:11
2  
Ah, so you are really just storing encrypted credentials as opposed to a reversible password. –  AJ Henderson Feb 13 '13 at 3:22
show 1 more comment

1 Answer

up vote 2 down vote accepted

Since you only need one account to be able to access the credentials for a second legacy system, I would recommend that you use a chain. The user password for your system should not be reversible and the encrypted credentials should not be available without the user's password. You can store the encrypted credentials with a symmetric record key that can be protected by both the user's password for your system and, if necessary, an administrative private key to allow account recovery. This would probably be the best you can do since it would not allow the user's legacy account to be decrypted without the user's password.

(Basically just treat the legacy credentials as secured data. There should be no difference.)

share|improve this answer
    
Yes. We are aware of the shit we are in lol which is really really embarrasing. I am going to decrypt your wonderful idea one at a time. So you think encrypting the secret key with user's password is okay? or are you suggesting the password for the 2nd system should just be the encrypted credential? Sorry for being a noob right now. Thanks! –  CppLearner Feb 13 '13 at 6:01
    
There really isn't any difference between the legacy credentials and any other encrypted data. You should do a typical user level encryption where the records can only be recovered if the user's password is entered (via whatever secure symmetric key derivation you want to do.) This is basically the best you can hope for unless you also have a hardware security module that will allow you to additionally encrypt it such that it can only be decrypted by a key held in the HSM. Generally, the best bet is to use a key for encrypting the record and then encrypt that key with the user's password. –  AJ Henderson Feb 13 '13 at 14:01
    
thanks! just did it. –  CppLearner Feb 13 '13 at 19:34
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.