- 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 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(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(Document doc, String signatureMethodURI, int hMACOutputLength, String canonicalizationMethodURI)Constructor SignedInfoSignedInfo(Document doc, String signatureMethodURI, int hMACOutputLength, String canonicalizationMethodURI, Provider provider, AlgorithmParameterSpec spec)ConstructsSignedInfousing given Canonicalization algorithm and Signature algorithm.SignedInfo(Document doc, String signatureMethodURI, String canonicalizationMethodURI)ConstructsSignedInfousing given Canonicalization algorithm and Signature algorithm.SignedInfo(Document doc, String signatureMethodURI, String canonicalizationMethodURI, Provider provider)ConstructsSignedInfousing given Canonicalization algorithm and Signature algorithm.SignedInfo(Document doc, Element signatureMethodElem, Element canonicalizationMethodElem)SignedInfo(Document doc, Element signatureMethodElem, Element canonicalizationMethodElem, Provider provider)SignedInfo(Element element, String baseURI)Build aSignedInfofrom anElementSignedInfo(Element element, String baseURI, boolean secureValidation)Build aSignedInfofrom anElementSignedInfo(Element element, String baseURI, boolean secureValidation, Provider provider)Build aSignedInfofrom anElement
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SecretKeycreateSecretKey(byte[] secretKeyBytes)Creates a SecretKey for the appropriate Mac algorithm based on a byte[] array password.StringgetBaseLocalName()Method getBaseLocalName Method getBaseLocalName Returns the localname of the Elements of the sub-class.StringgetCanonicalizationMethodURI()Returns the Canonicalization method URIbyte[]getCanonicalizedOctetStream()Returns getCanonicalizedOctetStreamStringgetInclusiveNamespaces()SignatureAlgorithmgetSignatureAlgorithm()ElementgetSignatureMethodElement()Method getSignatureMethodElementStringgetSignatureMethodURI()Returns the Signature method URIvoidsignInOctetStream(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, 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
-
-
-
-
Constructor Detail
-
SignedInfo
public SignedInfo(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- theDocumentin whichXMLsignaturewill be placed- Throws:
XMLSecurityException
-
SignedInfo
public SignedInfo(Document doc, String signatureMethodURI, String canonicalizationMethodURI) throws XMLSecurityException
ConstructsSignedInfousing 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(Document doc, String signatureMethodURI, String canonicalizationMethodURI, Provider provider) throws XMLSecurityException
ConstructsSignedInfousing 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 methodprovider- security provider to use- Throws:
XMLSecurityException
-
SignedInfo
public SignedInfo(Document doc, String signatureMethodURI, int hMACOutputLength, String canonicalizationMethodURI) throws XMLSecurityException
Constructor 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(Document doc, String signatureMethodURI, int hMACOutputLength, String canonicalizationMethodURI, Provider provider, AlgorithmParameterSpec spec) throws XMLSecurityException
ConstructsSignedInfousing given Canonicalization algorithm and Signature algorithm.- Parameters:
doc-SignedInfois placed in this documentsignatureMethodURI- URI representation of the Digest and Signature algorithmhMACOutputLength-canonicalizationMethodURI- URI representation of the Canonicalization methodprovider- security provider to usespec- AlgorithmParameterSpec to use- Throws:
XMLSecurityException
-
SignedInfo
public SignedInfo(Document doc, Element signatureMethodElem, Element canonicalizationMethodElem) throws XMLSecurityException
- Parameters:
doc-signatureMethodElem-canonicalizationMethodElem-- Throws:
XMLSecurityException
-
SignedInfo
public SignedInfo(Document doc, Element signatureMethodElem, Element canonicalizationMethodElem, Provider provider) throws XMLSecurityException
- Throws:
XMLSecurityException
-
SignedInfo
public SignedInfo(Element element, String baseURI) throws XMLSecurityException
Build 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(Element element, String baseURI, boolean secureValidation) throws XMLSecurityException
Build 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
-
SignedInfo
public SignedInfo(Element element, String baseURI, boolean secureValidation, Provider provider) throws XMLSecurityException
Build aSignedInfofrom anElement- Parameters:
element-SignedInfobaseURI- the URI of the resource where the XML instance was storedsecureValidation- whether secure validation is enabled or notprovider- security provider to use- Throws:
XMLSecurityException- See Also:
- Question, Answer
-
-
Method Detail
-
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, XMLSecurityException, IOExceptionReturns getCanonicalizedOctetStream- Returns:
- the canonicalization result octet stream of
SignedInfoelement - Throws:
CanonicalizationExceptionInvalidCanonicalizerExceptionXMLSecurityExceptionIOException
-
signInOctetStream
public void signInOctetStream(OutputStream os) throws CanonicalizationException, InvalidCanonicalizerException, XMLSecurityException
Output the C14n stream to the given OutputStream.- Parameters:
os-- Throws:
CanonicalizationExceptionInvalidCanonicalizerExceptionXMLSecurityException
-
getCanonicalizationMethodURI
public String getCanonicalizationMethodURI()
Returns the Canonicalization method URI- Returns:
- the Canonicalization method URI
-
getSignatureMethodURI
public String getSignatureMethodURI()
Returns the Signature method URI- Returns:
- the Signature method URI
-
getSignatureMethodElement
public Element getSignatureMethodElement()
Method getSignatureMethodElement- Returns:
- returns the SignatureMethod Element
-
createSecretKey
public 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 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 String getInclusiveNamespaces()
-
-