CryptoApi
Static Methods
Create
Creates an instance of the CryptoApi.
Returns
CryptoApi
·
Created instance of the CryptoApi.
Methods
SignData
Creates a signature of data using given key.
Params
data
byte[]
Data to sign.
privateKey
string
The private key used to sign data.
Returns
byte[]
·
Signature of data.
VerifySignature
Verifies a signature of data using given key.
Params
data
byte[]
Signed data.
signature
byte[]
Signature of data.
publicKey
string
The public key used to verify the signature.
Returns
bool
·
Verification status.
GeneratePrivateKey
Generates a new random private key.
The returned key is private key of elliptic curve cryptography.
Params
randomSeed
string?
(optional) String used as the seed of random generator.
Returns
string
·
Generated private key in WIF format.
DerivePrivateKey
Derives a private key from a password and salt.
The returned key is private key of elliptic curve cryptography. PBKDF2 algorithm is used to derive the key.
This method is deprecated. Use CryptoApi.DerivePrivateKey2 method instead.
Params
password
string
The password used to derive from.
salt
string
The random additional data used to derive.
Returns
string
·
Derived private key in WIF format.
DerivePrivateKey2
Derives a private key from a password and salt.
The returned key is private key of elliptic curve cryptography. PBKDF2 algorithm is used to derive the key.
Compared to CryptoApi.DerivePrivateKey method, this version of the derive function has an increased number of rounds. This makes using this function a safer choice, but it makes the derived key different than in the previous version.
Params
password
string
The password used to derive from.
salt
string
The random additional data used to derive.
Returns
string
·
Derived private key in WIF format.
DerivePublicKey
Derives public key from a private key.
The returned key is public key of elliptic curve cryptography.
Params
privateKey
string
The private key in WIF format.
Returns
string
·
Public key in Base58 format.
GenerateKeySymmetric
Generates a new random key for symmetric cryptography.
Returns
byte[]
·
Generated symmetric key.
EncryptDataSymmetric
Encrypts data using a symmetric key.
AES algorithm is used to encrypt data.
Params
data
byte[]
Data to encrypt.
symmetricKey
byte[]
The symmetric key.
Returns
byte[]
·
Encrypted data.
DecryptDataSymmetric
Decrypts data using a symmetric key.
Params
data
byte[]
Data to decrypt.
symmetricKey
byte[]
The symmetric key.
Returns
byte[]
·
Decrypted data.
ConvertPEMKeytoWIFKey
Converts a private key in PEM format to WIF format.
Params
pemKey
string
The private key in PEM format.
Returns
string
·
Converted private key to WIF format.
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.