Yes it is possible. A combination of "openssl x509 -C" and the following
code may help:

x509key::x509key( UCHAR *d, long len, int pk )
{ /* This takes a ASN1 string so that the keys can be imbeded in the
code */
 UCHAR *p;
 int result;

 installed=0;
 public_key=NULL;
 private_key=NULL;
 file_name=NULL;
 x509=NULL;
 pem_der=X509KEY_X509;
 if (pk==-1)
  { // Public Key
   x509=d2i_X509(NULL,&d,(long)len);
   if (x509 == NULL) return;
   public_key=X509_extract_key(x509);
   if (public_key == NULL) return;
   public_private=X509KEY_PUBLIC;
  }
 else
  { // Private Key
   p=d;
   private_key=d2i_PrivateKey(pk,NULL,&p,(long)len);
   if (private_key == NULL) return;
   x509=X509_new();
   if (!x509) return;
   result=X509_set_pubkey( x509, private_key );
   if (result!=1) return;
   public_key=X509_extract_key(x509);
   if (!public_key) return;
  }
 ERR_load_crypto_strings();
 SSLeay_add_all_algorithms();
 installed=1;
}

It is part of a class I wrote for myself so everything may not make
sense, but it should help.

Robert Sandilands

Andrew Barnes wrote:
> 
> Is there a way to have your private key and
> certificate embedded in the application and not use
> files?
> 
> __________________________________________________
> Do You Yahoo!?
> Get Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to