CCF
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ccf::crypto::RSAKeyPair_OpenSSL Class Reference

#include <rsa_key_pair.h>

Inherits ccf::crypto::RSAPublicKey_OpenSSL, and ccf::crypto::RSAKeyPair.

Public Member Functions

 RSAKeyPair_OpenSSL (size_t public_key_size=default_public_key_size, size_t public_exponent=default_public_exponent)
 
 RSAKeyPair_OpenSSL (EVP_PKEY *k)
 
 RSAKeyPair_OpenSSL (const RSAKeyPair &)=delete
 
 RSAKeyPair_OpenSSL (const Pem &pem)
 
 RSAKeyPair_OpenSSL (const JsonWebKeyRSAPrivate &jwk)
 
virtual ~RSAKeyPair_OpenSSL ()=default
 
virtual size_t key_size () const override
 
virtual std::vector< uint8_t > rsa_oaep_unwrap (const std::vector< uint8_t > &input, const std::optional< std::vector< std::uint8_t > > &label=std::nullopt) override
 
virtual Pem private_key_pem () const override
 
virtual Pem public_key_pem () const override
 
virtual std::vector< uint8_t > public_key_der () const override
 
virtual std::vector< uint8_t > sign (std::span< const uint8_t > d, MDType md_type=MDType::NONE, size_t salt_length=0) const override
 
virtual bool verify (const uint8_t *contents, size_t contents_size, const uint8_t *signature, size_t signature_size, MDType md_type=MDType::NONE, size_t salt_length=0) override
 
virtual JsonWebKeyRSAPrivate private_key_jwk_rsa (const std::optional< std::string > &kid=std::nullopt) const override
 
- Public Member Functions inherited from ccf::crypto::RSAPublicKey_OpenSSL
 RSAPublicKey_OpenSSL ()=default
 
 RSAPublicKey_OpenSSL (EVP_PKEY *c)
 
 RSAPublicKey_OpenSSL (const Pem &pem)
 
 RSAPublicKey_OpenSSL (std::span< const uint8_t > der)
 
 RSAPublicKey_OpenSSL (const JsonWebKeyRSAPublic &jwk)
 
virtual ~RSAPublicKey_OpenSSL ()=default
 
virtual std::vector< uint8_t > rsa_oaep_wrap (const uint8_t *input, size_t input_size, const uint8_t *label=nullptr, size_t label_size=0) override
 
virtual std::vector< uint8_t > rsa_oaep_wrap (const std::vector< uint8_t > &input, const std::optional< std::vector< std::uint8_t > > &label=std::nullopt) override
 
virtual bool verify_pkcs1 (const uint8_t *contents, size_t contents_size, const uint8_t *signature, size_t signature_size, MDType md_type=MDType::NONE) override
 
virtual Components components () const override
 
OpenSSL::Unique_BIGNUM get_bn_param (const char *key_name) const
 
virtual JsonWebKeyRSAPublic public_key_jwk_rsa (const std::optional< std::string > &kid=std::nullopt) const override
 
- Public Member Functions inherited from ccf::crypto::PublicKey_OpenSSL
 PublicKey_OpenSSL (PublicKey_OpenSSL &&key)=default
 
 PublicKey_OpenSSL (EVP_PKEY *key)
 
 PublicKey_OpenSSL (const Pem &pem)
 
 PublicKey_OpenSSL (std::span< const uint8_t > der)
 
 PublicKey_OpenSSL (const JsonWebKeyECPublic &jwk)
 
virtual ~PublicKey_OpenSSL ()
 
virtual bool verify (const uint8_t *contents, size_t contents_size, const uint8_t *sig, size_t sig_size, MDType md_type, HashBytes &bytes) override
 
virtual bool verify_hash (const uint8_t *hash, size_t hash_size, const uint8_t *sig, size_t sig_size, MDType md_type) override
 
virtual std::vector< uint8_t > public_key_raw () const override
 
virtual CurveID get_curve_id () const override
 
int get_openssl_group_id () const
 
 operator EVP_PKEY * () const
 
virtual Coordinates coordinates () const override
 
virtual JsonWebKeyECPublic public_key_jwk (const std::optional< std::string > &kid=std::nullopt) const override
 
virtual bool verify (const uint8_t *contents, size_t contents_size, const uint8_t *sig, size_t sig_size, MDType md_type, HashBytes &bytes)=0
 
bool verify (const uint8_t *contents, size_t contents_size, const uint8_t *sig, size_t sig_size, MDType md_type=MDType::NONE)
 
virtual bool verify (const std::vector< uint8_t > &contents, const std::vector< uint8_t > &signature)
 
virtual bool verify_hash (const std::vector< uint8_t > &hash, const std::vector< uint8_t > &signature, MDType md_type)
 
virtual bool verify_hash (const uint8_t *hash, size_t hash_size, const uint8_t *sig, size_t sig_size, MDType md_type)=0
 
- Public Member Functions inherited from ccf::crypto::PublicKey
bool verify (const uint8_t *contents, size_t contents_size, const uint8_t *sig, size_t sig_size, MDType md_type=MDType::NONE)
 
- Public Member Functions inherited from ccf::crypto::RSAPublicKey
 RSAPublicKey ()=default
 
virtual ~RSAPublicKey ()=default
 
 RSAPublicKey (const Pem &pem)
 
 RSAPublicKey (const std::vector< uint8_t > &der)
 
 RSAPublicKey (const JsonWebKeyRSAPublic &jwk)
 
- Public Member Functions inherited from ccf::crypto::RSAKeyPair
 RSAKeyPair ()=default
 
 RSAKeyPair (const RSAKeyPair &)=delete
 
 RSAKeyPair (const Pem &pem)
 
virtual ~RSAKeyPair ()=default
 
virtual bool verify (const std::vector< uint8_t > &contents, const std::vector< uint8_t > &signature, MDType md_type=MDType::NONE, size_t salt_length=0)
 

Additional Inherited Members

- Static Public Member Functions inherited from ccf::crypto::RSAPublicKey_OpenSSL
static std::vector< uint8_t > bn_bytes (const BIGNUM *bn)
 
- Static Public Member Functions inherited from ccf::crypto::PublicKey_OpenSSL
static int get_openssl_group_id (CurveID gid)
 
- Static Public Attributes inherited from ccf::crypto::RSAKeyPair
static constexpr size_t default_public_key_size = 2048
 
static constexpr size_t default_public_exponent = 65537
 
- Protected Member Functions inherited from ccf::crypto::PublicKey_OpenSSL
 PublicKey_OpenSSL ()
 
- Static Protected Member Functions inherited from ccf::crypto::RSAPublicKey_OpenSSL
static std::pair< std::vector< uint8_t >, std::vector< uint8_t > > rsa_public_raw_from_jwk (const JsonWebKeyRSAPublic &jwk)
 
- Static Protected Member Functions inherited from ccf::crypto::PublicKey_OpenSSL
static std::vector< uint8_t > ec_point_public_from_jwk (const JsonWebKeyECPublic &jwk)
 
- Protected Attributes inherited from ccf::crypto::PublicKey_OpenSSL
EVP_PKEY * key = nullptr
 

Constructor & Destructor Documentation

◆ RSAKeyPair_OpenSSL() [1/5]

ccf::crypto::RSAKeyPair_OpenSSL::RSAKeyPair_OpenSSL ( size_t  public_key_size = default_public_key_size,
size_t  public_exponent = default_public_exponent 
)

◆ RSAKeyPair_OpenSSL() [2/5]

ccf::crypto::RSAKeyPair_OpenSSL::RSAKeyPair_OpenSSL ( EVP_PKEY *  k)

◆ RSAKeyPair_OpenSSL() [3/5]

ccf::crypto::RSAKeyPair_OpenSSL::RSAKeyPair_OpenSSL ( const RSAKeyPair )
delete

◆ RSAKeyPair_OpenSSL() [4/5]

ccf::crypto::RSAKeyPair_OpenSSL::RSAKeyPair_OpenSSL ( const Pem pem)

◆ RSAKeyPair_OpenSSL() [5/5]

ccf::crypto::RSAKeyPair_OpenSSL::RSAKeyPair_OpenSSL ( const JsonWebKeyRSAPrivate jwk)

◆ ~RSAKeyPair_OpenSSL()

virtual ccf::crypto::RSAKeyPair_OpenSSL::~RSAKeyPair_OpenSSL ( )
virtualdefault

Member Function Documentation

◆ key_size()

size_t ccf::crypto::RSAKeyPair_OpenSSL::key_size ( ) const
overridevirtual

Get the key size in bits

Reimplemented from ccf::crypto::RSAPublicKey_OpenSSL.

◆ private_key_jwk_rsa()

JsonWebKeyRSAPrivate ccf::crypto::RSAKeyPair_OpenSSL::private_key_jwk_rsa ( const std::optional< std::string > &  kid = std::nullopt) const
overridevirtual

◆ private_key_pem()

Pem ccf::crypto::RSAKeyPair_OpenSSL::private_key_pem ( ) const
overridevirtual

Get the private key in PEM format

Implements ccf::crypto::RSAKeyPair.

◆ public_key_der()

std::vector< uint8_t > ccf::crypto::RSAKeyPair_OpenSSL::public_key_der ( ) const
overridevirtual

Get the public key in DER format

Reimplemented from ccf::crypto::RSAPublicKey_OpenSSL.

◆ public_key_pem()

Pem ccf::crypto::RSAKeyPair_OpenSSL::public_key_pem ( ) const
overridevirtual

Get the public key in PEM format

Reimplemented from ccf::crypto::RSAPublicKey_OpenSSL.

◆ rsa_oaep_unwrap()

std::vector< uint8_t > ccf::crypto::RSAKeyPair_OpenSSL::rsa_oaep_unwrap ( const std::vector< uint8_t > &  input,
const std::optional< std::vector< std::uint8_t > > &  label = std::nullopt 
)
overridevirtual

Unwrap data using RSA-OAEP-256 (CKM_RSA_PKCS_OAEP)

Parameters
inputRaw data to unwrap
labelOptional string used as label during unwrapping
Returns
Unwrapped data

Implements ccf::crypto::RSAKeyPair.

◆ sign()

std::vector< uint8_t > ccf::crypto::RSAKeyPair_OpenSSL::sign ( std::span< const uint8_t >  d,
MDType  md_type = MDType::NONE,
size_t  salt_length = 0 
) const
overridevirtual

◆ verify()

bool ccf::crypto::RSAKeyPair_OpenSSL::verify ( const uint8_t *  contents,
size_t  contents_size,
const uint8_t *  signature,
size_t  signature_size,
MDType  md_type = MDType::NONE,
size_t  salt_length = 0 
)
overridevirtual

Reimplemented from ccf::crypto::RSAPublicKey_OpenSSL.


The documentation for this class was generated from the following files: