org.apache.xml.security.signature
Class SignedInfo

java.lang.Object
  extended by org.apache.xml.security.utils.ElementProxy
      extended by org.apache.xml.security.utils.SignatureElementProxy
          extended by org.apache.xml.security.signature.Manifest
              extended by org.apache.xml.security.signature.SignedInfo

public class SignedInfo
extends Manifest

Handles <ds:SignedInfo> elements This SignedInfo element includes the canonicalization algorithm, a signature algorithm, and one or more references.

Author:
Christian Geuer-Pollmann

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
SignedInfo(Document doc)
          Overwrites Manifest.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, Element signatureMethodElem, Element canonicalizationMethodElem)
           
SignedInfo(Document doc, String signatureMethodURI, int hMACOutputLength, String canonicalizationMethodURI)
          Constructor SignedInfo
SignedInfo(Document doc, String signatureMethodURI, String canonicalizationMethodURI)
          Constructs SignedInfo using given Canonicalization algorithm and Signature algorithm.
SignedInfo(Element element, String baseURI)
          Build a SignedInfo from an Element
SignedInfo(Element element, String baseURI, boolean secureValidation)
          Build a SignedInfo from an Element
 
Method Summary
 SecretKey createSecretKey(byte[] secretKeyBytes)
          Creates a SecretKey for the appropriate Mac algorithm based on a byte[] array password.
 String getBaseLocalName()
          Method getBaseLocalName
 String getCanonicalizationMethodURI()
          Returns the Canonicalization method URI
 byte[] getCanonicalizedOctetStream()
          Returns getCanonicalizedOctetStream
 String getInclusiveNamespaces()
           
 SignatureAlgorithm getSignatureAlgorithm()
           
 Element getSignatureMethodElement()
          Method getSignatureMethodElement
 String getSignatureMethodURI()
          Returns the Signature method URI
 void signInOctetStream(OutputStream os)
          Output the C14n stream to the given OutputStream.
 boolean verify()
          Tests core validation process
 boolean 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, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SignedInfo

public SignedInfo(Document doc)
           throws XMLSecurityException
Overwrites Manifest.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 - the Document in which XMLsignature will be placed
Throws:
XMLSecurityException

SignedInfo

public SignedInfo(Document doc,
                  String signatureMethodURI,
                  String canonicalizationMethodURI)
           throws XMLSecurityException
Constructs SignedInfo using given Canonicalization algorithm and Signature algorithm.

Parameters:
doc - SignedInfo is placed in this document
signatureMethodURI - URI representation of the Digest and Signature algorithm
canonicalizationMethodURI - URI representation of the Canonicalization method
Throws:
XMLSecurityException

SignedInfo

public SignedInfo(Document doc,
                  String signatureMethodURI,
                  int hMACOutputLength,
                  String canonicalizationMethodURI)
           throws XMLSecurityException
Constructor SignedInfo

Parameters:
doc - SignedInfo is placed in this document
signatureMethodURI - URI representation of the Digest and Signature algorithm
hMACOutputLength -
canonicalizationMethodURI - URI representation of the Canonicalization method
Throws:
XMLSecurityException

SignedInfo

public SignedInfo(Document doc,
                  Element signatureMethodElem,
                  Element canonicalizationMethodElem)
           throws XMLSecurityException
Parameters:
doc -
signatureMethodElem -
canonicalizationMethodElem -
Throws:
XMLSecurityException

SignedInfo

public SignedInfo(Element element,
                  String baseURI)
           throws XMLSecurityException
Build a SignedInfo from an Element

Parameters:
element - SignedInfo
baseURI - 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 a SignedInfo from an Element

Parameters:
element - SignedInfo
baseURI - the URI of the resource where the XML instance was stored
secureValidation - whether secure validation is enabled or not
Throws:
XMLSecurityException
See Also:
Question, Answer
Method Detail

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 referenced ds:Manifests, 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(OutputStream os)
                       throws CanonicalizationException,
                              InvalidCanonicalizerException,
                              XMLSecurityException
Output the C14n stream to the given OutputStream.

Parameters:
os -
Throws:
CanonicalizationException
InvalidCanonicalizerException
XMLSecurityException

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

Overrides:
getBaseLocalName in class Manifest
Returns:
the localname of the Elements of the sub-class.

getInclusiveNamespaces

public String getInclusiveNamespaces()


Copyright © 2000–2014 The Apache Software Foundation. All rights reserved.