|
libcdoc
0.1.8
|
A descriptor of encryption method and key to be used in container. More...
#include <Recipient.h>
Public Types | |
| enum | Type : uint8_t { NONE, SYMMETRIC_KEY, PUBLIC_KEY, KEYSHARE } |
| The recipient type. More... | |
| enum | PKType : uint8_t { ECC, RSA } |
| The public key type. More... | |
Public Member Functions | |
| Recipient ()=default | |
| bool | isEmpty () const |
| test whether the Recipient structure is initialized More... | |
| bool | isSymmetric () const |
| check whether Recipient is based on symmetric key More... | |
| bool | isPKI () const |
| check whether Recipient is based on public key More... | |
| bool | isCertificate () const |
| check whether Recipient is based on certificate More... | |
| bool | isKeyServer () const |
| check whether Recipient is keyserver More... | |
| bool | isKeyShare () const |
| check whether Recipient is keyshare More... | |
| void | clear () |
| Clear all values and set type to NONE. More... | |
| bool | isTheSameRecipient (const Recipient &other) const |
| A convenience method to check whether two recipients are both public key based and have the same keys. More... | |
| bool | isTheSameRecipient (const std::vector< uint8_t > &public_key) const |
| A convenience method to check whether a recipient is public key based and has the given keys. More... | |
| std::string | getLabel (const std::vector< std::pair< std::string_view, std::string_view >> &extra) const |
| Get the label for this recipient. More... | |
| bool | operator== (const Recipient &other) const =default |
Static Public Member Functions | |
| static Recipient | makeSymmetric (std::string label, int32_t kdf_iter) |
| Create a new symmetric key based Recipient. More... | |
| static Recipient | makePublicKey (std::string label, std::vector< uint8_t > public_key, PKType pk_type) |
| Create a new public key based Recipient. More... | |
| static Recipient | makeCertificate (std::string label, std::vector< uint8_t > cert) |
| Create a new certificate based Recipient. More... | |
| static Recipient | makeServer (std::string label, std::vector< uint8_t > public_key, PKType pk_type, std::string server_id) |
| Create a new capsule server based Recipient If the label is empty, a machine-readable label text (public key version) is automatically generated according to CDoc2 specification. More... | |
| static Recipient | makeServer (std::string label, std::vector< uint8_t > cert, std::string server_id) |
| Create a new capsule server based Recipient If the label is empty, a machine-readable label text (either eID or certificate version) is automatically generated according to CDoc2 specification. More... | |
| static Recipient | makeShare (std::string label, std::string server_id, std::string recipient_id) |
| Create new keyshare recipient. More... | |
| static std::map< std::string, std::string > | parseLabel (const std::string &label) |
| parse machine-readable CDoc2 label More... | |
Public Attributes | |
| Type | type = Type::NONE |
| The recipient type. More... | |
| PKType | pk_type = PKType::ECC |
| The public key type. More... | |
| int32_t | kdf_iter = 0 |
| The number of iterations for PBKDF. Value 0 means directly provided symmetric key. More... | |
| std::string | label |
| The recipient's label (if empty the lock label will be autogenerated) More... | |
| std::vector< uint8_t > | rcpt_key |
| Recipient's public key (for all PKI types) More... | |
| std::vector< uint8_t > | cert |
| The recipient's certificate (if present) More... | |
| std::string | id |
| The recipient id for share server (PNOEE-XXXXXXXXXXX) More... | |
| std::string | server_id |
| The keyserver or share server list id (if present) More... | |
| uint64_t | expiry_ts = 0 |
| The requested capsule expiry timestamp (0 - use server default) More... | |
| std::string | file_name |
| key/certificate filename for machine-readable label More... | |
| std::string | key_name |
| public key/password name for machine-readable label More... | |
Protected Member Functions | |
| Recipient (Type _type) | |
A descriptor of encryption method and key to be used in container.
Recipient determines all the relevant properties to encrypt the FMK for a certain target.
| enum libcdoc::Recipient::PKType : uint8_t |
| enum libcdoc::Recipient::Type : uint8_t |
|
default |
|
inlineprotected |
|
inline |
Clear all values and set type to NONE.
| std::string libcdoc::Recipient::getLabel | ( | const std::vector< std::pair< std::string_view, std::string_view >> & | extra | ) | const |
Get the label for this recipient.
Either returns user-specified label or generate machine-readable if empty
| extra | additional parameter values to use |
|
inline |
check whether Recipient is based on certificate
|
inline |
test whether the Recipient structure is initialized
|
inline |
check whether Recipient is keyserver
|
inline |
check whether Recipient is keyshare
|
inline |
check whether Recipient is based on public key
|
inline |
check whether Recipient is based on symmetric key
| bool libcdoc::Recipient::isTheSameRecipient | ( | const Recipient & | other | ) | const |
A convenience method to check whether two recipients are both public key based and have the same keys.
| other | another Recipient |
| bool libcdoc::Recipient::isTheSameRecipient | ( | const std::vector< uint8_t > & | public_key | ) | const |
A convenience method to check whether a recipient is public key based and has the given keys.
| public_key | a public key to test |
|
static |
|
static |
Create a new capsule server based Recipient If the label is empty, a machine-readable label text (public key version) is automatically generated according to CDoc2 specification.
| label | the label text |
| public_key | the public key value |
| pk_type | the algorithm type (either ECC or RSA) |
| server_id | the keyserver id |
|
static |
Create a new capsule server based Recipient If the label is empty, a machine-readable label text (either eID or certificate version) is automatically generated according to CDoc2 specification.
| label | the label text |
| cert | the recipient's certificate (der-encoded) |
| server_id | the keyserver id |
|
static |
|
static |
|
default |
|
static |
parse machine-readable CDoc2 label
| label | the label |
| std::vector<uint8_t> libcdoc::Recipient::cert |
The recipient's certificate (if present)
| uint64_t libcdoc::Recipient::expiry_ts = 0 |
The requested capsule expiry timestamp (0 - use server default)
| std::string libcdoc::Recipient::file_name |
key/certificate filename for machine-readable label
| std::string libcdoc::Recipient::id |
The recipient id for share server (PNOEE-XXXXXXXXXXX)
| int32_t libcdoc::Recipient::kdf_iter = 0 |
The number of iterations for PBKDF. Value 0 means directly provided symmetric key.
| std::string libcdoc::Recipient::key_name |
public key/password name for machine-readable label
| std::string libcdoc::Recipient::label |
The recipient's label (if empty the lock label will be autogenerated)
| PKType libcdoc::Recipient::pk_type = PKType::ECC |
The public key type.
| std::vector<uint8_t> libcdoc::Recipient::rcpt_key |
Recipient's public key (for all PKI types)
| std::string libcdoc::Recipient::server_id |
The keyserver or share server list id (if present)
| Type libcdoc::Recipient::type = Type::NONE |
The recipient type.