CryptoApi
'CryptoApi' is a class representing Endpoint's API for cryptographic operations.
Static Methods
create
Creates instance of 'CryptoApi'.
Returns
CryptoApi
·
CryptoApi object
Methods
signData
Creates a signature of data using given key.
Params
data
const core::Buffer &
buffer to sign
privateKey
const std::string &
key used to sign data
Returns
core::Buffer
·
signature of data
verifySignature
Validate a signature of data using given key.
Params
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
Returns
bool
·
data validation result
generatePrivateKey
Generates a new private ECC key.
Params
randomSeed
const std::optional<std::string> &
optional string used as the base to generate the new key
Returns
std::string
·
generated ECC key in WIF format
derivePrivateKey
Generates a new private ECC key from a password using pbkdf2.
Params
password
const std::string &
the password used to generate the new key
salt
const std::string &
random string (additional input for the hashing function)
Returns
std::string
·
generated ECC key in WIF format
derivePrivateKey2
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.
Params
password
const std::string &
the password used to generate the new key
salt
const std::string &
random string (additional input for the hashing function)
Returns
std::string
·
generated ECC key in WIF format
derivePublicKey
Generates a new public ECC key as a pair for an existing private key.
Params
privateKey
const std::string &
Returns
std::string
·
generated ECC key in BASE58DER format
generateKeySymmetric
Generates a new symmetric key.
Returns
core::Buffer
·
generated key
encryptDataSymmetric
Encrypts buffer with a given key using AES.
Params
data
const core::Buffer &
buffer to encrypt
symmetricKey
const core::Buffer &
key used to encrypt data
Returns
core::Buffer
·
encrypted data buffer
decryptDataSymmetric
Decrypts buffer with a given key using AES.
Params
data
const core::Buffer &
buffer to decrypt
symmetricKey
const core::Buffer &
key used to decrypt data
Returns
core::Buffer
·
plain (decrypted) data buffer
convertPEMKeytoWIFKey
Converts given private key in PEM format to its WIF format.
Params
pemKey
const std::string &
private key to convert
Returns
std::string
·
private key in WIF format
convertPGPAsn1KeyToBase58DERKey
Converts given public key in PGP format to its base58DER format.
Params
pgpKey
const std::string &
Returns
std::string
·
private key in base58DER format
generateBip39
Generates ECC key and BIP-39 mnemonic from a password using BIP-39.
Params
strength
std::size_t
size of BIP-39 entropy, must be a multiple of 32
password
const std::string &
the password used to generate the Key
Returns
BIP39_t
·
BIP39_t object containing ECC Key and associated with it BIP-39 mnemonic and entropy
fromMnemonic
Generates ECC key using BIP-39 mnemonic.
Params
mnemonic
const std::string &
the BIP-39 entropy used to generate the Key
password
const std::string &
the password used to generate the Key
Returns
BIP39_t
·
BIP39_t object containing ECC Key and associated with it BIP-39 mnemonic and entropy
fromEntropy
Generates ECC key using BIP-39 entropy.
Params
entropy
const core::Buffer &
the BIP-39 entropy used to generate the Key
password
const std::string &
the password used to generate the Key
Returns
BIP39_t
·
BIP39_t object containing ECC Key and associated with it BIP-39 mnemonic and entropy
entropyToMnemonic
Converts BIP-39 entropy to mnemonic.
Params
entropy
const core::Buffer &
BIP-39 entropy
Returns
std::string
·
BIP-39 mnemonic
mnemonicToEntropy
Converts BIP-39 mnemonic to entropy.
Params
mnemonic
const std::string &
BIP-39 mnemonic
Returns
core::Buffer
·
BIP-39 entropy
mnemonicToSeed
Generates a seed used to generate a key using BIP-39 mnemonic with PBKDF2.
Params
mnemonic
const std::string &
BIP-39 mnemonic
password
const std::string &
the password used to generate the seed
Returns
core::Buffer
·
generated seed
We use cookies on our website. We use them to ensure the proper functioning of the site and, if you agree, for purposes we set, such as analytics or marketing.