# NSS Keys Store

**API Group:** `xmlsec_nss_keysstore`

NSS-specific key store implementation.

Keys store implementation for NSS.

Nss keys store that uses Simple Keys Store under the hood. Uses the NSS DB as a backing store for the finding keys, but the NSS DB is not written to by the keys store. So, if store->findkey is done and the key is not found in the simple keys store, the NSS DB is looked up. If store is called to adopt a key, that key is not written to the NSS DB. Thus, the NSS DB can be used to pre-load keys and becomes an alternate source of keys for xmlsec

## Macros

### `xmlSecNssKeysStoreId`

*Defined as:* `xmlSecNssKeysStoreGetKlass()`

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

A Nss keys store klass id.

---

## Functions

### `xmlSecNssKeysStoreGetKlass`

```c
xmlSecKeyStoreId xmlSecNssKeysStoreGetKlass(void);
```

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

The Nss list based keys store klass.

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

---

### `xmlSecNssKeysStoreAdoptKey`

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

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

Adds `key` to the `store`.

**Parameters:**

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


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

---

### `xmlSecNssKeysStoreLoad`

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

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

Reads keys from an XML file.

**Parameters:**

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


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

---

### `xmlSecNssKeysStoreSave`

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

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

Writes keys from `store` to an XML file.

**Parameters:**

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


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

---
