ciphers.h

Name

ciphers.h -- The ciphers transform.

Synopsis



struct      xmlSecCipherTransform;
typedef     xmlSecCipherTransformId;
int         (*xmlSecCipherUpdateMethod)     (xmlSecCipherTransformPtr transform,
                                             unsigned char *buffer,
                                             size_t size);
int         (*xmlSecCipherFinalMethod)      (xmlSecCipherTransformPtr transform);
int         xmlSecCipherTransformRead       (xmlSecBinTransformPtr transform,
                                             unsigned char *buf,
                                             size_t size);
int         xmlSecCipherTransformWrite      (xmlSecBinTransformPtr transform,
                                             unsigned char *buf,
                                             size_t size);
int         xmlSecCipherTransformFlush      (xmlSecBinTransformPtr transform);
int         xmlSecEvpCipherUpdate           (xmlSecCipherTransformPtr cipher,
                                             unsigned char *buffer,
                                             size_t size);
int         xmlSecEvpCipherFinal            (xmlSecCipherTransformPtr cipher);
int         xmlSecCipherUpdate              (xmlSecTransformPtr transform,
                                             unsigned char *buffer,
                                             size_t size);
int         xmlSecCipherFinal               (xmlSecTransformPtr transform);

Description

Details

struct xmlSecCipherTransform

struct xmlSecCipherTransform {	
    /* same as for xmlSecTransform but id type changed */
    xmlSecCipherTransformId		id;    
    xmlSecTransformStatus		status;
    int					dontDestroy;
    void				*data;
    
    /* xmlSecBinTransform specific */
    int					encode;
    xmlSecCipherTransformPtr		next;
    xmlSecCipherTransformPtr		prev;   
    void				*binData;
    
    /* xmlSecCipherTransform specific */
    unsigned char			*bufIn;
    unsigned char			*bufOut;
    EVP_CIPHER_CTX 			cipherCtx;
    unsigned char			*iv;
    size_t				ivPos;
    void				*cipherData;
};

The cipher (encrypt/decrypt) transform.

xmlSecCipherTransformId 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.
xmlSecCipherTransformPtr next next binary transform in the chain.
xmlSecCipherTransformPtr prev previous binary transform in the chain.
void *binData the pointer to binary transform speific data.
unsigned char *bufIn the pointer to input buffer.
unsigned char *bufOut the pointer to output buffer.
EVP_CIPHER_CTX cipherCtx the EVP chiper context.
unsigned char *iv the pointer to IV.
size_t ivPosthe position in IV (what was written out).
void *cipherData the chipher specific data.


xmlSecCipherTransformId

typedef const struct _xmlSecCipherTransformIdStruct	*xmlSecCipherTransformId;

The cipher (encrypt/decrypt) transform id.


xmlSecCipherUpdateMethod ()

int         (*xmlSecCipherUpdateMethod)     (xmlSecCipherTransformPtr transform,
                                             unsigned char *buffer,
                                             size_t size);

Encrypts/decrypts new chunk of data.

transform : the pointer to cipher transform.
buffer : the pointer to data.
size : the data size.
Returns :0 on success or a negative value otherwise.


xmlSecCipherFinalMethod ()

int         (*xmlSecCipherFinalMethod)      (xmlSecCipherTransformPtr transform);

Finalizes encryption/decryption.

transform : the pointer to cipher transform.
Returns :0 on success or a negative value otherwise.


xmlSecCipherTransformRead ()

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

Reads data from previous transform, encrypts or decrypts them and returns in the output buffer.

transform : the pointer to a cipher transform.
buf : the output buffer.
size : tje output buffer size.
Returns :the number of bytes in the buffer or negative value if an error occurs.


xmlSecCipherTransformWrite ()

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

Encrypts or decrypts the input data and writes them to the next transform.

transform : the poiter to a cipher transform.
buf : the input data buffer.
size : the input data size.
Returns :0 if success or a negative value otherwise.


xmlSecCipherTransformFlush ()

int         xmlSecCipherTransformFlush      (xmlSecBinTransformPtr transform);

Writes the rest of data to previous transform.

transform : the pointer to a cipher transform.
Returns :0 if success or negative value otherwise.


xmlSecEvpCipherUpdate ()

int         xmlSecEvpCipherUpdate           (xmlSecCipherTransformPtr cipher,
                                             unsigned char *buffer,
                                             size_t size);

Encrypts/decrypts new piece of data.

cipher : the pointer to EVP_* cipher transform.
buffer : the input buffer.
size : the input buffer size.
Returns :the number of bytes processed or a negative value if an error occurs.


xmlSecEvpCipherFinal ()

int         xmlSecEvpCipherFinal            (xmlSecCipherTransformPtr cipher);

Finalize encryption/decryption.

cipher : the pointer to EVP_* cipher transform.
Returns :the number of bytes processed or a negative value if an error occurs.


xmlSecCipherUpdate ()

int         xmlSecCipherUpdate              (xmlSecTransformPtr transform,
                                             unsigned char *buffer,
                                             size_t size);

Encrypts/decrypts new piece of data.

transform : the pointer to cipher transform.
buffer : the input buffer.
size : the input buffer size.
Returns :the number of bytes processed or a negative value if an error occurs.


xmlSecCipherFinal ()

int         xmlSecCipherFinal               (xmlSecTransformPtr transform);

Finalize encryption/decryption.

transform : the pointer to cipher transform.
Returns :the number of bytes processed or a negative value if an error occurs.