XML Security Library

LibXML2
LibXSLT
OpenSSL

xmlenc

Name

xmlenc -- 

Synopsis


enum        xmlEncCtxMode;
struct      xmlSecEncCtx;
xmlSecEncCtxPtr xmlSecEncCtxCreate          (xmlSecKeysMngrPtr keysMngr);
void        xmlSecEncCtxDestroy             (xmlSecEncCtxPtr encCtx);
int         xmlSecEncCtxInitialize          (xmlSecEncCtxPtr encCtx,
                                             xmlSecKeysMngrPtr keysMngr);
void        xmlSecEncCtxFinalize            (xmlSecEncCtxPtr encCtx);
int         xmlSecEncCtxCopyUserPref        (xmlSecEncCtxPtr dst,
                                             xmlSecEncCtxPtr src);
void        xmlSecEncCtxReset               (xmlSecEncCtxPtr encCtx);
int         xmlSecEncCtxBinaryEncrypt       (xmlSecEncCtxPtr encCtx,
                                             xmlNodePtr tmpl,
                                             const xmlSecByte *data,
                                             xmlSecSize dataSize);
int         xmlSecEncCtxXmlEncrypt          (xmlSecEncCtxPtr encCtx,
                                             xmlNodePtr tmpl,
                                             xmlNodePtr node);
int         xmlSecEncCtxUriEncrypt          (xmlSecEncCtxPtr encCtx,
                                             xmlNodePtr tmpl,
                                             const xmlChar *uri);
int         xmlSecEncCtxDecrypt             (xmlSecEncCtxPtr encCtx,
                                             xmlNodePtr node);
xmlSecBufferPtr xmlSecEncCtxDecryptToBuffer (xmlSecEncCtxPtr encCtx,
                                             xmlNodePtr node);
void        xmlSecEncCtxDebugDump           (xmlSecEncCtxPtr encCtx,
                                             FILE *output);
void        xmlSecEncCtxDebugXmlDump        (xmlSecEncCtxPtr encCtx,
                                             FILE *output);

Description

Details

enum xmlEncCtxMode

typedef enum {
    xmlEncCtxModeEncryptedData = 0,
    xmlEncCtxModeEncryptedKey
} xmlEncCtxMode;

The xmlSecEncCtx mode.

xmlEncCtxModeEncryptedData

the <enc:EncryptedData/> element procesing.

xmlEncCtxModeEncryptedKey

the <enc:EncryptedKey/> element processing.


struct xmlSecEncCtx

struct xmlSecEncCtx {

    /* these data user can set before performing the operation */
    void*			userData;
    unsigned int		flags;
    unsigned int		flags2;    
    xmlEncCtxMode		mode;
    xmlSecKeyInfoCtx		keyInfoReadCtx;
    xmlSecKeyInfoCtx		keyInfoWriteCtx;
    xmlSecTransformCtx		transformCtx;
    xmlSecTransformId		defEncMethodId;

    /* these data are returned */
    xmlSecKeyPtr		encKey;
    xmlSecTransformOperation	operation;
    xmlSecBufferPtr		result;
    int				resultBase64Encoded;
    int				resultReplaced;
    xmlSecTransformPtr		encMethod;

    /* attributes from EncryptedData or EncryptedKey */    
    xmlChar*			id;
    xmlChar*			type;
    xmlChar*			mimeType;
    xmlChar*			encoding;
    xmlChar*			recipient;
    xmlChar*			carriedKeyName;

    /* these are internal data, nobody should change that except us */
    xmlNodePtr			encDataNode;
    xmlNodePtr			encMethodNode;
    xmlNodePtr			keyInfoNode;
    xmlNodePtr			cipherValueNode;
    
    /* reserved for future */
    void*			reserved0;
    void*			reserved1;
};

XML Encrypiton context.

void *userData

the pointer to user data (xmlsec and xmlsec-crypto libraries never touches this).

unsigned int flags

the XML Encryption processing flags.

unsigned int flags2

the XML Encryption processing flags.

xmlEncCtxMode mode

the mode.

xmlSecKeyInfoCtx keyInfoReadCtx

the reading key context.

xmlSecKeyInfoCtx keyInfoWriteCtx

the writing key context (not used for signature verification).

xmlSecTransformCtx transformCtx

the transforms processing context.

xmlSecTransformId defEncMethodId

the default encryption method (used if <enc:EncryptionMethod/> node is not present).

xmlSecKeyPtr encKey

the signature key; application may set encKey before calling encryption/decryption functions.

xmlSecTransformOperation operation

the operation: encrypt or decrypt.

xmlSecBufferPtr result

the pointer to signature (not valid for signature verificaction).

int resultBase64Encoded

the flag: if set then result in result is base64 encoded.

int resultReplaced

the flag: if set then resulted <enc:EncryptedData/> or <enc:EncryptedKey/> node is added to the document.

xmlSecTransformPtr encMethod

the pointer to encryption transform.

xmlChar *id

the ID attribute of <enc:EncryptedData/> or <enc:EncryptedKey/> node.

xmlChar *type

the Type attribute of <enc:EncryptedData/> or <enc:EncryptedKey/> node.

xmlChar *mimeType

the MimeType attribute of <enc:EncryptedData/> or <enc:EncryptedKey/> node.

xmlChar *encoding

the Encoding attributeof <enc:EncryptedData/> or <enc:EncryptedKey/> node.

xmlChar *recipient

the Recipient attribute of <enc:EncryptedKey/> node..

xmlChar *carriedKeyName

the CarriedKeyName attribute of <enc:EncryptedKey/> node.

xmlNodePtr encDataNode

the pointer to <enc:EncryptedData/> or <enc:EncryptedKey/> node.

xmlNodePtr encMethodNode

the pointer to <enc:EncryptionMethod/> node.

xmlNodePtr keyInfoNode

the pointer to <enc:KeyInfo/> node.

xmlNodePtr cipherValueNode

the pointer to <enc:CipherValue/> node.

void *reserved0

reserved for the future.

void *reserved1

reserved for the future.


xmlSecEncCtxCreate ()

xmlSecEncCtxPtr xmlSecEncCtxCreate          (xmlSecKeysMngrPtr keysMngr);

Creates <enc:EncryptedData/> element processing context. The caller is responsible for destroying returend object by calling xmlSecEncCtxDestroy function.

keysMngr :

the pointer to keys manager.

Returns :

pointer to newly allocated context object or NULL if an error occurs.


xmlSecEncCtxDestroy ()

void        xmlSecEncCtxDestroy             (xmlSecEncCtxPtr encCtx);

Destroy context object created with xmlSecEncCtxCreate function.

encCtx :

the pointer to <enc:EncryptedData/> processing context.


xmlSecEncCtxInitialize ()

int         xmlSecEncCtxInitialize          (xmlSecEncCtxPtr encCtx,
                                             xmlSecKeysMngrPtr keysMngr);

Initializes <enc:EncryptedData/> element processing context. The caller is responsible for cleaing up returend object by calling xmlSecEncCtxFinalize function.

encCtx :

the pointer to <enc:EncryptedData/> processing context.

keysMngr :

the pointer to keys manager.

Returns :

0 on success or a negative value if an error occurs.


xmlSecEncCtxFinalize ()

void        xmlSecEncCtxFinalize            (xmlSecEncCtxPtr encCtx);

Cleans up encCtx object.

encCtx :

the pointer to <enc:EncryptedData/> processing context.


xmlSecEncCtxCopyUserPref ()

int         xmlSecEncCtxCopyUserPref        (xmlSecEncCtxPtr dst,
                                             xmlSecEncCtxPtr src);

Copies user preference from src context to dst.

dst :

the pointer to destination context.

src :

the pointer to source context.

Returns :

0 on success or a negative value if an error occurs.


xmlSecEncCtxReset ()

void        xmlSecEncCtxReset               (xmlSecEncCtxPtr encCtx);

Resets encCtx object, user settings are not touched.

encCtx :

the pointer to <enc:EncryptedData/> processing context.


xmlSecEncCtxBinaryEncrypt ()

int         xmlSecEncCtxBinaryEncrypt       (xmlSecEncCtxPtr encCtx,
                                             xmlNodePtr tmpl,
                                             const xmlSecByte *data,
                                             xmlSecSize dataSize);

Encrypts data according to template tmpl.

encCtx :

the pointer to <enc:EncryptedData/> processing context.

tmpl :

the pointer to <enc:EncryptedData/> template node.

data :

the pointer for binary buffer.

dataSize :

the data buffer size.

Returns :

0 on success or a negative value if an error occurs.


xmlSecEncCtxXmlEncrypt ()

int         xmlSecEncCtxXmlEncrypt          (xmlSecEncCtxPtr encCtx,
                                             xmlNodePtr tmpl,
                                             xmlNodePtr node);

Encrypts node according to template tmpl. If requested, node is replaced with result <enc:EncryptedData/> node.

encCtx :

the pointer to <enc:EncryptedData/> processing context.

tmpl :

the pointer to <enc:EncryptedData/> template node.

node :

the pointer to node for encryption.

Returns :

0 on success or a negative value if an error occurs.


xmlSecEncCtxUriEncrypt ()

int         xmlSecEncCtxUriEncrypt          (xmlSecEncCtxPtr encCtx,
                                             xmlNodePtr tmpl,
                                             const xmlChar *uri);

Encrypts data from uri according to template tmpl.

encCtx :

the pointer to <enc:EncryptedData/> processing context.

tmpl :

the pointer to <enc:EncryptedData/> template node.

uri :

the URI.

Returns :

0 on success or a negative value if an error occurs.


xmlSecEncCtxDecrypt ()

int         xmlSecEncCtxDecrypt             (xmlSecEncCtxPtr encCtx,
                                             xmlNodePtr node);

Decrypts node and if necessary replaces node with decrypted data.

encCtx :

the pointer to <enc:EncryptedData/> processing context.

node :

the pointer to <enc:EncryptedData/> node.

Returns :

0 on success or a negative value if an error occurs.


xmlSecEncCtxDecryptToBuffer ()

xmlSecBufferPtr xmlSecEncCtxDecryptToBuffer (xmlSecEncCtxPtr encCtx,
                                             xmlNodePtr node);

Decrypts node data to the encCtx buffer.

encCtx :

the pointer to <enc:EncryptedData/> processing context.

node :

the pointer to <enc:EncryptedData/> node.

Returns :

0 on success or a negative value if an error occurs.


xmlSecEncCtxDebugDump ()

void        xmlSecEncCtxDebugDump           (xmlSecEncCtxPtr encCtx,
                                             FILE *output);

Prints the debug information about encCtx to output.

encCtx :

the pointer to <enc:EncryptedData/> processing context.

output :

the pointer to output FILE.


xmlSecEncCtxDebugXmlDump ()

void        xmlSecEncCtxDebugXmlDump        (xmlSecEncCtxPtr encCtx,
                                             FILE *output);

Prints the debug information about encCtx to output in XML format.

encCtx :

the pointer to <enc:EncryptedData/> processing context.

output :

the pointer to output FILE.



Aleksey Sanin