Reputation: 3130
I am using RSACryptoServiceProvider to encrypt a symmetric key. I am using 1024 bits for the RSA object but I am not sure what data type I should use to store the encrypted key in my database.
Is binary(128) correct?
Upvotes: 0
Views: 323
Reputation: 69389
If you want product-specific recommendations, we'll need to know which database vendor you are using.
However, since you are encrypting with an RSA key, it's easy to predict the amount of data you will be storing. As you suggested, a 1024-bit key will produce 128 bytes of encrypted data. This should be stored as a binary type so as to avoid any loss of data through conversion to inappropriate character sets, for example.
In short, "binary(128)" looks like it could be correct, assuming that's a valid data type for your database vendor.
Upvotes: 2