CryptoApi
Defines cryptographic methods.
Constructors
CryptoApi
Create instance of CryptoApi
.
Methods
close
convertPEMKeyToWIFKey
Converts given private key in PEM format to its WIF format.
public String convertPEMKeyToWIFKey ( String pemKey )
Params Name Type Description pemKey String
private key to convert
Returns Type Description String
Private key in WIF format
decryptDataSymmetric
Decrypts buffer with a given key using AES.
public byte [ ] decryptDataSymmetric ( byte [ ] data , byte [ ] symmetricKey )
Params Name Type Description data byte[]
buffer to decrypt symmetricKey byte[]
key used to decrypt data
Returns Type Description byte[]
Plain (decrypted) data buffer
derivePrivateKey
Generates a new private ECC key from a password using pbkdf2.
public String derivePrivateKey ( String password , String salt )
Params Name Type Description password String
the password used to generate the new key salt String
random string (additional input for the hashing function)
Returns Type Description 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.
public String derivePrivateKey2 ( String password , String salt )
Params Name Type Description password String
the password used to generate the new key salt String
random string (additional input for the hashing function)
Returns Type Description String
generated ECC key in WIF format
derivePublicKey
Generates a new public ECC key as a pair for an existing private key.
public String derivePublicKey ( String privateKey )
Params Name Type Description privateKey String
private ECC key in WIF format
Returns Type Description String
Generated ECC key in BASE58DER format
encryptDataSymmetric
Encrypts buffer with a given key using AES.
public byte [ ] encryptDataSymmetric ( byte [ ] data , byte [ ] symmetricKey )
Params Name Type Description data byte[]
buffer to encrypt symmetricKey byte[]
key used to encrypt data
Returns Type Description byte[]
Encrypted data buffer
generateKeySymmetric
Generates a new symmetric key.
public byte [ ] generateKeySymmetric ( )
Returns Type Description byte[]
Generated key
generatePrivateKey
Generates a new private ECC key.
public String generatePrivateKey ( String randomSeed )
Params Name Type Description randomSeed String
optional string used as the base to generate the new key
Returns Type Description String
Generated ECC key in WIF format
signData
Creates a signature of data using given key.
public byte [ ] signData ( byte [ ] data , String privateKey )
Params Name Type Description data byte[]
data the buffer to sign privateKey String
the key used to sign data
Returns Type Description byte[]
Signature of data
verifySignature
Validate a signature of data using given key.
public boolean verifySignature ( byte [ ] data , byte [ ] signature , String publicKey )
Params Name Type Description data byte[]
buffer signature byte[]
of data publicKey String
public ECC key in BASE58DER format used to validate data
Returns Type Description boolean
data validation result