Marek Marcola wrote:
Hello,
I woud like my public key to be embedded in my source code
as static char*, cause later I want to verify my licence
with that key.
x509 = PEM_read_X509(fp, NULL, NULL, NULL);
pkey = X509_get_pubkey(x509);
//Serialization
for(i=0; i< sizeof(*pkey); i++){
fprintf(fp, "%2.2x", ((unsigned char*)pkey)[i] );
//Deserialization
How can I read my public key from a char* ??
You can not use this kind of serialization because pkey
has dynamic allocated objects.
Use d2i_RSAPublicKey() and i2d_RSAPublicKey()
or d2i_RSA_PUBKEY() and i2d_RSA_PUBKEY() instead
where:
RSA *rsa_key = pkey->rsa;
(example for RSA).
if you have an EVP_PKEY it would be better to use i2d_PUBKEY()
or i2d_PrivateKey() etc. instead of handling the different key types
separately (it would have the additional advantage of treating
the EVP_PKEY as opaque)
Cheers,
Nils
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager [EMAIL PROTECTED]