xmltooling 3.0.4

xmlsignature::Signature Class Reference

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

#include <xmltooling/signature/Signature.h>

Inheritance diagram for xmlsignature::Signature:
xmltooling::XMLObject

List of all members.

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 ContentReferencegetContentReference () 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=nullptr)=0
 Compute and append the signature based on the assigned ContentReference, KeyInfo, and signing key.
virtual SignaturecloneSignature () const =0
 Type-safe clone operation.

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.


Constructor & Destructor Documentation

xmlsignature::Signature::Signature ( ) [protected]

Default constructor.


Member Function Documentation

virtual Signature* xmlsignature::Signature::cloneSignature ( ) const [pure virtual]

Type-safe clone operation.

Returns:
copy of object
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:
keykey to sign with
sigAlgorithmXML signature algorithm identifier
ininput data
in_lensize of input data in bytes
outoutput buffer
out_lensize of output buffer in bytes
Returns:
size in bytes of base64-encoded signature
virtual const XMLCh* xmlsignature::Signature::getCanonicalizationMethod ( ) const [pure virtual]

Gets the canonicalization method for the ds:SignedInfo element.

Returns:
the canonicalization method
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
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
virtual const XMLCh* xmlsignature::Signature::getSignatureAlgorithm ( ) const [pure virtual]

Gets the signing algorithm for the signature.

Returns:
the signature algorithm, or nullptr if indeterminate
virtual DSIGSignature* xmlsignature::Signature::getXMLSignature ( ) const [pure virtual]

Gets the native Apache signature object, if present.

Returns:
the native Apache signature interface
virtual void xmlsignature::Signature::setCanonicalizationMethod ( const XMLCh *  c14n) [pure virtual]

Sets the canonicalization method for the ds:SignedInfo element.

Parameters:
c14nthe canonicalization method
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:
referencethe reference to attach, or nullptr
virtual void xmlsignature::Signature::setKeyInfo ( KeyInfo *  keyInfo) [pure virtual]

Sets a KeyInfo object to embed in the Signature.

Parameters:
keyInfopointer to a KeyInfo object, or nullptr
virtual void xmlsignature::Signature::setSignatureAlgorithm ( const XMLCh *  sm) [pure virtual]

Sets the signing algorithm for the signature.

Parameters:
smthe signature algorithm
virtual void xmlsignature::Signature::setSigningKey ( XSECCryptoKey *  signingKey) [pure virtual]

Sets the signing key used to create the signature.

Parameters:
signingKeythe secret/private key used to create the signature
virtual void xmlsignature::Signature::sign ( const xmltooling::Credential credential = nullptr) [pure virtual]

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

Parameters:
credentialoptional source of signing key and KeyInfo
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:
keykey to verify with
sigAlgorithmXML signature algorithm identifier
signaturebase64-encoded signature value
ininput data
in_lensize of input data in bytes
Returns:
true iff signature verifies

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