Represents an asymmetric key or key pair for a pubkey encryption algorithm.
More...
#include <asymmetric_key.hpp>
|
| ES_API (CPPESSENCE) explicit asymmetric_key(void *blob) |
| Creates an instance from an internal blob.
|
|
| asymmetric_key (use_public_tag tag, zstring_view path, const password_request_handler &handler={}) |
| Creates an instance from a public key stored on the disk.
|
|
| asymmetric_key (use_public_tag tag, std::span< const std::byte > buffer, const password_request_handler &handler={}) |
| Creates an instance from a memory buffer storing a public key.
|
|
| asymmetric_key (use_private_tag tag, zstring_view path, const password_request_handler &handler={}) |
| Creates an instance from a private key stored on the disk.
|
|
| asymmetric_key (use_private_tag tag, std::span< const std::byte > buffer, const password_request_handler &handler={}) |
| Creates an instance from a memory buffer storing a private key.
|
|
| ES_API (CPPESSENCE) asymmetric_key(asymmetric_key &&) noexcept |
|
| ES_API (CPPESSENCE) ~asymmetric_key() |
|
| ES_API (CPPESSENCE) asymmetric_key &operator |
|
| ES_API (CPPESSENCE) asymmetric_key_type type() const |
| Gets the type of the asymmetric key.
|
|
ES_API(CPPESSENCE) abi ES_API(CPPESSENCE) abi | ES_API (CPPESSENCE) void *to_blob() const noexcept |
| Gets the name of the asymmetric key.
|
|
ES_API(CPPESSENCE) abi | ES_API (CPPESSENCE) void save_public(zstring_view path) const |
| Saves the public key to a string.
|
|
ES_API(CPPESSENCE) abi ES_API(CPPESSENCE) abi | ES_API (CPPESSENCE) void save_private(zstring_view path) const |
| Saves the private key to a string.
|
|
void | save_private (zstring_view path, zstring_view cipher_name, std::string_view password) const |
| Encrypts and saves the private key to a file.
|
|
Represents an asymmetric key or key pair for a pubkey encryption algorithm.
- See also
- pubkey_cipher_provider
◆ asymmetric_key() [1/4]
essence::crypto::asymmetric_key::asymmetric_key |
( |
use_public_tag | tag, |
|
|
zstring_view | path, |
|
|
const password_request_handler & | handler = {} ) |
Creates an instance from a public key stored on the disk.
- Parameters
-
tag | The hint tag for overloading, should always be essence::crypto::use_public. |
path | The path of the public key file. |
handler | An optional callable object to retrieve the password having encrypted the key. |
- See also
- password_request_handler
◆ asymmetric_key() [2/4]
essence::crypto::asymmetric_key::asymmetric_key |
( |
use_public_tag | tag, |
|
|
std::span< const std::byte > | buffer, |
|
|
const password_request_handler & | handler = {} ) |
Creates an instance from a memory buffer storing a public key.
- Parameters
-
tag | the hint tag for overloading, should always be essence::crypto::use_public. |
buffer | the memory buffer containing the public key. |
handler | an optional callable object to retrieve the password having encrypted the key. |
◆ asymmetric_key() [3/4]
essence::crypto::asymmetric_key::asymmetric_key |
( |
use_private_tag | tag, |
|
|
zstring_view | path, |
|
|
const password_request_handler & | handler = {} ) |
Creates an instance from a private key stored on the disk.
- Parameters
-
tag | The hint tag for overloading, should always be essence::crypto::use_private. |
path | The path of the private key file. |
handler | An optional callable object to retrieve the password having encrypted the key. |
- See also
- password_request_handler
◆ asymmetric_key() [4/4]
essence::crypto::asymmetric_key::asymmetric_key |
( |
use_private_tag | tag, |
|
|
std::span< const std::byte > | buffer, |
|
|
const password_request_handler & | handler = {} ) |
Creates an instance from a memory buffer storing a private key.
- Parameters
-
tag | The hint tag for overloading, should always be essence::crypto::use_private. |
buffer | The memory buffer containing the private key. |
handler | An optional callable object to retrieve the password having encrypted the key. |
◆ ES_API() [1/5]
essence::crypto::asymmetric_key::ES_API |
( |
CPPESSENCE | | ) |
const |
|
nodiscard |
Gets the type of the asymmetric key.
- Returns
- The type of the asymmetric key.
- See also
- asymmetric_key_type
◆ ES_API() [2/5]
essence::crypto::asymmetric_key::ES_API |
( |
CPPESSENCE | | ) |
|
Creates an instance from an internal blob.
- Warning
- DO NOT USE this constructor unless you know what you are doing.
- Parameters
-
blob | a pointer to the internal blob. |
◆ ES_API() [3/5]
ES_API(CPPESSENCE) abi ES_API(CPPESSENCE) abi essence::crypto::asymmetric_key::ES_API |
( |
CPPESSENCE | | ) |
const |
|
nodiscardnoexcept |
Gets the name of the asymmetric key.
- Returns
- The name of the asymmetric key.
Gets the description of the asymmetric key.
- Returns
- The description of the asymmetric key.
Gets the internal blob.
- Returns
- The internal blob.
◆ ES_API() [4/5]
ES_API(CPPESSENCE) abi ES_API(CPPESSENCE) abi essence::crypto::asymmetric_key::ES_API |
( |
CPPESSENCE | | ) |
const |
|
nodiscard |
Saves the private key to a string.
- Returns
- The string containing the private key.
Encrypts and saves the private key to a string.
- Parameters
-
cipher_name | The name of a symmetric cipher to encrypt the key. |
password | The password coded in displayable characters to encrypt the key. |
- Returns
- The string containing the encrypted private key.
Saves the private key to a file.
- Parameters
-
path | The path of the file. |
◆ ES_API() [5/5]
ES_API(CPPESSENCE) abi essence::crypto::asymmetric_key::ES_API |
( |
CPPESSENCE | | ) |
const |
|
nodiscard |
Saves the public key to a string.
- Returns
- The string containing the public key.
Saves the public key to a file.
- Parameters
-
path | The path of the file. |
◆ save_private()
void essence::crypto::asymmetric_key::save_private |
( |
zstring_view | path, |
|
|
zstring_view | cipher_name, |
|
|
std::string_view | password ) const |
Encrypts and saves the private key to a file.
- Parameters
-
path | The path of the file. |
cipher_name | The name of a symmetric cipher to encrypt the key. |
password | The password coded in displayable characters to encrypt the key. |
The documentation for this class was generated from the following file: