SSP21-CPP
Namespaces | Classes | Typedefs | Enumerations | Functions
ssp21 Namespace Reference

SSP21-cpp main namespace. More...

Namespaces

 consts
 Useful constants.
 
 initiator
 Initiator namespace.
 
 levels
 Logging levels.
 
 responder
 Responder namespace.
 

Classes

struct  Addresses
 Link-layer pair of addresses. More...
 
class  BufferBase
 
struct  CertificateBody
 
struct  CertificateChain
 
struct  CertificateEnvelope
 
class  Chain
 
struct  ContainerEntryTypeSpec
 
struct  ContainerFile
 
class  Crypto
 
struct  CryptoErrorSpec
 
struct  CryptoLayerConfig
 
struct  CryptoSuite
 
class  DHOutput
 
class  DSAOutput
 
class  EnumField
 
class  ErrorCategory
 
class  Exception
 
struct  ExtensionEnvelope
 
struct  FormatErrorSpec
 
struct  HandshakeEphemeralSpec
 
struct  HandshakeErrorSpec
 
struct  HandshakeHashSpec
 
struct  HandshakeKDFSpec
 
struct  HandshakeModeSpec
 
class  HashOutput
 
class  ICertificateHandler
 
class  ICollection
 
class  ICryptoBackend
 
class  IKeyLookup
 
class  IKeySource
 
class  ILowerLayer
 Performs asynchronous RX/TX operations on behalf of an IUpperLayer. More...
 
class  IMessagePrinter
 
struct  InitiatorConfig
 
class  IntegerField
 
class  IStack
 
class  IUpperLayer
 Performs asynchronous RX/TX operations on behalf of an ILowerLayer. More...
 
struct  KeyPair
 
class  KeyRecord
 
struct  Module
 
struct  NonceModeSpec
 
struct  ParseErrorSpec
 
class  PrintHex
 
class  PrivateKey
 
class  PublicKey
 
struct  PublicKeyTypeSpec
 
struct  ResponderConfig
 
class  SecureBuffer
 
class  SecureDynamicBuffer
 
class  SecureFile
 
class  SeqByteField
 
class  SeqStructField
 
struct  SessionConfig
 
struct  SessionKeys
 
struct  SessionLimits
 
struct  SessionModeSpec
 
struct  SessionStatistics
 
struct  StaticKeys
 
class  Statistic
 
class  SymmetricKey
 
class  VLength
 

Typedefs

typedef void(* gen_keypair_func_t) (KeyPair &pair)
 
typedef void(* hash_func_t) (const std::initializer_list< seq32_t > &data, SecureBuffer &output)
 
typedef void(* mac_func_t) (const seq32_t &key, const std::initializer_list< seq32_t > &data, SecureBuffer &output)
 
typedef void(* dh_func_t) (const PrivateKey &priv_key, const seq32_t &pub_key, DHOutput &output, std::error_code &ec)
 
typedef void(* kdf_func_t) (const seq32_t &salt, const std::initializer_list< seq32_t > &input_key_material, SymmetricKey &key1, SymmetricKey &key2)
 
typedef bool(* verify_dsa_t) (const seq32_t &message, const seq32_t &signature, const seq32_t &public_key)
 
typedef ErrorCategory< CryptoErrorSpecCryptoErrorCategory
 
typedef ErrorCategory< FormatErrorSpecFormatErrorCategory
 
typedef ser4cpp::RSeq< uint32_t > seq32_t
 
typedef ser4cpp::WSeq< uint32_t > wseq32_t
 

Enumerations

enum  BufferType {
  empty, x25519_key, ed25519_public_key, ed25519_private_key,
  sha256, ed25519_signature, symmetric_key
}
 
enum  ContainerEntryType : uint8_t {
  ContainerEntryType::shared_secret = 0x0, ContainerEntryType::certificate_chain = 0x1, ContainerEntryType::x25519_public_key = 0x2, ContainerEntryType::x25519_private_key = 0x3,
  ContainerEntryType::ed25519_public_key = 0x4, ContainerEntryType::ed25519_private_key = 0x5, ContainerEntryType::undefined = 0xFF
}
 
enum  CryptoError : uint8_t {
  CryptoError::ok = 0x0, CryptoError::bad_key_type = 0x1, CryptoError::bad_length = 0x2, CryptoError::dh_x25519_fail = 0x3,
  CryptoError::undefined_algorithm = 0x4, CryptoError::mac_auth_fail = 0x5, CryptoError::signature_auth_fail = 0x6, CryptoError::bad_buffer_size = 0x7,
  CryptoError::no_valid_session = 0x8, CryptoError::expired_ttl = 0x9, CryptoError::nonce_replay = 0xA, CryptoError::max_nonce_exceeded = 0xB,
  CryptoError::max_session_time_exceeded = 0xC, CryptoError::empty_user_data = 0xD, CryptoError::clock_rollback = 0xE
}
 
enum  FormatError : uint8_t { FormatError::ok = 0x0, FormatError::insufficient_space = 0x1 }
 
enum  HandshakeEphemeral : uint8_t { HandshakeEphemeral::x25519 = 0x0, HandshakeEphemeral::nonce = 0x1, HandshakeEphemeral::none = 0x2, HandshakeEphemeral::undefined = 0xFF }
 
enum  HandshakeError : uint8_t {
  HandshakeError::bad_message_format = 0x0, HandshakeError::unsupported_version = 0x1, HandshakeError::unsupported_handshake_ephemeral = 0x2, HandshakeError::unsupported_handshake_hash = 0x3,
  HandshakeError::unsupported_handshake_kdf = 0x4, HandshakeError::unsupported_session_mode = 0x6, HandshakeError::unsupported_nonce_mode = 0x7, HandshakeError::unsupported_handshake_mode = 0x8,
  HandshakeError::bad_certificate_format = 0x9, HandshakeError::bad_certificate_chain = 0xA, HandshakeError::unsupported_certificate_feature = 0xB, HandshakeError::authentication_error = 0xC,
  HandshakeError::no_prior_handshake_begin = 0xD, HandshakeError::key_not_found = 0xE, HandshakeError::none = 0xFD, HandshakeError::undefined = 0xFE,
  HandshakeError::internal = 0xFF
}
 
enum  HandshakeHash : uint8_t { HandshakeHash::sha256 = 0x0, HandshakeHash::undefined = 0xFF }
 
enum  HandshakeKDF : uint8_t { HandshakeKDF::hkdf_sha256 = 0x0, HandshakeKDF::undefined = 0xFF }
 
enum  HandshakeMode : uint8_t {
  HandshakeMode::shared_secret = 0x0, HandshakeMode::preshared_public_keys = 0x1, HandshakeMode::industrial_certificates = 0x2, HandshakeMode::quantum_key_distribution = 0x3,
  HandshakeMode::undefined = 0xFF
}
 
enum  NonceMode : uint8_t { NonceMode::increment_last_rx = 0x0, NonceMode::greater_than_last_rx = 0x1, NonceMode::undefined = 0xFF }
 
enum  ParseError : uint8_t {
  ParseError::ok = 0x0, ParseError::insufficient_bytes = 0x1, ParseError::undefined_enum = 0x2, ParseError::unexpected_function = 0x3,
  ParseError::too_many_bytes = 0x4, ParseError::impl_capacity_limit = 0x5, ParseError::reserved_bit = 0x6, ParseError::bad_vlength = 0x7
}
 
enum  PublicKeyType : uint8_t { PublicKeyType::Ed25519 = 0x0, PublicKeyType::X25519 = 0x1, PublicKeyType::undefined = 0xFF }
 
enum  SessionMode : uint8_t { SessionMode::hmac_sha256_16 = 0x0, SessionMode::undefined = 0xFF }
 

Functions

std::error_code make_error_code (CryptoError err)
 
bool any (FormatError value)
 
std::error_code make_error_code (FormatError err)
 
bool any (HandshakeError value)
 
bool any (ParseError value)
 

Detailed Description

SSP21-cpp main namespace.

See Factory.h for the entrypoint of the library.

Enumeration Type Documentation

◆ ContainerEntryType

enum ssp21::ContainerEntryType : uint8_t
strong

enumerates the possible entry types in a container file

Enumerator
shared_secret 

256-bit shared secret

certificate_chain 

industrial certificate chain

x25519_public_key 

X25519 private key.

x25519_private_key 

X25519 private key.

ed25519_public_key 

Ed25519 private key.

ed25519_private_key 

Ed25519 private key.

undefined 

value not defined

Definition at line 27 of file ContainerEntryType.h.

◆ CryptoError

enum ssp21::CryptoError : uint8_t
strong

Various errors in the cryptographic layer

Enumerator
ok 

no error

bad_key_type 

attempted operation with bad key type

bad_length 

attempted operation with a buffer with the wrong length

dh_x25519_fail 

X25519 DH operation failed. Bad public key?

undefined_algorithm 

a procedure cannot be executed b/c of an undefined algorithm

mac_auth_fail 

A calculated MAC did not match the specified MAC.

signature_auth_fail 

A calculated digital signature did not authenticate.

bad_buffer_size 

A buffer had an insufficient or incorrect size.

no_valid_session 

No validate session for authenticating user data.

expired_ttl 

The TTL on a message is expired.

nonce_replay 

The nonce on a received message has been replayed.

max_nonce_exceeded 

A nonce has reached a configured maximum value.

max_session_time_exceeded 

The session time has reached a configured maximum value.

empty_user_data 

Received a session message with no user data.

clock_rollback 

A rollback of the monotonic clock was detected.

Definition at line 28 of file CryptoError.h.

◆ FormatError

enum ssp21::FormatError : uint8_t
strong

The result of a message format operation

Enumerator
ok 

message was formatted successfully

insufficient_space 

not enough output buffer space

Definition at line 28 of file FormatError.h.

◆ HandshakeEphemeral

enum ssp21::HandshakeEphemeral : uint8_t
strong

Specifies the meaning of the ephemeral data in RequestHandshakeBegin

Enumerator
x25519 

x25519 algorithm public key

nonce 

32-byte random nonce

none 

Empty ephemeral used for QKD mode.

undefined 

value not defined

Definition at line 27 of file HandshakeEphemeral.h.

◆ HandshakeError

enum ssp21::HandshakeError : uint8_t
strong

Denotes an error condition that occurred during the handshake process

Enumerator
bad_message_format 

A received handshake message was malformed in some manner.

unsupported_version 

The requested version is not supported.

unsupported_handshake_ephemeral 

The requested handshake ephemeral is not supported or doesn't match the handshake mode.

unsupported_handshake_hash 

The requested handshake hash is not supported.

unsupported_handshake_kdf 

The requested handshake KDF is not supported.

unsupported_session_mode 

The requested session mode is not supported.

unsupported_nonce_mode 

The requested nonce verification mode is not supported.

unsupported_handshake_mode 

The requested handshake mode is not supported.

bad_certificate_format 

One of the received certificates was improperly encoded.

bad_certificate_chain 

One of the received certificates was improperly encoded.

unsupported_certificate_feature 

One of the received certificates utilizes an unsupported feature.

authentication_error 

The outstation was unable to authenticate the master.

no_prior_handshake_begin 

The master requested handshake auth, but no prior handshake begin was received.

key_not_found 

In shared-secret mode, the requested key id (mode_data) was not found.

none 

This value gets used internally in ssp21-cpp only.

undefined 

value not defined

internal 

internal error

Definition at line 27 of file HandshakeError.h.

◆ HandshakeHash

enum ssp21::HandshakeHash : uint8_t
strong

Specifies which hash algorithm is used for the handshake hash to calculate the chaining key

Enumerator
sha256 

Use SHA256.

undefined 

value not defined

Definition at line 27 of file HandshakeHash.h.

◆ HandshakeKDF

enum ssp21::HandshakeKDF : uint8_t
strong

Specifies the Key Derivation Function (KDF) used during the handshake

Enumerator
hkdf_sha256 

Use HKDF with HMAC-SHA256.

undefined 

value not defined

Definition at line 27 of file HandshakeKDF.h.

◆ HandshakeMode

enum ssp21::HandshakeMode : uint8_t
strong

specifies how key derivation occurs

Enumerator
shared_secret 

both parties have a shared secret

preshared_public_keys 

both parties know each others public DH keys

industrial_certificates 

Industrial certificate format.

quantum_key_distribution 

Single-use shared secrets.

undefined 

value not defined

Definition at line 27 of file HandshakeMode.h.

◆ NonceMode

enum ssp21::NonceMode : uint8_t
strong

Determines how nonces are verified during the session

Enumerator
increment_last_rx 

new nonce must strictly be equal to last nonce plus one

greater_than_last_rx 

new nonce must be greater than last nonce

undefined 

value not defined

Definition at line 27 of file NonceMode.h.

◆ ParseError

enum ssp21::ParseError : uint8_t
strong

The result of a message parse operation

Enumerator
ok 

message was parsed successfully

insufficient_bytes 

parser ran out of bytes before completion

undefined_enum 

an enumeration value was undefined

unexpected_function 

the message function was not the expected value

too_many_bytes 

parser completed with bytes still remaining

impl_capacity_limit 

reached an implementation specific capacity limit

reserved_bit 

the bit-field contains a reserved bit(s) that is set

bad_vlength 

a variable length (vlength) was not encoded correctly

Definition at line 27 of file ParseError.h.

◆ PublicKeyType

enum ssp21::PublicKeyType : uint8_t
strong

Defines the type of the public key embedded in a certificate body

Enumerator
Ed25519 

The key is an Ed25519 DSA public key.

X25519 

The key is an x25519 DH key.

undefined 

value not defined

Definition at line 27 of file PublicKeyType.h.

◆ SessionMode

enum ssp21::SessionMode : uint8_t
strong

Specifies the complete set of algorithms used to secure the session

Enumerator
hmac_sha256_16 

HMAC-SHA256 truncated to 16 bytes.

undefined 

value not defined

Definition at line 27 of file SessionMode.h.