Search code examples
securityencryptionbase64rsarijndael

Should encrypted data base64 encoded to store it in a database?


Should I first encode my encrypted text with base64 to store it in a database? It will be larger when I encode it but is better or faster to decrypt it? (Especially for Rijndael and RSA encrypted data.)


Solution

  • No, you don't need to encode your ciphertext using base64 encoding. You should encode your ciphertext only if your field just accepts text values. Speed is normally not an issue as cryptographic algorithms are much slower than the conversion from or to base64.