Using AES GCM to encrypt password and store in DB

151 Views Asked by At

I'm trying to use the AES-GCM encryption and I didn't see a good solution on how the encrypted data is stored

I'm following the implementation recommended here https://www.scottbrady91.com/c-sharp/aes-gcm-dotnet#aesgcm and it seems once the data is encrypted we need 3 separate pieces to decrypt it (nonce, tag and the encrypted data).

In our previous implementation (AES-CBC), we simply had the encrypted string for the password and we stored it in our DB along with other user details.

Are there any recommended techniques to save the details needed for decryption? The blog above says a common technique is to concatenate everything [Nonce (12B) | Ciphertext (*B) | Tag (16B)].

Would converting all the byte arrays to base64 string, concatenating them and saving that string in password field in DB be a good approach?

If the question isn't appropriate for this forum, can someone please recommend some other forum?

0

There are 0 best solutions below