inline buffer message_digest_context::sign_finalize(pkey::pkey& pkey) { buffer result(pkey.size()); sign_finalize(buffer_cast<uint8_t>(result), buffer_size(result), pkey); return result; }
void cipher_context::open_initialize(const cipher_algorithm& _algorithm, const void* key, size_t key_len, const void* iv, size_t iv_len, pkey::pkey pkey) { assert(key); if (key_len != _algorithm.key_length()) { throw std::runtime_error("key_len"); } if (iv_len != _algorithm.iv_length()) { throw std::runtime_error("iv_len"); } error::throw_error_if_not(EVP_OpenInit(&m_ctx, _algorithm.raw(), static_cast<const unsigned char*>(key), static_cast<int>(key_len), static_cast<const unsigned char*>(iv), pkey.raw()) != 0); }
inline void certificate_request::sign(pkey::pkey pkey, hash::message_digest_algorithm algorithm) const { error::throw_error_if_not(X509_REQ_sign(ptr().get(), pkey.raw(), algorithm.raw()) != 0); }
inline bool certificate_request::verify_private_key(pkey::pkey pkey) const { return X509_REQ_check_private_key(ptr().get(), pkey.raw()) == 1; }
inline void certificate_request::set_public_key(pkey::pkey pkey) const { error::throw_error_if_not(X509_REQ_set_pubkey(ptr().get(), pkey.raw()) != 0); }