Table of Contents

Class DigestAlgorithms

Namespace
iText.Signatures
Assembly
itext.sign.dll

Class that contains a map with the different message digest algorithms.

public class DigestAlgorithms
Inheritance
DigestAlgorithms
Inherited Members

Constructors

DigestAlgorithms()

public DigestAlgorithms()

Fields

RIPEMD160

Algorithm available for signatures since PDF 1.7.

public const string RIPEMD160 = "RIPEMD160"

Field Value

string

SHA1

Algorithm available for signatures since PDF 1.3.

public const string SHA1 = "SHA-1"

Field Value

string

SHA256

Algorithm available for signatures since PDF 1.6.

public const string SHA256 = "SHA-256"

Field Value

string

SHA384

Algorithm available for signatures since PDF 1.7.

public const string SHA384 = "SHA-384"

Field Value

string

SHA3_256

Algorithm available for signatures since PDF 2.0 extended by ISO/TS 32001.

public const string SHA3_256 = "SHA3-256"

Field Value

string

SHA3_384

Algorithm available for signatures since PDF 2.0 extended by ISO/TS 32001.

public const string SHA3_384 = "SHA3-384"

Field Value

string

SHA3_512

Algorithm available for signatures since PDF 2.0 extended by ISO/TS 32001.

public const string SHA3_512 = "SHA3-512"

Field Value

string

SHA512

Algorithm available for signatures since PDF 1.7.

public const string SHA512 = "SHA-512"

Field Value

string

SHAKE256

Algorithm available for signatures since PDF 2.0 extended by ISO/TS 32001.

public const string SHAKE256 = "SHAKE256"

Field Value

string

Remarks

Algorithm available for signatures since PDF 2.0 extended by ISO/TS 32001.

The output length is fixed at 512 bits (64 bytes).

Methods

Digest(Stream, string)

Creates a hash using a specific digest algorithm and a provider.

public static byte[] Digest(Stream data, string hashAlgorithm)

Parameters

data Stream

the message of which you want to create a hash

hashAlgorithm string

the algorithm used to create the hash

Returns

byte[]

the hash

Digest(Stream, string, IExternalDigest)

Create a digest based on the inputstream.

public static byte[] Digest(Stream data, string hashAlgorithm, IExternalDigest externalDigest)

Parameters

data Stream

data to be digested

hashAlgorithm string

algorithm to be used

externalDigest IExternalDigest

external digest to be used

Returns

byte[]

digest of the data

Digest(Stream, IDigest)

Create a digest based on the inputstream.

public static byte[] Digest(Stream data, IDigest messageDigest)

Parameters

data Stream

data to be digested

messageDigest IDigest

algorithm to be used

Returns

byte[]

digest of the data

GetAllowedDigest(string)

Returns the id of a digest algorithms that is allowed in PDF, or null if it isn't allowed.

public static string GetAllowedDigest(string name)

Parameters

name string

The name of the digest algorithm.

Returns

string

An oid.

GetDigest(string)

Gets the digest name for a certain id.

public static string GetDigest(string oid)

Parameters

oid string

an id (for instance "1.2.840.113549.2.5")

Returns

string

a digest name (for instance "MD5")

GetMessageDigest(string)

Creates a MessageDigest object that can be used to create a hash.

public static IDigest GetMessageDigest(string hashAlgorithm)

Parameters

hashAlgorithm string

the algorithm you want to use to create a hash

Returns

IDigest

a MessageDigest object

GetMessageDigestFromOid(string)

Get a digest algorithm.

public static IDigest GetMessageDigestFromOid(string digestOid)

Parameters

digestOid string

oid of the digest algorithm

Returns

IDigest

MessageDigest object

GetOutputBitLength(string)

Retrieve the output length in bits of the given digest algorithm.

public static int GetOutputBitLength(string name)

Parameters

name string

the name of the digest algorithm

Returns

int

the length of the output of the algorithm in bits