Package es.gob.jmulticard.asn1.der.pkcs1
Class DigestInfo
- java.lang.Object
-
- es.gob.jmulticard.asn1.DecoderObject
-
- es.gob.jmulticard.asn1.der.Sequence
-
- es.gob.jmulticard.asn1.der.pkcs1.DigestInfo
-
public final class DigestInfo extends Sequence
Tipo ASN.1 PKCS#1 DigestInfo.DigestInfo::=SEQUENCE { digestAlgorithm AlgorithmIdentifier, digest OCTET STRING }
-
-
Field Summary
Fields Modifier and Type Field Description private static byte[]SHA1_DIGESTINFO_HEADERprivate static java.lang.StringSHA1WITHRSA_NORMALIZED_ALGO_NAMEprivate static byte[]SHA256_DIGESTINFO_HEADERprivate static java.lang.StringSHA256WITHRSA_NORMALIZED_ALGO_NAMEprivate static byte[]SHA384_DIGESTINFO_HEADERprivate static java.lang.StringSHA384WITHRSA_NORMALIZED_ALGO_NAMEprivate static byte[]SHA512_DIGESTINFO_HEADERprivate static java.lang.StringSHA512WITHRSA_NORMALIZED_ALGO_NAME
-
Constructor Summary
Constructors Constructor Description DigestInfo()Construye un objeto ASN.1 PKCS#1 DigestInfo.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static byte[]encode(java.lang.String signingAlgorithm, byte[] data, CryptoHelper cryptoHelper)Codifica una estructuraDigestInfo.private static CryptoHelper.DigestAlgorithmgetDigestAlgorithm(java.lang.String signatureAlgorithm)Obtiene el algoritmo de huella digital correspondiente a un algoritmo de firma concreto.private static java.lang.StringgetNormalizedSigningAlgorithm(java.lang.String algorithm)Normaliza los nombres de algorimo de firma.protected static byte[]getSha1DigestinfoHeader()protected static byte[]getSha256DigestinfoHeader()protected static byte[]getSha384DigestinfoHeader()protected static byte[]getSha512DigestinfoHeader()private static byte[]selectHeaderTemplate(CryptoHelper.DigestAlgorithm algorithm)Selecciona una plantilla con la cabecera delDigestInfopara un algoritmo concreto.java.lang.StringtoString()-
Methods inherited from class es.gob.jmulticard.asn1.der.Sequence
decodeValue, getDefaultTag, getElementAt, getElementCount
-
Methods inherited from class es.gob.jmulticard.asn1.DecoderObject
checkTag, getBytes, getRawDerValue, setDerValue
-
-
-
-
Field Detail
-
SHA1WITHRSA_NORMALIZED_ALGO_NAME
private static final java.lang.String SHA1WITHRSA_NORMALIZED_ALGO_NAME
- See Also:
- Constant Field Values
-
SHA256WITHRSA_NORMALIZED_ALGO_NAME
private static final java.lang.String SHA256WITHRSA_NORMALIZED_ALGO_NAME
- See Also:
- Constant Field Values
-
SHA384WITHRSA_NORMALIZED_ALGO_NAME
private static final java.lang.String SHA384WITHRSA_NORMALIZED_ALGO_NAME
- See Also:
- Constant Field Values
-
SHA512WITHRSA_NORMALIZED_ALGO_NAME
private static final java.lang.String SHA512WITHRSA_NORMALIZED_ALGO_NAME
- See Also:
- Constant Field Values
-
SHA1_DIGESTINFO_HEADER
private static final byte[] SHA1_DIGESTINFO_HEADER
-
SHA256_DIGESTINFO_HEADER
private static final byte[] SHA256_DIGESTINFO_HEADER
-
SHA384_DIGESTINFO_HEADER
private static final byte[] SHA384_DIGESTINFO_HEADER
-
SHA512_DIGESTINFO_HEADER
private static final byte[] SHA512_DIGESTINFO_HEADER
-
-
Method Detail
-
getSha1DigestinfoHeader
protected static byte[] getSha1DigestinfoHeader()
- Returns:
- the sha1DigestinfoHeader
-
getSha256DigestinfoHeader
protected static byte[] getSha256DigestinfoHeader()
- Returns:
- the sha256DigestinfoHeader
-
getSha384DigestinfoHeader
protected static byte[] getSha384DigestinfoHeader()
- Returns:
- the sha384DigestinfoHeader
-
getSha512DigestinfoHeader
protected static byte[] getSha512DigestinfoHeader()
- Returns:
- the sha512DigestinfoHeader
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
encode
public static byte[] encode(java.lang.String signingAlgorithm, byte[] data, CryptoHelper cryptoHelper) throws java.io.IOExceptionCodifica una estructuraDigestInfo.- Parameters:
signingAlgorithm- Algoritmo de huella digital o de firma electrónica.data- Datos de los que obtener la estructura.cryptoHelper- Manejador de operaciones criptográficas.- Returns:
- Estructura
DigestInfo. - Throws:
java.io.IOException- Cuando se produce algun error en la estrucura de la estructura.
-
getNormalizedSigningAlgorithm
private static java.lang.String getNormalizedSigningAlgorithm(java.lang.String algorithm)
Normaliza los nombres de algorimo de firma.- Parameters:
algorithm- Nombre de algoritmo.- Returns:
- Nombre de algoritmo normalizado.
-
selectHeaderTemplate
private static byte[] selectHeaderTemplate(CryptoHelper.DigestAlgorithm algorithm)
Selecciona una plantilla con la cabecera delDigestInfopara un algoritmo concreto.- Parameters:
algorithm- Algoritmo del que obtener la plantilla de cabecera.- Returns:
- Cabecera.
-
getDigestAlgorithm
private static CryptoHelper.DigestAlgorithm getDigestAlgorithm(java.lang.String signatureAlgorithm)
Obtiene el algoritmo de huella digital correspondiente a un algoritmo de firma concreto.- Parameters:
signatureAlgorithm- Algoritmo de firma.- Returns:
- Algoritmo de huella digital o la propia entrada si no se identificó.
-
-