我创建了一个SAML请求,并从SAML Server获得了签名响应。我想使用令牌签名证书(包含RSA公钥)验证这一点。
我正在使用OpenSSL库从文件加载证书,但我在RSA结构中获得了一些垃圾值,当我尝试创建XSECCryptoKey
密钥时,它最终会崩溃。
以下是我用来获取RSA密钥的示例。
const char* certpath = "sample.cer";
EVP_PKEY *key;
BIO* in=BIO_new(BIO_s_file_internal());
BIO_read_filename(in, certpath);
X509* cer=PEM_read_bio_X509(in, nullptr, nullptr, nullptr);
BIO_free(in);
key = X509_get_pubkey(cer);
XSECCryptoKey* ret=new OpenSSLCryptoKeyRSA(pkey); //crashing, because of improper values in RSA keys (key->pkey.rsa->n,key->pkey.rsa->d etc)
我在这里做错了什么?
答案 0 :(得分:0)
问题是因为openssl库。它适用于ssleay32.dll和libeay32.dll(0.98)版本,但不适用于1.0.1和1.0.2。