The IV is used to initialize the first 16 byte matrix of the AES-CBC encryption scheme. cryptographically secure pseudo-random number generator Is it enough for me to properly salt to simply prepend "mypass" with the salt?Ĥ) Am I somehow supposed to use the salt to derive the key that I will use for encrypting "mypass" with AES? Or am I doing it right by simply using a hardcoded key?ĥ) What am I supposed to store in my database? Should the salt, the iv and the ciphertext all be stored in individual columns, or should they be somehow combined together, if so, is simple concatenation enough, or they must be combined with a special function?Ħ) Am I completely wrong and if so, what should I do instead? Doesn't this make the salting redundant, because the point of the salt is to prevent two ciphertext of the "mypass" to be identical?Ģ) Inversely, could it be that the IV is redundant, and I could just pass in the zero IV or a constant IV since I am salting my passwords?ģ) Say the IV and the salt are not redundant, because somehow I read without really understanding that the IV is XORed but not the salt, making both useful. Given this example, I have a few points which confuses me.ġ) The random IV I am passing to AES will have the effect that no two "mypass" gives the same ciphertext. Than I must encrypt salt+"mypass" using AES-CBC which I will use a hardcoded 256 bit key and a randomly generated IV of 16 byte.Įffectively I have: AesEncrypt(salt+"mypass", GenerateIv(), Key) Than I must prepend the salt with the user password: salt+"mypass". Right now I think to do this I need to generate a 16-byte salt using a CSPRNG. I need to decide what is the safest way to obfuscate this password using AES-CBC. I'll give an example to better explain my issue:Ī user with username "bob" signs up with the password "mypass" When encrypting the user password to store it in my database using AES-CBC, do I need to use a Key, an IV and a Salt? Whatever I need to use, how would they be used exactly? It will help me understand things better if you do. I know that I shouldn't use AES-CBC to do this, and probably should go with a hashing algorithm instead of an encryption one, but please, ignore this fact. To protect the passwords from prying eyes, I want to obfuscate them, I decide to use AES in CBC mode to do so. I want to authenticate users, so I need to know if the password they provide matches the one stored in my database. Imagine I have a website with user accounts.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |