ballerina/crypto

Package Overview

This package provides the necessary utilities that are required to hash content using different hashing mechanisms and algorithms.

For information on the operations, which you can perform with this package, see the below Functions. For an example on the usage of the operations, see the Cryptographic Operations Example.

Functions

[34]

buildRsaPublicKey

Returns the `crypto:PublicKey` created with the modulus and exponent retrieved from the JWK's endpoint.

crc32b

Returns the Hex-encoded CRC32B value for the provided element.

decodeRsaPrivateKeyFromKeyFile

Reads a private key from the provided private key and private key password.

decodeRsaPrivateKeyFromKeyStore

Reads a private key from the provided PKCS#12 archive file.

decodeRsaPublicKeyFromCertFile

Reads a public key from the provided public certificate file.

decodeRsaPublicKeyFromTrustStore

Reads a public key from the provided PKCS#12 archive file.

decryptAesCbc

Returns the AES-CBC-decrypted value for the given AES-CBC-encrypted data.

decryptAesEcb

Returns the AES-ECB-decrypted value for the given AES-ECB-encrypted data.

decryptAesGcm

Returns the AES-GCM-decrypted value for the given AES-GCM-encrypted data.

decryptRsaEcb

Returns the RSA-decrypted value for the given RSA-encrypted data.

encryptAesCbc

Returns the AES-CBC-encrypted value for the given data.

encryptAesEcb

Returns the AES-ECB-encrypted value for the given data.

encryptAesGcm

Returns the AES-GCM-encrypted value for the given data.

encryptRsaEcb

Returns the RSA-encrypted value for the given data.

hashMd5

Returns the MD5 hash of the given data.

hashSha1

Returns the SHA-1 hash of the given data.

hashSha256

Returns the SHA-256 hash of the given data.

hashSha384

Returns the SHA-384 hash of the given data.

hashSha512

Returns the SHA-512 hash of the given data.

hmacMd5

Returns the HMAC using the MD-5 hash function of the given data.

hmacSha1

Returns the HMAC using the SHA-1 hash function of the given data.

hmacSha256

Returns the HMAC using the SHA-256 hash function of the given data.

hmacSha384

Returns the HMAC using the SHA-384 hash function of the given data.

hmacSha512

Returns the HMAC using the SHA-512 hash function of the given data.

signRsaMd5

Returns the RSA-MD5-based signature value for the given data.

signRsaSha1

Returns the RSA-SHA1-based signature value for the given data.

signRsaSha256

Returns the RSA-SHA256-based signature value for the given data.

signRsaSha384

Returns the RSA-SHA384-based signature value for the given data.

signRsaSha512

Returns the RSA-SHA512-based signature value for the given data.

verifyRsaMd5Signature

Verifies the RSA-MD5-based signature.

verifyRsaSha1Signature

Verifies the RSA-SHA1-based signature.

verifyRsaSha256Signature

Verifies the RSA-SHA256-based signature.

verifyRsaSha384Signature

Verifies the RSA-SHA384-based signature.

verifyRsaSha512Signature

Verifies the RSA-SHA512-based signature.

Records

[5]

Certificate

X509 public key certificate information.

KeyStore

KeyStore related configurations.

PrivateKey

Private key used in cryptographic operations.

PublicKey

Public key used in cryptographic operations.

TrustStore

TrustStore related configurations.

Constants

[9]

NONE

No padding.

OAEPwithMD5andMGF1

The `OAEPwithMD5andMGF1` padding mode.

OAEPWithSHA1AndMGF1

The `OAEPWithSHA1AndMGF1` padding mode.

OAEPWithSHA256AndMGF1

The `OAEPWithSHA256AndMGF1` padding mode.

OAEPwithSHA384andMGF1

The `OAEPwithSHA384andMGF1` padding mode.

OAEPwithSHA512andMGF1

The `OAEPwithSHA512andMGF1` padding mode.

PKCS1

The `PKCS1` padding mode.

PKCS5

The `PKCS5` padding mode.

RSA

The `RSA` algorithm.

Types

[3]

AesPadding

Padding algorithms supported by AES encryption and decryption.

KeyAlgorithm

The key algorithms supported by the Crypto module.

RsaPadding

Padding algorithms supported with RSA encryption and decryption.

Errors

[1]

Error

Represents the Crypto error.