- string keypath=data_path + "key.pem";\r
- BIO* in=BIO_new(BIO_s_file_internal());\r
- if (in && BIO_read_filename(in,keypath.c_str())>0) {\r
- EVP_PKEY* pkey=PEM_read_bio_PrivateKey(in, NULL, NULL, NULL);\r
- if (pkey) {\r
- m_key=new OpenSSLCryptoKeyRSA(pkey);\r
- EVP_PKEY_free(pkey);\r
- }\r
- }\r
- if (in) BIO_free(in);\r
- TS_ASSERT(m_key!=NULL);\r
-\r
- string certpath=data_path + "cert.pem";\r
- in=BIO_new(BIO_s_file_internal());\r
- if (in && BIO_read_filename(in,certpath.c_str())>0) {\r
- X509* x=NULL;\r
- while (x=PEM_read_bio_X509(in,NULL,NULL,NULL)) {\r
- m_certs.push_back(new OpenSSLCryptoX509(x));\r
- X509_free(x);\r
- }\r
- }\r
- if (in) BIO_free(in);\r
- TS_ASSERT(m_certs.size()>0);\r
- \r