Skip to main content
reference

CryptoApi

namespace: privmx::endpoint::crypto

CryptoApi is a class representing Endpoint's API for cryptographic operations.

Static Methods

create

Creates instance of CryptoApi

static CryptoApi create()

TypeDescription
CryptoApi CryptoApi object

Methods

signData

Creates a signature of data using given key.

core::Buffer signData(
const core::Buffer &data
const std::string &privateKey
)

NameTypeDescription
dataconst core::Buffer &buffer to sign
privateKeyconst std::string &key used to sign data

TypeDescription
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
)

NameTypeDescription
dataconst core::Buffer &buffer
signatureconst core::Buffer &signature of data to verify
publicKeyconst std::string &public ECC key in BASE58DER format used to validate data

TypeDescription
bool data validation result

generatePrivateKey

Generates a new private ECC key.

std::string generatePrivateKey(
const std::optional<std::string> &randomSeed
)

NameTypeDescription
randomSeedconst std::optional<std::string> &optional string used as the base to generate the new key

TypeDescription
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
)

NameTypeDescription
passwordconst std::string &the password used to generate the new key
saltconst std::string &random string (additional input for the hashing function)

TypeDescription
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
)

NameTypeDescription
privateKeyconst std::string &

TypeDescription
std::string generated ECC key in BASE58DER format

generateKeySymmetric

Generates a new symmetric key.

core::Buffer generateKeySymmetric()

TypeDescription
Buffer generated key

encryptDataSymmetric

Encrypts buffer with a given key using AES.

core::Buffer encryptDataSymmetric(
const core::Buffer &data
const core::Buffer &symmetricKey
)

NameTypeDescription
dataconst core::Buffer &buffer to encrypt
symmetricKeyconst core::Buffer &key used to encrypt data

TypeDescription
Buffer encrypted data buffer

decryptDataSymmetric

Decrypts buffer with a given key using AES.

core::Buffer decryptDataSymmetric(
const core::Buffer &data
const core::Buffer &symmetricKey
)

NameTypeDescription
dataconst core::Buffer &buffer to decrypt
symmetricKeyconst core::Buffer &key used to decrypt data

TypeDescription
Buffer plain (decrypted) data buffer

convertPEMKeytoWIFKey

Converts given private key in PEM format to its WIF format.

std::string convertPEMKeytoWIFKey(
const std::string &pemKey
)

NameTypeDescription
pemKeyconst std::string &private key to convert

TypeDescription
std::string private key in WIF format