public class SignedInfoImpl extends XmldsigDOMStructure implements SignedInfo
SignedInfo element that supports the
DOM XML representation and processing mechanism.DOMStructure.NodeWrapper| Modifier and Type | Field and Description |
|---|---|
protected CachedInputStream |
cachedCanonicalizedData_
The canonicalized SignedInfo cache filter;
|
protected CanonicalizationMethod |
canonicalizationMethod_
The
CanonicalizationMethod. |
protected String |
id_
The
id-attribute value. |
protected List |
references_
The list of
ReferenceImpls. |
protected AbstractSignatureMethodImpl |
signatureMethod_
The
SignatureMethod. |
implMap_, state_, STATE_CREATED, STATE_MARSHALED, STATE_UNINITIALIZED, STATE_UNMARSHALED| Constructor and Description |
|---|
SignedInfoImpl(CanonicalizationMethod canonicalizationMethod,
AbstractSignatureMethodImpl signatureMethod,
List references,
String id)
Creates a new instance of this
SignedInfoImpl with the
specified canonicalization method, signature method, list of
ReferenceImpls and id-attribute value. |
SignedInfoImpl(DOMCryptoContext context,
Node node)
Creates a new instance of this
SignedInfoImpl with the
specified context and node to unmarshal from. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
calculateSignatureValue(XMLCryptoContext context,
Key key)
Calculates the signature value using the contained
SignatureValue. |
protected InputStream |
canonicalize(XMLCryptoContext context)
Canonicalizes this
SignedInfo element using the contained
CanonicalizationMethod. |
void |
generateReferences(DOMCryptoContext context)
Generates each
Reference in this SignedInfo by calling
ReferenceImpl.generateReference(DOMCryptoContext) for each
Reference. |
CanonicalizationMethod |
getCanonicalizationMethod()
Returns the canonicalization method of this
SignedInfo. |
InputStream |
getCanonicalizedData()
Returns the canonicalized signed info bytes after a signing or validation
operation.
|
protected List |
getChildStructures()
|
String |
getId()
Returns the optional
Id attribute of this
SignedInfo. |
String |
getLocalName()
Returns the local name of the represented XML element.
|
List |
getReferences()
Returns an
unmodifiable list of one or more References. |
SignatureMethod |
getSignatureMethod()
Returns the signature method of this
SignedInfo. |
protected Attr |
marshalIDAttribute(DOMCryptoContext context,
Element parent)
Marshals the XML representation of an optional
Id-attribute
represented by this DOMStructure. |
protected void |
putChildStructure(DOMStructure childStructure)
|
protected void |
unmarshalAttributes(NamedNodeMap attributes,
DOMCryptoContext context)
Unmarshals the
Id-attribute. |
boolean |
validateReferences(XMLValidateContext validateContext)
Validates each
Reference in this SignedInfo by calling
ReferenceImpl.validate(XMLValidateContext) for each
Reference. |
boolean |
validateSignatureValue(XMLCryptoContext context,
byte[] value,
Key key)
Validate the signature value using the contained
SignatureMethod. |
getNamespace, initaddBytesToElement, addBytesToElement, clearMarshalling, clearMarshalling, getBytesFromElement, getBytesFromElementStream, getChildStructureVersion, getHere, getImplClass, getInstance, getInstance, getNode, getParentStructure, getParentStructureOf, getQualifiedName, getQualifiedName, hasNSDeclAttrInScope, isFeatureSupported, isNSDeclInScope, marshal, marshalAttributes, marshalElement, newIDforLookUp, putImplClass, setBackToCompatibilityPrior1_14, setNode, setParentStructure, toString, unmarshal, unmarshalElement, unmarshalIDAttribute, unmarshalStructures, wrapNodeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisFeatureSupportedprotected String id_
id-attribute value.protected CanonicalizationMethod canonicalizationMethod_
CanonicalizationMethod. (may not be null)protected AbstractSignatureMethodImpl signatureMethod_
SignatureMethod. (may not be null)protected List references_
ReferenceImpls. (may not be null)protected CachedInputStream cachedCanonicalizedData_
public SignedInfoImpl(DOMCryptoContext context, Node node) throws MarshalException
SignedInfoImpl with the
specified context and node to unmarshal from.context - the contextnode - the node to unmarshal fromMarshalException - if an exception occurs during unmarshalingpublic SignedInfoImpl(CanonicalizationMethod canonicalizationMethod, AbstractSignatureMethodImpl signatureMethod, List references, String id)
SignedInfoImpl with the
specified canonicalization method, signature method, list of
ReferenceImpls and id-attribute value.canonicalizationMethod - the canonicalization methodsignatureMethod - the signature methodreferences - a list of ReferenceImplsid - the id-attribute value (may be null)NullPointerException - if canonicalizationMethod,
signatureMethod or references is
nullIllegalArgumentException - if references is emptyClassCastException - if any of the references is not of type
ReferenceImplpublic String getLocalName()
DOMStructuregetLocalName in class DOMStructureDOMStructure.getLocalName()public CanonicalizationMethod getCanonicalizationMethod()
javax.xml.crypto.dsig.SignedInfoSignedInfo.getCanonicalizationMethod in interface SignedInfoSignedInfo.getCanonicalizationMethod()public SignatureMethod getSignatureMethod()
javax.xml.crypto.dsig.SignedInfoSignedInfo.getSignatureMethod in interface SignedInfoSignedInfo.getSignatureMethod()public List getReferences()
javax.xml.crypto.dsig.SignedInfounmodifiable list of one or more References.getReferences in interface SignedInfoReferencesSignedInfo.getReferences()public String getId()
javax.xml.crypto.dsig.SignedInfoId attribute of this
SignedInfo.getId in interface SignedInfonull if not specified)SignedInfo.getId()public InputStream getCanonicalizedData()
javax.xml.crypto.dsig.SignedInfogetCanonicalizedData in interface SignedInfoInputStream containing the canonicalized bytes, or
null if this SignedInfo has not been
signed or validated yetSignedInfo.getCanonicalizedData()protected List getChildStructures()
getChildStructures in class DOMStructureDOMStructures (may be empty, but never
null)protected void putChildStructure(DOMStructure childStructure) throws MarshalException
putChildStructure in class DOMStructurechildStructure - the unmarshalled child structureMarshalExceptionprotected Attr marshalIDAttribute(DOMCryptoContext context, Element parent)
DOMStructureId-attribute
represented by this DOMStructure.
This method is called by DOMStructure.marshal(DOMCryptoContext, Node, Node).
A subclass has to overwrite this method in order to marshal an
Id-attribute.
marshalIDAttribute in class DOMStructurecontext - the marshal contextparent - the element is the parent of the attribute node created however, an
the attribute node is not a child of it's parent element. see XPath.Id-attribute if any, otherwise
nullDOMStructure.marshalIDAttribute(DOMCryptoContext,
Element)protected void unmarshalAttributes(NamedNodeMap attributes, DOMCryptoContext context) throws MarshalException
Id-attribute.unmarshalAttributes in class DOMStructureattributes - the Attributes to unmarshalcontext - the marshal contextMarshalException - if an exception occurs during unmarshalingpublic boolean validateReferences(XMLValidateContext validateContext) throws XMLSignatureException
Reference in this SignedInfo by calling
ReferenceImpl.validate(XMLValidateContext) for each
Reference.validateContext - the validation contexttrue if all references are valid, or else
falseXMLSignatureException - if an unexpected exception occurs during validationpublic void generateReferences(DOMCryptoContext context) throws XMLSignatureException, MarshalException
Reference in this SignedInfo by calling
ReferenceImpl.generateReference(DOMCryptoContext) for each
Reference.context - the marshal contextXMLSignatureException - if an unexpected exception occurs during generationMarshalException - if an exception occurs during marshalingprotected InputStream canonicalize(XMLCryptoContext context) throws XMLSignatureException
SignedInfo element using the contained
CanonicalizationMethod.context - the contextSignedInfo elementXMLSignatureException - if an unexpected exception occurs during canonicalizationpublic byte[] calculateSignatureValue(XMLCryptoContext context, Key key) throws XMLSignatureException
SignatureValue.context - the contextkey - the signing keyXMLSignatureException - if an unexpected exception occurs during the signature value
calculationpublic boolean validateSignatureValue(XMLCryptoContext context, byte[] value, Key key) throws XMLSignatureException
SignatureMethod.context - the contextvalue - the raw signature valuekey - the verifying keytrue if the signature is valid, false
otherwiseXMLSignatureException - if an unexpected exception occurs during the signature value
validation© 2002-2005 IAIK, © 2004, 2006 - 2019 Stiftung SIC