Reading a binary RSA key from memory? #460
-
I wanted to store an RSA key in binary format in the code and retrieve it via e.g. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
First, this functionality is crypto library specific. If you are using default OpenSSL, then multiple RSA key formats are supported -- PEM, DER, ...: Line 304 in fd87b54 Note that RSA key has multiple components while AES/DES keys have only one. Thus, you need to know how these components are stored in memory to correctly read the key. You can also use something like xmlSecOpenSSLEvpKeyDataAdoptEvp() function to use an RSA key stored in OpenSSL EVP key which can be initialized / loaded using any relevant OpenSSL functions (e.g. EVP key can be on a hardware device). Aleksey |
Beta Was this translation helpful? Give feedback.
-
Thanks for the hints! Using the |
Beta Was this translation helpful? Give feedback.
First, this functionality is crypto library specific. If you are using default OpenSSL, then multiple RSA key formats are supported -- PEM, DER, ...:
xmlsec/src/openssl/app.c
Line 304 in fd87b54
Note that RSA key has multiple components while AES/DES keys have only one. Thus, you need to know how these components are stored in memory to correctly read the key.
You can also use something like xmlSecOpenSSLEvpKeyDataAdoptEvp() function to use an RSA key stored in OpenSSL EVP key which can be initialized / loaded using any relevant OpenSSL functions (e.g. EVP key can be on a hardware device).
Aleksey