xmldsig.h

Name

xmldsig.h -- The XML Digital Signature standard implementation.

Synopsis



struct      xmlSecDSigCtx;
xmlSecDSigCtxPtr xmlSecDSigCtxCreate        (xmlSecKeysMngrPtr keysMngr);
void        xmlSecDSigCtxDestroy            (xmlSecDSigCtxPtr ctx);
int         xmlSecDSigValidate              (xmlSecDSigCtxPtr ctx,
                                             void *context,
                                             xmlSecKeyPtr key,
                                             xmlNodePtr signNode,
                                             xmlSecDSigResultPtr *result);
int         xmlSecDSigGenerate              (xmlSecDSigCtxPtr ctx,
                                             void *context,
                                             xmlSecKeyPtr key,
                                             xmlNodePtr signNode,
                                             xmlSecDSigResultPtr *result);
struct      xmlSecDSigResult;
struct      xmlSecReferenceResult;
enum        xmlSecReferenceType;
xmlSecDSigResultPtr xmlSecDSigResultCreate  (xmlSecDSigCtxPtr ctx,
                                             void *context,
                                             xmlNodePtr signNode,
                                             int sign);
void        xmlSecDSigResultDestroy         (xmlSecDSigResultPtr result);
void        xmlSecDSigResultDebugDump       (xmlSecDSigResultPtr result,
                                             FILE *output);
xmlNodePtr  xmlSecSignatureCreate           (const xmlChar *id);
void        xmlSecSignatureDestroy          (xmlNodePtr signNode);
xmlNodePtr  xmlSecSignatureAddSignedInfo    (xmlNodePtr signNode,
                                             const xmlChar *id);
xmlNodePtr  xmlSecSignatureAddKeyInfo       (xmlNodePtr signNode,
                                             const xmlChar *id);
xmlNodePtr  xmlSecSignatureAddObject        (xmlNodePtr signNode,
                                             const xmlChar *id,
                                             const xmlChar *mimeType,
                                             const xmlChar *encoding);
xmlNodePtr  xmlSecSignedInfoAddC14NMethod   (xmlNodePtr signedInfoNode,
                                             xmlSecTransformId c14nMethod);
xmlNodePtr  xmlSecSignedInfoAddSignMethod   (xmlNodePtr signedInfoNode,
                                             xmlSecTransformId signMethod);
xmlNodePtr  xmlSecSignedInfoAddReference    (xmlNodePtr signedInfoNode,
                                             const xmlChar *id,
                                             const xmlChar *uri,
                                             const xmlChar *type);
xmlNodePtr  xmlSecReferenceAddDigestMethod  (xmlNodePtr refNode,
                                             xmlSecTransformId digestMethod);
xmlNodePtr  xmlSecReferenceAddTransform     (xmlNodePtr refNode,
                                             xmlSecTransformId transform);
xmlNodePtr  xmlSecObjectAddSignProperties   (xmlNodePtr objectNode,
                                             const xmlChar *id,
                                             const xmlChar *target);
xmlNodePtr  xmlSecObjectAddManifest         (xmlNodePtr objectNode,
                                             const xmlChar *id);
xmlNodePtr  xmlSecManifestAddReference      (xmlNodePtr manifestNode,
                                             const xmlChar *id,
                                             const xmlChar *uri,
                                             const xmlChar *type);

Description

Details

struct xmlSecDSigCtx

struct xmlSecDSigCtx {
    xmlSecKeysMngrPtr		keysMngr;
    int				processManifests;
    int				storeSignatures;
    int				storeReferences;
    int				storeManifests;	
    int				fakeSignatures;
};

XML DSig context.


xmlSecDSigCtxCreate ()

xmlSecDSigCtxPtr xmlSecDSigCtxCreate        (xmlSecKeysMngrPtr keysMngr);

Creates new xmlSecDSigCtx structure.


xmlSecDSigCtxDestroy ()

void        xmlSecDSigCtxDestroy            (xmlSecDSigCtxPtr ctx);

Destroys xmlSecDSigCtx structure ctx.


xmlSecDSigValidate ()

int         xmlSecDSigValidate              (xmlSecDSigCtxPtr ctx,
                                             void *context,
                                             xmlSecKeyPtr key,
                                             xmlNodePtr signNode,
                                             xmlSecDSigResultPtr *result);

Validates the signature in signNode and stores the pointer to validation result structure xmlSecDSigResult in the result.


xmlSecDSigGenerate ()

int         xmlSecDSigGenerate              (xmlSecDSigCtxPtr ctx,
                                             void *context,
                                             xmlSecKeyPtr key,
                                             xmlNodePtr signNode,
                                             xmlSecDSigResultPtr *result);

Signs the data according to the template in signNode node.


struct xmlSecDSigResult

struct xmlSecDSigResult {
    xmlSecDSigCtxPtr		ctx;
    void			*context;
    xmlNodePtr			self;
    int				sign;
    xmlSecTransformStatus	result;
    xmlSecTransformId		signMethod;
    xmlSecKeyPtr		key;
    xmlSecReferenceResultPtr	firstSignRef;
    xmlSecReferenceResultPtr	lastSignRef;
    xmlSecReferenceResultPtr	firstManifestRef;
    xmlSecReferenceResultPtr	lastManifestRef; 
    xmlBufferPtr		buffer;
};

XML DSig Result.


struct xmlSecReferenceResult

struct xmlSecReferenceResult {
    xmlSecDSigCtxPtr		ctx;
    xmlNodePtr			self;
    xmlSecReferenceType		refType;
    xmlSecTransformStatus	result;
    xmlSecReferenceResultPtr	next;
    xmlSecReferenceResultPtr	prev;
    xmlChar			*uri;
    xmlChar			*id;
    xmlChar			*type;
    xmlSecTransformId		digestMethod;
    xmlBufferPtr		buffer;
}; 

The result of <dsig:Reference> processing.


enum xmlSecReferenceType

typedef enum  {
    xmlSecSignedInfoReference,
    xmlSecManifestReference
} xmlSecReferenceType;

The possible <dsig:Reference> node locations: in the <dsig:SignedInfo> node or in the <dsig:Manifest> node.


xmlSecDSigResultCreate ()

xmlSecDSigResultPtr xmlSecDSigResultCreate  (xmlSecDSigCtxPtr ctx,
                                             void *context,
                                             xmlNodePtr signNode,
                                             int sign);

Creates new xmlSecDSigResult structure.


xmlSecDSigResultDestroy ()

void        xmlSecDSigResultDestroy         (xmlSecDSigResultPtr result);

Destroys the xmlSecDSigResult structure result.


xmlSecDSigResultDebugDump ()

void        xmlSecDSigResultDebugDump       (xmlSecDSigResultPtr result,
                                             FILE *output);

Prints the xmlSecDSigResult structure result to file output.


xmlSecSignatureCreate ()

xmlNodePtr  xmlSecSignatureCreate           (const xmlChar *id);

Creates new <dsig:Signature> node with the mantadory <dsig:SignatureValue> child. The application is responsible for inserting the returned node in the XML document.


xmlSecSignatureDestroy ()

void        xmlSecSignatureDestroy          (xmlNodePtr signNode);

Destroys standalone <dsig:Signature> node. You MUST not call this function if the <dsig:Signature> node was inserted in the XML document.


xmlSecSignatureAddSignedInfo ()

xmlNodePtr  xmlSecSignatureAddSignedInfo    (xmlNodePtr signNode,
                                             const xmlChar *id);

Adds <dsig:SignedInfo> node to the <dsig:Signature> node signNode.


xmlSecSignatureAddKeyInfo ()

xmlNodePtr  xmlSecSignatureAddKeyInfo       (xmlNodePtr signNode,
                                             const xmlChar *id);

Adds <dsig:KeyInfo> node to the <dsig:Signature> node signNode.


xmlSecSignatureAddObject ()

xmlNodePtr  xmlSecSignatureAddObject        (xmlNodePtr signNode,
                                             const xmlChar *id,
                                             const xmlChar *mimeType,
                                             const xmlChar *encoding);

Adds <dsig:Object> node to the <dsig:Signature> node signNode.


xmlSecSignedInfoAddC14NMethod ()

xmlNodePtr  xmlSecSignedInfoAddC14NMethod   (xmlNodePtr signedInfoNode,
                                             xmlSecTransformId c14nMethod);

Adds <dsig:CanonicalizationMethod> node with specified C14N algorithm c14nMethod to the <dsig:SignedInfo> node signedInfoNode.


xmlSecSignedInfoAddSignMethod ()

xmlNodePtr  xmlSecSignedInfoAddSignMethod   (xmlNodePtr signedInfoNode,
                                             xmlSecTransformId signMethod);

Adds <dsig:SignatureMethod> node with given signature algorithm signMethod to the <dsig:SignedInfo> node signedInfoNode.


xmlSecSignedInfoAddReference ()

xmlNodePtr  xmlSecSignedInfoAddReference    (xmlNodePtr signedInfoNode,
                                             const xmlChar *id,
                                             const xmlChar *uri,
                                             const xmlChar *type);

Adds <dsig:Reference> node with given URI (uri), Id (id) and Type (type) attributes and the required child node <dsig:DigestValue> to the <dsig:SignedInfo> node signedInfoNode.


xmlSecReferenceAddDigestMethod ()

xmlNodePtr  xmlSecReferenceAddDigestMethod  (xmlNodePtr refNode,
                                             xmlSecTransformId digestMethod);

Adds <dsig:DigestMethod> node with given digest algorithm (digestMethod) to the <dsig:Reference> node refNode.


xmlSecReferenceAddTransform ()

xmlNodePtr  xmlSecReferenceAddTransform     (xmlNodePtr refNode,
                                             xmlSecTransformId transform);

Adds <dsig:Transform> node to the <dsig:Reference> node refNode.


xmlSecObjectAddSignProperties ()

xmlNodePtr  xmlSecObjectAddSignProperties   (xmlNodePtr objectNode,
                                             const xmlChar *id,
                                             const xmlChar *target);

Adds <dsig:SignatureProperties> node to the <dsig:Object> node objectNode.


xmlSecObjectAddManifest ()

xmlNodePtr  xmlSecObjectAddManifest         (xmlNodePtr objectNode,
                                             const xmlChar *id);

Adds <dsig:Manifest> node to the <dsig:Object> node objectNode.


xmlSecManifestAddReference ()

xmlNodePtr  xmlSecManifestAddReference      (xmlNodePtr manifestNode,
                                             const xmlChar *id,
                                             const xmlChar *uri,
                                             const xmlChar *type);

Adds <dsig:Reference> node with specified URI (uri), Id (id) and Type (type) attributes and the required child node <dsig:DigestValue> to the <dsig:Manifest> node manifestNode:.