Class Manifest
- java.lang.Object
-
- org.apache.xml.security.utils.ElementProxy
-
- org.apache.xml.security.utils.SignatureElementProxy
-
- org.apache.xml.security.signature.Manifest
-
- Direct Known Subclasses:
SignedInfo
public class Manifest extends SignatureElementProxy
Handles<ds:Manifest>elements.This element holds the
Referenceelements- Author:
- $author: $
-
-
Field Summary
-
Fields inherited from class org.apache.xml.security.utils.ElementProxy
_baseURI, _constructionElement, _doc, _state, MODE_CREATE, MODE_DECRYPT, MODE_ENCRYPT, MODE_PROCESS, MODE_SIGN, MODE_UNKNOWN, MODE_VERIFY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDocument(java.lang.String BaseURI, java.lang.String referenceURI, Transforms transforms, java.lang.String digestURI, java.lang.String ReferenceId, java.lang.String ReferenceType)ThisaddDocumentmethod is used to add a new resource to the signed info.voidaddResourceResolver(ResourceResolver resolver)Adds Resource Resolver for retrieving resources at specifiedURIattribute inreferenceelementvoidaddResourceResolver(ResourceResolverSpi resolverSpi)Adds Resource Resolver for retrieving resources at specifiedURIattribute inreferenceelementvoidgenerateDigestValues()The calculation of the DigestValues in the References must be after the References are already added to the document and during the signing process.java.lang.StringgetBaseLocalName()Method getBaseLocalNamejava.lang.StringgetId()Returns theIdattributeintgetLength()Return the nonnegative number of added references.XMLSignatureInputgetReferencedContentAfterTransformsItem(int i)Method getReferencedContentAfterTransformsItemXMLSignatureInputgetReferencedContentBeforeTransformsItem(int i)Method getReferencedContentPriorTransformsItemjava.lang.StringgetResolverProperty(java.lang.String key)Returns the value at specified keybyte[]getSignedContentItem(int i)Method getSignedContentItemintgetSignedContentLength()Method getSignedContentLengthbooleangetVerificationResult(int index)After verifying aManifestor aSignedInfousing theverifyReferences()orSignedInfo.verify()methods, the individual results can be retrieved with this method.Referenceitem(int i)Return thei th reference.voidsetId(java.lang.String Id)Sets theIdattributevoidsetResolverProperty(java.lang.String key, java.lang.String value)Used to pass parameters like proxy servers etc to the ResourceResolver implementation.booleanverifyReferences()Used to do a reference validation of all enclosed references using theReference.verify()method.booleanverifyReferences(boolean followManifests)Used to do a reference validation of all enclosed references using theReference.verify()method.-
Methods inherited from class org.apache.xml.security.utils.SignatureElementProxy
getBaseNamespace
-
Methods inherited from class org.apache.xml.security.utils.ElementProxy
addBase64Element, addBase64Text, addBigIntegerElement, addText, addTextElement, createElementForFamily, getBaseURI, getBigIntegerFromChildElement, getBytesFromChildElement, getBytesFromTextChild, getDefaultPrefix, getDocument, getElement, getElementPlusReturns, getTextFromChildElement, getTextFromTextChild, guaranteeThatElementInCorrectSpace, length, setDefaultPrefix, setElement, setXPathNamespaceContext
-
-
-
-
Constructor Detail
-
Manifest
public Manifest(org.w3c.dom.Document doc)
ConsturtsManifest- Parameters:
doc- theDocumentin whichXMLsignatureis placed
-
Manifest
public Manifest(org.w3c.dom.Element element, java.lang.String BaseURI) throws XMLSecurityExceptionConstructor Manifest- Parameters:
element-BaseURI-- Throws:
XMLSecurityException
-
-
Method Detail
-
addDocument
public void addDocument(java.lang.String BaseURI, java.lang.String referenceURI, Transforms transforms, java.lang.String digestURI, java.lang.String ReferenceId, java.lang.String ReferenceType) throws XMLSignatureExceptionThisaddDocumentmethod is used to add a new resource to the signed info. AReferenceis built from the supplied values.- Parameters:
BaseURI- the URI of the resource where the XML instance was storedreferenceURI-URIattribute inReferencefor specifing where data istransforms- org.apache.xml.security.signature.Transforms object with an ordered list of transformations to be performed.digestURI- The digest algorthim URI to be used.ReferenceId-ReferenceType-- Throws:
XMLSignatureException
-
generateDigestValues
public void generateDigestValues() throws XMLSignatureException, ReferenceNotInitializedExceptionThe calculation of the DigestValues in the References must be after the References are already added to the document and during the signing process. This ensures that all neccesary data is in place.
-
getLength
public int getLength()
Return the nonnegative number of added references.- Returns:
- the number of references
-
item
public Reference item(int i) throws XMLSecurityException
Return thei th reference. Validivalues are 0 to{link@ getSize}-1.- Parameters:
i- Index of the requestedReference- Returns:
- the
i th reference - Throws:
XMLSecurityException
-
setId
public void setId(java.lang.String Id)
Sets theIdattribute- Parameters:
Id- theIdattribute inds:Manifest
-
getId
public java.lang.String getId()
Returns theIdattribute- Returns:
- the
Idattribute inds:Manifest
-
verifyReferences
public boolean verifyReferences() throws MissingResourceFailureException, XMLSecurityExceptionUsed to do a reference validation of all enclosed references using theReference.verify()method.This step loops through all
References and does verify the hash values. If one or more verifications fail, the method returnsfalse. If all verifications are successful, it returnstrue. The results of the individual reference validations are available by using thegetVerificationResult(int)method- Returns:
- true if all References verify, false if one or more do not verify.
- Throws:
MissingResourceFailureException- if aReferencedoes not verify (throws aReferenceNotInitializedExceptionbecause of an uninitializedXMLSignatureInputXMLSecurityException- See Also:
Reference.verify(),SignedInfo.verify(),MissingResourceFailureException
-
verifyReferences
public boolean verifyReferences(boolean followManifests) throws MissingResourceFailureException, XMLSecurityExceptionUsed to do a reference validation of all enclosed references using theReference.verify()method.This step loops through all
References and does verify the hash values. If one or more verifications fail, the method returnsfalse. If all verifications are successful, it returnstrue. The results of the individual reference validations are available by using thegetVerificationResult(int)method- Parameters:
followManifests-- Returns:
- true if all References verify, false if one or more do not verify.
- Throws:
MissingResourceFailureException- if aReferencedoes not verify (throws aReferenceNotInitializedExceptionbecause of an uninitializedXMLSignatureInputXMLSecurityException- See Also:
Reference.verify(),SignedInfo.verify(boolean),MissingResourceFailureException
-
getVerificationResult
public boolean getVerificationResult(int index) throws XMLSecurityExceptionAfter verifying aManifestor aSignedInfousing theverifyReferences()orSignedInfo.verify()methods, the individual results can be retrieved with this method.- Parameters:
index- an index of into aManifestor aSignedInfo- Returns:
- the results of reference validation at the specified index
- Throws:
XMLSecurityException
-
addResourceResolver
public void addResourceResolver(ResourceResolver resolver)
Adds Resource Resolver for retrieving resources at specifiedURIattribute inreferenceelement- Parameters:
resolver-ResourceResolvercan provide the implemenatin subclass ofResourceResolverSpifor retrieving resource.
-
addResourceResolver
public void addResourceResolver(ResourceResolverSpi resolverSpi)
Adds Resource Resolver for retrieving resources at specifiedURIattribute inreferenceelement- Parameters:
resolverSpi- the implemenatin subclass ofResourceResolverSpifor retrieving resource.
-
setResolverProperty
public void setResolverProperty(java.lang.String key, java.lang.String value)Used to pass parameters like proxy servers etc to the ResourceResolver implementation.- Parameters:
key- the keyvalue- the value
-
getResolverProperty
public java.lang.String getResolverProperty(java.lang.String key)
Returns the value at specified key- Parameters:
key- the key- Returns:
- the value
-
getSignedContentItem
public byte[] getSignedContentItem(int i) throws XMLSignatureExceptionMethod getSignedContentItem- Parameters:
i-- Returns:
- The signed content of the i reference.
- Throws:
XMLSignatureException
-
getReferencedContentBeforeTransformsItem
public XMLSignatureInput getReferencedContentBeforeTransformsItem(int i) throws XMLSecurityException
Method getReferencedContentPriorTransformsItem- Parameters:
i-- Returns:
- The contents before transformation of the reference i.
- Throws:
XMLSecurityException
-
getReferencedContentAfterTransformsItem
public XMLSignatureInput getReferencedContentAfterTransformsItem(int i) throws XMLSecurityException
Method getReferencedContentAfterTransformsItem- Parameters:
i-- Returns:
- The contents after transformation of the reference i.
- Throws:
XMLSecurityException
-
getSignedContentLength
public int getSignedContentLength()
Method getSignedContentLength- Returns:
- The nu,ber of references contained in this reference.
-
getBaseLocalName
public java.lang.String getBaseLocalName()
Method getBaseLocalName- Specified by:
getBaseLocalNamein classElementProxy- Returns:
- the localname of the Elements of the sub-class.
-
-