Top Constructors Methods
org.bouncycastle.bcpg

public Class HashUtils

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

size of the salt for the given hash algorithm in bytes
getV6SignatureSaltSizeInBytes
(int
hash algorithm tag
hashAlgorithm
)

Return the length of the salt per hash algorithm, used in OpenPGP v6 signatures.

public boolean

Returns:

true if the encountered size matches the spec
saltSizeMatchesSpec
(int
hash algorithm tag
hashAlgorithm
,
int
encountered salt size
saltSize
)

Return true, if the encountered saltLength matches the value the specification gives for the hashAlgorithm.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

HashUtilsback to summary
public HashUtils()

Method Detail

getV6SignatureSaltSizeInBytesback to summary
public static int getV6SignatureSaltSizeInBytes(int hashAlgorithm)

Return the length of the salt per hash algorithm, used in OpenPGP v6 signatures.

Parameters
hashAlgorithm:int

hash algorithm tag

Returns:int

size of the salt for the given hash algorithm in bytes

See Also
OpenPGP - Salt Size declarations
saltSizeMatchesSpecback to summary
public boolean saltSizeMatchesSpec(int hashAlgorithm, int saltSize)

Return true, if the encountered saltLength matches the value the specification gives for the hashAlgorithm.

Implementation Note

LibrePGP allows for zero-length signature salt values, so this method only works for IETF OpenPGP v6.

Parameters
hashAlgorithm:int

hash algorithm tag

saltSize:int

encountered salt size

Returns:boolean

true if the encountered size matches the spec