Top |
xmlSecPtrListPtr
xmlSecKeyDataIdsGet (void
);
Gets global registered key data klasses list.
xmlSecPtrListPtr
xmlSecKeyDataIdsGetEnabled (void
);
Gets global enabled key data klasses list.
int
xmlSecKeyDataIdsInit (void
);
Initializes the key data klasses. This function is called from the xmlSecInit function and the application should not call it directly.
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.
int
xmlSecKeyDataIdsRegisterDefault (void
);
Registers default (implemented by XML Security Library) key data klasses: <dsig:KeyName/> element processing klass, <dsig:KeyValue/> element processing klass, ...
int
xmlSecKeyDataIdsRegister (xmlSecKeyDataId id
);
Registers id
in the global list of key data klasses and enable this key data.
int
xmlSecKeyDataIdsRegisterDisabled (xmlSecKeyDataId id
);
Registers id
in the global list of key data klasses and but DO NOT enable this key data.
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.
xmlSecKeyDataPtr
xmlSecKeyDataDuplicate (xmlSecKeyDataPtr data
);
Creates a duplicate of the given data
. Caller is responsible for
destroying returned object with xmlSecKeyDataDestroy function.
void
xmlSecKeyDataDestroy (xmlSecKeyDataPtr data
);
Destroys the data and frees all allocated memory.
int xmlSecKeyDataGenerate (xmlSecKeyDataPtr data
,xmlSecSize sizeBits
,xmlSecKeyDataType type
);
Generates new key data of given size and type.
xmlSecKeyDataType
xmlSecKeyDataGetType (xmlSecKeyDataPtr data
);
Gets key data type.
xmlSecSize
xmlSecKeyDataGetSize (xmlSecKeyDataPtr data
);
Gets key data size.
const xmlChar *
xmlSecKeyDataGetIdentifier (xmlSecKeyDataPtr data
);
Gets key data identifier string.
void xmlSecKeyDataDebugDump (xmlSecKeyDataPtr data
,FILE *output
);
Prints key data debug info.
void xmlSecKeyDataDebugXmlDump (xmlSecKeyDataPtr data
,FILE *output
);
Prints key data debug info in XML format.
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. |
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. |
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. |
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. |
#define xmlSecKeyDataIsValid(data)
Macro. Returns 1 if data
is not NULL and data->id
is not NULL
or 0 otherwise.
#define xmlSecKeyDataCheckId(data, dataId)
Macro. Returns 1 if data
is valid and data
's id is equal to dataId
.
#define xmlSecKeyDataCheckUsage(data, usg)
Macro. Returns 1 if data
is valid and could be used for usg
.
#define xmlSecKeyDataCheckSize(data, size)
Macro. Returns 1 if data
is valid and data
's object has at least size
bytes.
int
(*xmlSecKeyDataInitMethod) (xmlSecKeyDataPtr data
);
Key data specific initialization method.
int (*xmlSecKeyDataDuplicateMethod) (xmlSecKeyDataPtr dst
,xmlSecKeyDataPtr src
);
Key data specific duplication (copy) method.
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.
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. |
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. |
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. |
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. |
int (*xmlSecKeyDataGenerateMethod) (xmlSecKeyDataPtr data
,xmlSecSize sizeBits
,xmlSecKeyDataType type
);
Key data specific method for generating new key data.
xmlSecKeyDataType
(*xmlSecKeyDataGetTypeMethod) (xmlSecKeyDataPtr data
);
Key data specific method to get the key type.
xmlSecSize
(*xmlSecKeyDataGetSizeMethod) (xmlSecKeyDataPtr data
);
Key data specific method to get the key size.
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).
void (*xmlSecKeyDataDebugDumpMethod) (xmlSecKeyDataPtr data
,FILE *output
);
Key data specific method for printing debug info.
#define xmlSecKeyDataKlassGetName(klass)
Macro. Returns data klass name.
xmlSecSize
xmlSecKeyDataBinaryValueGetSize (xmlSecKeyDataPtr data
);
Gets the binary key data size.
xmlSecBufferPtr
xmlSecKeyDataBinaryValueGetBuffer (xmlSecKeyDataPtr data
);
Gets the binary key data buffer.
int xmlSecKeyDataBinaryValueSetBuffer (xmlSecKeyDataPtr data
,const xmlSecByte *buf
,xmlSecSize bufSize
);
Sets the value of data
to buf
.
xmlSecPtrListId
xmlSecKeyDataListGetKlass (void
);
The key data list klass.
xmlSecPtrListId
xmlSecKeyDataIdListGetKlass (void
);
The key data id list klass.
int xmlSecKeyDataIdListFind (xmlSecPtrListPtr list
,xmlSecKeyDataId dataId
);
Lookups dataId
in list
.
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
.
xmlSecKeyDataId xmlSecKeyDataIdListFindByHref (xmlSecPtrListPtr list
,const xmlChar *href
,xmlSecKeyDataUsage usage
);
Lookups data klass in the list with given href
and usage
in list
.
xmlSecKeyDataId xmlSecKeyDataIdListFindByName (xmlSecPtrListPtr list
,const xmlChar *name
,xmlSecKeyDataUsage usage
);
Lookups data klass in the list with given name
and usage
in list
.
void xmlSecKeyDataIdListDebugDump (xmlSecPtrListPtr list
,FILE *output
);
Prints binary key data debug information to output
.
void xmlSecKeyDataIdListDebugXmlDump (xmlSecPtrListPtr list
,FILE *output
);
Prints binary key data debug information to output
in XML format.
xmlSecKeyDataStorePtr
xmlSecKeyDataStoreCreate (xmlSecKeyDataStoreId id
);
Creates new key data store of the specified klass id
. Caller is responsible
for freeing returned object with xmlSecKeyDataStoreDestroy function.
void
xmlSecKeyDataStoreDestroy (xmlSecKeyDataStorePtr store
);
Destroys the key data store created with xmlSecKeyDataStoreCreate function.
#define xmlSecKeyDataStoreGetName(store)
Macro. Returns key data store name.
#define xmlSecKeyDataStoreIsValid(store)
Macro. Returns 1 if store
is not NULL and store->id
is not NULL
or 0 otherwise.
#define xmlSecKeyDataStoreCheckId(store, storeId)
Macro. Returns 1 if store
is valid and store
's id is equal to storeId
.
#define xmlSecKeyDataStoreCheckSize(store, size)
Macro. Returns 1 if data
is valid and stores
's object has at least size
bytes.
int
(*xmlSecKeyDataStoreInitializeMethod) (xmlSecKeyDataStorePtr store
);
Key data store specific initialization method.
void
(*xmlSecKeyDataStoreFinalizeMethod) (xmlSecKeyDataStorePtr store
);
Key data store specific finalization (destroy) method.
#define xmlSecKeyDataStoreKlassGetName(klass)
Macro. Returns store klass name.
xmlSecPtrListId
xmlSecKeyDataStorePtrListGetKlass (void
);
Key data stores list.
void
xmlSecImportSetPersistKey (void
);
Sets global flag to import keys to persistent storage (MSCrypto and MSCNG). Also see PKCS12_NO_PERSIST_KEY.
typedef unsigned int xmlSecKeyDataUsage;
The bits mask that determines possible keys data usage.
#define xmlSecKeyDataUsageKeyInfoNodeRead 0x00001
The key data could be read from a <dsig:KeyInfo/> child.
#define xmlSecKeyDataUsageKeyInfoNodeWrite 0x00002
The key data could be written to a <dsig:KeyInfo /> child.
#define xmlSecKeyDataUsageKeyValueNodeRead 0x00004
The key data could be read from a <dsig:KeyValue /> child.
#define xmlSecKeyDataUsageKeyValueNodeWrite 0x00008
The key data could be written to a <dsig:KeyValue /> child.
#define xmlSecKeyDataUsageRetrievalMethodNodeXml 0x00010
The key data could be retrieved using <dsig:RetrievalMethod /> node in XML format.
#define xmlSecKeyDataUsageRetrievalMethodNodeBin 0x00020
The key data could be retrieved using <dsig:RetrievalMethod /> node in binary format.
#define xmlSecKeyDataUsageReadFromFile 0x00040
The key data could be read from a file.
#define xmlSecKeyDataUsageKeyInfoNode
The key data could be read and written from/to a <dsig:KeyInfo /> child.
#define xmlSecKeyDataUsageKeyValueNode
The key data could be read and written from/to a <dsig:KeyValue /> child.
#define xmlSecKeyDataUsageRetrievalMethodNode
The key data could be retrieved using <dsig:RetrievalMethod /> node in any format.
typedef unsigned int xmlSecKeyDataType;
The key data type (public/private, session/permanent, etc.).
#define xmlSecKeyDataTypeUnknown 0x0000
The key data type is unknown (same as xmlSecKeyDataTypeNone).
#define xmlSecKeyDataTypeNone xmlSecKeyDataTypeUnknown
The key data type is unknown (same as xmlSecKeyDataTypeUnknown).
#define xmlSecKeyDataTypePrivate 0x0002
The key data contain a private key.
#define xmlSecKeyDataTypeSymmetric 0x0004
The key data contain a symmetric key.
#define xmlSecKeyDataTypeSession 0x0008
The key data contain session key (one time key, not stored in keys manager).
#define xmlSecKeyDataTypePermanent 0x0010
The key data contain permanent key (stored in keys manager).
The key data format (binary, der, pem, etc.).
the key data format is unknown. |
||
the binary key data. |
||
the PEM key data (cert or public/private key). |
||
the DER key data (cert or public/private key). |
||
the PKCS8 PEM private key. |
||
the PKCS8 DER private key. |
||
the PKCS12 format (bag of keys and certs) |
||
the PEM cert. |
||
the DER cert. |
||
the crypto engine (e.g. OpenSSL ENGINE). |
||
the crypto store (e.g. OpenSSL ossl_store). |
struct xmlSecKeyData { xmlSecKeyDataId id; void* reserved0; void* reserved1; };
The key data: key value (crypto material), x509 data, pgp data, etc.
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 |
the klass size. |
|
xmlSecSize |
the object size. |
|
the object name. |
||
xmlSecKeyDataUsage |
the allowed data usage. |
|
the identification string (href). |
||
the data's XML node name. |
||
the data's XML node namespace. |
||
xmlSecKeyDataInitMethod |
the initialization method. |
|
xmlSecKeyDataDuplicateMethod |
the duplicate (copy) method. |
|
xmlSecKeyDataFinalizeMethod |
the finalization (destroy) method. |
|
xmlSecKeyDataGenerateMethod |
the new data generation method. |
|
xmlSecKeyDataGetTypeMethod |
the method to access data's type information. |
|
xmlSecKeyDataGetSizeMethod |
the method to access data's size. |
|
xmlSecKeyDataGetIdentifierMethod |
the method to access data's string identifier. |
|
xmlSecKeyDataXmlReadMethod |
the method for reading data from XML node. |
|
xmlSecKeyDataXmlWriteMethod |
the method for writing data to XML node. |
|
xmlSecKeyDataBinReadMethod |
the method for reading data from a binary buffer. |
|
xmlSecKeyDataBinWriteMethod |
the method for writing data to binary buffer. |
|
xmlSecKeyDataDebugDumpMethod |
the method for printing debug data information. |
|
xmlSecKeyDataDebugDumpMethod |
the method for printing debug data information in XML format. |
|
reserved for the future. |
||
reserved for the future. |
#define xmlSecKeyDataListId xmlSecKeyDataListGetKlass()
The key data klasses list klass id.
#define xmlSecKeyDataIdListId xmlSecKeyDataIdListGetKlass()
The key data list klass id.
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.
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 |
the data store klass size. |
|
xmlSecSize |
the data store obj size. |
|
the store's name. |
||
xmlSecKeyDataStoreInitializeMethod |
the store's initialization method. |
|
xmlSecKeyDataStoreFinalizeMethod |
the store's finalization (destroy) method. |
|
reserved for the future. |
||
reserved for the future. |