public final class UtilsCrypto
extends java.lang.Object
Utilities class for cryptographics operations.
Project:Library for the integration with the services of @Firma, eVisor and TS@.
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
calculateDigest(java.lang.String algorithm,
byte[] data,
java.security.Provider provider)
Calculate the digest of the input data with the algorithm specified.
|
static byte[] |
calculateDigestReturnB64ByteArray(java.lang.String algorithm,
byte[] data,
java.security.Provider provider)
Calculate the digest in base 64 of the input data with the algorithm specified.
|
static java.lang.String |
calculateDigestReturnB64String(java.lang.String algorithm,
byte[] data,
java.security.Provider provider)
Calculate the digest in base 64 of the input data with the algorithm specified.
|
static java.lang.String |
translateHashAlgorithmXML(java.lang.String algorithmURI)
Method that obtains the name of certain algorithm from the URI of the algorithm (only for XML format).
|
public static java.lang.String translateHashAlgorithmXML(java.lang.String algorithmURI)
throws CommonUtilsException
algorithmURI - Parameter that represents the URI of the algorithm.CommonUtilsException - If the algorithm isn't supported.public static byte[] calculateDigest(java.lang.String algorithm,
byte[] data,
java.security.Provider provider)
throws CommonUtilsException
algorithm - Hash algorithm to apply. It can not be null or empty.data - Array of bytes that represents the data to calculate the hash. It can not be null or empty.provider - Provider to use for calculate the hash algorithm. If it is null, then
tries to use the provider setted in java security providers configuration.CommonUtilsException - In case of the input hash or data are note properly defined, or that
the input hash is not recognized.public static byte[] calculateDigestReturnB64ByteArray(java.lang.String algorithm,
byte[] data,
java.security.Provider provider)
throws CommonUtilsException
algorithm - Hash algorithm to apply. It can not be null or empty.data - Array of bytes that represents the data to calculate the hash. It can not be null or empty.provider - Provider to use for calculate the hash algorithm. If it is null, then
tries to use the provider setted in java security providers configuration.CommonUtilsException - In case of the input hash or data are note properly defined, or that
the input hash is not recognized.public static java.lang.String calculateDigestReturnB64String(java.lang.String algorithm,
byte[] data,
java.security.Provider provider)
throws CommonUtilsException
algorithm - Hash algorithm to apply. It can not be null or empty.data - Array of bytes that represents the data to calculate the hash. It can not be null or empty.provider - Provider to use for calculate the hash algorithm. If it is null, then
tries to use the provider setted in java security providers configuration.String that represents the hash calculated in base 64 (not chunked).CommonUtilsException - In case of the input hash or data are note properly defined, or that
the input hash is not recognized.