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
Reference
elements
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.Logger
LOG
static int
MAXIMUM_REFERENCE_COUNT
The default maximum number of references per Manifest, if secure validation is enabled.private java.util.List<ResourceResolver>
perManifestResolvers
Field perManifestResolversprivate static java.lang.Integer
referenceCount
private java.util.List<Reference>
references
Field referencesprivate org.w3c.dom.Element[]
referencesEl
private java.util.Map<java.lang.String,java.lang.String>
resolverProperties
Field resolverPropertiesprivate boolean
secureValidation
private java.util.List<VerifiedReference>
verificationResults
Field verificationResults[]-
Fields inherited from class org.apache.xml.security.utils.ElementProxy
baseURI
-
-
Constructor Summary
Constructors Constructor Description Manifest(org.w3c.dom.Document doc)
ConstructsManifest
Manifest(org.w3c.dom.Element element, java.lang.String baseURI)
Constructor ManifestManifest(org.w3c.dom.Element element, java.lang.String baseURI, boolean secureValidation)
Constructor Manifest
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDocument(java.lang.String baseURI, java.lang.String referenceURI, Transforms transforms, java.lang.String digestURI, java.lang.String referenceId, java.lang.String referenceType)
ThisaddDocument
method is used to add a new resource to the signed info.void
addResourceResolver(ResourceResolver resolver)
Adds Resource Resolver for retrieving resources at specifiedURI
attribute inreference
elementvoid
addResourceResolver(ResourceResolverSpi resolverSpi)
Adds Resource Resolver for retrieving resources at specifiedURI
attribute inreference
elementvoid
generateDigestValues()
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.String
getBaseLocalName()
Method getBaseLocalName Returns the localname of the Elements of the sub-class.java.lang.String
getId()
Returns theId
attributeint
getLength()
Return the nonnegative number of added references.java.util.List<ResourceResolver>
getPerManifestResolvers()
Get the Per-Manifest Resolver ListXMLSignatureInput
getReferencedContentAfterTransformsItem(int i)
Method getReferencedContentAfterTransformsItemXMLSignatureInput
getReferencedContentBeforeTransformsItem(int i)
Method getReferencedContentPriorTransformsItemjava.util.Map<java.lang.String,java.lang.String>
getResolverProperties()
Get the resolver property mapjava.lang.String
getResolverProperty(java.lang.String key)
Returns the value at specified keybyte[]
getSignedContentItem(int i)
Method getSignedContentItemint
getSignedContentLength()
Method getSignedContentLengthboolean
getVerificationResult(int index)
After verifying aManifest
or aSignedInfo
using theverifyReferences()
orSignedInfo.verify()
methods, the individual results can be retrieved with this method.java.util.List<VerifiedReference>
getVerificationResults()
Get the list of verification result objectsboolean
isSecureValidation()
Reference
item(int i)
Return the ith reference.void
setId(java.lang.String Id)
Sets theId
attributevoid
setResolverProperty(java.lang.String key, java.lang.String value)
Used to pass parameters like proxy servers etc to the ResourceResolver implementation.boolean
verifyReferences()
Used to do a reference validation of all enclosed references using theReference.verify()
method.boolean
verifyReferences(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, 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
-
MAXIMUM_REFERENCE_COUNT
public static final int MAXIMUM_REFERENCE_COUNT
The default maximum number of references per Manifest, if secure validation is enabled.- See Also:
- Constant Field Values
-
LOG
private static final org.slf4j.Logger LOG
-
referenceCount
private static java.lang.Integer referenceCount
-
references
private java.util.List<Reference> references
Field references
-
referencesEl
private org.w3c.dom.Element[] referencesEl
-
verificationResults
private java.util.List<VerifiedReference> verificationResults
Field verificationResults[]
-
resolverProperties
private java.util.Map<java.lang.String,java.lang.String> resolverProperties
Field resolverProperties
-
perManifestResolvers
private java.util.List<ResourceResolver> perManifestResolvers
Field perManifestResolvers
-
secureValidation
private boolean secureValidation
-
-
Constructor Detail
-
Manifest
public Manifest(org.w3c.dom.Document doc)
ConstructsManifest
- Parameters:
doc
- theDocument
in whichXMLsignature
is placed
-
Manifest
public Manifest(org.w3c.dom.Element element, java.lang.String baseURI) throws XMLSecurityException
Constructor Manifest- Parameters:
element
-baseURI
-- Throws:
XMLSecurityException
-
Manifest
public Manifest(org.w3c.dom.Element element, java.lang.String baseURI, boolean secureValidation) throws XMLSecurityException
Constructor Manifest- Parameters:
element
-baseURI
-secureValidation
-- 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 XMLSignatureException
ThisaddDocument
method is used to add a new resource to the signed info. AReference
is built from the supplied values.- Parameters:
baseURI
- the URI of the resource where the XML instance was storedreferenceURI
-URI
attribute inReference
for specifying where data istransforms
- org.apache.xml.security.signature.Transforms object with an ordered list of transformations to be performed.digestURI
- The digest algorithm URI to be used.referenceId
-referenceType
-- Throws:
XMLSignatureException
-
generateDigestValues
public void generateDigestValues() throws XMLSignatureException, ReferenceNotInitializedException
The 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 necessary 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 the ith reference. Validi
values are 0 to{link@ getSize}-1
.- Parameters:
i
- Index of the requestedReference
- Returns:
- the ith reference
- Throws:
XMLSecurityException
-
setId
public void setId(java.lang.String Id)
Sets theId
attribute- Parameters:
Id
- theId
attribute inds:Manifest
-
getId
public java.lang.String getId()
Returns theId
attribute- Returns:
- the
Id
attribute inds:Manifest
-
verifyReferences
public boolean verifyReferences() throws MissingResourceFailureException, XMLSecurityException
Used to do a reference validation of all enclosed references using theReference.verify()
method.This step loops through all
Reference
s 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 aReference
does not verify (throws aReferenceNotInitializedException
because of an uninitializedXMLSignatureInput
XMLSecurityException
- See Also:
Reference.verify()
,SignedInfo.verify()
,MissingResourceFailureException
-
verifyReferences
public boolean verifyReferences(boolean followManifests) throws MissingResourceFailureException, XMLSecurityException
Used to do a reference validation of all enclosed references using theReference.verify()
method.This step loops through all
Reference
s 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 aReference
does not verify (throws aReferenceNotInitializedException
because of an uninitializedXMLSignatureInput
XMLSecurityException
- See Also:
Reference.verify()
,SignedInfo.verify(boolean)
,MissingResourceFailureException
-
getVerificationResult
public boolean getVerificationResult(int index) throws XMLSecurityException
After verifying aManifest
or aSignedInfo
using theverifyReferences()
orSignedInfo.verify()
methods, the individual results can be retrieved with this method.- Parameters:
index
- an index of into aManifest
or aSignedInfo
- Returns:
- the results of reference validation at the specified index
- Throws:
XMLSecurityException
-
getVerificationResults
public java.util.List<VerifiedReference> getVerificationResults()
Get the list of verification result objects
-
addResourceResolver
public void addResourceResolver(ResourceResolver resolver)
Adds Resource Resolver for retrieving resources at specifiedURI
attribute inreference
element- Parameters:
resolver
-ResourceResolver
can provide the implementation subclass ofResourceResolverSpi
for retrieving resource.
-
addResourceResolver
public void addResourceResolver(ResourceResolverSpi resolverSpi)
Adds Resource Resolver for retrieving resources at specifiedURI
attribute inreference
element- Parameters:
resolverSpi
- the implementation subclass ofResourceResolverSpi
for retrieving the resource.
-
getPerManifestResolvers
public java.util.List<ResourceResolver> getPerManifestResolvers()
Get the Per-Manifest Resolver List- Returns:
- the per-manifest Resolver List
-
getResolverProperties
public java.util.Map<java.lang.String,java.lang.String> getResolverProperties()
Get the resolver property map- Returns:
- the resolver property map
-
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 XMLSignatureException
Method 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 number of references contained in this reference.
-
getBaseLocalName
public java.lang.String getBaseLocalName()
Method getBaseLocalName Returns the localname of the Elements of the sub-class.- Specified by:
getBaseLocalName
in classElementProxy
- Returns:
- the localname of the Elements of the sub-class.
-
isSecureValidation
public boolean isSecureValidation()
-
-