# MsCng Keys Store

**API Group:** `xmlsec_mscng_keysstore`

MsCng-specific key store implementation.

Keys store implementation for Microsoft Cryptography API: Next Generation (CNG).

## Macros

### `xmlSecMSCngKeysStoreId`

*Defined as:* `xmlSecMSCngKeysStoreGetKlass()`

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

A MSCng keys store klass id.

---

## Functions

### `xmlSecMSCngKeysStoreGetKlass`

```c
xmlSecKeyStoreId xmlSecMSCngKeysStoreGetKlass(void);
```

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

The MSCng list based keys store klass.

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

---

### `xmlSecMSCngKeysStoreAdoptKey`

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

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

Adds `key` to the `store`.

**Parameters:**

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


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

---

### `xmlSecMSCngKeysStoreLoad`

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

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

Reads keys from an XML file.

**Parameters:**

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


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

---

### `xmlSecMSCngKeysStoreSave`

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

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

Writes keys from `store` to an XML file.

**Parameters:**

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


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

---
