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 ThisSignedInfo
element includes the canonicalization algorithm, a signature algorithm, and one or more references.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]
c14nizedBytes
Field c14nizedBytesprivate org.w3c.dom.Element
c14nMethod
private SignatureAlgorithm
signatureAlgorithm
Field signatureAlgorithmprivate org.w3c.dom.Element
signatureMethod
-
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)
ConstructsSignedInfo
using 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 aSignedInfo
from anElement
SignedInfo(org.w3c.dom.Element element, java.lang.String baseURI, boolean secureValidation)
Build aSignedInfo
from anElement
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.crypto.SecretKey
createSecretKey(byte[] secretKeyBytes)
Creates a SecretKey for the appropriate Mac algorithm based on a byte[] array password.java.lang.String
getBaseLocalName()
Method getBaseLocalName Method getBaseLocalName Returns the localname of the Elements of the sub-class.java.lang.String
getCanonicalizationMethodURI()
Returns the Canonicalization method URIbyte[]
getCanonicalizedOctetStream()
Returns getCanonicalizedOctetStreamjava.lang.String
getInclusiveNamespaces()
SignatureAlgorithm
getSignatureAlgorithm()
org.w3c.dom.Element
getSignatureMethodElement()
Method getSignatureMethodElementjava.lang.String
getSignatureMethodURI()
Returns the Signature method URIprivate static org.w3c.dom.Element
reparseSignedInfoElem(org.w3c.dom.Element element, boolean secureValidation)
void
signInOctetStream(java.io.OutputStream os)
Output the C14n stream to the given OutputStream.boolean
verify()
Tests core validation processboolean
verify(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 XMLSecurityException
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.- Parameters:
doc
- theDocument
in whichXMLsignature
will be placed- Throws:
XMLSecurityException
-
SignedInfo
public SignedInfo(org.w3c.dom.Document doc, java.lang.String signatureMethodURI, java.lang.String canonicalizationMethodURI) throws XMLSecurityException
ConstructsSignedInfo
using given Canonicalization algorithm and Signature algorithm.- Parameters:
doc
-SignedInfo
is 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 XMLSecurityException
Constructor SignedInfo- Parameters:
doc
-SignedInfo
is 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 XMLSecurityException
Build aSignedInfo
from anElement
- Parameters:
element
-SignedInfo
baseURI
- 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 XMLSecurityException
Build aSignedInfo
from anElement
- Parameters:
element
-SignedInfo
baseURI
- 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, XMLSecurityException
Tests core validation process- Returns:
- true if verification was successful
- Throws:
MissingResourceFailureException
XMLSecurityException
-
verify
public boolean verify(boolean followManifests) throws MissingResourceFailureException, XMLSecurityException
Tests core validation process- Parameters:
followManifests
- defines whether the verification process has to verify referencedds:Manifest
s, too- Returns:
- true if verification was successful
- Throws:
MissingResourceFailureException
XMLSecurityException
-
getCanonicalizedOctetStream
public byte[] getCanonicalizedOctetStream() throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException
Returns getCanonicalizedOctetStream- Returns:
- the canonicalization result octet stream of
SignedInfo
element - Throws:
CanonicalizationException
InvalidCanonicalizerException
XMLSecurityException
-
signInOctetStream
public void signInOctetStream(java.io.OutputStream os) throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException
Output the C14n stream to the given OutputStream.- Parameters:
os
-- Throws:
CanonicalizationException
InvalidCanonicalizerException
XMLSecurityException
-
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:
getBaseLocalName
in classManifest
- Returns:
- the localname of the Elements of the sub-class.
-
getInclusiveNamespaces
public java.lang.String getInclusiveNamespaces()
-
-