public class DigestAlgorithms extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
RIPEMD160
Algorithm available for signatures since PDF 1.7.
|
static String |
SHA1
Algorithm available for signatures since PDF 1.3.
|
static String |
SHA256
Algorithm available for signatures since PDF 1.6.
|
static String |
SHA3_256
Algorithm available for signatures since PDF 2.0
extended by ISO/TS 32001.
|
static String |
SHA3_384
Algorithm available for signatures since PDF 2.0
extended by ISO/TS 32001.
|
static String |
SHA3_512
Algorithm available for signatures since PDF 2.0
extended by ISO/TS 32001.
|
static String |
SHA384
Algorithm available for signatures since PDF 1.7.
|
static String |
SHA512
Algorithm available for signatures since PDF 1.7.
|
static String |
SHAKE256
Algorithm available for signatures since PDF 2.0
extended by ISO/TS 32001.
|
| Constructor and Description |
|---|
DigestAlgorithms() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
digest(InputStream data,
MessageDigest messageDigest)
Create a digest based on the input stream.
|
static byte[] |
digest(InputStream data,
String hashAlgorithm,
String provider)
Creates a hash using a specific digest algorithm and a provider.
|
static String |
getAllowedDigest(String name)
Returns the id of a digest algorithms that is allowed in PDF,
or null if it isn't allowed.
|
static String |
getDigest(String oid)
Gets the digest name for a certain id.
|
static MessageDigest |
getMessageDigest(String hashAlgorithm,
String provider)
Creates a MessageDigest object that can be used to create a hash.
|
static MessageDigest |
getMessageDigestFromOid(String digestOid,
String provider)
Get a digest algorithm.
|
static int |
getOutputBitLength(String name)
Retrieve the output length in bits of the given digest algorithm.
|
static String |
normalizeDigestName(String algo)
Normalize the digest name.
|
public static final String SHA1
public static final String SHA256
public static final String SHA384
public static final String SHA512
public static final String RIPEMD160
public static final String SHA3_256
public static final String SHA3_512
public static final String SHA3_384
public static final String SHAKE256
The output length is fixed at 512 bits (64 bytes).
public static MessageDigest getMessageDigestFromOid(String digestOid, String provider) throws NoSuchAlgorithmException, NoSuchProviderException
digestOid - oid of the digest algorithmprovider - the provider you want to use to create the hashNoSuchAlgorithmException - thrown when a particular cryptographic algorithm is
requested but is not available in the environmentNoSuchProviderException - thrown when a particular security provider is
requested but is not available in the environmentpublic static MessageDigest getMessageDigest(String hashAlgorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException
hashAlgorithm - the algorithm you want to use to create a hashprovider - the provider you want to use to create the hashNoSuchAlgorithmException - thrown when a particular cryptographic algorithm is
requested but is not available in the environmentNoSuchProviderException - thrown when a particular security provider is
requested but is not available in the environmentpublic static byte[] digest(InputStream data, String hashAlgorithm, String provider) throws GeneralSecurityException, IOException
data - the message of which you want to create a hashhashAlgorithm - the algorithm used to create the hashprovider - the provider used to create the hashGeneralSecurityException - when requested cryptographic algorithm or security provider
is not availableIOException - signals that an I/O exception has occurredpublic static byte[] digest(InputStream data, MessageDigest messageDigest) throws IOException
data - data to be digestedmessageDigest - algorithm to be usedIOException - signals that an I/O exception has occurredpublic static String getDigest(String oid)
oid - an id (for instance "1.2.840.113549.2.5")public static String normalizeDigestName(String algo)
algo - the name to be normalizedpublic static String getAllowedDigest(String name)
name - the name of the digest algorithmpublic static int getOutputBitLength(String name)
name - the name of the digest algorithmCopyright © 1998–2024 Apryse Group NV. All rights reserved.