What's in keyString?  The error message indicates that the banner
("-----BEGIN PRIVATE KEY-----") is missing.

Steven

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Tim Coleman
Sent: Thursday, 19 September 2002 11:49 PM
To: [EMAIL PROTECTED]
Subject: Creating a COM object to use openssl


Hi,

I've been working on making a COM object that uses OpenSSL to sign some
data that I'm using for a form of software licensing.  I have code that
works fine as an executable on Windows, but when I try to make a COM
object, I can't seem to load the private key from a string.  I'm not
sure if I'm doing something wrong or not.

Here's the code I have to load the private RSA key from a string.  After
this has been run, key is NULL, so it didn't succeed in loading the key
from the given string.

STDMETHODIMP CLicence::GenerateLicence(BSTR licenceData, BSTR keyString,
BSTR passphrase, BSTR *licence)
{
        AFX_MANAGE_STATE(AfxGetStaticModuleState())
        EVP_MD *md = EVP_sha1();
        EVP_add_cipher( EVP_des_ede3_cbc() );

        EVP_PKEY *key = NULL;
        BIO *bio = BIO_new_mem_buf( (char *) keyString, -1 );
        PEM_read_bio_PrivateKey(bio, &key, NULL, (char *) passphrase );
        BIO_free( bio );
        ...

I'm trying to access this object from an ASP page.  The specific error
from openssl is "error:0906D06C:PEM routines:PEM_read_bio:no start line"

Does anyone have any ideas on what might cause this?

Thanks,

--
Tim Coleman <[EMAIL PROTECTED]>
Web Developer, Open Text Corporation Global Services
Tel: 519 888 7111 ext. 2619
Fax: 519 888 6737

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

Reply via email to