keyString contains

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,2D1A4A3700D0F3ED

RAn7K9q2wwlz2vbwA9v+2I0RS/vxrwo4ldXGzWxlhGDk/yPmCZYonwo5J6WknkGa
4Th4bfSzXyOx1DJnxWDC81WQI9U59hoQZaNWQ/uvv2I691hYyV9hGe4j16nxdA6H
s/CUXXVjwBfXGBRS+tOtXk6v/Ze/n5Wp5CvUb+R210EWguSqo+zYLDxk7B3ILEb7
LuOTFsOfz8Fr4GUM0z2JsO5krUMw+4+5XcnUahxecxy+LfSM+uO9nN71/MRKgo8G
6nnwrlCKT3L18XTnXPaXKBZwcHd6jX2jY+RFDhZd17LvH3JI4ZqUQJelLCFLBacd
jyTgiZYbI6vuUq6vEoSEwrxV1iJ6z2UafnonSbcectgzyHCEkA/c52Z/8CSusp9p
R+uyglijjfFkz0VFE4Da1XNH9Iu4Rvoz8e8ksRYTc7X7GoCfC12YVEERQlkbsPr3
qFreIJFk8o/WJn3/jLVQET6BtwFscRzb+l5iDaHWoAjuPsZIyifybBOL2yy2hwJI
WXcpe2jSWv3r6PmHdom9JaQsjg6yObt91LZKeryek25pEs44z71MzNsLkKgnD+Fz
hEsHHUhCkqOGpG0yg0OfDQRr10TdOSI3W7DSM9i6oIAq4XATGqsoM1b8dFCJlZ4J
mZDOh+IMPlhhS9fnN5MnZWyP6H5d7b1kcH3AL43xzSowXrWetBYOtamqwooAT9Ia
ckvum/4x9IrRqxHgHnht9ZT4bjBr9HZMmw9ZPwo6AzWyiZWPmNWvw+grELNINFkv
uAqLG/rdVLFPuiNxJtO5UtuyOjfUorsAK1bjoA5OXUkwlH2Omnnnag==
-----END RSA PRIVATE KEY-----

It's just a temporary RSA key that I created for development.  The 
passphrase is "hello".

The ASP page loads the key from a file and sends it to the COM object.
When the error occurred, I tried outputting the keyString back to the 
ASP in the *licence variable, and the ASP did receive a correct looking 
string.

Steven Reddie wrote:
> 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]
> 

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

Reply via email to