Protocol++® (Protocolpp®)  v5.6.2
ProtocolPP::jecdsafp Class Reference
Inheritance diagram for ProtocolPP::jecdsafp:
Collaboration diagram for ProtocolPP::jecdsafp:

Public Member Functions

 jecdsafp (ike_hash_t hash, CryptoPP::OID curve, std::shared_ptr< InterfacePP::jlogger > &logger)
 
 jecdsafp (std::shared_ptr< jecdsafpsa > &security)
 
virtual ~jecdsafp ()=default
 Standard deconstructor.
 
template<typename T >
void set_field (field_t field, T fieldval)
 
template<typename T >
get_field (field_t field)
 
void gen_keypair ()
 Generate a public key pair.
 
void sign (std::shared_ptr< jarray< uint8_t >> &data, std::shared_ptr< jarray< uint8_t >> &signature)
 
void verify (std::shared_ptr< jarray< uint8_t >> &data)
 
void get_security (std::shared_ptr< jecdsafpsa > &sec)
 
void to_xml (tinyxml2::XMLPrinter &myxml, direction_t direction)
 
void to_json (std::ofstream &myjson, direction_t direction, std::string &indent)
 
void set_hdr (jarray< uint8_t > &hdr)
 
void set_field (field_t field, uint64_t value)
 
void set_prvkey256 (CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA256 >::PrivateKey &fieldval)
 
void set_prvkey384 (CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA384 >::PrivateKey &fieldval)
 
void set_prvkey512 (CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA512 >::PrivateKey &fieldval)
 
void set_pubkey256 (CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA256 >::PublicKey &fieldval)
 
void set_pubkey384 (CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA384 >::PublicKey &fieldval)
 
void set_pubkey512 (CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA512 >::PublicKey &fieldval)
 
jarray< uint8_t > get_hdr ()
 
uint64_t get_field (field_t field, jarray< uint8_t > &hdr)
 
CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA256 >::PrivateKey get_prvkey256 ()
 
CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA384 >::PrivateKey get_prvkey384 ()
 
CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA512 >::PrivateKey get_prvkey512 ()
 
CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA256 >::PublicKey get_pubkey256 ()
 
CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA384 >::PublicKey get_pubkey384 ()
 
CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA512 >::PublicKey get_pubkey512 ()
 
void encap_packet (std::shared_ptr< jarray< uint8_t >> &input, std::shared_ptr< jarray< uint8_t >> &output)
 
void decap_packet (std::shared_ptr< jarray< uint8_t >> &input, std::shared_ptr< jarray< uint8_t >> &output)
 
 jecdsafp (jecdsafp &jecdsafp)=delete
 
 jecdsafp (const jecdsafp &jecdsafp)=delete
 
- Public Member Functions inherited from ProtocolPP::jprotocol
 jprotocol (direction_t dir)
 
 jprotocol (direction_t dir, std::string &file)
 
 jprotocol (direction_t dir, std::shared_ptr< jrand > &rand)
 
 jprotocol (direction_t dir, std::shared_ptr< jrand > &rand, std::string &file)
 
virtual ~jprotocol ()
 Standard deconstructor.
 
virtual void encap_packet (std::shared_ptr< jarray< uint8_t >> &output)
 
virtual void decap_packet (std::shared_ptr< jarray< uint8_t >> &input)
 
bool hasfile ()
 
uint32_t get_status ()
 
jarray< uint8_t > checksum (iana_t prot, direction_t dir, jarray< uint8_t > &check, uint32_t offset=0)
 
jarray< uint8_t > pad (pad_t padtype, uint32_t len)
 
 jprotocol (jprotocol &jprotocol)=delete
 
 jprotocol (const jprotocol &jprotocol)=delete
 

Additional Inherited Members

- Static Public Member Functions inherited from ProtocolPP::jprotocol
const static std::string currentDateTime ()
 
static std::string str_status (uint32_t status)
 
static jarray< uint8_t > to_array (uint8_t input)
 
static jarray< uint8_t > to_array (uint16_t input)
 
static jarray< uint8_t > to_array (uint32_t input)
 
static jarray< uint8_t > to_array (uint64_t input)
 
static uint8_t to_u8 (jarray< uint8_t > src_array)
 
static uint16_t to_u16 (jarray< uint8_t > src_array)
 
static uint32_t to_u32 (jarray< uint8_t > src_array)
 
static uint64_t to_u64 (jarray< uint8_t > src_array)
 
static uint32_t fnv_hash (std::shared_ptr< jarray< uint8_t >> &header, jarray< uint8_t > &mask, uint32_t hdrlen)
 
- Protected Member Functions inherited from ProtocolPP::jprotocol
template<typename T , typename TE >
std::shared_ptr< jreplay< T, TE > > update_replay (protocol_t prot, T &seqnum, TE &extseq, bool usext, uint32_t size)
 
template<typename T , typename TE >
std::shared_ptr< jreplay< T, TE > > update_replay (protocol_t prot, T &seqnum, TE &extseq, bool usext, uint32_t size, jarray< uint8_t > &window)
 
void update_status (uint32_t stat)
 
void get_data (std::shared_ptr< jarray< uint8_t >> &data)
 
void put_data (std::shared_ptr< jarray< uint8_t >> &wdata)
 
void encryptdat (std::shared_ptr< jarray< uint8_t >> &red, std::shared_ptr< jarray< uint8_t >> &black)
 
void decryptdat (std::shared_ptr< jarray< uint8_t >> &black, std::shared_ptr< jarray< uint8_t >> &red)
 
uint32_t roundup (uint32_t value, uint32_t mult)
 
- Protected Attributes inherited from ProtocolPP::jprotocol
direction_t m_dir
 direction of processing
 
uint32_t m_status
 
std::shared_ptr< jrandm_rand
 random data generator passed into constructor
 
std::string m_filename
 file input string for this protocol
 
std::fstream m_file
 input file stream object for this protocol
 
endian_t m_endian
 endianess string for this protocol
 

Constructor & Destructor Documentation

◆ jecdsafp() [1/2]

ProtocolPP::jecdsafp::jecdsafp ( ike_hash_t  hash,
CryptoPP::OID  curve,
std::shared_ptr< InterfacePP::jlogger > &  logger 
)

ECDSA Fp Constructor for named type (see /ref jenum)

Parameters
hash- hash type for curve
curve- Name of the OID curve
logger- logging object

◆ jecdsafp() [2/2]

ProtocolPP::jecdsafp::jecdsafp ( std::shared_ptr< jecdsafpsa > &  security)
explicit

ECDSA Fp Constructor for named type (see /ref jenum)

Parameters
security- ECFPDSA Security Association

Member Function Documentation

◆ decap_packet()

void ProtocolPP::jecdsafp::decap_packet ( std::shared_ptr< jarray< uint8_t >> &  input,
std::shared_ptr< jarray< uint8_t >> &  output 
)
virtual

Not used in this protocol

Parameters
input- encapsulated data
output- decapsulated packet

Implements ProtocolPP::jprotocol.

◆ encap_packet()

void ProtocolPP::jecdsafp::encap_packet ( std::shared_ptr< jarray< uint8_t >> &  input,
std::shared_ptr< jarray< uint8_t >> &  output 
)
virtual

Not used in this protocol

Parameters
input- data to encapsulate
output- encapsulated packet

Implements ProtocolPP::jprotocol.

◆ get_field() [1/2]

template<typename T >
T ProtocolPP::jecdsafp::get_field ( field_t  field)
virtual

Returns the version field of the ECFPDSA object

ECFPDSA Get Fields
field typefield nameExample
int BITSIZEint bitsize = get_field<int>(field_t::BITSIZE)
ike_hash_t IKEHASHike_hash_t hash = get_field<ike_hash_t>(field_t::IKEHASH)
CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>::PublicKey PUBKEYCryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>::PublicKey pubkey = get_field<CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>::PublicKey>(field_t::PUBKEY)
CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>::PrivateKey PRVKEYCryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>::PrivateKey prvkey = get_field<CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>::PrivateKey>(field_t::PRVKEY)
CryptoPP::OID CURVE<CryptoPP::OID> curve = get_field<CryptoPP::OID>(field_t::CURVE)
Parameters
field- field to retrieve from the ECDSA object
Returns
field of the ECDSA object

Reimplemented from ProtocolPP::jprotocol.

◆ get_field() [2/2]

uint64_t ProtocolPP::jecdsafp::get_field ( field_t  field,
jarray< uint8_t > &  hdr 
)
virtual

Not used in this protocol

Returns
0

Implements ProtocolPP::jprotocol.

◆ get_hdr()

jarray<uint8_t> ProtocolPP::jecdsafp::get_hdr ( )
virtual

Not used in this protocol

Returns
empty array

Implements ProtocolPP::jprotocol.

◆ get_prvkey256()

CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>::PrivateKey ProtocolPP::jecdsafp::get_prvkey256 ( )
Returns
SHA-256 Private key for ECDSA

◆ get_prvkey384()

CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA384>::PrivateKey ProtocolPP::jecdsafp::get_prvkey384 ( )
Returns
SHA-384 Private key for ECDSA

◆ get_prvkey512()

CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA512>::PrivateKey ProtocolPP::jecdsafp::get_prvkey512 ( )
Returns
SHA-512 Private key for ECDSA

◆ get_pubkey256()

CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>::PublicKey ProtocolPP::jecdsafp::get_pubkey256 ( )
Returns
SHA-256 Public key for ECDSA

◆ get_pubkey384()

CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA384>::PublicKey ProtocolPP::jecdsafp::get_pubkey384 ( )
Returns
SHA-384 Public key for ECDSA

◆ get_pubkey512()

CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA512>::PublicKey ProtocolPP::jecdsafp::get_pubkey512 ( )
Returns
SHA-512 Public key for ECDSA

◆ get_security()

void ProtocolPP::jecdsafp::get_security ( std::shared_ptr< jecdsafpsa > &  sec)

get_security

Parameters
sec- Shared pointer to hold the security association

◆ set_field() [1/2]

template<typename T >
void ProtocolPP::jecdsafp::set_field ( field_t  field,
fieldval 
)

Allows the user to update the ECFPDSA object

ECFPDSA Set Fields
field typefield nameExample
int BITSIZEset_field<int>(field_t::BITSIZE, size)
ike_hash_t IKEHASHset_field<ike_hash_t>(field_t::IKEHASH, hash)
CryptoPP::OID CURVEset_field<CryptoPP::OID>(field_t::CURVE, curve)
Parameters
field- field to update for ECFPDSA
fieldval- value to update for ECFPDSA

◆ set_field() [2/2]

void ProtocolPP::jecdsafp::set_field ( field_t  field,
uint64_t  value 
)
virtual

Not used in this protocol

Parameters
field- field to update
value- new value for the field

Implements ProtocolPP::jprotocol.

◆ set_hdr()

void ProtocolPP::jecdsafp::set_hdr ( jarray< uint8_t > &  hdr)
virtual

Not used in this protocol

Parameters
hdr- header of the packet

Implements ProtocolPP::jprotocol.

◆ set_prvkey256()

void ProtocolPP::jecdsafp::set_prvkey256 ( CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA256 >::PrivateKey &  fieldval)
Parameters
fieldval- new SHA-256 private key for the field

◆ set_prvkey384()

void ProtocolPP::jecdsafp::set_prvkey384 ( CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA384 >::PrivateKey &  fieldval)
Parameters
fieldval- new SHA-384 private key for the field

◆ set_prvkey512()

void ProtocolPP::jecdsafp::set_prvkey512 ( CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA512 >::PrivateKey &  fieldval)
Parameters
fieldval- new SHA-512 private key for the field

◆ set_pubkey256()

void ProtocolPP::jecdsafp::set_pubkey256 ( CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA256 >::PublicKey &  fieldval)
Parameters
fieldval- new SHA-256 public key for the field

◆ set_pubkey384()

void ProtocolPP::jecdsafp::set_pubkey384 ( CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA384 >::PublicKey &  fieldval)
Parameters
fieldval- new SHA-384 public key for the field

◆ set_pubkey512()

void ProtocolPP::jecdsafp::set_pubkey512 ( CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA512 >::PublicKey &  fieldval)
Parameters
fieldval- new SHA-512 public key for the field

◆ sign()

void ProtocolPP::jecdsafp::sign ( std::shared_ptr< jarray< uint8_t >> &  data,
std::shared_ptr< jarray< uint8_t >> &  signature 
)

Generate a public key pair

Parameters
data- data to sign
signature- Signature generated from private key and data

◆ to_json()

void ProtocolPP::jecdsafp::to_json ( std::ofstream &  myjson,
direction_t  direction,
std::string &  indent 
)
virtual

Prints the protocol object in JSON

Parameters
myjson- JSON object to print to
direction- randomzation
indent- indentation for JSON output

Implements ProtocolPP::jprotocol.

◆ to_xml()

void ProtocolPP::jecdsafp::to_xml ( tinyxml2::XMLPrinter myxml,
direction_t  direction 
)
virtual

Prints the protocol object in XML

Parameters
myxml- XMLPrinter object to print to
direction- randomzation

Implements ProtocolPP::jprotocol.

◆ verify()

void ProtocolPP::jecdsafp::verify ( std::shared_ptr< jarray< uint8_t >> &  data)

Verify the signature using the received public key

Parameters
data- data and signature concatenated to verify (data || signature) returns results of signature verification in status word

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