Functions
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.
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.
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.
xmlSecKeyDataIdsRegister ()
int
xmlSecKeyDataIdsRegister (xmlSecKeyDataId id
);
Registers id
in the global list of key data klasses.
Returns
0 on success or a negative value if an error occurs.
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.
Returns
the pointer to newly allocated key data structure
or NULL if an error occurs.
xmlSecKeyDataDuplicate ()
xmlSecKeyDataPtr
xmlSecKeyDataDuplicate (xmlSecKeyDataPtr data
);
Creates a duplicate of the given data
. Caller is responsible for
destroying returned object with xmlSecKeyDataDestroy function.
Returns
the pointer to newly allocated key data structure
or NULL if an error occurs.
xmlSecKeyDataDestroy ()
void
xmlSecKeyDataDestroy (xmlSecKeyDataPtr data
);
Destroys the data and frees all allocated memory.
xmlSecKeyDataGenerate ()
int
xmlSecKeyDataGenerate (xmlSecKeyDataPtr data
,
xmlSecSize sizeBits
,
xmlSecKeyDataType type
);
Generates new key data of given size and type.
Returns
0 on success or a negative value otherwise.
xmlSecKeyDataGetSize ()
xmlSecSize
xmlSecKeyDataGetSize (xmlSecKeyDataPtr data
);
Gets key data size.
Returns
key data size (in bits).
xmlSecKeyDataGetIdentifier ()
const xmlChar *
xmlSecKeyDataGetIdentifier (xmlSecKeyDataPtr data
);
Gets key data identifier string.
Returns
key data id string.
xmlSecKeyDataDebugDump ()
void
xmlSecKeyDataDebugDump (xmlSecKeyDataPtr data
,
FILE *output
);
Prints key data debug info.
xmlSecKeyDataDebugXmlDump ()
void
xmlSecKeyDataDebugXmlDump (xmlSecKeyDataPtr data
,
FILE *output
);
Prints key data debug info in XML format.
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
.
Returns
0 on success or a negative value otherwise.
xmlSecKeyDataXmlWrite ()
int
xmlSecKeyDataXmlWrite (xmlSecKeyDataId id
,
xmlSecKeyPtr key
,
xmlNodePtr node
,
xmlSecKeyInfoCtxPtr keyInfoCtx
);
Writes the key data of klass id
from key
to an XML node
.
Returns
0 on success or a negative value otherwise.
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
.
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
.
Returns
0 on success or a negative value if an error occurs.
xmlSecKeyDataGetName()
#define xmlSecKeyDataGetName(data)
Macro. Returns the key data name.
xmlSecKeyDataIsValid()
#define xmlSecKeyDataIsValid(data)
Macro. Returns 1 if data
is not NULL and data->id
is not NULL
or 0 otherwise.
xmlSecKeyDataCheckId()
#define xmlSecKeyDataCheckId(data, dataId)
Macro. Returns 1 if data
is valid and data
's id is equal to dataId
.
xmlSecKeyDataCheckUsage()
#define xmlSecKeyDataCheckUsage(data, usg)
Macro. Returns 1 if data
is valid and could be used for usg
.
xmlSecKeyDataCheckSize()
#define xmlSecKeyDataCheckSize(data, size)
Macro. Returns 1 if data
is valid and data
's object has at least size
bytes.
xmlSecKeyDataInitMethod ()
int
(*xmlSecKeyDataInitMethod) (xmlSecKeyDataPtr data
);
Key data specific initialization method.
Returns
0 on success or a negative value if an error occurs.
xmlSecKeyDataDuplicateMethod ()
int
(*xmlSecKeyDataDuplicateMethod) (xmlSecKeyDataPtr dst
,
xmlSecKeyDataPtr src
);
Key data specific duplication (copy) method.
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.
xmlSecKeyDataXmlReadMethod ()
int
(*xmlSecKeyDataXmlReadMethod) (xmlSecKeyDataId id
,
xmlSecKeyPtr key
,
xmlNodePtr node
,
xmlSecKeyInfoCtxPtr keyInfoCtx
);
Key data specific method for reading XML node.
Returns
0 on success or a negative value if an error occurs.
xmlSecKeyDataXmlWriteMethod ()
int
(*xmlSecKeyDataXmlWriteMethod) (xmlSecKeyDataId id
,
xmlSecKeyPtr key
,
xmlNodePtr node
,
xmlSecKeyInfoCtxPtr keyInfoCtx
);
Key data specific method for writing XML node.
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.
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.
Returns
0 on success or a negative value if an error occurs.
xmlSecKeyDataGenerateMethod ()
int
(*xmlSecKeyDataGenerateMethod) (xmlSecKeyDataPtr data
,
xmlSecSize sizeBits
,
xmlSecKeyDataType type
);
Key data specific method for generating new key data.
Returns
0 on success or a negative value if an error occurs.
xmlSecKeyDataGetSizeMethod ()
xmlSecSize
(*xmlSecKeyDataGetSizeMethod) (xmlSecKeyDataPtr data
);
Key data specific method to get the key size.
Returns
the key size in bits.
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).
Returns
the identifier string or NULL if an error occurs.
xmlSecKeyDataDebugDumpMethod ()
void
(*xmlSecKeyDataDebugDumpMethod) (xmlSecKeyDataPtr data
,
FILE *output
);
Key data specific method for printing debug info.
xmlSecKeyDataKlassGetName()
#define xmlSecKeyDataKlassGetName(klass)
Macro. Returns data klass name.
xmlSecKeyDataListGetKlass ()
xmlSecPtrListId
xmlSecKeyDataListGetKlass (void
);
The key data list klass.
Returns
pointer to the key data list klass.
xmlSecKeyDataIdListGetKlass ()
xmlSecPtrListId
xmlSecKeyDataIdListGetKlass (void
);
The key data id list klass.
Returns
pointer to the key data id list klass.
xmlSecKeyDataIdListFind ()
int
xmlSecKeyDataIdListFind (xmlSecPtrListPtr list
,
xmlSecKeyDataId dataId
);
Lookups dataId
in list
.
Returns
1 if dataId
is found in the list
, 0 if not and a negative
value if an error occurs.
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
.
Returns
key data klass is found and NULL otherwise.
xmlSecKeyDataIdListFindByHref ()
xmlSecKeyDataId
xmlSecKeyDataIdListFindByHref (xmlSecPtrListPtr list
,
const xmlChar *href
,
xmlSecKeyDataUsage usage
);
Lookups data klass in the list with given href
and usage
in list
.
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
.
Returns
key data klass is found and NULL otherwise.
xmlSecKeyDataIdListDebugDump ()
void
xmlSecKeyDataIdListDebugDump (xmlSecPtrListPtr list
,
FILE *output
);
Prints binary key data debug information to output
.
xmlSecKeyDataIdListDebugXmlDump ()
void
xmlSecKeyDataIdListDebugXmlDump (xmlSecPtrListPtr list
,
FILE *output
);
Prints binary key data debug information to output
in XML format.
xmlSecKeyDataBinaryValueInitialize ()
int
xmlSecKeyDataBinaryValueInitialize (xmlSecKeyDataPtr data
);
Initializes key data.
Returns
0 on success or a negative value otherwise.
xmlSecKeyDataBinaryValueDuplicate ()
int
xmlSecKeyDataBinaryValueDuplicate (xmlSecKeyDataPtr dst
,
xmlSecKeyDataPtr src
);
Copies binary key data from src
to dst
.
Returns
0 on success or a negative value otherwise.
xmlSecKeyDataBinaryValueFinalize ()
void
xmlSecKeyDataBinaryValueFinalize (xmlSecKeyDataPtr data
);
Cleans up binary key data.
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.
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.
Returns
0 on success or a negative value otherwise.
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
.
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
.
Returns
0 on success or a negative value otherwise.
xmlSecKeyDataBinaryValueDebugDump ()
void
xmlSecKeyDataBinaryValueDebugDump (xmlSecKeyDataPtr data
,
FILE *output
);
Prints binary key data debug information to output
.
xmlSecKeyDataBinaryValueDebugXmlDump ()
void
xmlSecKeyDataBinaryValueDebugXmlDump (xmlSecKeyDataPtr data
,
FILE *output
);
Prints binary key data debug information to output
in XML format.
xmlSecKeyDataBinaryValueGetSize ()
xmlSecSize
xmlSecKeyDataBinaryValueGetSize (xmlSecKeyDataPtr data
);
Gets the binary key data size.
Returns
binary key data size in bits.
xmlSecKeyDataBinaryValueGetBuffer ()
xmlSecBufferPtr
xmlSecKeyDataBinaryValueGetBuffer (xmlSecKeyDataPtr data
);
Gets the binary key data buffer.
Returns
pointer to binary key data buffer.
xmlSecKeyDataBinaryValueSetBuffer ()
int
xmlSecKeyDataBinaryValueSetBuffer (xmlSecKeyDataPtr data
,
const xmlSecByte *buf
,
xmlSecSize bufSize
);
Sets the value of data
to buf
.
Returns
0 on success or a negative value otherwise.
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.
Returns
the pointer to newly allocated key data store structure
or NULL if an error occurs.
xmlSecKeyDataStoreGetName()
#define xmlSecKeyDataStoreGetName(store)
Macro. Returns key data store name.
xmlSecKeyDataStoreIsValid()
#define xmlSecKeyDataStoreIsValid(store)
Macro. Returns 1 if store
is not NULL and store->id
is not NULL
or 0 otherwise.
xmlSecKeyDataStoreCheckId()
#define xmlSecKeyDataStoreCheckId(store, storeId)
Macro. Returns 1 if store
is valid and store
's id is equal to storeId
.
xmlSecKeyDataStoreCheckSize()
#define xmlSecKeyDataStoreCheckSize(store, size)
Macro. Returns 1 if data
is valid and stores
's object has at least size
bytes.
xmlSecKeyDataStoreInitializeMethod ()
int
(*xmlSecKeyDataStoreInitializeMethod) (xmlSecKeyDataStorePtr store
);
Key data store specific initialization method.
Returns
0 on success or a negative value if an error occurs.
xmlSecKeyDataStoreFinalizeMethod ()
void
(*xmlSecKeyDataStoreFinalizeMethod) (xmlSecKeyDataStorePtr store
);
Key data store specific finalization (destroy) method.
xmlSecKeyDataStoreKlassGetName()
#define xmlSecKeyDataStoreKlassGetName(klass)
Macro. Returns store klass name.
xmlSecKeyDataStorePtrListGetKlass ()
xmlSecPtrListId
xmlSecKeyDataStorePtrListGetKlass (void
);
Key data stores list.
Returns
key data stores list klass.
Types and Values
xmlSecKeyDataUsage
typedef unsigned int xmlSecKeyDataUsage;
The bits mask that determines possible keys data usage.
xmlSecKeyDataUsageUnknown
#define xmlSecKeyDataUsageUnknown 0x00000
The key data usage is unknown.
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.
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.
xmlSecKeyDataUsageRetrievalMethodNodeXml
#define xmlSecKeyDataUsageRetrievalMethodNodeXml 0x00010
The key data could be retrieved using <dsig:RetrievalMethod /> node
in XML format.
xmlSecKeyDataUsageRetrievalMethodNodeBin
#define xmlSecKeyDataUsageRetrievalMethodNodeBin 0x00020
The key data could be retrieved using <dsig:RetrievalMethod /> node
in binary format.
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.
xmlSecKeyDataUsageKeyValueNode
#define xmlSecKeyDataUsageKeyValueNode
The key data could be read and written from/to a <dsig:KeyValue /> child.
xmlSecKeyDataUsageRetrievalMethodNode
#define xmlSecKeyDataUsageRetrievalMethodNode
The key data could be retrieved using <dsig:RetrievalMethod /> node
in any format.
xmlSecKeyDataType
typedef unsigned int xmlSecKeyDataType;
The key data type (public/private, session/permanet, etc.).
xmlSecKeyDataTypeUnknown
#define xmlSecKeyDataTypeUnknown 0x0000
The key data type is unknown (same as xmlSecKeyDataTypeNone).
xmlSecKeyDataTypeNone
#define xmlSecKeyDataTypeNone xmlSecKeyDataTypeUnknown
The key data type is unknown (same as xmlSecKeyDataTypeUnknown).
xmlSecKeyDataTypePublic
#define xmlSecKeyDataTypePublic 0x0001
The key data contain a public key.
xmlSecKeyDataTypePrivate
#define xmlSecKeyDataTypePrivate 0x0002
The key data contain a private key.
xmlSecKeyDataTypeSymmetric
#define xmlSecKeyDataTypeSymmetric 0x0004
The key data contain a symmetric key.
xmlSecKeyDataTypeSession
#define xmlSecKeyDataTypeSession 0x0008
The key data contain session key (one time key, not stored in keys manager).
xmlSecKeyDataTypePermanent
#define xmlSecKeyDataTypePermanent 0x0010
The key data contain permanent key (stored in keys manager).
xmlSecKeyDataTypeTrusted
#define xmlSecKeyDataTypeTrusted 0x0100
The key data is trusted.
xmlSecKeyDataTypeAny
#define xmlSecKeyDataTypeAny 0xFFFF
Any key data.
enum xmlSecKeyDataFormat
The key data format (binary, der, pem, etc.).
struct xmlSecKeyData
struct xmlSecKeyData {
xmlSecKeyDataId id;
void* reserved0;
void* reserved1;
};
The key data: key value (crypto material), x509 data, pgp data, etc.
xmlSecKeyDataIdUnknown
#define xmlSecKeyDataIdUnknown ((xmlSecKeyDataId)NULL)
The "unknown" id.
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).
xmlSecKeyDataListId
#define xmlSecKeyDataListId xmlSecKeyDataListGetKlass()
The key data klasses list klass id.
xmlSecKeyDataIdListId
#define xmlSecKeyDataIdListId xmlSecKeyDataIdListGetKlass()
The key data list klass id.
xmlSecKeyDataBinarySize
#define xmlSecKeyDataBinarySize
The binary key data object size.
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.
xmlSecKeyDataStoreIdUnknown
#define xmlSecKeyDataStoreIdUnknown NULL
The "unknown" id.
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).
xmlSecKeyDataStorePtrListId
#define xmlSecKeyDataStorePtrListId xmlSecKeyDataStorePtrListGetKlass()
The data store list id (klass).