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

# keysInternal.h

## Name

keysInternal.h -- The internal keys functions.

## Synopsis

    #define     xmlSecKeyInifiteRetrivals
    xmlSecKeyPtr (*xmlSecKeyCreateMethod)       (xmlSecKeyId id);
    xmlSecKeyPtr (*xmlSecKeyDuplicateMethod)    (xmlSecKeyPtr key);
    void        (*xmlSecKeyDestroyMethod)       (xmlSecKeyPtr key);
    int         (*xmlSecKeyReadXmlMethod)       (xmlSecKeyPtr key,
                                                 xmlNodePtr node);
    int         (*xmlSecKeyWriteXmlMethod)      (xmlSecKeyPtr key,
                                                 xmlSecKeyType type,
                                                 xmlNodePtr parent);
    int         (*xmlSecKeyReadBinaryMethod)    (xmlSecKeyPtr key,
                                                 unsigned char *buf,
                                                 size_t size);
    int         (*xmlSecKeyWriteBinaryMethod)   (xmlSecKeyPtr key,
                                                 xmlSecKeyType type,
                                                 unsigned char **buf,
                                                 size_t *size);
    void        xmlSecKeysInit                  (void);
    #define     xmlSecKeyIsValid                (key)
    #define     xmlSecKeyCheckId                (key, keyId)
    #define     xmlSecKeyCheckTransform         (key, tr)
    xmlSecKeyPtr xmlSecKeyReadXml               (xmlSecKeyId id,
                                                 xmlNodePtr node);
    int         xmlSecKeyWriteXml               (xmlSecKeyPtr key,
                                                 xmlSecKeyType type,
                                                 xmlNodePtr node);
    xmlSecKeyPtr xmlSecKeyReadBin               (xmlSecKeyId id,
                                                 unsigned char *buf,
                                                 size_t size);
    int         xmlSecKeyWriteBin               (xmlSecKeyPtr key,
                                                 xmlSecKeyType type,
                                                 unsigned char **buf,
                                                 size_t *size);

## Description

## Details

### xmlSecKeyInifiteRetrivals

    #define xmlSecKeyInifiteRetrivals		99999

Macro. Inifinite number of retrievals (really big number :) )

### xmlSecKeyCreateMethod ()

    xmlSecKeyPtr (*xmlSecKeyCreateMethod)       (xmlSecKeyId id);

Key specific creation method.

`id` : | the key id.
Returns : | the pointer to newly created xmlSecKey structure or NULL if an error occurs.

### xmlSecKeyDuplicateMethod ()

    xmlSecKeyPtr (*xmlSecKeyDuplicateMethod)    (xmlSecKeyPtr key);

Key specific duplication method.

`key` : | the key.
Returns : | the pointer to newly created xmlSecKey structure or NULL if an error occurs.

### xmlSecKeyDestroyMethod ()

    void        (*xmlSecKeyDestroyMethod)       (xmlSecKeyPtr key);

Key specific destroy method.

`key` : | the key.

### xmlSecKeyReadXmlMethod ()

    int         (*xmlSecKeyReadXmlMethod)       (xmlSecKeyPtr key,
                                                 xmlNodePtr node);

Key specific reading from XML node method.

`key` : | the key.
`node` : | the pointer to key's value XML node.
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeyWriteXmlMethod ()

    int         (*xmlSecKeyWriteXmlMethod)      (xmlSecKeyPtr key,
                                                 xmlSecKeyType type,
                                                 xmlNodePtr parent);

Key specific writing to XML node method.

`key` : | the key.
`type` : | the key type to write (public/private).
`parent` : | the pointer to key's value XML node parent node.
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeyReadBinaryMethod ()

    int         (*xmlSecKeyReadBinaryMethod)    (xmlSecKeyPtr key,
                                                 unsigned char *buf,
                                                 size_t size);

Key specific reading binary data method.

`key` : | the key.
`buf` : | the input data buffer.
`size` : | the input data buffer size.
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeyWriteBinaryMethod ()

    int         (*xmlSecKeyWriteBinaryMethod)   (xmlSecKeyPtr key,
                                                 xmlSecKeyType type,
                                                 unsigned char **buf,
                                                 size_t *size);

Key specific writing binary data method. The data are returned in an allocated `buf` and caller is responsible for freeing it using xmlFree() function.

`key` : | the key.
`type` : | the key type to write (public/private).
`buf` : | the pointer to pointer to the output buffer.
`size` : | the pointer to output buffer size.
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeysInit ()

    void        xmlSecKeysInit                  (void);

Initializes the key ids list (called from xmlSecInit() function). This function should not be called directly by applications.

### xmlSecKeyIsValid()

    #define     xmlSecKeyIsValid(key)

Macro. Returns 1 if `key` is not NULL and `key`->id is not NULL or 0 otherwise.

`key` : | the pointer to key.

### xmlSecKeyCheckId()

    #define     xmlSecKeyCheckId(key, keyId)

Macro. Returns 1 if `key` is valid and `key`'s id is equal to `keyId`.

`key` : | the pointer to key.
`keyId` : | the key Id.

### xmlSecKeyCheckTransform()

    #define     xmlSecKeyCheckTransform(key, tr)

Macro. Returns 1 if `key` is valid and could be used for transform `tr`.

`key` : | the pointer to key.
`tr` : | the pointer to transform.

### xmlSecKeyReadXml ()

    xmlSecKeyPtr xmlSecKeyReadXml               (xmlSecKeyId id,
                                                 xmlNodePtr node);

Reads the key from XML node.

`id` : | the key id.
`node` : | the pointer to key value node.
Returns : | the pointer to newly allocated xmlSecKey structure or NULL if an error occurs.

### xmlSecKeyWriteXml ()

    int         xmlSecKeyWriteXml               (xmlSecKeyPtr key,
                                                 xmlSecKeyType type,
                                                 xmlNodePtr node);

Writes the key in the XML node.

`key` : | the pointer to the xmlSecKey structure.
`type` : | the key type to write (public/private).
`node` : | the parent XML node.
Returns : | 0 on success or a negative value otherwise.

### xmlSecKeyReadBin ()

    xmlSecKeyPtr xmlSecKeyReadBin               (xmlSecKeyId id,
                                                 unsigned char *buf,
                                                 size_t size);

Reads the key from binary data.

`id` : | the key id.
`buf` : | the pointer to key binary data buffer.
`size` : | the size of the binary key data `buf`.
Returns : | the pointer to newly allocated xmlSecKey structure or NULL if an error occurs.

### xmlSecKeyWriteBin ()

    int         xmlSecKeyWriteBin               (xmlSecKeyPtr key,
                                                 xmlSecKeyType type,
                                                 unsigned char **buf,
                                                 size_t *size);

Writes the key in the binary buffer. The caller is responsible for freeing the returned buffer using xmlFree() function.

`key` : | the pointer to the xmlSecKey structure.
`type` : | the key type to write (public/private).
`buf` : | the pointer to pointer to the binary data buffer.
`size` : | the pointer to the returned buffer size.
Returns : | 0 on success or a negative value otherwise.

<<< Previous Page | Home | Up | Next Page >>>
io.h | membuf.h