#include <privmx/endpoint/crypto/CryptoApi.hpp>
|
| | CryptoApi ()=default |
| core::Buffer | signData (const core::Buffer &data, const std::string &privateKey) |
| bool | verifySignature (const core::Buffer &data, const core::Buffer &signature, const std::string &publicKey) |
| std::string | generatePrivateKey (const std::optional< std::string > &randomSeed) |
| std::string | derivePrivateKey (const std::string &password, const std::string &salt) |
| std::string | derivePrivateKey2 (const std::string &password, const std::string &salt) |
| std::string | derivePublicKey (const std::string &privateKey) |
| core::Buffer | generateKeySymmetric () |
| core::Buffer | encryptDataSymmetric (const core::Buffer &data, const core::Buffer &symmetricKey) |
| core::Buffer | decryptDataSymmetric (const core::Buffer &data, const core::Buffer &symmetricKey) |
| std::string | convertPEMKeytoWIFKey (const std::string &pemKey) |
| std::string | convertPGPAsn1KeyToBase58DERKey (const std::string &pgpKey) |
| BIP39_t | generateBip39 (std::size_t strength, const std::string &password=std::string()) |
| BIP39_t | fromMnemonic (const std::string &mnemonic, const std::string &password=std::string()) |
| BIP39_t | fromEntropy (const core::Buffer &entropy, const std::string &password=std::string()) |
| std::string | entropyToMnemonic (const core::Buffer &entropy) |
| core::Buffer | mnemonicToEntropy (const std::string &mnemonic) |
| core::Buffer | mnemonicToSeed (const std::string &mnemonic, const std::string &password=std::string()) |
'CryptoApi' is a class representing Endpoint's API for cryptographic operations.
◆ CryptoApi()
| privmx::endpoint::crypto::CryptoApi::CryptoApi |
( |
| ) |
|
|
default |
◆ convertPEMKeytoWIFKey()
| std::string privmx::endpoint::crypto::CryptoApi::convertPEMKeytoWIFKey |
( |
const std::string & | pemKey | ) |
|
Converts given private key in PEM format to its WIF format.
- Parameters
-
| pemKey | private key to convert |
- Returns
- private key in WIF format
◆ convertPGPAsn1KeyToBase58DERKey()
| std::string privmx::endpoint::crypto::CryptoApi::convertPGPAsn1KeyToBase58DERKey |
( |
const std::string & | pgpKey | ) |
|
Converts given public key in PGP format to its base58DER format.
- Parameters
-
| pemKey | public key to convert |
- Returns
- public key in base58DER format
◆ create()
| CryptoApi privmx::endpoint::crypto::CryptoApi::create |
( |
| ) |
|
|
static |
◆ decryptDataSymmetric()
Decrypts buffer with a given key using AES.
- Parameters
-
| data | buffer to decrypt |
| symmetricKey | key used to decrypt data |
- Returns
- plain (decrypted) data buffer
◆ derivePrivateKey()
| std::string privmx::endpoint::crypto::CryptoApi::derivePrivateKey |
( |
const std::string & | password, |
|
|
const std::string & | salt ) |
Generates a new private ECC key from a password using pbkdf2.
- Parameters
-
| password | the password used to generate the new key |
| salt | random string (additional input for the hashing function) |
- Returns
- generated ECC key in WIF format
◆ derivePrivateKey2()
| std::string privmx::endpoint::crypto::CryptoApi::derivePrivateKey2 |
( |
const std::string & | password, |
|
|
const std::string & | salt ) |
Generates a new private ECC key from a password using pbkdf2. This version of the derive function has a rounds count increased to 200k. This makes using this function a safer choice, but it makes the received key different than in the original version.
- Parameters
-
| password | the password used to generate the new key |
| salt | random string (additional input for the hashing function) |
- Returns
- generated ECC key in WIF format
◆ derivePublicKey()
| std::string privmx::endpoint::crypto::CryptoApi::derivePublicKey |
( |
const std::string & | privateKey | ) |
|
Generates a new public ECC key as a pair for an existing private key.
- Parameters
-
| privatekey | private ECC key in WIF format |
- Returns
- generated ECC key in BASE58DER format
◆ encryptDataSymmetric()
Encrypts buffer with a given key using AES.
- Parameters
-
| data | buffer to encrypt |
| symmetricKey | key used to encrypt data |
- Returns
- encrypted data buffer
◆ entropyToMnemonic()
| std::string privmx::endpoint::crypto::CryptoApi::entropyToMnemonic |
( |
const core::Buffer & | entropy | ) |
|
Converts BIP-39 entropy to mnemonic.
- Parameters
-
- Returns
- BIP-39 mnemonic
◆ fromEntropy()
| BIP39_t privmx::endpoint::crypto::CryptoApi::fromEntropy |
( |
const core::Buffer & | entropy, |
|
|
const std::string & | password = std::string() ) |
Generates ECC key using BIP-39 entropy.
- Parameters
-
| entropy | the BIP-39 entropy used to generate the Key |
| password | the password used to generate the Key |
- Returns
- BIP39_t object containing ECC Key and associated with it BIP-39 mnemonic and entropy
◆ fromMnemonic()
| BIP39_t privmx::endpoint::crypto::CryptoApi::fromMnemonic |
( |
const std::string & | mnemonic, |
|
|
const std::string & | password = std::string() ) |
Generates ECC key using BIP-39 mnemonic.
- Parameters
-
| mnemonic | the BIP-39 mnemonic used to generate the Key |
| password | the password used to generate the Key |
- Returns
- BIP39_t object containing ECC Key and associated with it BIP-39 mnemonic and entropy
◆ generateBip39()
| BIP39_t privmx::endpoint::crypto::CryptoApi::generateBip39 |
( |
std::size_t | strength, |
|
|
const std::string & | password = std::string() ) |
Generates ECC key and BIP-39 mnemonic from a password using BIP-39.
- Parameters
-
| strength | size of BIP-39 entropy, must be a multiple of 32 between 128 and 256. |
| password | the password used to generate the Key |
- Returns
- BIP39_t object containing ECC Key and associated with it BIP-39 mnemonic and entropy
◆ generateKeySymmetric()
| core::Buffer privmx::endpoint::crypto::CryptoApi::generateKeySymmetric |
( |
| ) |
|
Generates a new symmetric key.
- Returns
- generated key
◆ generatePrivateKey()
| std::string privmx::endpoint::crypto::CryptoApi::generatePrivateKey |
( |
const std::optional< std::string > & | randomSeed | ) |
|
Generates a new private ECC key.
- Parameters
-
| randomSeed | optional string used as the base to generate the new key |
- Returns
- generated ECC key in WIF format
◆ mnemonicToEntropy()
| core::Buffer privmx::endpoint::crypto::CryptoApi::mnemonicToEntropy |
( |
const std::string & | mnemonic | ) |
|
Converts BIP-39 mnemonic to entropy.
- Parameters
-
- Returns
- BIP-39 entropy
◆ mnemonicToSeed()
| core::Buffer privmx::endpoint::crypto::CryptoApi::mnemonicToSeed |
( |
const std::string & | mnemonic, |
|
|
const std::string & | password = std::string() ) |
Generates a seed used to generate a key using BIP-39 mnemonic with PBKDF2.
- Parameters
-
| mnemonic | BIP-39 mnemonic |
| password | the password used to generate the seed |
- Returns
- generated seed
◆ signData()
| core::Buffer privmx::endpoint::crypto::CryptoApi::signData |
( |
const core::Buffer & | data, |
|
|
const std::string & | privateKey ) |
Creates a signature of data using given key.
- Parameters
-
| data | buffer to sign |
| privateKey | key used to sign data |
- Returns
- signature of data
◆ verifySignature()
| bool privmx::endpoint::crypto::CryptoApi::verifySignature |
( |
const core::Buffer & | data, |
|
|
const core::Buffer & | signature, |
|
|
const std::string & | publicKey ) |
Validate a signature of data using given key.
- Parameters
-
| data | buffer |
| signature | signature of data to verify |
| publicKey | public ECC key in BASE58DER format used to validate data |
- Returns
- data validation result
The documentation for this class was generated from the following file: