public class Manifest extends SignatureElementProxy
<ds:Manifest>
elements.
This element holds the Reference
elements
Modifier and Type | Field and Description |
---|---|
static int |
MAXIMUM_REFERENCE_COUNT
The default maximum number of references per Manifest, if secure validation is enabled.
|
baseURI
Constructor and Description |
---|
Manifest(Document doc)
Constructs
Manifest |
Manifest(Element element,
String baseURI)
Constructor Manifest
|
Manifest(Element element,
String baseURI,
boolean secureValidation)
Constructor Manifest
|
Modifier and Type | Method and Description |
---|---|
void |
addDocument(String baseURI,
String referenceURI,
Transforms transforms,
String digestURI,
String referenceId,
String referenceType)
This
addDocument method is used to add a new resource to the
signed info. |
void |
addResourceResolver(ResourceResolverSpi resolver)
Adds Resource Resolver for retrieving resources at specified
URI attribute
in reference element |
void |
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.
|
String |
getBaseLocalName()
Method getBaseLocalName
Returns the localname of the Elements of the sub-class.
|
String |
getId()
Returns the
Id attribute |
int |
getLength()
Return the nonnegative number of added references.
|
List<ResourceResolverSpi> |
getPerManifestResolvers()
Get the Per-Manifest Resolver List
|
XMLSignatureInput |
getReferencedContentAfterTransformsItem(int i)
Method getReferencedContentAfterTransformsItem
|
XMLSignatureInput |
getReferencedContentBeforeTransformsItem(int i)
Method getReferencedContentPriorTransformsItem
|
Map<String,String> |
getResolverProperties()
Get the resolver property map
|
String |
getResolverProperty(String key)
Returns the value at specified key
|
byte[] |
getSignedContentItem(int i)
Method getSignedContentItem
|
int |
getSignedContentLength()
Method getSignedContentLength
|
boolean |
getVerificationResult(int index)
After verifying a
Manifest or a SignedInfo using the
verifyReferences() or SignedInfo.verify() methods,
the individual results can be retrieved with this method. |
List<VerifiedReference> |
getVerificationResults()
Get the list of verification result objects
|
boolean |
isSecureValidation() |
Reference |
item(int i)
Return the ith reference.
|
void |
setId(String Id)
Sets the
Id attribute |
void |
setResolverProperty(String key,
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 the
Reference.verify() method. |
boolean |
verifyReferences(boolean followManifests)
Used to do a reference
validation of all enclosed references using the
Reference.verify() method. |
getBaseNamespace
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
public static final int MAXIMUM_REFERENCE_COUNT
public Manifest(Document doc)
Manifest
doc
- the Document
in which XMLsignature
is placedpublic Manifest(Element element, String baseURI) throws XMLSecurityException
element
- baseURI
- XMLSecurityException
public Manifest(Element element, String baseURI, boolean secureValidation) throws XMLSecurityException
element
- baseURI
- secureValidation
- XMLSecurityException
public void addDocument(String baseURI, String referenceURI, Transforms transforms, String digestURI, String referenceId, String referenceType) throws XMLSignatureException
addDocument
method is used to add a new resource to the
signed info. A Reference
is built
from the supplied values.baseURI
- the URI of the resource where the XML instance was storedreferenceURI
- URI
attribute in Reference
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
- XMLSignatureException
public void generateDigestValues() throws XMLSignatureException, ReferenceNotInitializedException
public int getLength()
public Reference item(int i) throws XMLSecurityException
i
values are 0 to {link@ getSize}-1
.i
- Index of the requested Reference
XMLSecurityException
public void setId(String Id)
Id
attributeId
- the Id
attribute in ds:Manifest
public String getId()
Id
attributeId
attribute in ds:Manifest
public boolean verifyReferences() throws MissingResourceFailureException, XMLSecurityException
Reference.verify()
method.
This step loops through all Reference
s and does verify the hash
values. If one or more verifications fail, the method returns
false
. If all verifications are successful,
it returns true
. The results of the individual reference
validations are available by using the getVerificationResult(int)
method
MissingResourceFailureException
- if a Reference
does not verify
(throws a ReferenceNotInitializedException
because of an uninitialized XMLSignatureInput
XMLSecurityException
Reference.verify()
,
SignedInfo.verify()
,
MissingResourceFailureException
public boolean verifyReferences(boolean followManifests) throws MissingResourceFailureException, XMLSecurityException
Reference.verify()
method.
This step loops through all Reference
s and does verify the hash
values. If one or more verifications fail, the method returns
false
. If all verifications are successful,
it returns true
. The results of the individual reference
validations are available by using the getVerificationResult(int)
method
followManifests
- MissingResourceFailureException
- if a Reference
does not verify
(throws a ReferenceNotInitializedException
because of an uninitialized XMLSignatureInput
XMLSecurityException
Reference.verify()
,
SignedInfo.verify(boolean)
,
MissingResourceFailureException
public boolean getVerificationResult(int index) throws XMLSecurityException
Manifest
or a SignedInfo
using the
verifyReferences()
or SignedInfo.verify()
methods,
the individual results can be retrieved with this method.index
- an index of into a Manifest
or a SignedInfo
XMLSecurityException
public List<VerifiedReference> getVerificationResults()
public void addResourceResolver(ResourceResolverSpi resolver)
URI
attribute
in reference
elementresolver
- ResourceResolverSpi
can provide the implementation subclass of
ResourceResolverSpi
for retrieving resource.public List<ResourceResolverSpi> getPerManifestResolvers()
public Map<String,String> getResolverProperties()
public void setResolverProperty(String key, String value)
key
- the keyvalue
- the valuepublic String getResolverProperty(String key)
key
- the keypublic byte[] getSignedContentItem(int i) throws XMLSignatureException
i
- XMLSignatureException
public XMLSignatureInput getReferencedContentBeforeTransformsItem(int i) throws XMLSecurityException
i
- XMLSecurityException
public XMLSignatureInput getReferencedContentAfterTransformsItem(int i) throws XMLSecurityException
i
- XMLSecurityException
public int getSignedContentLength()
public String getBaseLocalName()
getBaseLocalName
in class ElementProxy
public boolean isSecureValidation()
Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.