- Home
- Download
- News
- Documentation

- FAQ
- Tutorial
- API reference
- Examples

- XML Digital Signature

- Online Verifier

- XML Encryption
- XML Canonicalization
- Reporting Bugs
- Mailing list
- Related
- Authors

# keysdata

## Name

keysdata -- Crypto key data object definition.

## Synopsis

    struct              xmlSecKeyData;
    intxmlSecKeyDataBinRead                (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             const xmlSecByte *buf,
                                                             xmlSecSize bufSize,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);
    int                 (*xmlSecKeyDataBinReadMethod)       (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             const xmlSecByte *buf,
                                                             xmlSecSize bufSize,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);
    intxmlSecKeyDataBinWrite               (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlSecByte **buf,
                                                             xmlSecSize *bufSize,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);
    int                 (*xmlSecKeyDataBinWriteMethod)      (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlSecByte **buf,
                                                             xmlSecSize *bufSize,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);
    #define             xmlSecKeyDataBinarySize
    intxmlSecKeyDataBinaryValueBinRead     (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             const xmlSecByte *buf,
                                                             xmlSecSize bufSize,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);
    intxmlSecKeyDataBinaryValueBinWrite    (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlSecByte **buf,
                                                             xmlSecSize *bufSize,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);
    voidxmlSecKeyDataBinaryValueDebugDump   (xmlSecKeyDataPtr data,
                                                             FILE *output);
    voidxmlSecKeyDataBinaryValueDebugXmlDump
                                                            (xmlSecKeyDataPtr data,
                                                             FILE *output);
    intxmlSecKeyDataBinaryValueDuplicate   (xmlSecKeyDataPtr dst,
                                                             xmlSecKeyDataPtr src);
    voidxmlSecKeyDataBinaryValueFinalize    (xmlSecKeyDataPtr data);
    xmlSecBufferPtrxmlSecKeyDataBinaryValueGetBuffer   (xmlSecKeyDataPtr data);
    xmlSecSize          xmlSecKeyDataBinaryValueGetSize     (xmlSecKeyDataPtr data);
    intxmlSecKeyDataBinaryValueInitialize  (xmlSecKeyDataPtr data);
    intxmlSecKeyDataBinaryValueSetBuffer   (xmlSecKeyDataPtr data,
                                                             const xmlSecByte *buf,
                                                             xmlSecSize bufSize);
    intxmlSecKeyDataBinaryValueXmlRead     (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlNodePtr node,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);
    intxmlSecKeyDataBinaryValueXmlWrite    (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlNodePtr node,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);
    #define             xmlSecKeyDataCheckId                (data,
                                                             dataId)
    #define             xmlSecKeyDataCheckSize              (data,
                                                             size)
    #define             xmlSecKeyDataCheckUsage             (data,
                                                             usg)
    xmlSecKeyDataPtr    xmlSecKeyDataCreate                 (xmlSecKeyDataId id);
    voidxmlSecKeyDataDebugDump              (xmlSecKeyDataPtr data,
                                                             FILE *output);
    void                (*xmlSecKeyDataDebugDumpMethod)     (xmlSecKeyDataPtr data,
                                                             FILE *output);
    voidxmlSecKeyDataDebugXmlDump           (xmlSecKeyDataPtr data,
                                                             FILE *output);
    voidxmlSecKeyDataDestroy                (xmlSecKeyDataPtr data);
    xmlSecKeyDataPtrxmlSecKeyDataDuplicate              (xmlSecKeyDataPtr data);
    int                 (*xmlSecKeyDataDuplicateMethod)     (xmlSecKeyDataPtr dst,
                                                             xmlSecKeyDataPtr src);
    void                (*xmlSecKeyDataFinalizeMethod)      (xmlSecKeyDataPtr data);
    enum                xmlSecKeyDataFormat;
    intxmlSecKeyDataGenerate               (xmlSecKeyDataPtr data,
                                                             xmlSecSize sizeBits,
                                                             xmlSecKeyDataType type);
    int                 (*xmlSecKeyDataGenerateMethod)      (xmlSecKeyDataPtr data,
                                                             xmlSecSize sizeBits,
                                                             xmlSecKeyDataType type);
    const xmlChar *     xmlSecKeyDataGetIdentifier          (xmlSecKeyDataPtr data);
    const xmlChar *     (*xmlSecKeyDataGetIdentifierMethod) (xmlSecKeyDataPtr data);
    #define             xmlSecKeyDataGetName                (data)
    xmlSecSize          xmlSecKeyDataGetSize                (xmlSecKeyDataPtr data);
    xmlSecSize          (*xmlSecKeyDataGetSizeMethod)       (xmlSecKeyDataPtr data);
    xmlSecKeyDataType   xmlSecKeyDataGetType                (xmlSecKeyDataPtr data);
    xmlSecKeyDataType   (*xmlSecKeyDataGetTypeMethod)       (xmlSecKeyDataPtr data);
    voidxmlSecKeyDataIdListDebugDump        (xmlSecPtrListPtr list,
                                                             FILE *output);
    voidxmlSecKeyDataIdListDebugXmlDump     (xmlSecPtrListPtr list,
                                                             FILE *output);
    intxmlSecKeyDataIdListFind             (xmlSecPtrListPtr list,
                                                             xmlSecKeyDataId dataId);
    xmlSecKeyDataIdxmlSecKeyDataIdListFindByHref       (xmlSecPtrListPtr list,
                                                             const xmlChar *href,
                                                             xmlSecKeyDataUsage usage);
    xmlSecKeyDataIdxmlSecKeyDataIdListFindByName       (xmlSecPtrListPtr list,
                                                             const xmlChar *name,
                                                             xmlSecKeyDataUsage usage);
    xmlSecKeyDataIdxmlSecKeyDataIdListFindByNode       (xmlSecPtrListPtr list,
                                                             const xmlChar *nodeName,
                                                             const xmlChar *nodeNs,
                                                             xmlSecKeyDataUsage usage);
    xmlSecPtrListIdxmlSecKeyDataIdListGetKlass         (void);
    #define             xmlSecKeyDataIdListId
    #define             xmlSecKeyDataIdUnknown
    xmlSecPtrListPtr    xmlSecKeyDataIdsGet                 (void);
    intxmlSecKeyDataIdsInit                (void);
    intxmlSecKeyDataIdsRegister            (xmlSecKeyDataId id);
    intxmlSecKeyDataIdsRegisterDefault     (void);
    voidxmlSecKeyDataIdsShutdown            (void);
    int                 (*xmlSecKeyDataInitMethod)          (xmlSecKeyDataPtr data);
    #define             xmlSecKeyDataIsValid                (data)
    struct              xmlSecKeyDataKlass;
    #define             xmlSecKeyDataKlassGetName           (klass)
    xmlSecPtrListIdxmlSecKeyDataListGetKlass           (void);
    #define             xmlSecKeyDataListId
    struct              xmlSecKeyDataStore;
    #define             xmlSecKeyDataStoreCheckId           (store,
                                                             storeId)
    #define             xmlSecKeyDataStoreCheckSize         (store,
                                                             size)
    xmlSecKeyDataStorePtr xmlSecKeyDataStoreCreate          (xmlSecKeyDataStoreId id);
    voidxmlSecKeyDataStoreDestroy           (xmlSecKeyDataStorePtr store);
    void                (*xmlSecKeyDataStoreFinalizeMethod) (xmlSecKeyDataStorePtr store);
    #define             xmlSecKeyDataStoreGetName           (store)
    #define             xmlSecKeyDataStoreIdUnknown
    int                 (*xmlSecKeyDataStoreInitializeMethod)
                                                            (xmlSecKeyDataStorePtr store);
    #define             xmlSecKeyDataStoreIsValid           (store)
    struct              xmlSecKeyDataStoreKlass;
    #define             xmlSecKeyDataStoreKlassGetName      (klass)
    xmlSecPtrListIdxmlSecKeyDataStorePtrListGetKlass   (void);
    #define             xmlSecKeyDataStorePtrListId
    typedef             xmlSecKeyDataType;
    #define             xmlSecKeyDataTypeAny
    #define             xmlSecKeyDataTypeNone
    #define             xmlSecKeyDataTypePermanent
    #define             xmlSecKeyDataTypePrivate
    #define             xmlSecKeyDataTypePublic
    #define             xmlSecKeyDataTypeSession
    #define             xmlSecKeyDataTypeSymmetric
    #define             xmlSecKeyDataTypeTrusted
    #define             xmlSecKeyDataTypeUnknown
    typedef             xmlSecKeyDataUsage;
    #define             xmlSecKeyDataUsageAny
    #define             xmlSecKeyDataUsageKeyInfoNode
    #define             xmlSecKeyDataUsageKeyInfoNodeRead
    #define             xmlSecKeyDataUsageKeyInfoNodeWrite
    #define             xmlSecKeyDataUsageKeyValueNode
    #define             xmlSecKeyDataUsageKeyValueNodeRead
    #define             xmlSecKeyDataUsageKeyValueNodeWrite
    #define             xmlSecKeyDataUsageRetrievalMethodNode
    #define             xmlSecKeyDataUsageRetrievalMethodNodeBin
    #define             xmlSecKeyDataUsageRetrievalMethodNodeXml
    #define             xmlSecKeyDataUsageUnknown
    intxmlSecKeyDataXmlRead                (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlNodePtr node,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);
    int                 (*xmlSecKeyDataXmlReadMethod)       (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlNodePtr node,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);
    intxmlSecKeyDataXmlWrite               (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlNodePtr node,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);
    int                 (*xmlSecKeyDataXmlWriteMethod)      (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlNodePtr node,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

## Description

Crypto key data object definition.

## Details

### struct xmlSecKeyData

    struct xmlSecKeyData {
        xmlSecKeyDataId                     id;
        void*                               reserved0;
        void*                               reserved1;
    };

The key data: key value (crypto material), x509 data, pgp data, etc.

xmlSecKeyDataId `id`; | the data id (xmlSecKeyDataId).
void *`reserved0`; | reserved for the future.
void *`reserved1`; | reserved for the future.

### xmlSecKeyDataBinRead ()

    int                 xmlSecKeyDataBinRead                (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             const xmlSecByte *buf,
                                                             xmlSecSize bufSize,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

Reads the key data of klass `id` from binary buffer `buf` to `key`.

`id` : | the data klass.
`key` : | the destination key.
`buf` : | the input binary buffer.
`bufSize` : | the input buffer size.
`keyInfoCtx` : | the <dsig:KeyInfo/> node processing context.
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeyDataBinReadMethod ()

    int                 (*xmlSecKeyDataBinReadMethod)       (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             const xmlSecByte *buf,
                                                             xmlSecSize bufSize,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

Key data specific method for reading binary buffer.

`id` : | the data id.
`key` : | the key.
`buf` : | the input buffer.
`bufSize` : | the buffer size.
`keyInfoCtx` : | the <dsig:KeyInfo/> node processing context.
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeyDataBinWrite ()

    int                 xmlSecKeyDataBinWrite               (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlSecByte **buf,
                                                             xmlSecSize *bufSize,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

Writes the key data of klass `id` from the `key` to a binary buffer `buf`.

`id` : | the data klass.
`key` : | the source key.
`buf` : | the output binary buffer.
`bufSize` : | the output buffer size.
`keyInfoCtx` : | the <dsig:KeyInfo/> node processing context.
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeyDataBinWriteMethod ()

    int                 (*xmlSecKeyDataBinWriteMethod)      (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlSecByte **buf,
                                                             xmlSecSize *bufSize,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

Key data specific method for reading binary buffer.

`id` : | the data id.
`key` : | the key.
`buf` : | the output buffer.
`bufSize` : | the buffer size.
`keyInfoCtx` : | the <dsig:KeyInfo/> node processing context.
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeyDataBinarySize

    #define             xmlSecKeyDataBinarySize

The binary key data object size.

### xmlSecKeyDataBinaryValueBinRead ()

    int                 xmlSecKeyDataBinaryValueBinRead     (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             const xmlSecByte *buf,
                                                             xmlSecSize bufSize,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

Reads binary key data of the klass `id` from `buf` to the `key`.

`id` : | the data klass.
`key` : | the pointer to destination key.
`buf` : | the source binary buffer.
`bufSize` : | the source binary buffer size.
`keyInfoCtx` : | the pointer to <dsig:KeyInfo/> element processing context.
Returns : | 0 on success or a negative value otherwise.

### xmlSecKeyDataBinaryValueBinWrite ()

    int                 xmlSecKeyDataBinaryValueBinWrite    (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlSecByte **buf,
                                                             xmlSecSize *bufSize,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

Writes binary key data of klass `id` from the `key` to `buf`.

`id` : | the data klass.
`key` : | the pointer to source key.
`buf` : | the destination binary buffer.
`bufSize` : | the destination binary buffer size.
`keyInfoCtx` : | the pointer to <dsig:KeyInfo/> element processing context.
Returns : | 0 on success or a negative value otherwise.

### xmlSecKeyDataBinaryValueDebugDump ()

    void                xmlSecKeyDataBinaryValueDebugDump   (xmlSecKeyDataPtr data,
                                                             FILE *output);

Prints binary key data debug information to `output`.

`data` : | the pointer to binary key data.
`output` : | the pointer to output FILE.

### xmlSecKeyDataBinaryValueDebugXmlDump ()

    void                xmlSecKeyDataBinaryValueDebugXmlDump
                                                            (xmlSecKeyDataPtr data,
                                                             FILE *output);

Prints binary key data debug information to `output` in XML format.

`data` : | the pointer to binary key data.
`output` : | the pointer to output FILE.

### xmlSecKeyDataBinaryValueDuplicate ()

    int                 xmlSecKeyDataBinaryValueDuplicate   (xmlSecKeyDataPtr dst,
                                                             xmlSecKeyDataPtr src);

Copies binary key data from `src` to `dst`.

`dst` : | the pointer to destination binary key data.
`src` : | the pointer to source binary key data.
Returns : | 0 on success or a negative value otherwise.

### xmlSecKeyDataBinaryValueFinalize ()

    void                xmlSecKeyDataBinaryValueFinalize    (xmlSecKeyDataPtr data);

Cleans up binary key data.

`data` : | the pointer to binary key data.

### xmlSecKeyDataBinaryValueGetBuffer ()

    xmlSecBufferPtr     xmlSecKeyDataBinaryValueGetBuffer   (xmlSecKeyDataPtr data);

Gets the binary key data buffer.

`data` : | the pointer to binary key data.
Returns : | pointer to binary key data buffer.

### xmlSecKeyDataBinaryValueGetSize ()

    xmlSecSize          xmlSecKeyDataBinaryValueGetSize     (xmlSecKeyDataPtr data);

Gets the binary key data size.

`data` : | the pointer to binary key data.
Returns : | binary key data size in bits.

### xmlSecKeyDataBinaryValueInitialize ()

    int                 xmlSecKeyDataBinaryValueInitialize  (xmlSecKeyDataPtr data);

Initializes key data.

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

### xmlSecKeyDataBinaryValueSetBuffer ()

    int                 xmlSecKeyDataBinaryValueSetBuffer   (xmlSecKeyDataPtr data,
                                                             const xmlSecByte *buf,
                                                             xmlSecSize bufSize);

Sets the value of `data` to `buf`.

`data` : | the pointer to binary key data.
`buf` : | the pointer to binary buffer.
`bufSize` : | the binary buffer size.
Returns : | 0 on success or a negative value otherwise.

### xmlSecKeyDataBinaryValueXmlRead ()

    int                 xmlSecKeyDataBinaryValueXmlRead     (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlNodePtr node,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

Reads binary key data from `node` to the key by base64 decoding the `node` content.

`id` : | the data klass.
`key` : | the pointer to destination key.
`node` : | the pointer to an XML node.
`keyInfoCtx` : | the pointer to <dsig:KeyInfo/> element processing context.
Returns : | 0 on success or a negative value otherwise.

### xmlSecKeyDataBinaryValueXmlWrite ()

    int                 xmlSecKeyDataBinaryValueXmlWrite    (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlNodePtr node,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

Base64 encodes binary key data of klass `id` from the `key` and sets to the `node` content.

`id` : | the data klass.
`key` : | the pointer to source key.
`node` : | the pointer to an XML node.
`keyInfoCtx` : | the pointer to <dsig:KeyInfo/> element processing context.
Returns : | 0 on success or a negative value otherwise.

### xmlSecKeyDataCheckId()

    #define             xmlSecKeyDataCheckId(data, dataId)

Macro. Returns 1 if `data` is valid and `data`'s id is equal to `dataId`.

`data` : | the pointer to data.
`dataId` : | the data Id.

### xmlSecKeyDataCheckSize()

    #define             xmlSecKeyDataCheckSize(data, size)

Macro. Returns 1 if `data` is valid and `data`'s object has at least `size` bytes.

`data` : | the pointer to data.
`size` : | the expected size.

### xmlSecKeyDataCheckUsage()

    #define             xmlSecKeyDataCheckUsage(data, usg)

Macro. Returns 1 if `data` is valid and could be used for `usg`.

`data` : | the pointer to data.
`usg` : | the data usage.

### xmlSecKeyDataCreate ()

    xmlSecKeyDataPtr    xmlSecKeyDataCreate                 (xmlSecKeyDataId id);

Allocates and initializes new key data of the specified type `id`. Caller is responsible for destroying returned object with xmlSecKeyDataDestroy function.

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

### xmlSecKeyDataDebugDump ()

    void                xmlSecKeyDataDebugDump              (xmlSecKeyDataPtr data,
                                                             FILE *output);

Prints key data debug info.

`data` : | the pointer to key data.
`output` : | the pointer to output FILE.

### xmlSecKeyDataDebugDumpMethod ()

    void                (*xmlSecKeyDataDebugDumpMethod)     (xmlSecKeyDataPtr data,
                                                             FILE *output);

Key data specific method for printing debug info.

`data` : | the data.
`output` : | the FILE to print debug info (should be open for writing).

### xmlSecKeyDataDebugXmlDump ()

    void                xmlSecKeyDataDebugXmlDump           (xmlSecKeyDataPtr data,
                                                             FILE *output);

Prints key data debug info in XML format.

`data` : | the pointer to key data.
`output` : | the pointer to output FILE.

### xmlSecKeyDataDestroy ()

    void                xmlSecKeyDataDestroy                (xmlSecKeyDataPtr data);

Destroys the data and frees all allocated memory.

`data` : | the pointer to the key data.

### xmlSecKeyDataDuplicate ()

    xmlSecKeyDataPtr    xmlSecKeyDataDuplicate              (xmlSecKeyDataPtr data);

Creates a duplicate of the given `data`. Caller is responsible for destroying returned object with xmlSecKeyDataDestroy function.

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

### xmlSecKeyDataDuplicateMethod ()

    int                 (*xmlSecKeyDataDuplicateMethod)     (xmlSecKeyDataPtr dst,
                                                             xmlSecKeyDataPtr src);

Key data specific duplication (copy) method.

`dst` : | the pointer to destination key data.
`src` : | the poiniter to source key data.
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeyDataFinalizeMethod ()

    void                (*xmlSecKeyDataFinalizeMethod)      (xmlSecKeyDataPtr data);

Key data specific finalization method. All the objects and resources allocated by the key data object must be freed inside this method.

`data` : | the data.

### enum xmlSecKeyDataFormat

    typedef enum {
        xmlSecKeyDataFormatUnknown = 0,
        xmlSecKeyDataFormatBinary,
        xmlSecKeyDataFormatPem,
        xmlSecKeyDataFormatDer,
        xmlSecKeyDataFormatPkcs8Pem,
        xmlSecKeyDataFormatPkcs8Der,
        xmlSecKeyDataFormatPkcs12,
        xmlSecKeyDataFormatCertPem,
        xmlSecKeyDataFormatCertDer
    } xmlSecKeyDataFormat;

The key data format (binary, der, pem, etc.).

`xmlSecKeyDataFormatUnknown` | the key data format is unknown.
`xmlSecKeyDataFormatBinary` | the binary key data.
`xmlSecKeyDataFormatPem` | the PEM key data (cert or public/private key).
`xmlSecKeyDataFormatDer` | the DER key data (cert or public/private key).
`xmlSecKeyDataFormatPkcs8Pem` | the PKCS8 PEM private key.
`xmlSecKeyDataFormatPkcs8Der` | the PKCS8 DER private key.
`xmlSecKeyDataFormatPkcs12` | the PKCS12 format (bag of keys and certs)
`xmlSecKeyDataFormatCertPem` | the PEM cert.
`xmlSecKeyDataFormatCertDer` | the DER cert.

### xmlSecKeyDataGenerate ()

    int                 xmlSecKeyDataGenerate               (xmlSecKeyDataPtr data,
                                                             xmlSecSize sizeBits,
                                                             xmlSecKeyDataType type);

Generates new key data of given size and type.

`data` : | the pointer to key data.
`sizeBits` : | the desired key data size (in bits).
`type` : | the desired key data type.
Returns : | 0 on success or a negative value otherwise.

### xmlSecKeyDataGenerateMethod ()

    int                 (*xmlSecKeyDataGenerateMethod)      (xmlSecKeyDataPtr data,
                                                             xmlSecSize sizeBits,
                                                             xmlSecKeyDataType type);

Key data specific method for generating new key data.

`data` : | the pointer to key data.
`sizeBits` : | the key data specific size.
`type` : | the required key type (session/permanent, etc.)
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeyDataGetIdentifier ()

    const xmlChar *     xmlSecKeyDataGetIdentifier          (xmlSecKeyDataPtr data);

Gets key data identifier string.

`data` : | the pointer to key data.
Returns : | key data id string.

### xmlSecKeyDataGetIdentifierMethod ()

    const xmlChar *     (*xmlSecKeyDataGetIdentifierMethod) (xmlSecKeyDataPtr data);

Key data specific method to get the key data identifier string (for example, X509 data identifier is the subject of the verified cert).

`data` : | the pointer to key data.
Returns : | the identifier string or NULL if an error occurs.

### xmlSecKeyDataGetName()

    #define             xmlSecKeyDataGetName(data)

Macro. Returns the key data name.

`data` : | the pointer to key data.

### xmlSecKeyDataGetSize ()

    xmlSecSize          xmlSecKeyDataGetSize                (xmlSecKeyDataPtr data);

Gets key data size.

`data` : | the pointer to key data.
Returns : | key data size (in bits).

### xmlSecKeyDataGetSizeMethod ()

    xmlSecSize          (*xmlSecKeyDataGetSizeMethod)       (xmlSecKeyDataPtr data);

Key data specific method to get the key size.

`data` : | the pointer to key data.
Returns : | the key size in bits.

### xmlSecKeyDataGetType ()

    xmlSecKeyDataType   xmlSecKeyDataGetType                (xmlSecKeyDataPtr data);

Gets key data type.

`data` : | the pointer to key data.
Returns : | key data type.

### xmlSecKeyDataGetTypeMethod ()

    xmlSecKeyDataType   (*xmlSecKeyDataGetTypeMethod)       (xmlSecKeyDataPtr data);

Key data specific method to get the key type.

`data` : | the data.
Returns : | the key type.

### xmlSecKeyDataIdListDebugDump ()

    void                xmlSecKeyDataIdListDebugDump        (xmlSecPtrListPtr list,
                                                             FILE *output);

Prints binary key data debug information to `output`.

`list` : | the pointer to key data ids list.
`output` : | the pointer to output FILE.

### xmlSecKeyDataIdListDebugXmlDump ()

    void                xmlSecKeyDataIdListDebugXmlDump     (xmlSecPtrListPtr list,
                                                             FILE *output);

Prints binary key data debug information to `output` in XML format.

`list` : | the pointer to key data ids list.
`output` : | the pointer to output FILE.

### xmlSecKeyDataIdListFind ()

    int                 xmlSecKeyDataIdListFind             (xmlSecPtrListPtr list,
                                                             xmlSecKeyDataId dataId);

Lookups `dataId` in `list`.

`list` : | the pointer to key data ids list.
`dataId` : | the key data klass.
Returns : | 1 if `dataId` is found in the `list`, 0 if not and a negative value if an error occurs.

### xmlSecKeyDataIdListFindByHref ()

    xmlSecKeyDataId     xmlSecKeyDataIdListFindByHref       (xmlSecPtrListPtr list,
                                                             const xmlChar *href,
                                                             xmlSecKeyDataUsage usage);

Lookups data klass in the list with given `href` and `usage` in `list`.

`list` : | the pointer to key data ids list.
`href` : | the desired key data klass href.
`usage` : | the desired key data usage.
Returns : | key data klass is found and NULL otherwise.

### xmlSecKeyDataIdListFindByName ()

    xmlSecKeyDataId     xmlSecKeyDataIdListFindByName       (xmlSecPtrListPtr list,
                                                             const xmlChar *name,
                                                             xmlSecKeyDataUsage usage);

Lookups data klass in the list with given `name` and `usage` in `list`.

`list` : | the pointer to key data ids list.
`name` : | the desired key data klass name.
`usage` : | the desired key data usage.
Returns : | key data klass is found and NULL otherwise.

### xmlSecKeyDataIdListFindByNode ()

    xmlSecKeyDataId     xmlSecKeyDataIdListFindByNode       (xmlSecPtrListPtr list,
                                                             const xmlChar *nodeName,
                                                             const xmlChar *nodeNs,
                                                             xmlSecKeyDataUsage usage);

Lookups data klass in the list with given `nodeName`, `nodeNs` and `usage` in the `list`.

`list` : | the pointer to key data ids list.
`nodeName` : | the desired key data klass XML node name.
`nodeNs` : | the desired key data klass XML node namespace.
`usage` : | the desired key data usage.
Returns : | key data klass is found and NULL otherwise.

### xmlSecKeyDataIdListGetKlass ()

    xmlSecPtrListId     xmlSecKeyDataIdListGetKlass         (void);

The key data id list klass.

Returns : | pointer to the key data id list klass.

### xmlSecKeyDataIdListId

    #define xmlSecKeyDataIdListId   xmlSecKeyDataIdListGetKlass()

The key data list klass id.

### xmlSecKeyDataIdUnknown

    #define xmlSecKeyDataIdUnknown                  ((xmlSecKeyDataId)NULL)

The "unknown" id.

### xmlSecKeyDataIdsGet ()

    xmlSecPtrListPtr    xmlSecKeyDataIdsGet                 (void);

Gets global registered key data klasses list.

Returns : | the pointer to list of all registered key data klasses.

### xmlSecKeyDataIdsInit ()

    int                 xmlSecKeyDataIdsInit                (void);

Initializes the key data klasses. This function is called from the xmlSecInit function and the application should not call it directly.

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

### xmlSecKeyDataIdsRegister ()

    int                 xmlSecKeyDataIdsRegister            (xmlSecKeyDataId id);

Registers `id` in the global list of key data klasses.

`id` : | the key data klass.
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeyDataIdsRegisterDefault ()

    int                 xmlSecKeyDataIdsRegisterDefault     (void);

Registers default (implemented by XML Security Library) key data klasses: <dsig:KeyName/> element processing klass, <dsig:KeyValue/> element processing klass, ...

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

### xmlSecKeyDataIdsShutdown ()

    void                xmlSecKeyDataIdsShutdown            (void);

Shuts down the keys data klasses. This function is called from the xmlSecShutdown function and the application should not call it directly.

### xmlSecKeyDataInitMethod ()

    int                 (*xmlSecKeyDataInitMethod)          (xmlSecKeyDataPtr data);

Key data specific initialization method.

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

### xmlSecKeyDataIsValid()

    #define             xmlSecKeyDataIsValid(data)

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

`data` : | the pointer to data.

### struct xmlSecKeyDataKlass

    struct xmlSecKeyDataKlass {
        xmlSecSize                          klassSize;
        xmlSecSize                          objSize;

        /* data */
        const xmlChar*                      name;
        xmlSecKeyDataUsage                  usage;
        const xmlChar*                      href;
        const xmlChar*                      dataNodeName;
        const xmlChar*                      dataNodeNs;

        /* constructors/destructor */
        xmlSecKeyDataInitMethod             initialize;
        xmlSecKeyDataDuplicateMethod        duplicate;
        xmlSecKeyDataFinalizeMethod         finalize;
        xmlSecKeyDataGenerateMethod         generate;

        /* get info */
        xmlSecKeyDataGetTypeMethod          getType;
        xmlSecKeyDataGetSizeMethod          getSize;
        xmlSecKeyDataGetIdentifierMethod    getIdentifier;

        /* read/write */
        xmlSecKeyDataXmlReadMethod          xmlRead;
        xmlSecKeyDataXmlWriteMethod         xmlWrite;
        xmlSecKeyDataBinReadMethod          binRead;
        xmlSecKeyDataBinWriteMethod         binWrite;

        /* debug */
        xmlSecKeyDataDebugDumpMethod        debugDump;
        xmlSecKeyDataDebugDumpMethod        debugXmlDump;

        /* for the future */
        void*                               reserved0;
        void*                               reserved1;
    };

The data id (klass).

xmlSecSize `klassSize`; | the klass size.
xmlSecSize `objSize`; | the object size.
const xmlChar *`name`; | the object name.
xmlSecKeyDataUsage `usage`; | the allowed data usage.
const xmlChar *`href`; | the identification string (href).
const xmlChar *`dataNodeName`; | the data's XML node name.
const xmlChar *`dataNodeNs`; | the data's XML node namespace.
xmlSecKeyDataInitMethod `initialize`; | the initialization method.
xmlSecKeyDataDuplicateMethod `duplicate`; | the duplicate (copy) method.
xmlSecKeyDataFinalizeMethod `finalize`; | the finalization (destroy) method.
xmlSecKeyDataGenerateMethod `generate`; | the new data generation method.
xmlSecKeyDataGetTypeMethod `getType`; | the method to access data's type information.
xmlSecKeyDataGetSizeMethod `getSize`; | the method to access data's size.
xmlSecKeyDataGetIdentifierMethod `getIdentifier`; | the method to access data's string identifier.
xmlSecKeyDataXmlReadMethod `xmlRead`; | the method for reading data from XML node.
xmlSecKeyDataXmlWriteMethod `xmlWrite`; | the method for writing data to XML node.
xmlSecKeyDataBinReadMethod `binRead`; | the method for reading data from a binary buffer.
xmlSecKeyDataBinWriteMethod `binWrite`; | the method for writing data to binary buffer.
xmlSecKeyDataDebugDumpMethod `debugDump`; | the method for printing debug data information.
xmlSecKeyDataDebugDumpMethod `debugXmlDump`; | the method for printing debug data information in XML format.
void *`reserved0`; | reserved for the future.
void *`reserved1`; | reserved for the future.

### xmlSecKeyDataKlassGetName()

    #define             xmlSecKeyDataKlassGetName(klass)

Macro. Returns data klass name.

`klass` : | the data klass.

### xmlSecKeyDataListGetKlass ()

    xmlSecPtrListId     xmlSecKeyDataListGetKlass           (void);

The key data list klass.

Returns : | pointer to the key data list klass.

### xmlSecKeyDataListId

    #define xmlSecKeyDataListId     xmlSecKeyDataListGetKlass()

The key data klasses list klass id.

### struct xmlSecKeyDataStore

    struct xmlSecKeyDataStore {
        xmlSecKeyDataStoreId                id;

        /* for the future */
        void*                               reserved0;
        void*                               reserved1;
    };

The key data store. Key data store holds common key data specific information required for key data processing. For example, X509 data store may hold information about trusted (root) certificates.

xmlSecKeyDataStoreId `id`; | the store id (xmlSecKeyDataStoreId).
void *`reserved0`; | reserved for the future.
void *`reserved1`; | reserved for the future.

### xmlSecKeyDataStoreCheckId()

    #define             xmlSecKeyDataStoreCheckId(store, storeId)

Macro. Returns 1 if `store` is valid and `store`'s id is equal to `storeId`.

`store` : | the pointer to store.
`storeId` : | the store Id.

### xmlSecKeyDataStoreCheckSize()

    #define             xmlSecKeyDataStoreCheckSize(store, size)

Macro. Returns 1 if `data` is valid and `stores`'s object has at least `size` bytes.

`store` : | the pointer to store.
`size` : | the expected size.

### xmlSecKeyDataStoreCreate ()

    xmlSecKeyDataStorePtr xmlSecKeyDataStoreCreate          (xmlSecKeyDataStoreId id);

Creates new key data store of the specified klass `id`. Caller is responsible for freeing returned object with xmlSecKeyDataStoreDestroy function.

`id` : | the store id.
Returns : | the pointer to newly allocated key data store structure or NULL if an error occurs.

### xmlSecKeyDataStoreDestroy ()

    void                xmlSecKeyDataStoreDestroy           (xmlSecKeyDataStorePtr store);

Destroys the key data store created with xmlSecKeyDataStoreCreate function.

`store` : | the pointer to the key data store..

### xmlSecKeyDataStoreFinalizeMethod ()

    void                (*xmlSecKeyDataStoreFinalizeMethod) (xmlSecKeyDataStorePtr store);

Key data store specific finalization (destroy) method.

`store` : | the data store.

### xmlSecKeyDataStoreGetName()

    #define             xmlSecKeyDataStoreGetName(store)

Macro. Returns key data store name.

`store` : | the pointer to store.

### xmlSecKeyDataStoreIdUnknown

    #define xmlSecKeyDataStoreIdUnknown                     NULL

The "unknown" id.

### xmlSecKeyDataStoreInitializeMethod ()

    int                 (*xmlSecKeyDataStoreInitializeMethod)
                                                            (xmlSecKeyDataStorePtr store);

Key data store specific initialization method.

`store` : | the data store.
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeyDataStoreIsValid()

    #define             xmlSecKeyDataStoreIsValid(store)

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

`store` : | the pointer to store.

### struct xmlSecKeyDataStoreKlass

    struct xmlSecKeyDataStoreKlass {
        xmlSecSize                          klassSize;
        xmlSecSize                          objSize;

        /* data */
        const xmlChar*                      name;

        /* constructors/destructor */
        xmlSecKeyDataStoreInitializeMethod  initialize;
        xmlSecKeyDataStoreFinalizeMethod    finalize;

        /* for the future */
        void*                               reserved0;
        void*                               reserved1;
    };

The data store id (klass).

xmlSecSize `klassSize`; | the data store klass size.
xmlSecSize `objSize`; | the data store obj size.
const xmlChar *`name`; | the store's name.
xmlSecKeyDataStoreInitializeMethod `initialize`; | the store's initialization method.
xmlSecKeyDataStoreFinalizeMethod `finalize`; | the store's finalization (destroy) method.
void *`reserved0`; | reserved for the future.
void *`reserved1`; | reserved for the future.

### xmlSecKeyDataStoreKlassGetName()

    #define             xmlSecKeyDataStoreKlassGetName(klass)

Macro. Returns store klass name.

`klass` : | the pointer to store klass.

### xmlSecKeyDataStorePtrListGetKlass ()

    xmlSecPtrListId     xmlSecKeyDataStorePtrListGetKlass   (void);

Key data stores list.

Returns : | key data stores list klass.

### xmlSecKeyDataStorePtrListId

    #define xmlSecKeyDataStorePtrListId     xmlSecKeyDataStorePtrListGetKlass()

The data store list id (klass).

### xmlSecKeyDataType

    typedef unsigned int                            xmlSecKeyDataType;

The key data type (public/private, session/permanet, etc.).

### xmlSecKeyDataTypeAny

    #define xmlSecKeyDataTypeAny                            0xFFFF

Any key data.

### xmlSecKeyDataTypeNone

    #define xmlSecKeyDataTypeNone                           xmlSecKeyDataTypeUnknown

The key data type is unknown (same as xmlSecKeyDataTypeUnknown).

### xmlSecKeyDataTypePermanent

    #define xmlSecKeyDataTypePermanent                      0x0010

The key data contain permanent key (stored in keys manager).

### xmlSecKeyDataTypePrivate

    #define xmlSecKeyDataTypePrivate                        0x0002

The key data contain a private key.

### xmlSecKeyDataTypePublic

    #define xmlSecKeyDataTypePublic                         0x0001

The key data contain a public key.

### xmlSecKeyDataTypeSession

    #define xmlSecKeyDataTypeSession                        0x0008

The key data contain session key (one time key, not stored in keys manager).

### xmlSecKeyDataTypeSymmetric

    #define xmlSecKeyDataTypeSymmetric                      0x0004

The key data contain a symmetric key.

### xmlSecKeyDataTypeTrusted

    #define xmlSecKeyDataTypeTrusted                        0x0100

The key data is trusted.

### xmlSecKeyDataTypeUnknown

    #define xmlSecKeyDataTypeUnknown                        0x0000

The key data type is unknown (same as xmlSecKeyDataTypeNone).

### xmlSecKeyDataUsage

    typedef unsigned int                                    xmlSecKeyDataUsage;

The bits mask that determines possible keys data usage.

### xmlSecKeyDataUsageAny

    #define xmlSecKeyDataUsageAny                           0xFFFFF

Any key data usage.

### xmlSecKeyDataUsageKeyInfoNode

    #define             xmlSecKeyDataUsageKeyInfoNode

The key data could be read and written from/to a <dsig:KeyInfo /> child.

### xmlSecKeyDataUsageKeyInfoNodeRead

    #define xmlSecKeyDataUsageKeyInfoNodeRead               0x00001

The key data could be read from a <dsig:KeyInfo/> child.

### xmlSecKeyDataUsageKeyInfoNodeWrite

    #define xmlSecKeyDataUsageKeyInfoNodeWrite              0x00002

The key data could be written to a <dsig:KeyInfo /> child.

### xmlSecKeyDataUsageKeyValueNode

    #define             xmlSecKeyDataUsageKeyValueNode

The key data could be read and written from/to a <dsig:KeyValue /> child.

### xmlSecKeyDataUsageKeyValueNodeRead

    #define xmlSecKeyDataUsageKeyValueNodeRead              0x00004

The key data could be read from a <dsig:KeyValue /> child.

### xmlSecKeyDataUsageKeyValueNodeWrite

    #define xmlSecKeyDataUsageKeyValueNodeWrite             0x00008

The key data could be written to a <dsig:KeyValue /> child.

### xmlSecKeyDataUsageRetrievalMethodNode

    #define             xmlSecKeyDataUsageRetrievalMethodNode

The key data could be retrieved using <dsig:RetrievalMethod /> node in any format.

### xmlSecKeyDataUsageRetrievalMethodNodeBin

    #define xmlSecKeyDataUsageRetrievalMethodNodeBin        0x00020

The key data could be retrieved using <dsig:RetrievalMethod /> node in binary format.

### xmlSecKeyDataUsageRetrievalMethodNodeXml

    #define xmlSecKeyDataUsageRetrievalMethodNodeXml        0x00010

The key data could be retrieved using <dsig:RetrievalMethod /> node in XML format.

### xmlSecKeyDataUsageUnknown

    #define xmlSecKeyDataUsageUnknown                       0x00000

The key data usage is unknown.

### xmlSecKeyDataXmlRead ()

    int                 xmlSecKeyDataXmlRead                (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlNodePtr node,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

Reads the key data of klass `id` from XML `node` and adds them to `key`.

`id` : | the data klass.
`key` : | the destination key.
`node` : | the pointer to an XML node.
`keyInfoCtx` : | the pointer to <dsig:KeyInfo/> element processing context.
Returns : | 0 on success or a negative value otherwise.

### xmlSecKeyDataXmlReadMethod ()

    int                 (*xmlSecKeyDataXmlReadMethod)       (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlNodePtr node,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

Key data specific method for reading XML node.

`id` : | the data id.
`key` : | the key.
`node` : | the pointer to data's value XML node.
`keyInfoCtx` : | the <dsig:KeyInfo/> node processing context.
Returns : | 0 on success or a negative value if an error occurs.

### xmlSecKeyDataXmlWrite ()

    int                 xmlSecKeyDataXmlWrite               (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlNodePtr node,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

Writes the key data of klass `id` from `key` to an XML `node`.

`id` : | the data klass.
`key` : | the source key.
`node` : | the pointer to an XML node.
`keyInfoCtx` : | the pointer to <dsig:KeyInfo/> element processing context.
Returns : | 0 on success or a negative value otherwise.

### xmlSecKeyDataXmlWriteMethod ()

    int                 (*xmlSecKeyDataXmlWriteMethod)      (xmlSecKeyDataId id,
                                                             xmlSecKeyPtr key,
                                                             xmlNodePtr node,
                                                             xmlSecKeyInfoCtxPtr keyInfoCtx);

Key data specific method for writing XML node.

`id` : | the data id.
`key` : | the key.
`node` : | the pointer to data's value XML node.
`keyInfoCtx` : | the <dsig:KeyInfo> node processing context.
Returns : | 0 on success or a negative value if an error occurs.