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).

Best regards,
-- 
Marek Marcola <[EMAIL PROTECTED]>

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to