Skip to content

API XMLSec Core KeysMngr

Aleksey Sanin edited this page Jun 22, 2026 · 5 revisions

Keys Manager

API Group: xmlsec_core_keysmngr

Keys manager — locating and verifying keys.

Keys manager object functions.

Macros

xmlSecKeyStoreGetName

Defined as: ((xmlSecKeyStoreIsValid((store))) ? \ xmlSecKeyStoreKlassGetName((store)->id) : NULL)

Source: include/xmlsec/keysmngr.h

Macro. Returns key store name.

Parameters:

  • store — the pointer to store.

xmlSecKeyStoreIsValid

Defined as: ((( store ) != NULL) && ((( store )->id) != NULL))

Source: include/xmlsec/keysmngr.h

Macro. Returns 1 if store is not NULL and store->id is not NULL.

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

Parameters:

  • store — the pointer to store.

xmlSecKeyStoreCheckId

Defined as: (xmlSecKeyStoreIsValid(( store )) && \ ((( store )->id) == ( storeId )))

Source: include/xmlsec/keysmngr.h

Macro. Returns 1 if store is valid and store id matches storeId.

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

Parameters:

  • store — the pointer to store.
  • storeId — the store Id.

xmlSecKeyStoreCheckSize

Defined as: (xmlSecKeyStoreIsValid(( store )) && \ (( store )->id->objSize >= size))

Source: include/xmlsec/keysmngr.h

Macro. Returns 1 if store is valid and object size meets minimum.

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

Parameters:

  • store — the pointer to store.
  • size — the expected size.

xmlSecKeyStoreIdUnknown

Defined as: ((xmlSecKeyDataStoreId)NULL)

Source: include/xmlsec/keysmngr.h

The "unknown" id.


xmlSecKeyStoreKlassGetName

Defined as: (((klass)) ? ((klass)->name) : NULL)

Source: include/xmlsec/keysmngr.h

Macro. Returns store klass name.

Parameters:

  • klass — the pointer to store klass.

xmlSecSimpleKeysStoreId

Defined as: xmlSecSimpleKeysStoreGetKlass()

Source: include/xmlsec/keysmngr.h

A simple keys store klass id.


Typedefs

xmlSecKeyKlass

typedef const struct _xmlSecKeyKlass xmlSecKeyKlass;

Source: include/xmlsec/keysmngr.h

The key klass.


xmlSecKeyId

typedef const struct _xmlSecKeyKlass* xmlSecKeyId;

Source: include/xmlsec/keysmngr.h

Pointer to xmlSecKeyKlass.


xmlSecKeyStoreKlass

typedef const struct _xmlSecKeyStoreKlass xmlSecKeyStoreKlass;

Source: include/xmlsec/keysmngr.h

The key store klass.


xmlSecKeyStoreId

typedef const struct _xmlSecKeyStoreKlass* xmlSecKeyStoreId;

Source: include/xmlsec/keysmngr.h

Pointer to xmlSecKeyStoreKlass.


xmlSecGetKeyCallback

typedef xmlSecKeyPtr(* xmlSecGetKeyCallback) (xmlNodePtr keyInfoNode, xmlSecKeyInfoCtxPtr keyInfoCtx))(xmlNodePtr keyInfoNode, xmlSecKeyInfoCtxPtr keyInfoCtx);

Source: include/xmlsec/keysmngr.h

Reads the dsig:KeyInfo/ node and extracts the key.

Reads the dsig:KeyInfo/ node keyInfoNode and extracts the key.

Parameters:

  • keyInfoNode — the pointer to dsig:KeyInfo/ node.
  • keyInfoCtx — the pointer to dsig:KeyInfo/ node processing context.

Returns: the pointer to key or NULL if the key is not found or an error occurs.


xmlSecKeyStoreInitializeMethod

typedef int(* xmlSecKeyStoreInitializeMethod) (xmlSecKeyStorePtr store))(xmlSecKeyStorePtr store);

Source: include/xmlsec/keysmngr.h

Keys store specific initialization method.

Parameters:

  • store — the store.

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


xmlSecKeyStoreFinalizeMethod

typedef void(* xmlSecKeyStoreFinalizeMethod) (xmlSecKeyStorePtr store))(xmlSecKeyStorePtr store);

Source: include/xmlsec/keysmngr.h

Keys store specific finalization (destroy) method.

Parameters:

  • store — the store.

xmlSecKeyStoreFindKeyMethod

typedef xmlSecKeyPtr(* xmlSecKeyStoreFindKeyMethod) (xmlSecKeyStorePtr store, const xmlChar *name, xmlSecKeyInfoCtxPtr keyInfoCtx))(xmlSecKeyStorePtr store, const xmlChar *name, xmlSecKeyInfoCtxPtr keyInfoCtx);

Source: include/xmlsec/keysmngr.h

Keys store specific find method by key name.

Keys store specific find method. The caller is responsible for destroying the returned key using xmlSecKeyDestroy method.

Parameters:

  • store — the store.
  • name — the desired key name.
  • keyInfoCtx — the pointer to key info context.

Returns: the pointer to a key or NULL if key is not found or an error occurs.


xmlSecKeyStoreFindKeyFromX509DataMethod

typedef xmlSecKeyPtr(* xmlSecKeyStoreFindKeyFromX509DataMethod) (xmlSecKeyStorePtr store, xmlSecKeyX509DataValuePtr x509Data, xmlSecKeyInfoCtxPtr keyInfoCtx))(xmlSecKeyStorePtr store, xmlSecKeyX509DataValuePtr x509Data, xmlSecKeyInfoCtxPtr keyInfoCtx);

Source: include/xmlsec/keysmngr.h

Keys store specific find method by X509 data.

Keys store specific find method. The caller is responsible for destroying the returned key using xmlSecKeyDestroy method.

Parameters:

  • store — the store.
  • x509Data — the x509 data to lookup key.
  • keyInfoCtx — the pointer to key info context.

Returns: the pointer to a key or NULL if key is not found or an error occurs.


xmlSecSimpleKeysStoreAdoptKeyFunc

typedef int(* xmlSecSimpleKeysStoreAdoptKeyFunc) (xmlSecKeyStorePtr store, xmlSecKeyPtr key))(xmlSecKeyStorePtr store, xmlSecKeyPtr key);

Source: include/xmlsec/keysmngr.h

Adds key to the store.

Adds key to the store. On success, the store owns the key.

Parameters:

  • store — the pointer to key store.
  • key — the pointer to key.

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


Functions

xmlSecKeysMngrCreate

xmlSecKeysMngrPtr xmlSecKeysMngrCreate(void);

Source: include/xmlsec/keysmngr.h

Creates a new keys manager.

Creates new keys manager. Caller is responsible for freeing it with xmlSecKeysMngrDestroy function.

Returns: the pointer to newly allocated keys manager or NULL if an error occurs.


xmlSecKeysMngrDestroy

void xmlSecKeysMngrDestroy(xmlSecKeysMngrPtr mngr);

Source: include/xmlsec/keysmngr.h

Destroys a keys manager.

Destroys keys manager created with xmlSecKeysMngrCreate function.

Parameters:

  • mngr — the pointer to keys manager.

xmlSecKeysMngrFindKey

xmlSecKeyPtr xmlSecKeysMngrFindKey(xmlSecKeysMngrPtr mngr, const xmlChar *name, xmlSecKeyInfoCtxPtr keyInfoCtx);

Source: include/xmlsec/keysmngr.h

Looks up a key in the keys manager keys store.

Lookups key in the keys manager keys store. The caller is responsible for destroying the returned key using xmlSecKeyDestroy method.

Parameters:

  • mngr — the pointer to keys manager.
  • name — the desired key name.
  • keyInfoCtx — the pointer to dsig:KeyInfo/ node processing context.

Returns: the pointer to a key or NULL if key is not found or an error occurs.


xmlSecKeysMngrFindKeyFromX509Data

xmlSecKeyPtr xmlSecKeysMngrFindKeyFromX509Data(xmlSecKeysMngrPtr mngr, xmlSecKeyX509DataValuePtr x509Data, xmlSecKeyInfoCtxPtr keyInfoCtx);

Source: include/xmlsec/keysmngr.h

Looks up a key by X.509 data in the keys manager keys store.

Lookups key in the keys manager keys store. The caller is responsible for destroying the returned key using xmlSecKeyDestroy method.

Parameters:

  • mngr — the pointer to keys manager.
  • x509Data — the X509 data to use for searching the keys.
  • keyInfoCtx — the pointer to dsig:KeyInfo/ node processing context.

Returns: the pointer to a key or NULL if key is not found or an error occurs.


xmlSecKeysMngrAdoptKeysStore

int xmlSecKeysMngrAdoptKeysStore(xmlSecKeysMngrPtr mngr, xmlSecKeyStorePtr store);

Source: include/xmlsec/keysmngr.h

Adopts keys store in the keys manager mngr.

Parameters:

  • mngr — the pointer to keys manager.
  • store — the pointer to keys store.

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


xmlSecKeysMngrGetKeysStore

xmlSecKeyStorePtr xmlSecKeysMngrGetKeysStore(xmlSecKeysMngrPtr mngr);

Source: include/xmlsec/keysmngr.h

Gets the keys store.

Parameters:

  • mngr — the pointer to keys manager.

Returns: the keys store in the keys manager mngr or NULL if there is no store or an error occurs.


xmlSecKeysMngrAdoptDataStore

int xmlSecKeysMngrAdoptDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStorePtr store);

Source: include/xmlsec/keysmngr.h

Adopts data store in the keys manager.

Parameters:

  • mngr — the pointer to keys manager.
  • store — the pointer to data store.

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


xmlSecKeysMngrGetDataStore

xmlSecKeyDataStorePtr xmlSecKeysMngrGetDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStoreId id);

Source: include/xmlsec/keysmngr.h

Looks up a data store by klass in the keys manager.

Lookups the data store of given klass id in the keys manager.

Parameters:

  • mngr — the pointer to keys manager.
  • id — the desired data store klass.

Returns: pointer to data store or NULL if it is not found or an error occurs.


xmlSecKeysMngrGetKey

xmlSecKeyPtr xmlSecKeysMngrGetKey(xmlNodePtr keyInfoNode, xmlSecKeyInfoCtxPtr keyInfoCtx);

Source: include/xmlsec/keysmngr.h

Reads a KeyInfo node and extracts the key.

Reads the dsig:KeyInfo/ node keyInfoNode and extracts the key.

Parameters:

  • keyInfoNode — the pointer to dsig:KeyInfo/ node.
  • keyInfoCtx — the pointer to dsig:KeyInfo/ node processing context.

Returns: the pointer to key or NULL if the key is not found or an error occurs.


xmlSecKeyStoreCreate

xmlSecKeyStorePtr xmlSecKeyStoreCreate(xmlSecKeyStoreId id);

Source: include/xmlsec/keysmngr.h

Creates a new keys store of the specified klass.

Creates new store of the specified klass klass. Caller is responsible for freeing the returned store by calling xmlSecKeyStoreDestroy function.

Parameters:

  • id — the key store klass.

Returns: the pointer to newly allocated keys store or NULL if an error occurs.


xmlSecKeyStoreDestroy

void xmlSecKeyStoreDestroy(xmlSecKeyStorePtr store);

Source: include/xmlsec/keysmngr.h

Destroys a keys store.

Destroys the store created with xmlSecKeyStoreCreate function.

Parameters:

  • store — the pointer to keys store.

xmlSecKeyStoreFindKey

xmlSecKeyPtr xmlSecKeyStoreFindKey(xmlSecKeyStorePtr store, const xmlChar *name, xmlSecKeyInfoCtxPtr keyInfoCtx);

Source: include/xmlsec/keysmngr.h

Looks up a key in the store by name.

Lookups key in the store. The caller is responsible for destroying the returned key using xmlSecKeyDestroy method.

Parameters:

  • store — the pointer to keys store.
  • name — the desired key name.
  • keyInfoCtx — the pointer to dsig:KeyInfo/ node processing context.

Returns: the pointer to a key or NULL if key is not found or an error occurs.


xmlSecKeyStoreFindKeyFromX509Data

xmlSecKeyPtr xmlSecKeyStoreFindKeyFromX509Data(xmlSecKeyStorePtr store, xmlSecKeyX509DataValuePtr x509Data, xmlSecKeyInfoCtxPtr keyInfoCtx);

Source: include/xmlsec/keysmngr.h

Looks up a key by X.509 data in the store.

Lookups key in the store. The caller is responsible for destroying the returned key using xmlSecKeyDestroy method.

Parameters:

  • store — the pointer to keys store.
  • x509Data — the X509 data to use for search.
  • keyInfoCtx — the pointer to dsig:KeyInfo/ node processing context.

Returns: the pointer to a key or NULL if key is not found or an error occurs.


xmlSecSimpleKeysStoreGetKlass

xmlSecKeyStoreId xmlSecSimpleKeysStoreGetKlass(void);

Source: include/xmlsec/keysmngr.h

The simple list based keys store klass.

Returns: simple list based keys store klass.


xmlSecSimpleKeysStoreAdoptKey

int xmlSecSimpleKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key);

Source: include/xmlsec/keysmngr.h

Adds key to the store.

Parameters:

  • store — the pointer to simple keys store.
  • key — the pointer to key.

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


xmlSecSimpleKeysStoreLoad

int xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri, xmlSecKeysMngrPtr keysMngr);

Source: include/xmlsec/keysmngr.h

Reads keys from an XML file.

Parameters:

  • store — the pointer to simple keys store.
  • uri — the filename.
  • keysMngr — the pointer to associated keys manager.

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


xmlSecSimpleKeysStoreLoad_ex

int xmlSecSimpleKeysStoreLoad_ex(xmlSecKeyStorePtr store, const char *uri, xmlSecKeysMngrPtr keysMngr, xmlSecSimpleKeysStoreAdoptKeyFunc adoptKeyFunc);

Source: include/xmlsec/keysmngr.h

Reads keys from an XML file using a custom adopt callback.

Reads keys from an XML file.

Parameters:

  • store — the pointer to simple keys store.
  • uri — the filename.
  • keysMngr — the pointer to associated keys manager.
  • adoptKeyFunc — the callback to add the key to keys manager.

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


xmlSecSimpleKeysStoreSave

int xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecKeyDataType type);

Source: include/xmlsec/keysmngr.h

Writes keys from store to an XML file.

Parameters:

  • store — the pointer to simple keys store.
  • filename — the filename.
  • type — the saved keys type (public, private, ...).

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


xmlSecSimpleKeysStoreGetKeys

xmlSecPtrListPtr xmlSecSimpleKeysStoreGetKeys(xmlSecKeyStorePtr store);

Source: include/xmlsec/keysmngr.h

Gets list of keys from simple keys store.

Parameters:

  • store — the pointer to simple keys store.

Returns: pointer to the list of keys stored in the keys store or NULL if an error occurs.


Clone this wiki locally