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

#include <ec_public_key.h>

Inherits ccf::crypto::ECPublicKey, and ccf::crypto::PublicKey_OpenSSL.

Inherited by ccf::crypto::ECKeyPair_OpenSSL.

Public Member Functions

 ECPublicKey_OpenSSL (EVP_PKEY *key)
 
 ECPublicKey_OpenSSL (const Pem &pem)
 
 ECPublicKey_OpenSSL (ECPublicKey_OpenSSL &&key)=default
 
 ECPublicKey_OpenSSL (std::span< const uint8_t > der)
 
 ECPublicKey_OpenSSL (const JsonWebKeyECPublic &jwk)
 
 ~ECPublicKey_OpenSSL () override
 
bool verify (const uint8_t *contents, size_t contents_size, const uint8_t *sig, size_t sig_size, MDType md_type, HashBytes &bytes) override
 
bool verify_hash (const uint8_t *hash, size_t hash_size, const uint8_t *sig, size_t sig_size, MDType md_type) override
 
Pem public_key_pem () const override
 
std::vector< uint8_t > public_key_der () const override
 
std::vector< uint8_t > public_key_raw () const override
 
CurveID get_curve_id () const override
 
int get_openssl_group_id () const
 
Coordinates coordinates () const override
 
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::ECPublicKey
virtual ~ECPublicKey ()=default
 
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::PublicKey_OpenSSL
 PublicKey_OpenSSL ()=default
 
 PublicKey_OpenSSL (EVP_PKEY *key)
 
 PublicKey_OpenSSL (const Pem &pem)
 
void check_is_cose_compatible (int cose_alg)
 
 operator EVP_PKEY * () const
 
virtual ~PublicKey_OpenSSL ()
 

Static Public Member Functions

static int get_openssl_group_id (CurveID gid)
 

Protected Member Functions

 ECPublicKey_OpenSSL ()
 

Static Protected Member Functions

static std::vector< uint8_t > ec_point_public_from_jwk (const JsonWebKeyECPublic &jwk)
 

Additional Inherited Members

- Protected Attributes inherited from ccf::crypto::PublicKey_OpenSSL
EVP_PKEY * key = nullptr
 

Constructor & Destructor Documentation

◆ ECPublicKey_OpenSSL() [1/6]

ccf::crypto::ECPublicKey_OpenSSL::ECPublicKey_OpenSSL ( )
protecteddefault

◆ ECPublicKey_OpenSSL() [2/6]

ccf::crypto::ECPublicKey_OpenSSL::ECPublicKey_OpenSSL ( EVP_PKEY *  key)

◆ ECPublicKey_OpenSSL() [3/6]

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

◆ ECPublicKey_OpenSSL() [4/6]

ccf::crypto::ECPublicKey_OpenSSL::ECPublicKey_OpenSSL ( ECPublicKey_OpenSSL &&  key)
default

◆ ECPublicKey_OpenSSL() [5/6]

ccf::crypto::ECPublicKey_OpenSSL::ECPublicKey_OpenSSL ( std::span< const uint8_t >  der)

◆ ECPublicKey_OpenSSL() [6/6]

ccf::crypto::ECPublicKey_OpenSSL::ECPublicKey_OpenSSL ( const JsonWebKeyECPublic jwk)

◆ ~ECPublicKey_OpenSSL()

ccf::crypto::ECPublicKey_OpenSSL::~ECPublicKey_OpenSSL ( )
overridedefault

Member Function Documentation

◆ coordinates()

ECPublicKey::Coordinates ccf::crypto::ECPublicKey_OpenSSL::coordinates ( ) const
overridevirtual

The x/y coordinates of the public key

Implements ccf::crypto::ECPublicKey.

◆ ec_point_public_from_jwk()

std::vector< uint8_t > ccf::crypto::ECPublicKey_OpenSSL::ec_point_public_from_jwk ( const JsonWebKeyECPublic jwk)
staticprotected

◆ get_curve_id()

CurveID ccf::crypto::ECPublicKey_OpenSSL::get_curve_id ( ) const
overridevirtual

The curve ID

Implements ccf::crypto::ECPublicKey.

◆ get_openssl_group_id() [1/2]

int ccf::crypto::ECPublicKey_OpenSSL::get_openssl_group_id ( ) const

◆ get_openssl_group_id() [2/2]

int ccf::crypto::ECPublicKey_OpenSSL::get_openssl_group_id ( CurveID  gid)
static

◆ public_key_der()

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

Get the public key in DER format

Implements ccf::crypto::ECPublicKey.

◆ public_key_jwk()

JsonWebKeyECPublic ccf::crypto::ECPublicKey_OpenSSL::public_key_jwk ( const std::optional< std::string > &  kid = std::nullopt) const
overridevirtual

◆ public_key_pem()

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

Get the public key in PEM format

Implements ccf::crypto::ECPublicKey.

◆ public_key_raw()

std::vector< uint8_t > ccf::crypto::ECPublicKey_OpenSSL::public_key_raw ( ) const
overridevirtual

Get the raw bytes of the public key

Implements ccf::crypto::ECPublicKey.

◆ verify() [1/4]

virtual bool ccf::crypto::ECPublicKey::verify ( const std::vector< uint8_t > &  contents,
const std::vector< uint8_t > &  signature 
)
inlinevirtual

Verify that a signature was produced on contents with the private key associated with the public key held by the object.

Parameters
contentsSequence of bytes that was signed
signatureSignature as a sequence of bytes
Returns
Whether the signature matches the contents and the key

Reimplemented from ccf::crypto::ECPublicKey.

◆ verify() [2/4]

bool ccf::crypto::ECPublicKey_OpenSSL::verify ( const uint8_t *  contents,
size_t  contents_size,
const uint8_t *  sig,
size_t  sig_size,
MDType  md_type,
HashBytes bytes 
)
overridevirtual

Verify that a signature was produced on contents with the private key associated with the public key held by the object.

Parameters
contentsaddress of contents
contents_sizesize of contents
sigaddress of signature
sig_sizesize of signature
md_typeDigest algorithm to use
bytesBuffer to write the hash to
Returns
Whether the signature matches the contents and the key

Implements ccf::crypto::ECPublicKey.

◆ verify() [3/4]

virtual bool ccf::crypto::ECPublicKey::verify ( const uint8_t *  contents,
size_t  contents_size,
const uint8_t *  sig,
size_t  sig_size,
MDType  md_type,
HashBytes bytes 
)
virtual

Verify that a signature was produced on contents with the private key associated with the public key held by the object.

Parameters
contentsaddress of contents
contents_sizesize of contents
sigaddress of signature
sig_sizesize of signature
md_typeDigest algorithm to use
bytesBuffer to write the hash to
Returns
Whether the signature matches the contents and the key

Implements ccf::crypto::ECPublicKey.

◆ verify() [4/4]

bool ccf::crypto::ECPublicKey::verify ( const uint8_t *  contents,
size_t  contents_size,
const uint8_t *  sig,
size_t  sig_size,
MDType  md_type = MDType::NONE 
)
inline

Verify that a signature was produced on contents with the private key associated with the public key held by the object.

Parameters
contentsaddress of contents
contents_sizesize of contents
sigaddress of signature
sig_sizesize of signature
md_typeDigest algorithm to use (derived from the public key if md_type == MDType::None).
Returns
Whether the signature matches the contents and the key

◆ verify_hash() [1/3]

virtual bool ccf::crypto::ECPublicKey::verify_hash ( const std::vector< uint8_t > &  hash,
const std::vector< uint8_t > &  signature,
MDType  md_type 
)
inlinevirtual

Verify that a signature was produced on the hash of some contents with the private key associated with the public key held by the object.

Parameters
hashHash of some content
signatureSignature as a sequence of bytes
md_typeType of hash
Returns
Whether the signature matches the hash and the key

Reimplemented from ccf::crypto::ECPublicKey.

◆ verify_hash() [2/3]

bool ccf::crypto::ECPublicKey_OpenSSL::verify_hash ( const uint8_t *  hash,
size_t  hash_size,
const uint8_t *  sig,
size_t  sig_size,
MDType  md_type 
)
overridevirtual

Verify that a signature was produced on the hash of some contents with the private key associated with the public key held by the object.

Parameters
hashHash of some content
hash_sizelength of hash
sigSignature as a sequence of bytes
sig_sizeLength of sig
md_typeDigest algorithm
Returns
Whether the signature matches the hash and the key

Implements ccf::crypto::ECPublicKey.

◆ verify_hash() [3/3]

virtual bool ccf::crypto::ECPublicKey::verify_hash ( const uint8_t *  hash,
size_t  hash_size,
const uint8_t *  sig,
size_t  sig_size,
MDType  md_type 
)
virtual

Verify that a signature was produced on the hash of some contents with the private key associated with the public key held by the object.

Parameters
hashHash of some content
hash_sizelength of hash
sigSignature as a sequence of bytes
sig_sizeLength of sig
md_typeDigest algorithm
Returns
Whether the signature matches the hash and the key

Implements ccf::crypto::ECPublicKey.


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