xmlenc.h

Name

xmlenc.h -- The XML Encrypiton standard implementation.

Synopsis



struct      xmlSecEncCtx;
struct      xmlSecEncResult;
xmlSecEncCtxPtr xmlSecEncCtxCreate          (xmlSecKeysMngrPtr keysMngr);
void        xmlSecEncCtxDestroy             (xmlSecEncCtxPtr ctx);
int         xmlSecEncryptMemory             (xmlSecEncCtxPtr ctx,
                                             void *context,
                                             xmlSecKeyPtr key,
                                             xmlNodePtr encNode,
                                             unsigned char *buf,
                                             size_t size,
                                             xmlSecEncResultPtr *result);
int         xmlSecEncryptUri                (xmlSecEncCtxPtr ctx,
                                             void *context,
                                             xmlSecKeyPtr key,
                                             xmlNodePtr encNode,
                                             const char *uri,
                                             xmlSecEncResultPtr *result);
int         xmlSecEncryptXmlNode            (xmlSecEncCtxPtr ctx,
                                             void *context,
                                             xmlSecKeyPtr key,
                                             xmlNodePtr encNode,
                                             xmlNodePtr src,
                                             xmlSecEncResultPtr *result);
int         xmlSecDecrypt                   (xmlSecEncCtxPtr ctx,
                                             void *context,
                                             xmlSecKeyPtr key,
                                             xmlNodePtr encNode,
                                             xmlSecEncResultPtr *result);
xmlSecEncResultPtr xmlSecEncResultCreate    (xmlSecEncCtxPtr ctx,
                                             void *context,
                                             int encrypt,
                                             xmlNodePtr node);
void        xmlSecEncResultDestroy          (xmlSecEncResultPtr result);
void        xmlSecEncResultDebugDump        (xmlSecEncResultPtr result,
                                             FILE *output);
void        xmlSecEncResultDebugXmlDump     (xmlSecEncResultPtr result,
                                             FILE *output);

Description

Details

struct xmlSecEncCtx

struct xmlSecEncCtx {
    xmlSecKeyInfoCtx		keyInfoCtx;
    xmlSecTransformId		encryptionMethod;
    int				ignoreType;
    time_t			certsVerificationTime;
};

XML Encrypiton context.

xmlSecKeyInfoCtx keyInfoCtx 
xmlSecTransformId encryptionMethod the default encryption algorithm id.
int ignoreType the flag to ignore Type attribute in the <enc:EncryptedData> node
time_t certsVerificationTime 


struct xmlSecEncResult

struct xmlSecEncResult {
    xmlSecEncCtxPtr		ctx;
    void			*context;
    xmlNodePtr			self;
    int				encrypt;
    xmlChar			*id;
    xmlChar			*type;
    xmlChar			*mimeType;
    xmlChar			*encoding;
    xmlSecTransformId		encryptionMethod;
    xmlSecKeyPtr		key;
    xmlSecBufferPtr		buffer;
    int				replaced;
};

The XML Encrypiton results.

xmlSecEncCtxPtr ctx the pointer to xmlSecEncCtx structure.
void *context the pointer to application specific data.
xmlNodePtr self the pointer to <enc:EncryptedData> node.
int encrypt the encrypt/decrypt flag.
xmlChar *id the Id attribute of the <enc:EncryptedData> node.
xmlChar *type the Type attribute of the <enc:EncryptedData> node.
xmlChar *mimeType the MimeType attribute of the <enc:EncryptedData> node.
xmlChar *encoding the Encoding attribute of the <enc:EncryptedData> node.
xmlSecTransformId encryptionMethod the used encryption algorithm id.
xmlSecKeyPtr key the used encryption key.
xmlSecBufferPtr buffer the decrypted data.
int replaced if set then the decrypted data were put back into the original document.


xmlSecEncCtxCreate ()

xmlSecEncCtxPtr xmlSecEncCtxCreate          (xmlSecKeysMngrPtr keysMngr);

Creates new encryption context.

keysMngr : the pointer to xmlSecKeysMngr structure.
Returns :newly allocated xmlSecEncCtx structure or NULL if an error occurs.


xmlSecEncCtxDestroy ()

void        xmlSecEncCtxDestroy             (xmlSecEncCtxPtr ctx);

Destroys the xmlSecEncCtx structure.

ctx : the pointer to xmlSecEncCtx structure.


xmlSecEncryptMemory ()

int         xmlSecEncryptMemory             (xmlSecEncCtxPtr ctx,
                                             void *context,
                                             xmlSecKeyPtr key,
                                             xmlNodePtr encNode,
                                             unsigned char *buf,
                                             size_t size,
                                             xmlSecEncResultPtr *result);

Encrypts binary data from the buf according to the template in the <enc:EncryptionData> node. After the encrytion the result XML is in the encNode node.

ctx : the pointer to xmlSecEncCtx structure.
context : the pointer to application specific data that will be passed to all callback functions.
key : the key to use (if NULL then the key specified in <dsig:KeyInfo> will be used).
encNode : the pointer to encryption template (<enc:EncryptionData> node).
buf : the pointer to data to encrypt.
size : the size of the data in buf.
result : the pointer where to store encryption results.
Returns :0 on success or a negative value otherwise.


xmlSecEncryptUri ()

int         xmlSecEncryptUri                (xmlSecEncCtxPtr ctx,
                                             void *context,
                                             xmlSecKeyPtr key,
                                             xmlNodePtr encNode,
                                             const char *uri,
                                             xmlSecEncResultPtr *result);

Encrypts binary data from the uri according to the template in the <enc:EncryptionData> node. After the encrytion the result XML is in the encNode node.

ctx : the pointer to xmlSecEncCtx structure.
context : the pointer to application specific data that will be passed to all callback functions.
key : the key to use (if NULL then the key specified in <dsig:KeyInfo> will be used).
encNode : the pointer to encryption template (<enc:EncryptionData> node).
uri : the URI to data to encrypt.
result : the pointer where to store encryption results.
Returns :0 on success or a negative value otherwise.


xmlSecEncryptXmlNode ()

int         xmlSecEncryptXmlNode            (xmlSecEncCtxPtr ctx,
                                             void *context,
                                             xmlSecKeyPtr key,
                                             xmlNodePtr encNode,
                                             xmlNodePtr src,
                                             xmlSecEncResultPtr *result);

Encrypts XML data from the encNode according to the template in the <enc:EncryptionData> node. After the encrytion the result XML is in the src node.

ctx : the pointer to xmlSecEncCtx structure.
context : the pointer to application specific data that will be passed to all callback functions.
key : the key to use (if NULL then the key specified in <dsig:KeyInfo> will be used).
encNode : the pointer to encryption template (<enc:EncryptionData> node).
src : the pointer to XML node to encrypt.
result : the pointer where to store encryption results.
Returns :0 on success or a negative value otherwise.


xmlSecDecrypt ()

int         xmlSecDecrypt                   (xmlSecEncCtxPtr ctx,
                                             void *context,
                                             xmlSecKeyPtr key,
                                             xmlNodePtr encNode,
                                             xmlSecEncResultPtr *result);

Decrypts data from the <enc:EncryptionData> node.

ctx : the pointer to xmlSecEncCtx structure.
context : the pointer to application specific data that will be passed to all callback functions.
key : the key to use (if NULL then the key specified in <dsig:KeyInfo> will be used).
encNode : the pointer to encryption template (<enc:EncryptionData> node).
result : the pointer where to store encryption results.
Returns :0 on success or a negative value otherwise.


xmlSecEncResultCreate ()

xmlSecEncResultPtr xmlSecEncResultCreate    (xmlSecEncCtxPtr ctx,
                                             void *context,
                                             int encrypt,
                                             xmlNodePtr node);

Creates new xmlSecEncResult structure.

ctx : the pointer to xmlSecEncCtx structure.
context : the pointer to application specific data that will be passed to all callback functions.
encrypt : the encrypt/decrypt flag.
node : the pointer to <enc:EncryptedData> node.
Returns :newly created xmlSecEncResult structure or NULL if an error occurs.


xmlSecEncResultDestroy ()

void        xmlSecEncResultDestroy          (xmlSecEncResultPtr result);

Destroys xmlSecEncResult structure result.

result : the pointer to xmlSecEncResult structure.


xmlSecEncResultDebugDump ()

void        xmlSecEncResultDebugDump        (xmlSecEncResultPtr result,
                                             FILE *output);

Prints the xmlSecEncResult structure result to file output.

result : the pointer to xmlSecEncResult structure.
output : the pointer to destination FILE.


xmlSecEncResultDebugXmlDump ()

void        xmlSecEncResultDebugXmlDump     (xmlSecEncResultPtr result,
                                             FILE *output);

Prints the xmlSecEncResult structure result to file output in XML format.

result : the pointer to xmlSecEncResult structure.
output : the pointer to destination FILE.