CCF
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
ccf::crypto::PublicKey Class Referenceabstract

#include <public_key.h>

Inherited by ccf::crypto::PublicKey_OpenSSL.

Classes

struct  Coordinates
 

Public Member Functions

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
 
virtual Pem public_key_pem () const =0
 
virtual std::vector< uint8_t > public_key_der () const =0
 
virtual std::vector< uint8_t > public_key_raw () const =0
 
virtual CurveID get_curve_id () const =0
 
virtual Coordinates coordinates () const =0
 
virtual JsonWebKeyECPublic public_key_jwk (const std::optional< std::string > &kid=std::nullopt) const =0
 

Member Function Documentation

◆ coordinates()

virtual Coordinates ccf::crypto::PublicKey::coordinates ( ) const
pure virtual

The x/y coordinates of the public key

Implemented in ccf::crypto::KeyPair_OpenSSL, and ccf::crypto::PublicKey_OpenSSL.

◆ get_curve_id()

virtual CurveID ccf::crypto::PublicKey::get_curve_id ( ) const
pure virtual

◆ public_key_der()

virtual std::vector< uint8_t > ccf::crypto::PublicKey::public_key_der ( ) const
pure virtual

◆ public_key_jwk()

virtual JsonWebKeyECPublic ccf::crypto::PublicKey::public_key_jwk ( const std::optional< std::string > &  kid = std::nullopt) const
pure virtual

◆ public_key_pem()

virtual Pem ccf::crypto::PublicKey::public_key_pem ( ) const
pure virtual

◆ public_key_raw()

virtual std::vector< uint8_t > ccf::crypto::PublicKey::public_key_raw ( ) const
pure virtual

Get the raw bytes of the public key

Implemented in ccf::crypto::KeyPair_OpenSSL, and ccf::crypto::PublicKey_OpenSSL.

◆ verify() [1/3]

virtual bool ccf::crypto::PublicKey::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 in ccf::crypto::PublicKey_OpenSSL, and ccf::crypto::KeyPair_OpenSSL.

◆ verify() [2/3]

virtual bool ccf::crypto::PublicKey::verify ( const uint8_t *  contents,
size_t  contents_size,
const uint8_t *  sig,
size_t  sig_size,
MDType  md_type,
HashBytes bytes 
)
pure 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

Implemented in ccf::crypto::KeyPair_OpenSSL, ccf::crypto::PublicKey_OpenSSL, and ccf::crypto::PublicKey_OpenSSL.

◆ verify() [3/3]

bool ccf::crypto::PublicKey::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/2]

virtual bool ccf::crypto::PublicKey::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 in ccf::crypto::PublicKey_OpenSSL.

◆ verify_hash() [2/2]

virtual bool ccf::crypto::PublicKey::verify_hash ( const uint8_t *  hash,
size_t  hash_size,
const uint8_t *  sig,
size_t  sig_size,
MDType  md_type 
)
pure 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

Implemented in ccf::crypto::PublicKey_OpenSSL, and ccf::crypto::PublicKey_OpenSSL.


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