xmltooling 3.2.4

Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
xmlsignature::Signature Class Referenceabstract

XMLObject representing XML Digital Signature, version 20020212, Signature element. More...

`#include <xmltooling/signature/Signature.h>`

Inheritance diagram for xmlsignature::Signature:
[legend]
Collaboration diagram for xmlsignature::Signature:
[legend]

## Public Member Functions
virtual const XMLCh * | getCanonicalizationMethod () const =0
| Gets the canonicalization method for the ds:SignedInfo element.
virtual const XMLCh * | getSignatureAlgorithm () const =0
| Gets the signing algorithm for the signature.
virtual void | setCanonicalizationMethod (const XMLCh *c14n)=0
| Sets the canonicalization method for the ds:SignedInfo element.
virtual void | setSignatureAlgorithm (const XMLCh *sm)=0
| Sets the signing algorithm for the signature.
virtual void | setSigningKey (XSECCryptoKey *signingKey)=0
| Sets the signing key used to create the signature.
virtual void | setKeyInfo (KeyInfo *keyInfo)=0
| Sets a KeyInfo object to embed in the Signature.
virtual KeyInfo * | getKeyInfo () const =0
| Gets the KeyInfo object associated with the Signature.
virtual void | setContentReference (ContentReference *reference)=0
| Sets the ContentReference object to the Signature to be applied when the signature is created.
virtual ContentReference * | getContentReference () const =0
| Gets the ContentReference object associated with the Signature.
virtual DSIGSignature * | getXMLSignature () const =0
| Gets the native Apache signature object, if present.
virtual void | sign (const xmltooling::Credential *credential=0)=0
| Compute and append the signature based on the assigned ContentReference, KeyInfo, and signing key.
virtual Signature * | cloneSignature () const =0
| Type-safe clone operation.
Public Member Functions inherited from xmltooling::XMLObject
virtual XMLObject * | clone () const =0
| Creates a copy of the object, along with all of its children.
virtual void | detach ()=0
| Specialized function for detaching a child object from its parent while disposing of the parent.
virtual const QName & | getElementQName () const =0
| Gets the QName for this element.
virtual const std::set< Namespace > & | getNamespaces () const =0
| Gets the namespaces that are scoped to this element.
virtual void | addNamespace (const Namespace &ns) const =0
| Adds a namespace to the ones already scoped to this element.
virtual void | removeNamespace (const Namespace &ns)=0
| Removes a namespace from this element.
virtual const QName * | getSchemaType () const =0
| Gets the XML schema type of this element.
virtual const XMLCh * | getXMLID () const =0
| Gets the value of the ID attribute set on this object, if any.
virtual const XMLCh * | getLang () const
| Returns the xml:lang property of the object, if any.
bool | nil () const
| Returns the xsi:nil property of the object, or false if not set.
virtual xmlconstants::xmltooling_bool_t | getNil () const =0
| Returns the xsi:nil property as an explicit enumerated value.
virtual void | nil (xmlconstants::xmltooling_bool_t value)=0
| Sets the xsi:nil property using an enumerated value.
void | nil (bool value)
| Sets the xsi:nil property.
void | setNil (const XMLCh *value)
| Sets the xsi:nil property using a string constant.
virtual bool | hasParent () const =0
| Checks to see if this object has a parent.
virtual XMLObject * | getParent () const =0
| Gets the parent of this element or null if there is no parent.
virtual void | setParent (XMLObject *parent)=0
| Sets the parent of this element.
virtual bool | hasChildren () const =0
| Checks if this XMLObject has children.
virtual const std::list< XMLObject * > & | getOrderedChildren () const =0
| Returns an unmodifiable list of child objects in the order that they should appear in the serialized representation.
virtual void | removeChild (XMLObject *child)=0
| Used by a child's detach method to isolate the child from this parent object in preparation for destroying the parent (this object).
virtual const XMLCh * | getTextContent (unsigned int position=0) const =0
| Returns the text content at the specified position relative to any child elements.
virtual void | setTextContent (const XMLCh *value, unsigned int position=0)=0
| Sets (or clears) text content relative to a child element's position.
virtual xercesc::DOMElement * | getDOM () const =0
| Gets the DOM representation of this XMLObject, if one exists.
virtual void | setDOM (xercesc::DOMElement *dom, bool bindDocument=false) const =0
| Sets the DOM representation of this XMLObject.
virtual void | setDocument (xercesc::DOMDocument *doc) const =0
| Assigns ownership of a DOM document to the XMLObject.
virtual void | releaseDOM () const =0
| Releases the DOM representation of this XMLObject, if there is one.
virtual void | releaseParentDOM (bool propagateRelease=true) const =0
| Releases the DOM representation of this XMLObject's parent.
virtual void | releaseChildrenDOM (bool propagateRelease=true) const =0
| Releases the DOM representation of this XMLObject's children.
void | releaseThisandParentDOM () const
| A convenience method that is equal to calling releaseDOM() then releaseParentDOM(true).
void | releaseThisAndChildrenDOM () const
| A convenience method that is equal to calling releaseChildrenDOM(true) then releaseDOM().
virtual xercesc::DOMElement * | marshall (xercesc::DOMDocument *document=0, const std::vector< xmlsignature::Signature * > *sigs=0, const Credential *credential=0) const =0
| Marshalls the XMLObject, and its children, into a DOM element.
virtual xercesc::DOMElement * | marshall (xercesc::DOMElement *parentElement, const std::vector< xmlsignature::Signature * > *sigs=0, const Credential *credential=0) const =0
| Marshalls the XMLObject and appends it as a child of the given parent element.
virtual XMLObject * | unmarshall (xercesc::DOMElement *element, bool bindDocument=false)=0
| Unmarshalls the given W3C DOM element into the XMLObject.

## Static Public Member Functions
static unsigned int | createRawSignature (const XSECCryptoKey *key, const XMLCh *sigAlgorithm, const char *in, unsigned int in_len, char *out, unsigned int out_len)
| Sign the input data and return a base64-encoded signature.
static bool | verifyRawSignature (const XSECCryptoKey *key, const XMLCh *sigAlgorithm, const char *signature, const char *in, unsigned int in_len)
| Verifies a base-64 encoded signature over the input data.

## Static Public Attributes
static const XMLCh | LOCAL_NAME []
| Element local name.

## Protected Member Functions
| Signature ()
| Default constructor.

## Detailed Description

XMLObject representing XML Digital Signature, version 20020212, Signature element.

The default signature settings include Exclusive c14n w/o comments, SHA-1 digests, and RSA-SHA1 signing.

## Member Function Documentation

## ◆ cloneSignature()

virtual Signature * xmlsignature::Signature::cloneSignature | ( |  | ) | const
| pure virtual

Type-safe clone operation.

Returns
  copy of object

## ◆ createRawSignature()

static unsigned int xmlsignature::Signature::createRawSignature | ( | const XSECCryptoKey * | key,
|  | const XMLCh * | sigAlgorithm,
|  | const char * | in,
|  | unsigned int | in_len,
|  | char * | out,
|  | unsigned int | out_len )
| static

Sign the input data and return a base64-encoded signature.

The signature value MUST NOT contain any embedded linefeeds.

Allows specialized applications to create raw signatures over any input using the same cryptography layer as XML Signatures use.

Parameters

  key | key to sign with
  sigAlgorithm | XML signature algorithm identifier
  in | input data
  in_len | size of input data in bytes
  out | output buffer
  out_len | size of output buffer in bytes

Returns
  size in bytes of base64-encoded signature

## ◆ getCanonicalizationMethod()

virtual const XMLCh * xmlsignature::Signature::getCanonicalizationMethod | ( |  | ) | const
| pure virtual

Gets the canonicalization method for the ds:SignedInfo element.

Returns
  the canonicalization method

## ◆ getContentReference()

virtual ContentReference * xmlsignature::Signature::getContentReference | ( |  | ) | const
| pure virtual

Gets the ContentReference object associated with the Signature.

This is NOT provided for access to the data associated with an unmarshalled signature. It is used only in the creation of signatures. Access to data for validation purposes is provided through the native DSIGSignature object.

Returns
  pointer to a ContentReference object, or nullptr

## ◆ getKeyInfo()

virtual KeyInfo * xmlsignature::Signature::getKeyInfo | ( |  | ) | const
| pure virtual

Gets the KeyInfo object associated with the Signature.

This is NOT provided for access to the data associated with an unmarshalled signature. It is used only in the creation of signatures. Access to data for validation purposes is provided through the native DSIGSignature object.

Returns
  pointer to a KeyInfo object, or nullptr

## ◆ getSignatureAlgorithm()

virtual const XMLCh * xmlsignature::Signature::getSignatureAlgorithm | ( |  | ) | const
| pure virtual

Gets the signing algorithm for the signature.

Returns
  the signature algorithm, or nullptr if indeterminate

## ◆ getXMLSignature()

virtual DSIGSignature * xmlsignature::Signature::getXMLSignature | ( |  | ) | const
| pure virtual

Gets the native Apache signature object, if present.

Returns
  the native Apache signature interface

## ◆ setCanonicalizationMethod()

virtual void xmlsignature::Signature::setCanonicalizationMethod | ( | const XMLCh * | c14n | ) |
| pure virtual

Sets the canonicalization method for the ds:SignedInfo element.

Parameters

  c14n | the canonicalization method

## ◆ setContentReference()

virtual void xmlsignature::Signature::setContentReference | ( | ContentReference * | reference | ) |
| pure virtual

Sets the ContentReference object to the Signature to be applied when the signature is created.

Parameters

  reference | the reference to attach, or nullptr

## ◆ setKeyInfo()

virtual void xmlsignature::Signature::setKeyInfo | ( | KeyInfo * | keyInfo | ) |
| pure virtual

Sets a KeyInfo object to embed in the Signature.

Parameters

  keyInfo | pointer to a KeyInfo object, or nullptr

## ◆ setSignatureAlgorithm()

virtual void xmlsignature::Signature::setSignatureAlgorithm | ( | const XMLCh * | sm | ) |
| pure virtual

Sets the signing algorithm for the signature.

Parameters

  sm | the signature algorithm

## ◆ setSigningKey()

virtual void xmlsignature::Signature::setSigningKey | ( | XSECCryptoKey * | signingKey | ) |
| pure virtual

Sets the signing key used to create the signature.

Parameters

  signingKey | the secret/private key used to create the signature

## ◆ sign()

virtual void xmlsignature::Signature::sign | ( | const xmltooling::Credential * | credential = 0 | ) |
| pure virtual

Compute and append the signature based on the assigned ContentReference, KeyInfo, and signing key.

Parameters

  credential | optional source of signing key and KeyInfo

## ◆ verifyRawSignature()

static bool xmlsignature::Signature::verifyRawSignature | ( | const XSECCryptoKey * | key,
|  | const XMLCh * | sigAlgorithm,
|  | const char * | signature,
|  | const char * | in,
|  | unsigned int | in_len )
| static

Verifies a base-64 encoded signature over the input data.

Allows specialized applications to verify raw signatures over any input using the same cryptography layer as XML Signatures use.

Parameters

  key | key to verify with
  sigAlgorithm | XML signature algorithm identifier
  signature | base64-encoded signature value
  in | input data
  in_len | size of input data in bytes

Returns
  true iff signature verifies

The documentation for this class was generated from the following file:

- xmltooling/signature/Signature.h