Functions
buildRsaPublicKey | I Builds the RSA public key from the given modulus and exponent parameters. |
crc32b | I Returns the Hex-encoded CRC32B value for the given data. |
decodeRsaPrivateKeyFromKeyFile | I Decodes the RSA private key from the given private key and private key password. |
decodeRsaPrivateKeyFromKeyStore | I Decodes the RSA private key from the given PKCS#12 archive file. |
decodeRsaPublicKeyFromCertFile | I Decodes the RSA public key from the given public certificate file. |
decodeRsaPublicKeyFromTrustStore | I Decodes the RSA public key from the given PKCS#12 archive file. |
decryptAesCbc | I Returns the AES-CBC-decrypted value for the given AES-CBC-encrypted data. |
decryptAesEcb | I Returns the AES-ECB-decrypted value for the given AES-ECB-encrypted data. |
decryptAesGcm | I Returns the AES-GCM-decrypted value for the given AES-GCM-encrypted data. |
decryptRsaEcb | I Returns the RSA-decrypted value for the given RSA-encrypted data. |
encryptAesCbc | I Returns the AES-CBC-encrypted value for the given data. |
encryptAesEcb | I Returns the AES-ECB-encrypted value for the given data. |
encryptAesGcm | I Returns the AES-GCM-encrypted value for the given data. |
encryptRsaEcb | I Returns the RSA-encrypted value for the given data. |
hashMd5 | I Returns the MD5 hash of the given data. |
hashSha1 | I Returns the SHA-1 hash of the given data. |
hashSha256 | I Returns the SHA-256 hash of the given data. |
hashSha384 | I Returns the SHA-384 hash of the given data. |
hashSha512 | I Returns the SHA-512 hash of the given data. |
hmacMd5 | I Returns the HMAC using the MD5 hash function of the given data. |
hmacSha1 | I Returns the HMAC using the SHA-1 hash function of the given data. |
hmacSha256 | I Returns the HMAC using the SHA-256 hash function of the given data. |
hmacSha384 | I Returns the HMAC using the SHA-384 hash function of the given data. |
hmacSha512 | I Returns the HMAC using the SHA-512 hash function of the given data. |
signRsaMd5 | I Returns the RSA-MD5 based signature value for the given data. |
signRsaSha1 | I Returns the RSA-SHA1 based signature value for the given data. |
signRsaSha256 | I Returns the RSA-SHA256 based signature value for the given data. |
signRsaSha384 | I Returns the RSA-SHA384 based signature value for the given data. |
signRsaSha512 | I Returns the RSA-SHA512 based signature value for the given data. |
verifyRsaMd5Signature | I Verifies the RSA-MD5 based signature. |
verifyRsaSha1Signature | I Verifies the RSA-SHA1 based signature. |
verifyRsaSha256Signature | I Verifies the RSA-SHA256 based signature. |
verifyRsaSha384Signature | I Verifies the RSA-SHA384 based signature. |
verifyRsaSha512Signature | I Verifies the RSA-SHA512 based signature. |
buildRsaPublicKey
Builds the RSA public key from the given modulus and exponent parameters.
1string modulus = "luZFdW1ynitztkWLC6xKegbRWxky...";2string exponent = "AQAB";3crypto:PublicKey publicKey = check crypto:buildRsaPublicKey(modulus, exponent);
crc32b
function crc32b(byte[ ] input) returns string
Returns the Hex-encoded CRC32B value for the given data.
1string stringData = "Hello Ballerina";2byte[] data = stringData.toBytes();3string checksum = crypto:crc32b(data);
Parameters
- input byte[ ]
Value for checksum generation
decodeRsaPrivateKeyFromKeyFile
function decodeRsaPrivateKeyFromKeyFile(string keyFile, string? keyPassword) returns PrivateKey | Error
Decodes the RSA private key from the given private key and private key password.
1string keyFile = "/path/to/private.key";2crypto:PrivateKey privateKey = check crypto:decodeRsaPrivateKeyFromKeyFile(keyFile, "keyPassword");
Parameters
- keyFile string
Path to the key file
- keyPassword string? (default ())
Password of the key file if it is encrypted
Return Type
(PrivateKey | Error)Reference to the private key or else a crypto:Error
if the private key was unreadable
decodeRsaPrivateKeyFromKeyStore
function decodeRsaPrivateKeyFromKeyStore(KeyStore keyStore, string keyAlias, string keyPassword) returns PrivateKey | Error
Decodes the RSA private key from the given PKCS#12 archive file.
1crypto:KeyStore keyStore = {2 path: "/path/to/keyStore.p12",3 password: "keyStorePassword"4};5crypto:PrivateKey privateKey = check crypto:decodeRsaPrivateKeyFromKeyStore(keyStore, "keyAlias", "keyPassword");
Parameters
- keyStore KeyStore
KeyStore configurations
- keyAlias string
Key alias
- keyPassword string
Key password
Return Type
(PrivateKey | Error)Reference to the private key or else a crypto:Error
if the private key was unreadable
decodeRsaPublicKeyFromCertFile
Decodes the RSA public key from the given public certificate file.
1string certFile = "/path/to/public.cert";2crypto:PublicKey publicKey = check crypto:decodeRsaPublicKeyFromCertFile(certFile);
Parameters
- certFile string
Path to the ceritificate file
decodeRsaPublicKeyFromTrustStore
function decodeRsaPublicKeyFromTrustStore(TrustStore trustStore, string keyAlias) returns PublicKey | Error
Decodes the RSA public key from the given PKCS#12 archive file.
1crypto:TrustStore trustStore = {2 path: "/path/tp/truststore.p12",3 password: "truststorePassword"4};5crypto:PublicKey publicKey = check crypto:decodeRsaPublicKeyFromTrustStore(trustStore, "keyAlias");
decryptAesCbc
function decryptAesCbc(byte[ ] input, byte[ ] key, byte[ ] iv, AesPadding padding) returns byte[ ] | Error
Returns the AES-CBC-decrypted value for the given AES-CBC-encrypted data.
1string dataString = "Hello Ballerina!";2byte[] data = dataString.toBytes();3byte[16] key = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];4foreach int i in 0...15 {5 key[i] = <byte>(check random:createIntInRange(0, 255);6}7byte[16] initialVector = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];8foreach int i in 0...15 {9 initialVector[i] = <byte>(check random:createIntInRange(0, 255);10}11byte[] cipherText = check crypto:encryptAesCbc(data, key, initialVector);12byte[] plainText = check crypto:decryptAesCbc(cipherText, key, initialVector);
Parameters
- input byte[ ]
The content to be decrypted
- key byte[ ]
Encryption key
- iv byte[ ]
Initialization vector
- padding AesPadding (default PKCS5)
The padding algorithm
decryptAesEcb
function decryptAesEcb(byte[ ] input, byte[ ] key, AesPadding padding) returns byte[ ] | Error
Returns the AES-ECB-decrypted value for the given AES-ECB-encrypted data.
1string dataString = "Hello Ballerina!";2byte[] data = dataString.toBytes();3byte[16] key = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];4foreach int i in 0...15 {5 key[i] = <byte>(check random:createIntInRange(0, 255);6}7byte[] cipherText = check crypto:encryptAesEcb(data, key);8byte[] plainText = check crypto:decryptAesEcb(cipherText, key);
Parameters
- input byte[ ]
The content to be decrypted
- key byte[ ]
Encryption key
- padding AesPadding (default PKCS5)
The padding algorithm
decryptAesGcm
function decryptAesGcm(byte[ ] input, byte[ ] key, byte[ ] iv, AesPadding padding, int tagSize) returns byte[ ] | Error
Returns the AES-GCM-decrypted value for the given AES-GCM-encrypted data.
1string dataString = "Hello Ballerina!";2byte[] data = dataString.toBytes();3byte[16] key = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];4foreach int i in 0...15 {5 key[i] = <byte>(check random:createIntInRange(0, 255);6}7byte[16] initialVector = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];8foreach int i in 0...15 {9 initialVector[i] = <byte>(check random:createIntInRange(0, 255);10}11byte[] cipherText = check crypto:encryptAesGcm(data, key, initialVector);12byte[] plainText = check crypto:decryptAesGcm(cipherText, key, initialVector);
Parameters
- input byte[ ]
The content to be decrypted
- key byte[ ]
Encryption key
- iv byte[ ]
Initialization vector
- padding AesPadding (default PKCS5)
The padding algorithm
- tagSize int (default 128)
Tag size
decryptRsaEcb
function decryptRsaEcb(byte[ ] input, PrivateKey | PublicKey key, RsaPadding padding) returns byte[ ] | Error
Returns the RSA-decrypted value for the given RSA-encrypted data.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3crypto:KeyStore keyStore = {4 path: "/path/to/keyStore.p12",5 password: "keyStorePassword"6};7crypto:PublicKey publicKey = check crypto:decodePublicKey(keyStore, "keyAlias");8crypto:PrivateKey privateKey = check crypto:decodePrivateKey(keyStore, "keyAlias", "keyPassword");9byte[] cipherText = check crypto:encryptRsaEcb(data, publicKey);10byte[] plainText = check crypto:decryptRsaEcb(cipherText, privateKey);
Parameters
- input byte[ ]
The content to be decrypted
- key PrivateKey | PublicKey
Private or public key used for encryption
- padding RsaPadding (default PKCS1)
The padding algorithm
encryptAesCbc
function encryptAesCbc(byte[ ] input, byte[ ] key, byte[ ] iv, AesPadding padding) returns byte[ ] | Error
Returns the AES-CBC-encrypted value for the given data.
1string dataString = "Hello Ballerina!";2byte[] data = dataString.toBytes();3byte[16] key = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];4foreach int i in 0...15 {5 key[i] = <byte>(check random:createIntInRange(0, 255);6}7byte[16] initialVector = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];8foreach int i in 0...15 {9 initialVector[i] = <byte>(check random:createIntInRange(0, 255);10}11byte[] cipherText = check crypto:encryptAesCbc(data, key, initialVector);
Parameters
- input byte[ ]
The content to be encrypted
- key byte[ ]
Encryption key
- iv byte[ ]
Initialization vector
- padding AesPadding (default PKCS5)
The padding algorithm
encryptAesEcb
function encryptAesEcb(byte[ ] input, byte[ ] key, AesPadding padding) returns byte[ ] | Error
Returns the AES-ECB-encrypted value for the given data.
1string dataString = "Hello Ballerina!";2byte[] data = dataString.toBytes();3byte[16] key = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];4foreach int i in 0...15 {5 key[i] = <byte>(check random:createIntInRange(0, 255);6}7byte[] cipherText = check crypto:encryptAesEcb(data, key);
Parameters
- input byte[ ]
The content to be encrypted
- key byte[ ]
Encryption key
- padding AesPadding (default PKCS5)
The padding algorithm
encryptAesGcm
function encryptAesGcm(byte[ ] input, byte[ ] key, byte[ ] iv, AesPadding padding, int tagSize) returns byte[ ] | Error
Returns the AES-GCM-encrypted value for the given data.
1string dataString = "Hello Ballerina!";2byte[] data = dataString.toBytes();3byte[16] key = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];4foreach int i in 0...15 {5 key[i] = <byte>(check random:createIntInRange(0, 255);6}7byte[16] initialVector = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];8foreach int i in 0...15 {9 initialVector[i] = <byte>(check random:createIntInRange(0, 255);10}11byte[] cipherText = check crypto:encryptAesGcm(data, key, initialVector);
Parameters
- input byte[ ]
The content to be encrypted
- key byte[ ]
Encryption key
- iv byte[ ]
Initialization vector
- padding AesPadding (default PKCS5)
The padding algorithm
- tagSize int (default 128)
Tag size
encryptRsaEcb
function encryptRsaEcb(byte[ ] input, PrivateKey | PublicKey key, RsaPadding padding) returns byte[ ] | Error
Returns the RSA-encrypted value for the given data.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3crypto:KeyStore keyStore = {4 path: "/path/to/keyStore.p12",5 password: "keyStorePassword"6};7crypto:PublicKey publicKey = check crypto:decodePublicKey(keyStore, "keyAlias");8byte[] cipherText = check crypto:encryptRsaEcb(data, publicKey);
Parameters
- input byte[ ]
The content to be encrypted
- key PrivateKey | PublicKey
Private or public key used for encryption
- padding RsaPadding (default PKCS1)
The padding algorithm
hashMd5
function hashMd5(byte[ ] input, byte[ ]? salt) returns byte[ ]
Returns the MD5 hash of the given data.
1string dataString = "Hello Ballerina";2byte[] data = dataString.toBytes();3byte[] hash = crypto:hashMd5(data);
Parameters
- input byte[ ]
Value to be hashed
- salt byte[ ]? (default ())
Salt to be added
Return Type
(byte[ ])Hashed output
hashSha1
function hashSha1(byte[ ] input, byte[ ]? salt) returns byte[ ]
Returns the SHA-1 hash of the given data.
1string dataString = "Hello Ballerina";2byte[] data = dataString.toBytes();3byte[] hash = crypto:hashSha1(data);
Parameters
- input byte[ ]
Value to be hashed
- salt byte[ ]? (default ())
Salt to be added
Return Type
(byte[ ])Hashed output
hashSha256
function hashSha256(byte[ ] input, byte[ ]? salt) returns byte[ ]
Returns the SHA-256 hash of the given data.
1string dataString = "Hello Ballerina";2byte[] data = dataString.toBytes();3byte[] hash = crypto:hashSha256(data);
Parameters
- input byte[ ]
Value to be hashed
- salt byte[ ]? (default ())
Salt to be added
Return Type
(byte[ ])Hashed output
hashSha384
function hashSha384(byte[ ] input, byte[ ]? salt) returns byte[ ]
Returns the SHA-384 hash of the given data.
1string dataString = "Hello Ballerina";2byte[] data = dataString.toBytes();3byte[] hash = crypto:hashSha384(data);
Parameters
- input byte[ ]
Value to be hashed
- salt byte[ ]? (default ())
Salt to be added
Return Type
(byte[ ])Hashed output
hashSha512
function hashSha512(byte[ ] input, byte[ ]? salt) returns byte[ ]
Returns the SHA-512 hash of the given data.
1string dataString = "Hello Ballerina";2byte[] data = dataString.toBytes();3byte[] hash = crypto:hashSha512(data);
Parameters
- input byte[ ]
Value to be hashed
- salt byte[ ]? (default ())
Salt to be added
Return Type
(byte[ ])Hashed output
hmacMd5
function hmacMd5(byte[ ] input, byte[ ] key) returns byte[ ] | Error
Returns the HMAC using the MD5 hash function of the given data.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3string secret = "some-secret";4byte[] key = secret.toBytes();5byte[] hmac = crypto:hmacMd5(data, key);
Parameters
- input byte[ ]
Value to be hashed
- key byte[ ]
Key used for HMAC generation
hmacSha1
function hmacSha1(byte[ ] input, byte[ ] key) returns byte[ ] | Error
Returns the HMAC using the SHA-1 hash function of the given data.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3string secret = "some-secret";4byte[] key = secret.toBytes();5byte[] hmac = crypto:hmacSha1(data, key);
Parameters
- input byte[ ]
Value to be hashed
- key byte[ ]
Key used for HMAC generation
hmacSha256
function hmacSha256(byte[ ] input, byte[ ] key) returns byte[ ] | Error
Returns the HMAC using the SHA-256 hash function of the given data.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3string secret = "some-secret";4byte[] key = secret.toBytes();5byte[] hmac = crypto:hmacSha256(data, key);
Parameters
- input byte[ ]
Value to be hashed
- key byte[ ]
Key used for HMAC generation
hmacSha384
function hmacSha384(byte[ ] input, byte[ ] key) returns byte[ ] | Error
Returns the HMAC using the SHA-384 hash function of the given data.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3string secret = "some-secret";4byte[] key = secret.toBytes();5byte[] hmac = crypto:hmacSha384(data, key);
Parameters
- input byte[ ]
Value to be hashed
- key byte[ ]
Key used for HMAC generation
hmacSha512
function hmacSha512(byte[ ] input, byte[ ] key) returns byte[ ] | Error
Returns the HMAC using the SHA-512 hash function of the given data.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3string secret = "some-secret";4byte[] key = secret.toBytes();5byte[] hmac = crypto:hmacSha512(data, key);
Parameters
- input byte[ ]
Value to be hashed
- key byte[ ]
Key used for HMAC generation
signRsaMd5
function signRsaMd5(byte[ ] input, PrivateKey privateKey) returns byte[ ] | Error
Returns the RSA-MD5 based signature value for the given data.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3crypto:KeyStore keyStore = {4 path: "/path/to/keyStore.p12",5 password: "keyStorePassword"6};7crypto:PrivateKey privateKey = check crypto:decodePrivateKey(keyStore, "keyAlias", "keyPassword");8byte[] signature = check crypto:signRsaMd5(data, privateKey);
Return Type
(byte[ ] | Error)The generated signature or else a crypto:Error
if the private key is invalid
signRsaSha1
function signRsaSha1(byte[ ] input, PrivateKey privateKey) returns byte[ ] | Error
Returns the RSA-SHA1 based signature value for the given data.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3crypto:KeyStore keyStore = {4 path: "/path/to/keyStore.p12",5 password: "keyStorePassword"6};7crypto:PrivateKey privateKey = check crypto:decodePrivateKey(keyStore, "keyAlias", "keyPassword");8byte[] signature = check crypto:signRsaSha1(data, privateKey);
Return Type
(byte[ ] | Error)The generated signature or else a crypto:Error
if the private key is invalid
signRsaSha256
function signRsaSha256(byte[ ] input, PrivateKey privateKey) returns byte[ ] | Error
Returns the RSA-SHA256 based signature value for the given data.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3crypto:KeyStore keyStore = {4 path: "/path/to/keyStore.p12",5 password: "keyStorePassword"6};7crypto:PrivateKey privateKey = check crypto:decodePrivateKey(keyStore, "keyAlias", "keyPassword");8byte[] signature = check crypto:signRsaSha256(data, privateKey);
Return Type
(byte[ ] | Error)The generated signature or else a crypto:Error
if the private key is invalid
signRsaSha384
function signRsaSha384(byte[ ] input, PrivateKey privateKey) returns byte[ ] | Error
Returns the RSA-SHA384 based signature value for the given data.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3crypto:KeyStore keyStore = {4 path: "/path/to/keyStore.p12",5 password: "keyStorePassword"6};7crypto:PrivateKey privateKey = check crypto:decodePrivateKey(keyStore, "keyAlias", "keyPassword");8byte[] signature = check crypto:signRsaSha384(data, privateKey);
Return Type
(byte[ ] | Error)The generated signature or else a crypto:Error
if the private key is invalid
signRsaSha512
function signRsaSha512(byte[ ] input, PrivateKey privateKey) returns byte[ ] | Error
Returns the RSA-SHA512 based signature value for the given data.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3crypto:KeyStore keyStore = {4 path: "/path/to/keyStore.p12",5 password: "keyStorePassword"6};7crypto:PrivateKey privateKey = check crypto:decodePrivateKey(keyStore, "keyAlias", "keyPassword");8byte[] signature = check crypto:signRsaSha512(data, privateKey);
Return Type
(byte[ ] | Error)The generated signature or else a crypto:Error
if the private key is invalid
verifyRsaMd5Signature
function verifyRsaMd5Signature(byte[ ] data, byte[ ] signature, PublicKey publicKey) returns boolean | Error
Verifies the RSA-MD5 based signature.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3crypto:KeyStore keyStore = {4 path: "/path/to/keyStore.p12",5 password: "keyStorePassword"6};7crypto:PrivateKey privateKey = check crypto:decodePrivateKey(keyStore, "keyAlias", "keyPassword")8byte[] signature = check crypto:signRsaMd5(data, privateKey);9crypto:PublicKey publicKey = check crypto:decodePublicKey(keyStore, "keyAlias");10boolean validity = check crypto:verifyRsaMd5Signature(data, signature, publicKey);
Parameters
- data byte[ ]
The content to be verified
- signature byte[ ]
Signature value
- publicKey PublicKey
Public key used for verification
verifyRsaSha1Signature
function verifyRsaSha1Signature(byte[ ] data, byte[ ] signature, PublicKey publicKey) returns boolean | Error
Verifies the RSA-SHA1 based signature.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3crypto:KeyStore keyStore = {4 path: "/path/to/keyStore.p12",5 password: "keyStorePassword"6};7crypto:PrivateKey privateKey = check crypto:decodePrivateKey(keyStore, "keyAlias", "keyPassword");8byte[] signature = check crypto:signRsaMd5(data, privateKey);9crypto:PublicKey publicKey = check crypto:decodePublicKey(keyStore, "keyAlias");10boolean validity = check crypto:verifyRsaSha1Signature(data, signature, publicKey);
Parameters
- data byte[ ]
The content to be verified
- signature byte[ ]
Signature value
- publicKey PublicKey
Public key used for verification
verifyRsaSha256Signature
function verifyRsaSha256Signature(byte[ ] data, byte[ ] signature, PublicKey publicKey) returns boolean | Error
Verifies the RSA-SHA256 based signature.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3crypto:KeyStore keyStore = {4 path: "/path/to/keyStore.p12",5 password: "keyStorePassword"6};7crypto:PrivateKey privateKey = check crypto:decodePrivateKey(keyStore, "keyAlias", "keyPassword");8byte[] signature = check crypto:signRsaMd5(data, privateKey);9crypto:PublicKey publicKey = check crypto:decodePublicKey(keyStore, "keyAlias");10boolean validity = check crypto:verifyRsaSha256Signature(data, signature, publicKey);
Parameters
- data byte[ ]
The content to be verified
- signature byte[ ]
Signature value
- publicKey PublicKey
Public key used for verification
verifyRsaSha384Signature
function verifyRsaSha384Signature(byte[ ] data, byte[ ] signature, PublicKey publicKey) returns boolean | Error
Verifies the RSA-SHA384 based signature.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3crypto:KeyStore keyStore = {4 path: "/path/to/keyStore.p12",5 password: "keyStorePassword"6};7crypto:PrivateKey privateKey = check crypto:decodePrivateKey(keyStore, "keyAlias", "keyPassword");8byte[] signature = check crypto:signRsaMd5(data, privateKey);9crypto:PublicKey publicKey = check crypto:decodePublicKey(keyStore, "keyAlias");10boolean validity = check crypto:verifyRsaSha384Signature(data, signature, publicKey);
Parameters
- data byte[ ]
The content to be verified
- signature byte[ ]
Signature value
- publicKey PublicKey
Public key used for verification
verifyRsaSha512Signature
function verifyRsaSha512Signature(byte[ ] data, byte[ ] signature, PublicKey publicKey) returns boolean | Error
Verifies the RSA-SHA512 based signature.
1string input = "Hello Ballerina";2byte[] data = input.toBytes();3crypto:KeyStore keyStore = {4 path: "/path/to/keyStore.p12",5 password: "keyStorePassword"6};7crypto:PrivateKey privateKey = check crypto:decodePrivateKey(keyStore, "keyAlias", "keyPassword");8byte[] signature = check crypto:signRsaMd5(data, privateKey);9crypto:PublicKey publicKey = check crypto:decodePublicKey(keyStore, "keyAlias");10boolean validity = check crypto:verifyRsaSha512Signature(data, signature, publicKey);
Parameters
- data byte[ ]
The content to be verified
- signature byte[ ]
Signature value
- publicKey PublicKey
Public key used for verification