public class HMACIntegrity extends java.lang.Object implements XmlSignatureAlgorithm
MAC algorithms take two implicit parameters, their keying material
determined from KeyInfo and the octet stream output by
CanonicalizationMethod. MACs and signature algorithms are
syntactically identical but a MAC implies a shared secret key.
The HMAC algorithm
(RFC2104 ) takes the output (truncation) length in bits as a parameter; this
specification REQUIRES that the truncation length be a multiple of 8 (i.e.
fall on a byte boundary) because Base64 encoding operates on full bytes.
If the truncation parameter is not specified then all the bits of the hash
are output. Any signature with a truncation length that is less than half
the output length of the underlying hash algorithm MUST be deemed invalid. An
example of an HMAC SignatureMethod element:
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1">
<HMACOutputLength>128</HMACOutputLength>
</SignatureMethod>
The output of the HMAC algorithm is ultimately the output (possibly truncated) of the chosen digest algorithm. This value shall be base64 encoded in the same straightforward fashion as the output of the digest algorithms.
Schema Definition:
<simpleType name="HMACOutputLengthType">
<restriction base="integer"/>
</simpleType>
| Modifier and Type | Class and Description |
|---|---|
static class |
HMACIntegrity.HMACwithMD5 |
static class |
HMACIntegrity.HMACwithRIPEMD |
static class |
HMACIntegrity.HMACwithSHA1 |
static class |
HMACIntegrity.HMACwithSHA256 |
static class |
HMACIntegrity.HMACwithSHA384 |
static class |
HMACIntegrity.HMACwithSHA512 |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PARAM_HMAC_OUTPUT_LEGTH |
| Constructor and Description |
|---|
HMACIntegrity(tr.gov.tubitak.uekae.esya.api.crypto.alg.MACAlg aMACAlg) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getAlgorithmName() |
void |
initSign(java.security.Key aKey,
tr.gov.tubitak.uekae.esya.api.crypto.params.AlgorithmParams aParameters) |
void |
initVerify(java.security.Key aKey,
tr.gov.tubitak.uekae.esya.api.crypto.params.AlgorithmParams aParameters) |
byte[] |
sign() |
void |
update(byte[] aData) |
boolean |
verify(byte[] aSignatureValue) |
public static final java.lang.String PARAM_HMAC_OUTPUT_LEGTH
public HMACIntegrity(tr.gov.tubitak.uekae.esya.api.crypto.alg.MACAlg aMACAlg)
public java.lang.String getAlgorithmName()
getAlgorithmName in interface XmlSignatureAlgorithmpublic void initSign(java.security.Key aKey,
tr.gov.tubitak.uekae.esya.api.crypto.params.AlgorithmParams aParameters)
throws XMLSignatureException
initSign in interface XmlSignatureAlgorithmXMLSignatureExceptionpublic void initVerify(java.security.Key aKey,
tr.gov.tubitak.uekae.esya.api.crypto.params.AlgorithmParams aParameters)
throws XMLSignatureException
initVerify in interface XmlSignatureAlgorithmXMLSignatureExceptionpublic void update(byte[] aData)
throws XMLSignatureException
update in interface XmlSignatureAlgorithmXMLSignatureExceptionpublic byte[] sign()
throws XMLSignatureException
sign in interface XmlSignatureAlgorithmXMLSignatureExceptionpublic boolean verify(byte[] aSignatureValue)
throws XMLSignatureException
verify in interface XmlSignatureAlgorithmXMLSignatureExceptionCopyright © 2025. All rights reserved.