CryptoApi
namespace: privmx::endpoint::crypto
CryptoApi is a class representing Endpoint's API for cryptographic operations.
Static Methods
create
Methods
signData
Creates a signature of data using given key.
core::Buffer signData(
const core::Buffer &data
const std::string &privateKey
)
Name | Type | Description |
---|---|---|
data | const core::Buffer & | buffer to sign |
privateKey | const std::string & | key used to sign data |
Type | Description |
---|---|
Buffer | signature of data |
verifySignature
Validate a signature of data using given key.
bool verifySignature(
const core::Buffer &data
const core::Buffer &signature
const std::string &publicKey
)
Name | Type | Description |
---|---|---|
data | const core::Buffer & | buffer |
signature | const core::Buffer & | signature of data to verify |
publicKey | const std::string & | public ECC key in BASE58DER format used to validate data |
Type | Description |
---|---|
bool | data validation result |
generatePrivateKey
Generates a new private ECC key.
std::string generatePrivateKey(
const std::optional<std::string> &randomSeed
)
Name | Type | Description |
---|---|---|
randomSeed | const std::optional<std::string> & | optional string used as the base to generate the new key |
Type | Description |
---|---|
std::string | generated ECC key in WIF format |
derivePrivateKey
Generates a new private ECC key from a password using pbkdf2.
std::string derivePrivateKey(
const std::string &password
const std::string &salt
)
Name | Type | Description |
---|---|---|
password | const std::string & | the password used to generate the new key |
salt | const std::string & | random string (additional input for the hashing function) |
Type | Description |
---|---|
std::string | generated ECC key in WIF format |
derivePublicKey
Generates a new public ECC key as a pair for an existing private key.
std::string derivePublicKey(
const std::string &privateKey
)
Name | Type | Description |
---|---|---|
privateKey | const std::string & |
Type | Description |
---|---|
std::string | generated ECC key in BASE58DER format |
generateKeySymmetric
Generates a new symmetric key.
core::Buffer generateKeySymmetric()
Type | Description |
---|---|
Buffer | generated key |
encryptDataSymmetric
Encrypts buffer with a given key using AES.
core::Buffer encryptDataSymmetric(
const core::Buffer &data
const core::Buffer &symmetricKey
)
Name | Type | Description |
---|---|---|
data | const core::Buffer & | buffer to encrypt |
symmetricKey | const core::Buffer & | key used to encrypt data |
Type | Description |
---|---|
Buffer | encrypted data buffer |
decryptDataSymmetric
Decrypts buffer with a given key using AES.
core::Buffer decryptDataSymmetric(
const core::Buffer &data
const core::Buffer &symmetricKey
)
Name | Type | Description |
---|---|---|
data | const core::Buffer & | buffer to decrypt |
symmetricKey | const core::Buffer & | key used to decrypt data |
Type | Description |
---|---|
Buffer | plain (decrypted) data buffer |
convertPEMKeytoWIFKey
Converts given private key in PEM format to its WIF format.
std::string convertPEMKeytoWIFKey(
const std::string &pemKey
)
Name | Type | Description |
---|---|---|
pemKey | const std::string & | private key to convert |
Type | Description |
---|---|
std::string | private key in WIF format |