# GnuTLS Keys Store

**API Group:** `xmlsec_gnutls_keysstore`

GnuTLS-specific key store implementation.

Keys store implementation for GNUTLS. GnuTLS keys store that uses Simple Keys Store under the hood.

## Macros

### `xmlSecGnuTLSKeysStoreId`

*Defined as:* `xmlSecGnuTLSKeysStoreGetKlass()`

*Source:* [include/xmlsec/gnutls/keysstore.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/gnutls/keysstore.h#L26)

A GnuTLS keys store klass id.

---

## Functions

### `xmlSecGnuTLSKeysStoreGetKlass`

```c
xmlSecKeyStoreId xmlSecGnuTLSKeysStoreGetKlass(void);
```

*Source:* [include/xmlsec/gnutls/keysstore.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/gnutls/keysstore.h#L27)

The GnuTLS list based keys store klass.

**Returns:** GnuTLS list based keys store klass.

---

### `xmlSecGnuTLSKeysStoreAdoptKey`

```c
int xmlSecGnuTLSKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key);
```

*Source:* [include/xmlsec/gnutls/keysstore.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/gnutls/keysstore.h#L29)

Adds `key` to the `store`.

**Parameters:**

- `store` — the pointer to GnuTLS keys store.
- `key` — the pointer to key.


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

---

### `xmlSecGnuTLSKeysStoreLoad`

```c
int xmlSecGnuTLSKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri, xmlSecKeysMngrPtr keysMngr);
```

*Source:* [include/xmlsec/gnutls/keysstore.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/gnutls/keysstore.h#L31)

Reads keys from an XML file.

**Parameters:**

- `store` — the pointer to GnuTLS keys store.
- `uri` — the filename.
- `keysMngr` — the pointer to associated keys manager.


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

---

### `xmlSecGnuTLSKeysStoreSave`

```c
int xmlSecGnuTLSKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecKeyDataType type);
```

*Source:* [include/xmlsec/gnutls/keysstore.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/gnutls/keysstore.h#L34)

Writes keys from `store` to an XML file.

**Parameters:**

- `store` — the pointer to GnuTLS keys store.
- `filename` — the filename.
- `type` — the saved keys type (public, private, ...).


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

---
