EVPPKey EVPPKey::createFromRSAKey(const RSAKey& key) { boost::shared_ptr<EVP_PKEY> _pkey(EVP_PKEY_new(), EVP_PKEY_free); EXCEPTION_ASSERT(_pkey, Exception::bad_function_call, "Unable to create a EVP_PKEY structure"); EVP_PKEY_set1_RSA(_pkey.get(), key.d_rsa.get()); return EVPPKey(_pkey, key.hasPrivateCompound()); }
bool operator==(const RSAKey& lhs, const RSAKey& rhs) { if (lhs.hasPrivateCompound()) { if (rhs.hasPrivateCompound()) { return lhs.d_private_key == rhs.d_private_key; } } else { if (!rhs.hasPrivateCompound()) { return lhs.d_public_key == rhs.d_public_key; } } return false; }