Try to split b64 data in 64 chars lines. Francesco Petruzzi
[EMAIL PROTECTED] -------- The information contained in this electronic message and any attachments (the "Message") is intended for one or more specific individuals or entities, and may be confidential, proprietary, privileged or otherwise protected by law. If you are not the intended recipient, please notify the sender immediately, delete this Message and do not disclose, distribute, or copy it to any third party or otherwise use this Message. Electronic messages are not secure or error free and can contain viruses or may be delayed, and the sender is not liable for any of these occurrences. The sender reserves the right to monitor, record and retain electronic messages. -------- Le informazioni contenute in questo messaggio e gli eventuali allegati (il "Messaggio") si intendono inviate a uno o piú specifici destinatari. Il contenuto del Messaggio puó essere confidenziale, riservato e comunque protetto dalla legge applicabile. Se non siete i destinatari del Messaggio, siete pregati di informare immediatamente il mittente, cancellare questo Messaggio, non rivelarlo, non distribuirlo ne' inoltrarlo a terzi, non copiarlo né farne alcun uso. I messaggi di posta elettronica non sono sicuri e sono soggetti ad alterazioni, possono essere trasmettitori di Virus informatici o soggetti a ritardi nella distribuzione. Il mittente del Messaggio non puó essere in alcun modo considerato responsabile per queste evenienze. Il mittente si riserva il diritto di archiviare, ritenere e controllare i messaggi di posta elettronica. ----- Original Message ----- From: "coco coco" <[EMAIL PROTECTED]> To: <openssl-users@openssl.org> Sent: Tuesday, June 14, 2005 9:24 AM Subject: [Norton AntiSpam] question on reading PEM from memory > I'm trying to read a certificate in PEM format from memory, using BIO, but > everytime, it just returns NULL. Can anyone point out what's wrong with this > code? > > char * mykey = > "-----BEGIN CERTIFICATE-----\n" \ > "MIIBzjCCATegAwIBAgIIB+d8Z03zbQQwDQYJKoZIhvcNAQEFBQAwHzEMMAoGA1UEAxMDY3NwMQ8 wDQYDVQQGDAbkuK3lm70wHhcNMDUwMjA2MDc1OTQ3WhcNMDcwMjA2MDc1OTQ3WjAfMQwwCgYDVQQ DEwNjc3AxDzANBgNVBAYMBuS4reWbvTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAi5ERCTk 3RC8W/9T+ozruc9kWhLh9vQ1Ke130TfzWgX0wK2qGNUy+C4CCsjn6ThO8vz4QQtbt1QSwl8+BUAU dAto2iiHyI4nzxEnwhTheRDFnJsjMwwbjkYXZIDgpt+EiT9U0UryHtNaPUK7+se9Ee7PpjbJb51v wHhIGOikhDdkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEBADANBgkqhkiG9w0BAQUFAAOBgQB/nUF ATa4V8CXo0nMZYzBGA+bddbkphmW1unD/BLLbWq4ant4bgALt0a1nqHKEAPkeHXryxvsvZAoRR4m I7YvEjQvKaA06AwniATOcMDsa3RrHRoXp+/N2OfNMzjYt3Wa0ZqiI9Y/u1odrkvFamhKuCpMzvrJ SOACsiKB31v2fuw==\n" > \ > "-----END CERTIFICATE-----\n"; > > BIO *bio = BIO_new_mem_buf(mykey, -1); > > X509 *x509 = NULL; > PEM_read_bio_X509(bio, &x509, 0, NULL); > > if (x509 == NULL) > std::cout << "PEM_read_bio_X509 failed..." << std::endl; > > The problem is PEM_read_bio_X509() always return NULL for x509. I must have > done something wrong, but have no clue what is going on here. Browsing thru > the book "Network Security with OpenSSL" over and over again, and even > reading the code of OpenSSL, the way I invoked those functions seems correct > to me. > > Any help would be very much appreciated. > > rgds > > _________________________________________________________________ > Express yourself instantly with MSN Messenger! Download today - it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-users@openssl.org > Automated List Manager [EMAIL PROTECTED] > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]