Codeunit 5505372 M365 Cryptographic Library

Codeunit 5505372 M365 Cryptographic Library

Methods

SetHashAlgorithm

procedure SetHashAlgorithm(algorithm: Option)

Sets the cryptographic hash algorithm to use for subsequent calls to ComputeHash().

Parameters / Return Value

  • algorithm Option

    Option


MD5

procedure MD5(): Integer

The MD5 message-digest algorithm is a widely used hash function producing a 128-bit hash value. Although MD5 was initially designed to be used as a cryptographic hash function, it has been found to suffer from extensive vulnerabilities. It can still be used as a checksum to verify data integrity, but only against unintentional corruption. It remains suitable for other non-cryptographic purposes, for example for determining the partition for a particular key in a partitioned database. See https://en.wikipedia.org/wiki/MD5

Parameters / Return Value

  • Returns Integer

    Integer


SHA1

procedure SHA1(): Integer

In cryptography, SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function which takes an input and produces a 160-bit (20-byte) hash value known as a message digest – typically rendered as a hexadecimal number, 40 digits long. It was designed by the United States National Security Agency, and is a U.S. Federal Information Processing Standard Since 2005 SHA-1 has not been considered secure against well-funded opponents,and since 2010 many organizations have recommended its replacement. See https://en.wikipedia.org/wiki/SHA-1

Parameters / Return Value

  • Returns Integer

    Integer


SHA256

procedure SHA256(): Integer

Contained in SHA-2 (Secure Hash Algorithm 2). SHA-2 is a set of cryptographic hash functions designed by the United States National Security Agency (NSA). They are built using the Merkle–Damgård structure, from a one-way compression function itself built using the Davies–Meyer structure from a (classified) specialized block cipher. SHA-2 includes significant changes from its predecessor, SHA-1. SHA-256 and SHA-512 are novel hash functions computed with 32-bit and 64-bit words, respectively. They use different shift amounts and additive constants, but their structures are otherwise virtually identical, differing only in the number of rounds. See https://en.wikipedia.org/wiki/SHA-2

Parameters / Return Value

  • Returns Integer

    Integer


SHA384

procedure SHA384(): Integer

Contained in SHA-2 (Secure Hash Algorithm 2). SHA-2 is a set of cryptographic hash functions designed by the United States National Security Agency (NSA). They are built using the Merkle–Damgård structure, from a one-way compression function itself built using the Davies–Meyer structure from a (classified) specialized block cipher. SHA-2 includes significant changes from its predecessor, SHA-1. SHA-256 and SHA-512 are novel hash functions computed with 32-bit and 64-bit words, respectively. They use different shift amounts and additive constants, but their structures are otherwise virtually identical, differing only in the number of rounds. See https://en.wikipedia.org/wiki/SHA-2

Parameters / Return Value

  • Returns Integer

    Integer


SHA512

procedure SHA512(): Integer

Contained in SHA-2 (Secure Hash Algorithm 2). SHA-2 is a set of cryptographic hash functions designed by the United States National Security Agency (NSA). They are built using the Merkle–Damgård structure, from a one-way compression function itself built using the Davies–Meyer structure from a (classified) specialized block cipher. SHA-2 includes significant changes from its predecessor, SHA-1. SHA-256 and SHA-512 are novel hash functions computed with 32-bit and 64-bit words, respectively. They use different shift amounts and additive constants, but their structures are otherwise virtually identical, differing only in the number of rounds. See https://en.wikipedia.org/wiki/SHA-2

Parameters / Return Value

  • Returns Integer

    Integer


SetTextOutputFormat

procedure SetTextOutputFormat(format: Option)

Sets the text output format for subsequent calls to ComputeHash().

Parameters / Return Value

  • format Option

    Option


OutputHex

procedure OutputHex(): Integer

Defines the text output to be as a hex string.

Parameters / Return Value

  • Returns Integer

    Integer


OutputBase64

procedure OutputBase64(): Integer

Defines the text output to be as a base64 encoded string.

Parameters / Return Value

  • Returns Integer

    Integer


ComputeHash

procedure ComputeHash(var forStream: InStream; var toHashStream: OutStream): Boolean

ComputeHash() uses the set hash function to compute the respective hash of forStream. The result is stored in toHashStream.

Parameters / Return Value

  • forStream InStream

    InStream

  • toHashStream OutStream

    OutStream

  • Returns Boolean

    Boolean


ComputeHash

procedure ComputeHash(var forStream: InStream; var toHashTempBlob: Codeunit "Temp Blob"): Boolean

ComputeHash() uses the set hash function to compute the respective hash of forStream. The result is stored in toHashTempBlob.

Parameters / Return Value

  • forStream InStream

    InStream

  • toHashTempBlob Codeunit "Temp Blob"

    Codeunit “Temp

  • Returns Boolean

    Boolean


ComputeHash

procedure ComputeHash(var forStream: InStream; var toHashText: Text): Boolean

ComputeHash() uses the set hash function to compute the respective hash of forStream. The result is stored in toHashText as its hexadecimal or base64 text representation.

Parameters / Return Value

  • forStream InStream

    InStream

  • toHashText Text

    Text

  • Returns Boolean

    Boolean


ComputeHash

procedure ComputeHash(var forTempBlob: Codeunit "Temp Blob"; var toHashTempBlob: Codeunit "Temp Blob"): Boolean

ComputeHash() uses the set hash function to compute the respective hash of forTempBlob. The result is stored in toHashTempBlob.

Parameters / Return Value

  • forTempBlob Codeunit "Temp Blob"

    Codeunit “Temp

  • toHashTempBlob Codeunit "Temp Blob"

    Codeunit Blob”

  • Returns Boolean

    Boolean


ComputeHash

procedure ComputeHash(var forTempBlob: Codeunit "Temp Blob"; var toHashText: Text): Boolean

ComputeHash() uses the set hash function to compute the respective hash of forTempBlob. The result is stored in toHashText as its hexadecimal or base64 text representation.

Parameters / Return Value

  • forTempBlob Codeunit "Temp Blob"

    Codeunit “Temp

  • toHashText Text

    Text

  • Returns Boolean

    Boolean


ComputeHash

procedure ComputeHash(forText: Text; var toHashTempBlob: Codeunit "Temp Blob"): Boolean

ComputeHash() uses the set hash function to compute the respective hash of forText. The result is stored in toHashTempBlob.

Parameters / Return Value

  • forText Text

    Text

  • toHashTempBlob Codeunit "Temp Blob"

    Codeunit “Temp

  • Returns Boolean

    Boolean


ComputeHash

procedure ComputeHash(forText: Text; var toHashText: Text): Boolean

ComputeHash() uses the set hash function to compute the respective hash of forText. The result is stored in toHashText as its hexadecimal or base64 text representation.

Parameters / Return Value

  • forText Text

    Text

  • toHashText Text

    Text

  • Returns Boolean

    Boolean


SignString

procedure SignString(stringToSign: Text; signatureXmlString: Text; hashAlgorithm: Enum "Hash Algorithm"): Text

Uses the specifed hash algorithm to hash the string. Then signs the string with the specified Private-Key. Returns the signature as base64.

Parameters / Return Value

  • stringToSign Text

    Text

  • signatureXmlString Text

    Text

  • hashAlgorithm Enum "Hash Algorithm"

    Enum “Hash Algorithm”

  • Returns Text

    Text


SignString

procedure SignString(stringToSign: Text; signatureXmlString: SecretText; hashAlgorithm: Enum "Hash Algorithm"): Text

Uses the specifed hash algorithm to hash the string. Then signs the string with the specified Private-Key. Returns the signature as base64.

Parameters / Return Value

  • stringToSign Text

    Text

  • signatureXmlString SecretText

    SecretText

  • hashAlgorithm Enum "Hash Algorithm"

    Enum “Hash Algorithm”

  • Returns Text

    Text


SignString

procedure SignString(stringToSign: Text; signatureXmlString: Text): Text

Uses the standard SHA256 hash algorithm to hash the string. Then signs the string with the specified Private-Key. Returns the signature as base64.

Parameters / Return Value

  • stringToSign Text

    Text

  • signatureXmlString Text

    Text

  • Returns Text

    Text


SignString

procedure SignString(stringToSign: Text; signatureXmlString: SecretText): Text

Uses the standard SHA256 hash algorithm to hash the string. Then signs the string with the specified Private-Key. Returns the signature as base64.

Parameters / Return Value

  • stringToSign Text

    Text

  • signatureXmlString SecretText

    SecretText

  • Returns Text

    Text


ValidateSignature

procedure ValidateSignature(stringToCheck: Text; signatureXmlString: Text; signatureBase64: Text; hashAlgorithm: Enum "Hash Algorithm"): Boolean

Uses the specified hash algorithm and public-key to determine whether the passed signature validates the string. Returns Boolean.

Parameters / Return Value

  • stringToCheck Text

    Text

  • signatureXmlString Text

    Text

  • signatureBase64 Text

    Text

  • hashAlgorithm Enum "Hash Algorithm"

    Enum “Hash Algorithm”

  • Returns Boolean

    Boolean


ValidateSignature

procedure ValidateSignature(stringToCheck: Text; signatureXmlString: Text; signatureBase64: Text): Boolean

Uses the standard SHA-256 hash algorithm and public-key to determine whether the passed signature validates the string. Returns Boolean.

Parameters / Return Value

  • stringToCheck Text

    Text

  • signatureXmlString Text

    Text

  • signatureBase64 Text

    Text

  • Returns Boolean

    Boolean



EOS Labs -