XML Security Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# transformsInternal.h

## Name

transformsInternal.h -- The internal transform's functions.

## Synopsis

    enum        xmlSecTransformType;
    typedef     xmlSecTransformUsage;
    #define     xmlSecUsageAny
    #define     xmlSecUsageDSigC14N
    #define     xmlSecUsageDSigTransform
    #define     xmlSecUsageDSigDigest
    #define     xmlSecUsageDSigSignature
    #define     xmlSecUsageEncryptionMethod
    enum        xmlSecTransformResult;
    struct      xmlSecTransform;
    void        xmlSecTransformsInit            (void);
    int         xmlSecTransformsNodeRead        (xmlSecTransformStatePtr state,
                                                 xmlNodePtr transformsNode);
    xmlSecTransformId xmlSecTransformFind       (const xmlChar *href);
    xmlSecTransformPtr xmlSecTransformNodeRead  (xmlNodePtr transformNode,
                                                 xmlSecTransformUsage usage,
                                                 int dontDestroy);
    int         xmlSecTransformNodeWrite        (xmlNodePtr transformNode,
                                                 xmlSecTransformId id);
    #define     xmlSecTransformIsValid          (transform)
    #define     xmlSecTransformCheckType        (transform, t)
    #define     xmlSecTransformCheckId          (transform, i)
    xmlSecTransformPtr xmlSecTransformCreate    (xmlSecTransformId id,
                                                 xmlSecTransformUsage usage,
                                                 int dontDestroy);
    void        xmlSecTransformDestroy          (xmlSecTransformPtr transform,
                                                 int forceDestroy);
    int         xmlSecTransformRead             (xmlSecTransformPtr transform,
                                                 xmlNodePtr transformNode);
    xmlSecTransformPtr (*xmlSecTransformCreateMethod)
                                                (xmlSecTransformId id);
    void        (*xmlSecTransformDestroyMethod) (xmlSecTransformPtr transform);
    int         (*xmlSecTransformReadNodeMethod)
                                                (xmlSecTransformPtr transform,
                                                 xmlNodePtr transformNode);
    typedef     xmlSecBinTransformId;
    struct      xmlSecBinTransform;
    enum        xmlSecBinTransformSubType;
    #define     xmlSecBinTransformIdCheckKeyId  (id, kId)
    #define     xmlSecBinTransformIdGetKeyId    (id)
    #define     xmlSecBinTransformCheckSubType  (transform, t)
    #define     xmlSecBinTransformIdGetEncKeyType(id)
    #define     xmlSecBinTransformIdGetDecKeyType(id)
    int         xmlSecBinTransformAddKey        (xmlSecTransformPtr transform,
                                                 xmlSecKeyPtr key);
    int         xmlSecBinTransformRead          (xmlSecTransformPtr transform,
                                                 unsigned char *buf,
                                                 size_t size);
    int         xmlSecBinTransformWrite         (xmlSecTransformPtr transform,
                                                 unsigned char *buf,
                                                 size_t size);
    int         xmlSecBinTransformFlush         (xmlSecTransformPtr transform);
    xmlSecTransformPtr xmlSecBinTransformAddAfter
                                                (xmlSecTransformPtr curTransform,
                                                 xmlSecTransformPtr newTransform);
    xmlSecTransformPtr xmlSecBinTransformAddBefore
                                                (xmlSecTransformPtr curTransform,
                                                 xmlSecTransformPtr newTransform);
    void        xmlSecBinTransformRemove        (xmlSecTransformPtr transform);
    void        xmlSecBinTransformDestroyAll    (xmlSecTransformPtr transform);
    void        xmlSecBinTransformSetEncrypt    (xmlSecTransformPtr transform,
                                                 int encrypt);
    int         (*xmlSecBinTransformAddKeyMethod)
                                                (xmlSecBinTransformPtr transform,
                                                 xmlSecKeyPtr key);
    int         (*xmlSecBinTransformReadMethod) (xmlSecBinTransformPtr transform,
                                                 unsigned char *buf,
                                                 size_t size);
    int         (*xmlSecBinTransformWriteMethod)
                                                (xmlSecBinTransformPtr transform,
                                                 unsigned char *buf,
                                                 size_t size);
    int         (*xmlSecBinTransformFlushMethod)
                                                (xmlSecBinTransformPtr transform);
    typedef     xmlSecXmlTransformId;
    struct      xmlSecXmlTransform;
    int         (*xmlSecXmlTransformExecuteMethod)
                                                (xmlSecXmlTransformPtr transform,
                                                 xmlDocPtr ctxDoc,
                                                 xmlDocPtr *doc,
                                                 xmlSecNodeSetPtr *nodes);
    int         xmlSecXmlTransformExecute       (xmlSecTransformPtr transform,
                                                 xmlDocPtr ctxDoc,
                                                 xmlDocPtr *doc,
                                                 xmlSecNodeSetPtr *nodes);
    typedef     xmlSecC14NTransformId;
    struct      xmlSecC14NTransform;
    int         (*xmlSecC14NTransformExecuteMethod)
                                                (xmlSecC14NTransformPtr transform,
                                                 xmlDocPtr doc,
                                                 xmlSecNodeSetPtr nodes,
                                                 xmlOutputBufferPtr buffer);
    int         xmlSecC14NTransformExecute      (xmlSecTransformPtr transform,
                                                 xmlDocPtr doc,
                                                 xmlSecNodeSetPtr nodes,
                                                 xmlOutputBufferPtr buffer);
    struct      xmlSecTransformState;
    xmlSecTransformStatePtr xmlSecTransformStateCreate
                                                (xmlDocPtr doc,
                                                 xmlSecNodeSetPtr nodeSet,
                                                 const char *uri);
    void        xmlSecTransformStateDestroy     (xmlSecTransformStatePtr state);
    int         xmlSecTransformStateUpdate      (xmlSecTransformStatePtr state,
                                                 xmlSecTransformPtr transform);
    int         xmlSecTransformStateFinal       (xmlSecTransformStatePtr state,
                                                 xmlSecTransformResult type);

## Description

## Details

### enum xmlSecTransformType

    typedef enum  {
        xmlSecTransformTypeBinary,
        xmlSecTransformTypeXml,
        xmlSecTransformTypeC14N
    } xmlSecTransformType;

The transform input/output types.

`xmlSecTransformTypeBinary` | input - binary; output - binary.
`xmlSecTransformTypeXml` | input - XML; output - XML.
`xmlSecTransformTypeC14N` | input - XML; output - binary.

### xmlSecTransformUsage

    typedef unsigned long 				xmlSecTransformUsage;

The transform usage bits mask.

### xmlSecUsageAny

    #define xmlSecUsageAny				0

Transform could be used for operation.

### xmlSecUsageDSigC14N

    #define xmlSecUsageDSigC14N			1

Transform could be used for C14N.

### xmlSecUsageDSigTransform

    #define xmlSecUsageDSigTransform		2

Transform could be used as a transform in XML DSig.

### xmlSecUsageDSigDigest

    #define xmlSecUsageDSigDigest			4

Transform could be used for digests.

### xmlSecUsageDSigSignature

    #define xmlSecUsageDSigSignature		8

Transform could be used for generating signatures.

### xmlSecUsageEncryptionMethod

    #define xmlSecUsageEncryptionMethod		16

Transform could be used for encryption.

### enum xmlSecTransformResult

    typedef enum {
        xmlSecTransformResultBinary,
        xmlSecTransformResultXml
    } xmlSecTransformResult;

The transform result types.

`xmlSecTransformResultBinary` | binary data.
`xmlSecTransformResultXml` | XML document plus nodes set.

### struct xmlSecTransform

    struct xmlSecTransform {
        xmlSecTransformId 			id;
        xmlSecTransformStatus		status;
        int					dontDestroy;
        void				*data;
    };

The transform structure.

xmlSecTransformId `id` | the transform id (pointer to xmlSecTransformId).
xmlSecTransformStatus `status` | the transform status (ok/fail/unknown).
int `dontDestroy` | the don't automatically destroy flag.
void *`data` | the pointer to transform specific data.

### xmlSecTransformsInit ()

    void        xmlSecTransformsInit            (void);

Trnasforms engine initialization (called from xmlSecInit() function). The applications should not call this function directly.

### xmlSecTransformsNodeRead ()

    int         xmlSecTransformsNodeRead        (xmlSecTransformStatePtr state,
                                                 xmlNodePtr transformsNode);

Reads the transform node and updates `state`,

`state` : | the pointer to current transform state.
`transformsNode` : | the pointer to the <dsig:Transform> node.
Returns : | 0 on success or a negative value otherwise.

### xmlSecTransformFind ()

    xmlSecTransformId xmlSecTransformFind       (const xmlChar *href);

Searches the list of known transforms for transform with given href

`href` : | the transform href.
Returns : | the id of the found transform or NULL if an error occurs or transform is not found.

### xmlSecTransformNodeRead ()

    xmlSecTransformPtr xmlSecTransformNodeRead  (xmlNodePtr transformNode,
                                                 xmlSecTransformUsage usage,
                                                 int dontDestroy);

Reads transform from the `transformNode` as follows: 1) reads "Algorithm" attribute; 2) checks the list of known algorithms; 3) calls transform create method; 4) calls transform read transform node method.

`transformNode` : | the pointer to <dsig:Transform> node.
`usage` : | the usage of the transfomr (signature, encryption, etc.).
`dontDestroy` : | the flag whether we need to destroy the transform.
Returns : | the pointer to newly allocated xmlSecTransform structure or NULL if an error occurs.

### xmlSecTransformNodeWrite ()

    int         xmlSecTransformNodeWrite        (xmlNodePtr transformNode,
                                                 xmlSecTransformId id);

Writes Agorithm attribute in the transform node.

`transformNode` : | the pointer to <dsig:Transform> node.
`id` : | the transform id.
Returns : | 0 on success or a negative value otherwise.

### xmlSecTransformIsValid()

    #define     xmlSecTransformIsValid(transform)

Macro. Returns 1 if the `transform` is valid or 0 otherwise.

`transform` : | the pointer to transform.

### xmlSecTransformCheckType()

    #define     xmlSecTransformCheckType(transform, t)

Macro. Returns 1 if the `transform` is valid and has specified type `t` or 0 otherwise.

`transform` : | the pointer to transform.
`t` : | the transform type.

### xmlSecTransformCheckId()

    #define     xmlSecTransformCheckId(transform, i)

Macro. Returns 1 if the `transform` is valid and has specified id `i` or 0 otherwise.

`transform` : | the pointer to transform.
`i` : | the transform id.

### xmlSecTransformCreate ()

    xmlSecTransformPtr xmlSecTransformCreate    (xmlSecTransformId id,
                                                 xmlSecTransformUsage usage,
                                                 int dontDestroy);

Creates new transform from the transform id object.

`id` : | the transform id to create.
`usage` : | the proposed transform usage.
`dontDestroy` : | the flag that controls wherther the transforms can destroy the transforms automatically
Returns : | the pointer to newly created xmlSecTransform structure or NULL if an error occurs.

### xmlSecTransformDestroy ()

    void        xmlSecTransformDestroy          (xmlSecTransformPtr transform,
                                                 int forceDestroy);

Destroys transform by calling appropriate transform specific function.

`transform` : | the pointer to xmlSecTransform structure.
`forceDestroy` : | the flag whether the transform destruction will be forced.

### xmlSecTransformRead ()

    int         xmlSecTransformRead             (xmlSecTransformPtr transform,
                                                 xmlNodePtr transformNode);

Reads transform information from the `transformNode` using transform specific function.

`transform` : | the pointer to xmlSecTransform structure.
`transformNode` : | the pointer to the <dsig:Transform> node.
Returns : | 0 on success or a negative value otherwise.

### xmlSecTransformCreateMethod ()

    xmlSecTransformPtr (*xmlSecTransformCreateMethod)
                                                (xmlSecTransformId id);

The transform specific creation method.

`id` : | the transform id to create.
Returns : | pointer to the newly created transform or NULL if an error occurs.

### xmlSecTransformDestroyMethod ()

    void        (*xmlSecTransformDestroyMethod) (xmlSecTransformPtr transform);

The transform specific destroy method.

`transform` : | the pointer to the xmlSecTransform structure.

### xmlSecTransformReadNodeMethod ()

    int         (*xmlSecTransformReadNodeMethod)
                                                (xmlSecTransformPtr transform,
                                                 xmlNodePtr transformNode);

The transfomr specific method to read the transform data from the `transformNode`.

`transform` : | the pointer to the xmlSecTransform structure.
`transformNode` : | the pointer to the <dsig:Transform> node.
Returns : | 0 on success or a negative value otherwise.

### xmlSecBinTransformId

    typedef const struct _xmlSecBinTransformIdStruct *xmlSecBinTransformId;

The binary transform id (`xmlSecTransformTypeBinary` type).

### struct xmlSecBinTransform

    struct xmlSecBinTransform {
        /* same as for xmlSecTransform but id type changed */
        xmlSecBinTransformId 		id;
        xmlSecTransformStatus		status;
        int					dontDestroy;
        void				*data;

        /* xmlSecBinTransform specific */
        int					encode;
        xmlSecBinTransformPtr		next;
        xmlSecBinTransformPtr		prev;
        void				*binData;
    };

Binary transforms are very similar to BIO from OpenSSL. However,there is one big difference. In OpenSSL BIO writing operation *always* encrypts data and read operation *always* decrypts data. We do not want to have this restriction.

xmlSecBinTransformId `id` | the transform id (pointer to xmlSecBinTransformId).
xmlSecTransformStatus `status` | the transform status (ok/fail/unknown).
int `dontDestroy` | the don't automatically destroy flag.
void *`data` | the pointer to transform specific data.
int `encode` | encode/decode (encrypt/decrypt) flag.
xmlSecBinTransformPtr `next` | next binary transform in the chain.
xmlSecBinTransformPtr `prev` | previous binary transform in the chain.
void *`binData` | the pointer to binary transform speific data.

### enum xmlSecBinTransformSubType

    typedef enum {
        xmlSecBinTransformSubTypeNone = 0,
        xmlSecBinTransformSubTypeDigest,
        xmlSecBinTransformSubTypeCipher,
        xmlSecBinTransformSubTypeBuffered
    } xmlSecBinTransformSubType;

Binary transform sub-types.

`xmlSecBinTransformSubTypeNone` | unknown.
`xmlSecBinTransformSubTypeDigest` | digest.
`xmlSecBinTransformSubTypeCipher` | cipher.
`xmlSecBinTransformSubTypeBuffered` | buffered transform.

### xmlSecBinTransformIdCheckKeyId()

    #define     xmlSecBinTransformIdCheckKeyId(id, kId)

Macro. Returns 1 if the transform `id` has xmlSecTransformTypeBinary type and the transform's keyId matches specified `kId` or 0 otherwise.

`id` : | the transform id.
`kId` : | the key id.

### xmlSecBinTransformIdGetKeyId()

    #define     xmlSecBinTransformIdGetKeyId(id)

Macro. Returns the key id required by the transform or NULL if an error occurs.

`id` : | the transform id.

### xmlSecBinTransformCheckSubType()

    #define     xmlSecBinTransformCheckSubType(transform, t)

Macro. Returns 1 if the `transform` is valid, has xmlSecTransformTypeBinary type and has specified subtype `t` or 0 otherwise.

`transform` : | the pointer to transform.
`t` : | the transform's subtype.

### xmlSecBinTransformIdGetEncKeyType()

    #define     xmlSecBinTransformIdGetEncKeyType(id)

Macro. Returns the encryption key type by the transform or NULL if an error occurs.

`id` : | the transform id.

### xmlSecBinTransformIdGetDecKeyType()

    #define     xmlSecBinTransformIdGetDecKeyType(id)

Macro. Returns the decryption key type by the transform or NULL if an error occurs.

`id` : | the transform id.

### xmlSecBinTransformAddKey ()

    int         xmlSecBinTransformAddKey        (xmlSecTransformPtr transform,
                                                 xmlSecKeyPtr key);

Sets the key for binary transform (wrapper for transform specific addBinKey() method).

`transform` : | the pointer to xmlSecTransform structure.
`key` : | the pointer to xmlSecKey structure.
Returns : | 0 on success or a negative value otherwise.

### xmlSecBinTransformRead ()

    int         xmlSecBinTransformRead          (xmlSecTransformPtr transform,
                                                 unsigned char *buf,
                                                 size_t size);

Reads chunk of data from the transform (wrapper transform specific readBin() function).

`transform` : | the pointer to xmlSecTransform structure.
`buf` : | the output buffer.
`size` : | the output buffer size.
Returns : | the number of bytes in the buffer or negative value if an error occurs.

### xmlSecBinTransformWrite ()

    int         xmlSecBinTransformWrite         (xmlSecTransformPtr transform,
                                                 unsigned char *buf,
                                                 size_t size);

Writes data to the transform (wrapper to the transform specific writeBin() function).

`transform` : | the pointer to xmlSecTransform structure.
`buf` : | the input data buffer.
`size` : | the input data size.
Returns : | 0 if success or a negative value otherwise.

### xmlSecBinTransformFlush ()

    int         xmlSecBinTransformFlush         (xmlSecTransformPtr transform);

Finalizes writing (wrapper for transform specific flushBin() method).

`transform` : | the pointer to xmlSecTransform structure.
Returns : | 0 if success or negative value otherwise.

### xmlSecBinTransformAddAfter ()

    xmlSecTransformPtr xmlSecBinTransformAddAfter
                                                (xmlSecTransformPtr curTransform,
                                                 xmlSecTransformPtr newTransform);

Adds `newTransform` after the `curTransform`.

`curTransform` : | the pointer to current transform (may be NULL).
`newTransform` : | the pointer to new transform.
Returns : | pointer to the new transforms chain or NULL if an error occurs.

### xmlSecBinTransformAddBefore ()

    xmlSecTransformPtr xmlSecBinTransformAddBefore
                                                (xmlSecTransformPtr curTransform,
                                                 xmlSecTransformPtr newTransform);

Adds `newTransform` before the `curTransform`.

`curTransform` : | the pointer to current transform (may be NULL).
`newTransform` : | the pointer to new transform.
Returns : | pointer to the new transforms chain or NULL if an error occurs.

### xmlSecBinTransformRemove ()

    void        xmlSecBinTransformRemove        (xmlSecTransformPtr transform);

Removes `transform` from the chain. This method MUST be called by any bin transform id destructor.

`transform` : | the pointer to xmlSecTransform structure.

### xmlSecBinTransformDestroyAll ()

    void        xmlSecBinTransformDestroyAll    (xmlSecTransformPtr transform);

Destroys all transforms in the chain.

`transform` : | the pointer to xmlSecTransform structure.

### xmlSecBinTransformSetEncrypt ()

    void        xmlSecBinTransformSetEncrypt    (xmlSecTransformPtr transform,
                                                 int encrypt);

Sets the `transform` direction - encrypt/decrypt (or encode/decode).

`transform` : | the pointer to xmlSecTransform structure.
`encrypt` : | the encrypt/decrypt (or encode/decode) flag.

### xmlSecBinTransformAddKeyMethod ()

    int         (*xmlSecBinTransformAddKeyMethod)
                                                (xmlSecBinTransformPtr transform,
                                                 xmlSecKeyPtr key);

The transform specific method to set key for use.

`transform` : | the pointer to binary transform.
`key` : | the pointer to key.
Returns : | 0 on success or a negative value otherwise.

### xmlSecBinTransformReadMethod ()

    int         (*xmlSecBinTransformReadMethod) (xmlSecBinTransformPtr transform,
                                                 unsigned char *buf,
                                                 size_t size);

The transform specific method to read next chunk of binary data into `buf`.

`transform` : | the pointer to xmlSecTransform structure.
`buf` : | the output buffer.
`size` : | the output buffer size.
Returns : | the number of bytes in the buffer or negative value if an error occurs.

### xmlSecBinTransformWriteMethod ()

    int         (*xmlSecBinTransformWriteMethod)
                                                (xmlSecBinTransformPtr transform,
                                                 unsigned char *buf,
                                                 size_t size);

The transform specific method to write next chunk of binary data from `buf`.

`transform` : | the pointer to xmlSecTransform structure.
`buf` : | the input data buffer.
`size` : | the input data size.
Returns : | 0 if success or a negative value otherwise.

### xmlSecBinTransformFlushMethod ()

    int         (*xmlSecBinTransformFlushMethod)
                                                (xmlSecBinTransformPtr transform);

The transform specific method to finalize writing.

`transform` : | the pointer to xmlSecTransform structure.
Returns : | 0 if success or negative value otherwise.

### xmlSecXmlTransformId

    typedef const struct _xmlSecXmlTransformIdStruct *xmlSecXmlTransformId;

The xml transform id (`xmlSecTransformTypeXml` type).

### struct xmlSecXmlTransform

    struct xmlSecXmlTransform {
        /* same as for xmlSecTransform but id type changed */
        xmlSecXmlTransformId 		id;
        xmlSecTransformStatus		status;
        int					dontDestroy;
        void				*data;

        /* xmlSecXmlTransform specific */
        xmlNodePtr				here;
        void				*xmlData;
    };

The XML transform structure.

xmlSecXmlTransformId `id` | the transform id (pointer to xmlSecXmlTransformId).
xmlSecTransformStatus `status` | the transform status (ok/fail/unknown).
int `dontDestroy` | the don't automatically destroy flag.
void *`data` | the pointer to transform specific data.
xmlNodePtr `here` | the pointer to transform's <dsig:Transform> node.
void *`xmlData` | the pointer to xml transform specific data.

### xmlSecXmlTransformExecuteMethod ()

    int         (*xmlSecXmlTransformExecuteMethod)
                                                (xmlSecXmlTransformPtr transform,
                                                 xmlDocPtr ctxDoc,
                                                 xmlDocPtr *doc,
                                                 xmlSecNodeSetPtr *nodes);

Transform specific execute method. Returns result nodes set in `nodes`.

`transform` : | the pointer to XML transform.
`ctxDoc` : | the pointer to the document containing the transform's <dsig:Transform> node.
`doc` : | the pointer to the pointer to current document.
`nodes` : | the pointer to the pointer to current and result nodes set.
Returns : | 0 on success or a negative value otherwise.

### xmlSecXmlTransformExecute ()

    int         xmlSecXmlTransformExecute       (xmlSecTransformPtr transform,
                                                 xmlDocPtr ctxDoc,
                                                 xmlDocPtr *doc,
                                                 xmlSecNodeSetPtr *nodes);

Executes the XML `transform` and returns result nodes set in `nodes` (wrapper for transform specific executeXml() method).

`transform` : | the pointer to XML transform.
`ctxDoc` : | the pointer to the document containing the transform's <dsig:Transform> node.
`doc` : | the pointer to the pointer to current document.
`nodes` : | the pointer to the pointer to current and result nodes set.
Returns : | 0 on success or a negative value otherwise.

### xmlSecC14NTransformId

    typedef const struct _xmlSecC14NTransformIdStruct *xmlSecC14NTransformId;

The C14N transform id structure (`xmlSecTransformTypeC14N` type).

### struct xmlSecC14NTransform

    struct xmlSecC14NTransform {
        /* same as for xmlSecTransform but id type changed */
        xmlSecC14NTransformId 		id;
        xmlSecTransformStatus		status;
        int					dontDestroy;
        void				*data;

        /* xmlSecC14NTransform specific */
        void				*c14nData;
    };

The C14N transform structure.

xmlSecC14NTransformId `id` | the transform id (pointer to xmlSecC14NTransformId).
xmlSecTransformStatus `status` | the transform status (ok/fail/unknown).
int `dontDestroy` | the don't automatically destroy flag.
void *`data` | the pointer to transform specific data.
void *`c14nData` | the pointer to transform specific data.

### xmlSecC14NTransformExecuteMethod ()

    int         (*xmlSecC14NTransformExecuteMethod)
                                                (xmlSecC14NTransformPtr transform,
                                                 xmlDocPtr doc,
                                                 xmlSecNodeSetPtr nodes,
                                                 xmlOutputBufferPtr buffer);

Transform specific execute method. returns result in the `buffer`.

`transform` : | the pointer to C14N transform.
`doc` : | the pointer to current document.
`nodes` : | the pointer to current nodes set.
`buffer` : | the result buffer.
Returns : | 0 on success or a negative value otherwise.

### xmlSecC14NTransformExecute ()

    int         xmlSecC14NTransformExecute      (xmlSecTransformPtr transform,
                                                 xmlDocPtr doc,
                                                 xmlSecNodeSetPtr nodes,
                                                 xmlOutputBufferPtr buffer);

Executes the C14N `transform` and returns result in the `buffer` (wrapper for transform specific executeC14n() method). If the `trnaform` is NULL then the default xmlSecC14NInclusive transform is executed.

`transform` : | the pointer to C14N transform.
`doc` : | the pointer to current document.
`nodes` : | the pointer to current nodes set.
`buffer` : | the result buffer.
Returns : | 0 on success or a negative value otherwise.

### struct xmlSecTransformState

    struct xmlSecTransformState {
        /* initial state */
        xmlDocPtr				initDoc;
        xmlSecNodeSetPtr			initNodeSet;
        char				*initUri;

        /* current state: xml */
        xmlDocPtr				curDoc;
        xmlSecNodeSetPtr			curNodeSet;

        /* current state: binary */
        xmlBufferPtr			curBuf;
        xmlSecTransformPtr			curFirstBinTransform;
        xmlSecTransformPtr			curLastBinTransform;

        /*  optimization: special case for c14n transforms */
        xmlSecTransformPtr			curC14NTransform;
    };

The current transforms state.

xmlDocPtr `initDoc` | the pointer to the original xml document.
xmlSecNodeSetPtr `initNodeSet` | the original nodes set.
char *`initUri` | the original uri.
xmlDocPtr `curDoc` | the pointer to the current doc.
xmlSecNodeSetPtr `curNodeSet` | the pointer to the current nodes set.
xmlBufferPtr `curBuf` | the pointer to the current binary data.
xmlSecTransformPtr `curFirstBinTransform` | the pointer to the first pending binary transform.
xmlSecTransformPtr `curLastBinTransform` | the pointer to the last pending binary transform.
xmlSecTransformPtr `curC14NTransform` | the current pending c14n transform.

### xmlSecTransformStateCreate ()

    xmlSecTransformStatePtr xmlSecTransformStateCreate
                                                (xmlDocPtr doc,
                                                 xmlSecNodeSetPtr nodeSet,
                                                 const char *uri);

Creates new transform state.

`doc` : | the pointer to XML document that contains <dsig:Signature> node.
`nodeSet` : | the original nodes set.
`uri` : | the original uri.
Returns : | pointer to newly allocated xmlSecTransformState structure or NULL if an error occurs.

### xmlSecTransformStateDestroy ()

    void        xmlSecTransformStateDestroy     (xmlSecTransformStatePtr state);

Destroys the transform state.

`state` : | the pointer to xmlSecTransformState structure.

### xmlSecTransformStateUpdate ()

    int         xmlSecTransformStateUpdate      (xmlSecTransformStatePtr state,
                                                 xmlSecTransformPtr transform);

Updates the current `state` with `transform`. Note all transforms are applied immidiatelly.

`state` : | the pointer to xmlSecTransformState structure.
`transform` : | the pointer to xmlSecTransform structure.
Returns : | 0 on success or negative value otherwise.

### xmlSecTransformStateFinal ()

    int         xmlSecTransformStateFinal       (xmlSecTransformStatePtr state,
                                                 xmlSecTransformResult type);

Finalazies transforms `state` (applies all pending transforms) and creates a result of the desired `type`.

`state` : | the pointer to xmlSecTransformState structure.
`type` : | the desired final type.
Returns : | 0 on success or negative value otherwise.

<<< Previous Page | Home | Up | Next Page >>>
nodeset.h | xmltree.h