Class SignedInfo
- java.lang.Object
-
- org.apache.xml.security.utils.ElementProxy
-
- org.apache.xml.security.utils.SignatureElementProxy
-
- org.apache.xml.security.signature.Manifest
-
- org.apache.xml.security.signature.SignedInfo
-
public class SignedInfo extends Manifest
Handles<ds:SignedInfo>elements ThisSignedInfoelement includes the canonicalization algorithm, a signature algorithm, and one or more references.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]c14nizedBytesField c14nizedBytesprivate org.w3c.dom.Elementc14nMethodprivate SignatureAlgorithmsignatureAlgorithmField signatureAlgorithmprivate org.w3c.dom.ElementsignatureMethod-
Fields inherited from class org.apache.xml.security.signature.Manifest
MAXIMUM_REFERENCE_COUNT
-
Fields inherited from class org.apache.xml.security.utils.ElementProxy
baseURI
-
-
Constructor Summary
Constructors Constructor Description SignedInfo(org.w3c.dom.Document doc)OverwritesManifest.addDocument(java.lang.String, java.lang.String, org.apache.xml.security.transforms.Transforms, java.lang.String, java.lang.String, java.lang.String)because it creates another Element.SignedInfo(org.w3c.dom.Document doc, java.lang.String signatureMethodURI, int hMACOutputLength, java.lang.String canonicalizationMethodURI)Constructor SignedInfoSignedInfo(org.w3c.dom.Document doc, java.lang.String signatureMethodURI, java.lang.String canonicalizationMethodURI)ConstructsSignedInfousing given Canonicalization algorithm and Signature algorithm.SignedInfo(org.w3c.dom.Document doc, org.w3c.dom.Element signatureMethodElem, org.w3c.dom.Element canonicalizationMethodElem)SignedInfo(org.w3c.dom.Element element, java.lang.String baseURI)Build aSignedInfofrom anElementSignedInfo(org.w3c.dom.Element element, java.lang.String baseURI, boolean secureValidation)Build aSignedInfofrom anElement
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.crypto.SecretKeycreateSecretKey(byte[] secretKeyBytes)Creates a SecretKey for the appropriate Mac algorithm based on a byte[] array password.java.lang.StringgetBaseLocalName()Method getBaseLocalName Method getBaseLocalName Returns the localname of the Elements of the sub-class.java.lang.StringgetCanonicalizationMethodURI()Returns the Canonicalization method URIbyte[]getCanonicalizedOctetStream()Returns getCanonicalizedOctetStreamjava.lang.StringgetInclusiveNamespaces()SignatureAlgorithmgetSignatureAlgorithm()org.w3c.dom.ElementgetSignatureMethodElement()Method getSignatureMethodElementjava.lang.StringgetSignatureMethodURI()Returns the Signature method URIprivate static org.w3c.dom.ElementreparseSignedInfoElem(org.w3c.dom.Element element, boolean secureValidation)voidsignInOctetStream(java.io.OutputStream os)Output the C14n stream to the given OutputStream.booleanverify()Tests core validation processbooleanverify(boolean followManifests)Tests core validation process-
Methods inherited from class org.apache.xml.security.signature.Manifest
addDocument, addResourceResolver, addResourceResolver, generateDigestValues, getId, getLength, getPerManifestResolvers, getReferencedContentAfterTransformsItem, getReferencedContentBeforeTransformsItem, getResolverProperties, getResolverProperty, getSignedContentItem, getSignedContentLength, getVerificationResult, getVerificationResults, isSecureValidation, item, setId, setResolverProperty, verifyReferences, verifyReferences
-
Methods inherited from class org.apache.xml.security.utils.SignatureElementProxy
getBaseNamespace
-
Methods inherited from class org.apache.xml.security.utils.ElementProxy
addBase64Element, addBase64Text, addBigIntegerElement, addReturnToSelf, addText, addTextElement, appendOther, appendSelf, appendSelf, createElementForFamily, createElementForFamilyLocal, createText, getBaseURI, getBigIntegerFromChildElement, getBytesFromTextChild, getDefaultPrefix, getDocument, getElement, getElementPlusReturns, getFirstChild, getLocalAttribute, getTextFromChildElement, getTextFromTextChild, length, registerDefaultPrefixes, setDefaultPrefix, setDocument, setElement, setElement, setLocalAttribute, setLocalIdAttribute, setXPathNamespaceContext
-
-
-
-
Field Detail
-
signatureAlgorithm
private SignatureAlgorithm signatureAlgorithm
Field signatureAlgorithm
-
c14nizedBytes
private byte[] c14nizedBytes
Field c14nizedBytes
-
c14nMethod
private org.w3c.dom.Element c14nMethod
-
signatureMethod
private org.w3c.dom.Element signatureMethod
-
-
Constructor Detail
-
SignedInfo
public SignedInfo(org.w3c.dom.Document doc) throws XMLSecurityExceptionOverwritesManifest.addDocument(java.lang.String, java.lang.String, org.apache.xml.security.transforms.Transforms, java.lang.String, java.lang.String, java.lang.String)because it creates another Element.- Parameters:
doc- theDocumentin whichXMLsignaturewill be placed- Throws:
XMLSecurityException
-
SignedInfo
public SignedInfo(org.w3c.dom.Document doc, java.lang.String signatureMethodURI, java.lang.String canonicalizationMethodURI) throws XMLSecurityExceptionConstructsSignedInfousing given Canonicalization algorithm and Signature algorithm.- Parameters:
doc-SignedInfois placed in this documentsignatureMethodURI- URI representation of the Digest and Signature algorithmcanonicalizationMethodURI- URI representation of the Canonicalization method- Throws:
XMLSecurityException
-
SignedInfo
public SignedInfo(org.w3c.dom.Document doc, java.lang.String signatureMethodURI, int hMACOutputLength, java.lang.String canonicalizationMethodURI) throws XMLSecurityExceptionConstructor SignedInfo- Parameters:
doc-SignedInfois placed in this documentsignatureMethodURI- URI representation of the Digest and Signature algorithmhMACOutputLength-canonicalizationMethodURI- URI representation of the Canonicalization method- Throws:
XMLSecurityException
-
SignedInfo
public SignedInfo(org.w3c.dom.Document doc, org.w3c.dom.Element signatureMethodElem, org.w3c.dom.Element canonicalizationMethodElem) throws XMLSecurityException- Parameters:
doc-signatureMethodElem-canonicalizationMethodElem-- Throws:
XMLSecurityException
-
SignedInfo
public SignedInfo(org.w3c.dom.Element element, java.lang.String baseURI) throws XMLSecurityExceptionBuild aSignedInfofrom anElement- Parameters:
element-SignedInfobaseURI- the URI of the resource where the XML instance was stored- Throws:
XMLSecurityException- See Also:
- Question, Answer
-
SignedInfo
public SignedInfo(org.w3c.dom.Element element, java.lang.String baseURI, boolean secureValidation) throws XMLSecurityExceptionBuild aSignedInfofrom anElement- Parameters:
element-SignedInfobaseURI- the URI of the resource where the XML instance was storedsecureValidation- whether secure validation is enabled or not- Throws:
XMLSecurityException- See Also:
- Question, Answer
-
-
Method Detail
-
reparseSignedInfoElem
private static org.w3c.dom.Element reparseSignedInfoElem(org.w3c.dom.Element element, boolean secureValidation) throws XMLSecurityException- Throws:
XMLSecurityException
-
verify
public boolean verify() throws MissingResourceFailureException, XMLSecurityExceptionTests core validation process- Returns:
- true if verification was successful
- Throws:
MissingResourceFailureExceptionXMLSecurityException
-
verify
public boolean verify(boolean followManifests) throws MissingResourceFailureException, XMLSecurityExceptionTests core validation process- Parameters:
followManifests- defines whether the verification process has to verify referencedds:Manifests, too- Returns:
- true if verification was successful
- Throws:
MissingResourceFailureExceptionXMLSecurityException
-
getCanonicalizedOctetStream
public byte[] getCanonicalizedOctetStream() throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityExceptionReturns getCanonicalizedOctetStream- Returns:
- the canonicalization result octet stream of
SignedInfoelement - Throws:
CanonicalizationExceptionInvalidCanonicalizerExceptionXMLSecurityException
-
signInOctetStream
public void signInOctetStream(java.io.OutputStream os) throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityExceptionOutput the C14n stream to the given OutputStream.- Parameters:
os-- Throws:
CanonicalizationExceptionInvalidCanonicalizerExceptionXMLSecurityException
-
getCanonicalizationMethodURI
public java.lang.String getCanonicalizationMethodURI()
Returns the Canonicalization method URI- Returns:
- the Canonicalization method URI
-
getSignatureMethodURI
public java.lang.String getSignatureMethodURI()
Returns the Signature method URI- Returns:
- the Signature method URI
-
getSignatureMethodElement
public org.w3c.dom.Element getSignatureMethodElement()
Method getSignatureMethodElement- Returns:
- returns the SignatureMethod Element
-
createSecretKey
public javax.crypto.SecretKey createSecretKey(byte[] secretKeyBytes)
Creates a SecretKey for the appropriate Mac algorithm based on a byte[] array password.- Parameters:
secretKeyBytes-- Returns:
- the secret key for the SignedInfo element.
-
getSignatureAlgorithm
public SignatureAlgorithm getSignatureAlgorithm()
-
getBaseLocalName
public java.lang.String getBaseLocalName()
Method getBaseLocalName Method getBaseLocalName Returns the localname of the Elements of the sub-class.- Overrides:
getBaseLocalNamein classManifest- Returns:
- the localname of the Elements of the sub-class.
-
getInclusiveNamespaces
public java.lang.String getInclusiveNamespaces()
-
-