Protocol++® (Protocolpp®)
v5.6.2
|
Public Member Functions | |
jrsa (std::shared_ptr< InterfacePP::jlogger > &logger) | |
jrsa (int bitsize, rsapadtype_t padding, std::shared_ptr< InterfacePP::jlogger > &logger) | |
jrsa (int bitsize, rsapadtype_t padding, CryptoPP::RSA::PrivateKey &PRVKey, CryptoPP::RSA::PublicKey &PUBKey, std::shared_ptr< InterfacePP::jlogger > &logger) | |
jrsa (std::shared_ptr< jrsasa > &security) | |
virtual | ~jrsa ()=default |
Standard deconstructor. | |
template<typename T > | |
void | set_field (field_t field, T fieldval) |
template<typename T > | |
T | get_field (field_t field) |
void | gen_keypair () |
Generate key pair. | |
void | encrypt (std::shared_ptr< jarray< uint8_t >> &data, std::shared_ptr< jarray< uint8_t >> &ciphertext) |
void | decrypt (std::shared_ptr< jarray< uint8_t >> &ciphertext, std::shared_ptr< jarray< uint8_t >> &data) |
void | sign (std::shared_ptr< jarray< uint8_t >> &data, std::shared_ptr< jarray< uint8_t >> &signature) |
void | verify (std::shared_ptr< jarray< uint8_t >> &signature) |
void | get_security (std::shared_ptr< jrsasa > &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) |
jarray< uint8_t > | get_hdr () |
uint64_t | get_field (field_t field, jarray< uint8_t > &hdr) |
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) |
jrsa (jrsa &jrsa)=delete | |
jrsa (const jrsa &jrsa)=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< jrand > | m_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 | |
|
explicit |
Standard constructor with default values bitsize=3072 padding=PKCS1_5
logger | - logging object |
ProtocolPP::jrsa::jrsa | ( | int | bitsize, |
rsapadtype_t | padding, | ||
std::shared_ptr< InterfacePP::jlogger > & | logger | ||
) |
Standard constructor
bitsize | - size of the private key |
padding | - padding types (PKCS1_5 and PSS) |
logger | - logging object |
ProtocolPP::jrsa::jrsa | ( | int | bitsize, |
rsapadtype_t | padding, | ||
CryptoPP::RSA::PrivateKey & | PRVKey, | ||
CryptoPP::RSA::PublicKey & | PUBKey, | ||
std::shared_ptr< InterfacePP::jlogger > & | logger | ||
) |
Standard constructor
bitsize | - size of the private key |
padding | - padding types (PKCS1_5 and PSS) |
PRVKey | - RSA private key |
PUBKey | - RSA public key |
logger | - logging object |
|
explicit |
Standard constructor
security | - security association for RSA |
|
virtual |
Not used in this protocol
input | - encapsulated packet |
output | - decapsulated packet |
Implements ProtocolPP::jprotocol.
void ProtocolPP::jrsa::decrypt | ( | std::shared_ptr< jarray< uint8_t >> & | ciphertext, |
std::shared_ptr< jarray< uint8_t >> & | data | ||
) |
Decrypt the data
ciphertext | - encrypted data |
data | - decrypted data |
|
virtual |
Not used in this protocol
input | - data to encapsulate |
output | - encapsulated packet |
Implements ProtocolPP::jprotocol.
void ProtocolPP::jrsa::encrypt | ( | std::shared_ptr< jarray< uint8_t >> & | data, |
std::shared_ptr< jarray< uint8_t >> & | ciphertext | ||
) |
Encrypt the data
data | - data to encrypt |
ciphertext | - encrypted data |
|
virtual |
Returns the version field RSA object
field type | field name | Example |
---|---|---|
rsapadtype_t | RSAPAD | rsapadtype_t rsapad = get_field<rsapadtype_t>(field_t::RSAPAD) |
int | BITSIZE | int bitsize = get_field<int>(field_t::BITSIZE) |
CryptoPP::RSA::PrivateKey | PRVKEY | CryptoPP::RSA::PrivateKey prvkey = get_field<CryptoPP::RSA::PrivateKey>(field_t::PRVKEY) |
CryptoPP::RSA::PublicKey | PUBKEY | CryptoPP::RSA::PublicKey pubkey = get_field<CryptoPP::RSA::PublicKey>(field_t::PUBKEY) |
std::pair<CryptoPP::RSA::PrivateKey, CryptoPP::RSA::PublicKey> | KEYPAIR | shared_ptr<std::pair<CryptoPP::RSA::PrivateKey, CryptoPP::RSA::PublicKey> keypair = get_field<std::pair<CryptoPP::RSA::PrivateKey, CryptoPP::RSA::PublicKey>>(field_t::KEYPAIR) |
field | - field to retrieve from the IP security association |
Reimplemented from ProtocolPP::jprotocol.
|
virtual |
void ProtocolPP::jrsa::get_security | ( | std::shared_ptr< jrsasa > & | sec | ) |
get_security
sec | - Shared pointer to hold the security association |
void ProtocolPP::jrsa::set_field | ( | field_t | field, |
T | fieldval | ||
) |
Allows the user to update the field RSA object
field type | field name | Example |
---|---|---|
rsapadtype_t | RSAPAD | set_field<rsapadtype_t>(field_t::RSAPAD, rsapadtype_t::PKCS15) |
int | BITSIZE | set_field<int>(field_t::BITSIZE, bitsize) |
field | - field to update the IP security association |
fieldval | - value to update the IP security association |
|
virtual |
Not used in this protocol
field | - field to update |
value | - new value for the field |
Implements ProtocolPP::jprotocol.
|
virtual |
void ProtocolPP::jrsa::sign | ( | std::shared_ptr< jarray< uint8_t >> & | data, |
std::shared_ptr< jarray< uint8_t >> & | signature | ||
) |
Sign the data
data | - Data to sign using the pad type |
signature | - Generated signature |
|
virtual |
Prints the protocol object in JSON
myjson | - JSON object to print to |
direction | - randomzation |
indent | - indentation for JSON output |
Implements ProtocolPP::jprotocol.
|
virtual |
Prints the protocol object in XML
myxml | - XMLPrinter object to print to |
direction | - randomzation |
Implements ProtocolPP::jprotocol.
void ProtocolPP::jrsa::verify | ( | std::shared_ptr< jarray< uint8_t >> & | signature | ) |
Verify the data
signature | - Signature to verify using the pad type returns result of the signature verification in the status word |