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.utils.ElementProxy
_baseURI, _constructionElement, _doc, _state, MODE_CREATE, MODE_DECRYPT, MODE_ENCRYPT, MODE_PROCESS, MODE_SIGN, MODE_UNKNOWN, MODE_VERIFY
 
Constructor Summary
SignedInfo(org.w3c.dom.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(org.w3c.dom.Document doc, org.w3c.dom.Element SignatureMethodElem, org.w3c.dom.Element CanonicalizationMethodElem)
           
SignedInfo(org.w3c.dom.Document doc, java.lang.String SignatureMethodURI, int HMACOutputLength, java.lang.String CanonicalizationMethodURI)
          Constructor SignedInfo
SignedInfo(org.w3c.dom.Document doc, java.lang.String SignatureMethodURI, java.lang.String CanonicalizationMethodURI)
          Constructs SignedInfo using given Canoicaliztion algorithm and Signature algorithm
SignedInfo(org.w3c.dom.Element element, java.lang.String BaseURI)
          Build a SignedInfo from an Element
 
Method Summary
 javax.crypto.SecretKey createSecretKey(byte[] secretKeyBytes)
          Creates a SecretKey for the appropriate Mac algorithm based on a byte[] array password.
 java.lang.String getBaseLocalName()
          Method getBaseLocalName
 java.lang.String getCanonicalizationMethodURI()
          Returns the Canonicalization method URI
 byte[] getCanonicalizedOctetStream()
          Returns getCanonicalizedOctetStream
 java.lang.String getInclusiveNamespaces()
           
 org.w3c.dom.Element getSignatureMethodElement()
          Method getSignatureMethodElement
 java.lang.String getSignatureMethodURI()
          Returns the Signature method URI
 void signInOctectStream(java.io.OutputStream os)
          Output the C14n stream to the give 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, getReferencedContentAfterTransformsItem, getReferencedContentBeforeTransformsItem, getResolverProperty, getSignedContentItem, getSignedContentLength, getVerificationResult, 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, addText, addTextElement, createElementForFamily, getBaseURI, getBigIntegerFromChildElement, getBytesFromChildElement, getBytesFromTextChild, getDefaultPrefix, getDocument, getElement, getElementPlusReturns, getTextFromChildElement, getTextFromTextChild, guaranteeThatElementInCorrectSpace, length, setDefaultPrefix, setElement, setXPathNamespaceContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SignedInfo

public SignedInfo(org.w3c.dom.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(org.w3c.dom.Document doc,
                  java.lang.String SignatureMethodURI,
                  java.lang.String CanonicalizationMethodURI)
           throws XMLSecurityException
Constructs SignedInfo using given Canoicaliztion algorithm and Signature algorithm

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

SignedInfo

public SignedInfo(org.w3c.dom.Document doc,
                  java.lang.String SignatureMethodURI,
                  int HMACOutputLength,
                  java.lang.String CanonicalizationMethodURI)
           throws XMLSecurityException
Constructor SignedInfo

Parameters:
doc -
CanonicalizationMethodURI -
SignatureMethodURI -
HMACOutputLength -
Throws:
XMLSecurityException

SignedInfo

public SignedInfo(org.w3c.dom.Document doc,
                  org.w3c.dom.Element SignatureMethodElem,
                  org.w3c.dom.Element CanonicalizationMethodElem)
           throws XMLSecurityException
Parameters:
doc -
SignatureMethodElem -
CanonicalizationMethodElem -
Throws:
XMLSecurityException

SignedInfo

public SignedInfo(org.w3c.dom.Element element,
                  java.lang.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
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 octedt stream of SignedInfo element
Throws:
CanonicalizationException
InvalidCanonicalizerException
XMLSecurityException

signInOctectStream

public void signInOctectStream(java.io.OutputStream os)
                        throws CanonicalizationException,
                               InvalidCanonicalizerException,
                               XMLSecurityException
Output the C14n stream to the give outputstream.

Parameters:
os -
Throws:
CanonicalizationException
InvalidCanonicalizerException
XMLSecurityException

getCanonicalizationMethodURI

public java.lang.String getCanonicalizationMethodURI()
Returns the Canonicalization method URI

Returns:
the Canonicalization method URI

getSignatureMethodURI

public java.lang.String getSignatureMethodURI()
Returns the Signature method URI

Returns:
the Signature method URI

getSignatureMethodElement

public org.w3c.dom.Element getSignatureMethodElement()
Method getSignatureMethodElement

Returns:
gets The SignatureMethod Node.

createSecretKey

public javax.crypto.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.

getBaseLocalName

public java.lang.String getBaseLocalName()
Method getBaseLocalName

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

getInclusiveNamespaces

public java.lang.String getInclusiveNamespaces()