keys.h

Name

keys.h -- The keys helper functions.

Synopsis



enum        xmlSecKeyUsage;
struct      xmlSecKeyReq;
int         xmlSecKeyReqInitialize          (xmlSecKeyReqPtr keyReq);
void        xmlSecKeyReqFinalize            (xmlSecKeyReqPtr keyReq);
int         xmlSecKeyReqCopy                (xmlSecKeyReqPtr dst,
                                             xmlSecKeyReqPtr src);
int         xmlSecKeyReqMatchKey            (xmlSecKeyReqPtr keyReq,
                                             xmlSecKeyPtr key);
int         xmlSecKeyReqMatchKeyValue       (xmlSecKeyReqPtr keyReq,
                                             xmlSecKeyDataPtr value);
#define     xmlSecKeyInifiteRetrivals
#define     xmlSecKeyIsValid                (key)
#define     xmlSecKeyCheckId                (key, keyId)
typedef     xmlSecKeyOrigin;
#define     xmlSecKeyOriginDefault
#define     xmlSecKeyOriginKeyManager
#define     xmlSecKeyOriginKeyName
#define     xmlSecKeyOriginKeyValue
#define     xmlSecKeyOriginRetrievalDocument
#define     xmlSecKeyOriginRetrievalRemote
#define     xmlSecKeyOriginX509
#define     xmlSecKeyOriginPGP
#define     xmlSecKeyOriginEncryptedKey
#define     xmlSecKeyOriginAll
struct      xmlSecKey;
xmlSecKeyPtr xmlSecKeyCreate                (void);
void        xmlSecKeyDestroy                (xmlSecKeyPtr key);
void        xmlSecKeyEmpty                  (xmlSecKeyPtr key);
xmlSecKeyPtr xmlSecKeyDuplicate             (xmlSecKeyPtr key);
int         xmlSecKeyCopy                   (xmlSecKeyPtr keyDst,
                                             xmlSecKeyPtr keySrc);
const xmlChar* xmlSecKeyGetName             (xmlSecKeyPtr key);
int         xmlSecKeySetName                (xmlSecKeyPtr key,
                                             const xmlChar *name);
xmlSecKeyDataType xmlSecKeyGetType          (xmlSecKeyPtr key);
xmlSecKeyDataPtr xmlSecKeyGetValue          (xmlSecKeyPtr key);
int         xmlSecKeySetValue               (xmlSecKeyPtr key,
                                             xmlSecKeyDataPtr value);
xmlSecKeyDataPtr xmlSecKeyGetData           (xmlSecKeyPtr key,
                                             xmlSecKeyDataId dataId);
xmlSecKeyDataPtr xmlSecKeyEnsureData        (xmlSecKeyPtr key,
                                             xmlSecKeyDataId dataId);
int         xmlSecKeyAdoptData              (xmlSecKeyPtr key,
                                             xmlSecKeyDataPtr data);
void        xmlSecKeyDebugDump              (xmlSecKeyPtr key,
                                             FILE *output);
void        xmlSecKeyDebugXmlDump           (xmlSecKeyPtr key,
                                             FILE *output);
xmlSecKeyPtr xmlSecKeyGenerate              (const xmlChar *type,
                                             const xmlChar *name,
                                             size_t sizeBits);
int         xmlSecKeyMatch                  (xmlSecKeyPtr key,
                                             const xmlChar *name,
                                             xmlSecKeyReqPtr keyReq);
#define     xmlSecKeyPtrListId
xmlSecPtrListId xmlSecKeyPtrListGetKlass    (void);

Description

Details

enum xmlSecKeyUsage

typedef enum  {
    xmlSecKeyUsageAny = 0,
    xmlSecKeyUsageSign,
    xmlSecKeyUsageVerify,
    xmlSecKeyUsageEncrypt,
    xmlSecKeyUsageDecrypt
} xmlSecKeyUsage;

The key usage.

xmlSecKeyUsageAny the key can be used in any way.
xmlSecKeyUsageSign the key for signing.
xmlSecKeyUsageVerify the key for signature verification.
xmlSecKeyUsageEncrypt the encryption key.
xmlSecKeyUsageDecrypt the decryption key.


struct xmlSecKeyReq

struct xmlSecKeyReq {
    xmlSecKeyDataId			keyId;
    xmlSecKeyDataType			keyType;
    xmlSecKeyUsage			keyUsage;
    size_t				keyBitsSize;
};


xmlSecKeyReqInitialize ()

int         xmlSecKeyReqInitialize          (xmlSecKeyReqPtr keyReq);

keyReq : 
Returns : 


xmlSecKeyReqFinalize ()

void        xmlSecKeyReqFinalize            (xmlSecKeyReqPtr keyReq);

keyReq : 


xmlSecKeyReqCopy ()

int         xmlSecKeyReqCopy                (xmlSecKeyReqPtr dst,
                                             xmlSecKeyReqPtr src);

dst : 
src : 
Returns : 


xmlSecKeyReqMatchKey ()

int         xmlSecKeyReqMatchKey            (xmlSecKeyReqPtr keyReq,
                                             xmlSecKeyPtr key);

keyReq : 
key : 
Returns : 


xmlSecKeyReqMatchKeyValue ()

int         xmlSecKeyReqMatchKeyValue       (xmlSecKeyReqPtr keyReq,
                                             xmlSecKeyDataPtr value);

keyReq : 
value : 
Returns : 


xmlSecKeyInifiteRetrivals

#define xmlSecKeyInifiteRetrivals		99999

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


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.


xmlSecKeyOrigin

typedef long				xmlSecKeyOrigin;

The key origin (keys manager, remote document, cert, etc.).


xmlSecKeyOriginDefault

#define xmlSecKeyOriginDefault			0

Default origin (unknown).


xmlSecKeyOriginKeyManager

#define xmlSecKeyOriginKeyManager		1

The key was found in the keys manager.


xmlSecKeyOriginKeyName

#define xmlSecKeyOriginKeyName			2 

The key was found in the keys manager via key name specified in the <dsig:KeyName> node. (useless w/o xmlSecKeyOriginKeyManager).


xmlSecKeyOriginKeyValue

#define xmlSecKeyOriginKeyValue			4

The key was extracted from <dsig:KeyValue> node.


xmlSecKeyOriginRetrievalDocument

#define xmlSecKeyOriginRetrievalDocument	8

The key was extracted thru <dsig:RetrievalMethod> pointing in the same document.


xmlSecKeyOriginRetrievalRemote

#define xmlSecKeyOriginRetrievalRemote		16

The key was extracted thru <dsig:RetrievalMethod> pointing to another document.


xmlSecKeyOriginX509

#define xmlSecKeyOriginX509			32

The key was extracted from X509 certificate in the <dsig:X509Data> node.


xmlSecKeyOriginPGP

#define xmlSecKeyOriginPGP			64

The PGP key from <dsig:PGPData> node. Not used.


xmlSecKeyOriginEncryptedKey

#define xmlSecKeyOriginEncryptedKey		128

The key was extracted from <enc:EncryptedKey> node.


xmlSecKeyOriginAll

#define     xmlSecKeyOriginAll

All of the above.


struct xmlSecKey

struct xmlSecKey {
    xmlSecKeyDataPtr			value;
    xmlChar*				name;
    xmlSecPtrListPtr			dataList;


    xmlSecKeyDataType			type;
    xmlSecKeyOrigin			origin;
};

The key.

xmlSecKeyDataPtr value 
xmlChar *name 
xmlSecPtrListPtr dataList 
xmlSecKeyDataType type the key type (private/public).
xmlSecKeyOrigin origin the key origin.


xmlSecKeyCreate ()

xmlSecKeyPtr xmlSecKeyCreate                (void);

Creates new key of the specified type id.

Returns :the pointer to newly allocated xmlSecKey structure or NULL if an error occurs.


xmlSecKeyDestroy ()

void        xmlSecKeyDestroy                (xmlSecKeyPtr key);

Destroys the key and frees all allocated memory.

key : the pointer to the xmlSecKey structure.


xmlSecKeyEmpty ()

void        xmlSecKeyEmpty                  (xmlSecKeyPtr key);

key : 


xmlSecKeyDuplicate ()

xmlSecKeyPtr xmlSecKeyDuplicate             (xmlSecKeyPtr key);

Creates a duplicate of the given key.

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


xmlSecKeyCopy ()

int         xmlSecKeyCopy                   (xmlSecKeyPtr keyDst,
                                             xmlSecKeyPtr keySrc);

keyDst : 
keySrc : 
Returns : 


xmlSecKeyGetName ()

const xmlChar* xmlSecKeyGetName             (xmlSecKeyPtr key);

key : 
Returns : 


xmlSecKeySetName ()

int         xmlSecKeySetName                (xmlSecKeyPtr key,
                                             const xmlChar *name);

key : 
name : 
Returns : 


xmlSecKeyGetType ()

xmlSecKeyDataType xmlSecKeyGetType          (xmlSecKeyPtr key);

key : 
Returns : 


xmlSecKeyGetValue ()

xmlSecKeyDataPtr xmlSecKeyGetValue          (xmlSecKeyPtr key);

key : 
Returns : 


xmlSecKeySetValue ()

int         xmlSecKeySetValue               (xmlSecKeyPtr key,
                                             xmlSecKeyDataPtr value);

key : 
value : 
Returns : 


xmlSecKeyGetData ()

xmlSecKeyDataPtr xmlSecKeyGetData           (xmlSecKeyPtr key,
                                             xmlSecKeyDataId dataId);

key : 
dataId : 
Returns : 


xmlSecKeyEnsureData ()

xmlSecKeyDataPtr xmlSecKeyEnsureData        (xmlSecKeyPtr key,
                                             xmlSecKeyDataId dataId);

key : 
dataId : 
Returns : 


xmlSecKeyAdoptData ()

int         xmlSecKeyAdoptData              (xmlSecKeyPtr key,
                                             xmlSecKeyDataPtr data);

key : 
data : 
Returns : 


xmlSecKeyDebugDump ()

void        xmlSecKeyDebugDump              (xmlSecKeyPtr key,
                                             FILE *output);

Prints the information about the key to the output.

key : the pointer to the xmlSecKey structure.
output : the destination FILE pointer.


xmlSecKeyDebugXmlDump ()

void        xmlSecKeyDebugXmlDump           (xmlSecKeyPtr key,
                                             FILE *output);

Prints the information about the key to the output in XML format.

key : the pointer to the xmlSecKey structure.
output : the destination FILE pointer.


xmlSecKeyGenerate ()

xmlSecKeyPtr xmlSecKeyGenerate              (const xmlChar *type,
                                             const xmlChar *name,
                                             size_t sizeBits);

type : 
name : 
sizeBits : 
Returns : 


xmlSecKeyMatch ()

int         xmlSecKeyMatch                  (xmlSecKeyPtr key,
                                             const xmlChar *name,
                                             xmlSecKeyReqPtr keyReq);

Checks whether the key matches the given criteria (key name is equal to name, key id is equal to id, key type is type).

key : the pointer to the xmlSecKey structure.
name : the pointer to key name (may be NULL).
keyReq : 
Returns :1 if the key satisfies the given criteria or 0 otherwise.


xmlSecKeyPtrListId

#define xmlSecKeyPtrListId	xmlSecKeyPtrListGetKlass()


xmlSecKeyPtrListGetKlass ()

xmlSecPtrListId xmlSecKeyPtrListGetKlass    (void);

Returns :