Functions - crypto

crc32b

Returns Hex encoded CRC32B value for the provided element.

decodePrivateKey

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

decodePublicKey

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

decryptAesCbc

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

decryptAesEcb

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

decryptAesGcm

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

decryptRsaEcb

Returns RSA decrypted value for the given RSA encrypted data.

encryptAesCbc

Returns AES CBC encrypted value for the given data.

encryptAesEcb

Returns AES ECB encrypted value for the given data.

encryptAesGcm

Returns AES GCM encrypted value for the given data.

encryptRsaEcb

Returns 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 MD-5 hash function of the given data.

hmacSha1

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

hmacSha256

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

hmacSha384

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

hmacSha512

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

signRsaMd5

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

signRsaSha1

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

signRsaSha256

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

signRsaSha384

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

signRsaSha512

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

verifyRsaMd5Signature

Verify RSA-MD5 based signature.

verifyRsaSha1Signature

Verify RSA-SHA1 based signature.

verifyRsaSha256Signature

Verify RSA-SHA256 based signature.

verifyRsaSha384Signature

Verify RSA-SHA384 based signature.

verifyRsaSha512Signature

Verify RSA-SHA512 based signature.

crc32b

(byte input)

returns string

Returns Hex encoded CRC32B value for the provided element.

Parameters

  • input byte
  • Value for checksum generation

  • Return Type

    (string)
  • The generated checksum

decodePrivateKey

(KeyStore | TrustStore keyStore, string keyAlias, string keyPassword)

returns PrivateKey | Error

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

Parameters

  • keyAlias string
  • Key alias

  • keyPassword string
  • Key password

  • Return Type

    (PrivateKey | Error)
  • Reference to the private key or Error if private key was unreadable

decodePublicKey

(KeyStore | TrustStore keyStore, string keyAlias)

returns PublicKey | Error

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

Parameters

  • keyAlias string
  • Key alias

  • Return Type

    (PublicKey | Error)
  • Reference to the public key or Error if private key was unreadable

decryptAesCbc

(byte input, byte key, byte iv, AesPadding padding)

returns byte | Error

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

Parameters

  • input byte
  • The content to be decrypted

  • key byte
  • Encryption key

  • iv byte
  • Initialization vector

  • Return Type

    (byte | Error)
  • Decrypted data or Error if key is invalid

decryptAesEcb

(byte input, byte key, AesPadding padding)

returns byte | Error

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

Parameters

  • input byte
  • The content to be decrypted

  • key byte
  • Encryption key

  • Return Type

    (byte | Error)
  • Decrypted data or Error if key is invalid

decryptAesGcm

(byte input, byte key, byte iv, AesPadding padding, int tagSize)

returns byte | Error

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

Parameters

  • input byte
  • The content to be decrypted

  • key byte
  • Encryption key

  • iv byte
  • Initialization vector

  • tagSize int - 128
  • Tag size

  • Return Type

    (byte | Error)
  • Decrypted data or Error if key is invalid

decryptRsaEcb

(byte input, PrivateKey | PublicKey key, RsaPadding padding)

returns byte | Error

Returns RSA decrypted value for the given RSA encrypted data.

Parameters

  • input byte
  • The content to be decrypted

  • Return Type

    (byte | Error)
  • Decrypted data or Error if key is invalid

encryptAesCbc

(byte input, byte key, byte iv, AesPadding padding)

returns byte | Error

Returns AES CBC encrypted value for the given data.

Parameters

  • input byte
  • The content to be encrypted

  • key byte
  • Encryption key

  • iv byte
  • Initialization vector

  • Return Type

    (byte | Error)
  • Encrypted data or Error if key is invalid

encryptAesEcb

(byte input, byte key, AesPadding padding)

returns byte | Error

Returns AES ECB encrypted value for the given data.

Parameters

  • input byte
  • The content to be encrypted

  • key byte
  • Encryption key

  • Return Type

    (byte | Error)
  • Encrypted data or Error if key is invalid

encryptAesGcm

(byte input, byte key, byte iv, AesPadding padding, int tagSize)

returns byte | Error

Returns AES GCM encrypted value for the given data.

Parameters

  • input byte
  • The content to be encrypted

  • key byte
  • Encryption key

  • iv byte
  • Initialization vector

  • tagSize int - 128
  • Tag size

  • Return Type

    (byte | Error)
  • Encrypted data or Error if key is invalid

encryptRsaEcb

(byte input, PrivateKey | PublicKey key, RsaPadding padding)

returns byte | Error

Returns RSA encrypted value for the given data.

Parameters

  • input byte
  • The content to be encrypted

  • Return Type

    (byte | Error)
  • Encrypted data or Error if key is invalid

hashMd5

(byte input)

returns byte

Returns the MD5 hash of the given data.

Parameters

  • input byte
  • Value to be hashed

  • Return Type

    (byte)
  • Hashed output

hashSha1

(byte input)

returns byte

Returns the SHA-1 hash of the given data.

Parameters

  • input byte
  • Value to be hashed

  • Return Type

    (byte)
  • Hashed output

hashSha256

(byte input)

returns byte

Returns the SHA-256 hash of the given data.

Parameters

  • input byte
  • Value to be hashed

  • Return Type

    (byte)
  • Hashed output

hashSha384

(byte input)

returns byte

Returns the SHA-384 hash of the given data.

Parameters

  • input byte
  • Value to be hashed

  • Return Type

    (byte)
  • Hashed output

hashSha512

(byte input)

returns byte

Returns the SHA-512 hash of the given data.

Parameters

  • input byte
  • Value to be hashed

  • Return Type

    (byte)
  • Hashed output

hmacMd5

(byte input, byte key)

returns byte

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

Parameters

  • input byte
  • Value to be hashed

  • key byte
  • Key used for HMAC generation

  • Return Type

    (byte)
  • HMAC output

hmacSha1

(byte input, byte key)

returns byte

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

Parameters

  • input byte
  • Value to be hashed

  • key byte
  • Key used for HMAC generation

  • Return Type

    (byte)
  • HMAC output

hmacSha256

(byte input, byte key)

returns byte

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

Parameters

  • input byte
  • Value to be hashed

  • key byte
  • Key used for HMAC generation

  • Return Type

    (byte)
  • HMAC output

hmacSha384

(byte input, byte key)

returns byte

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

Parameters

  • input byte
  • Value to be hashed

  • key byte
  • Key used for HMAC generation

  • Return Type

    (byte)
  • HMAC output

hmacSha512

(byte input, byte key)

returns byte

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

Parameters

  • input byte
  • Value to be hashed

  • key byte
  • Key used for HMAC generation

  • Return Type

    (byte)
  • HMAC output

signRsaMd5

(byte input, PrivateKey privateKey)

returns byte | Error

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

Parameters

  • input byte
  • The content to be signed

  • privateKey PrivateKey
  • Private key used for signing

  • Return Type

    (byte | Error)
  • The generated signature or Error if private key is invalid

signRsaSha1

(byte input, PrivateKey privateKey)

returns byte | Error

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

Parameters

  • input byte
  • The content to be signed

  • privateKey PrivateKey
  • Private key used for signing

  • Return Type

    (byte | Error)
  • The generated signature or Error if private key is invalid

signRsaSha256

(byte input, PrivateKey privateKey)

returns byte | Error

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

Parameters

  • input byte
  • The content to be signed

  • privateKey PrivateKey
  • Private key used for signing

  • Return Type

    (byte | Error)
  • The generated signature or Error if private key is invalid

signRsaSha384

(byte input, PrivateKey privateKey)

returns byte | Error

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

Parameters

  • input byte
  • The content to be signed

  • privateKey PrivateKey
  • Private key used for signing.

  • Return Type

    (byte | Error)
  • The generated signature or Error if private key is invalid

signRsaSha512

(byte input, PrivateKey privateKey)

returns byte | Error

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

Parameters

  • input byte
  • The content to be signed

  • privateKey PrivateKey
  • Private key used for signing

  • Return Type

    (byte | Error)
  • The generated signature or Error if private key is invalid

verifyRsaMd5Signature

(byte data, byte signature, PublicKey publicKey)

returns boolean | Error

Verify RSA-MD5 based signature.

Parameters

  • data byte
  • The content to be verified

  • signature byte
  • Signature value

  • publicKey PublicKey
  • Public key used for verification

  • Return Type

    (boolean | Error)
  • Validity of the signature or Error if public key is invalid

verifyRsaSha1Signature

(byte data, byte signature, PublicKey publicKey)

returns boolean | Error

Verify RSA-SHA1 based signature.

Parameters

  • data byte
  • The content to be verified

  • signature byte
  • Signature value

  • publicKey PublicKey
  • Public key used for verification

  • Return Type

    (boolean | Error)
  • Validity of the signature or Error if public key is invalid

verifyRsaSha256Signature

(byte data, byte signature, PublicKey publicKey)

returns boolean | Error

Verify RSA-SHA256 based signature.

Parameters

  • data byte
  • The content to be verified

  • signature byte
  • Signature value

  • publicKey PublicKey
  • Public key used for verification

  • Return Type

    (boolean | Error)
  • Validity of the signature or Error if public key is invalid

verifyRsaSha384Signature

(byte data, byte signature, PublicKey publicKey)

returns boolean | Error

Verify RSA-SHA384 based signature.

Parameters

  • data byte
  • The content to be verified

  • signature byte
  • Signature value

  • publicKey PublicKey
  • Public key used for verification

  • Return Type

    (boolean | Error)
  • Validity of the signature or Error if public key is invalid

verifyRsaSha512Signature

(byte data, byte signature, PublicKey publicKey)

returns boolean | Error

Verify RSA-SHA512 based signature.

Parameters

  • data byte
  • The content to be verified

  • signature byte
  • Signature value

  • publicKey PublicKey
  • Public key used for verification

  • Return Type

    (boolean | Error)
  • Validity of the signature or Error if public key is invalid