On Thu, Feb 02, 2006, Chong Peng wrote:

> dear all:
> 
> i am trying to read the rsa key from the memory (rather than from a file). 
> here is what i did:
> 
> 1. use the "openssl genrsa -out key.pem 1024" to generate a rsa key in the 
> file key.pem.
> 2. copy and paste the key from the "key.pem" to my code.
> 3. use a mem bio to read the key from the memory.
> 
> my code to do this is like the following.
> 
> the call to "PEM_ASN1_read_bio" always return null. anybody has any idea or 
> similiar experience? thanks a lot
> 
> chong peng
> 
> /* copy and paste from key.pem */
> char rsakey[] = 
> "-----BEGIN RSA PRIVATE KEY-----\
> MIICXAIBAAKBgQC0SF/4JTo3XzffsPeNPbglZ6sz/f/mlUO/CUtB8hk0DTz3V/9r\
> iWagrVHjqaF/xikWFsxbzKecRyDDNyhgMWV8eeAVGpJSvmyJZH43MWO1zCiBXsi2\

Well there aren't any line feeds (\n) in there so you the whole thing is being
incorrectly represented as a single line.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to