## certkeys

certkeys — Certificate keys support functions for Microsoft Cryptography API: Next Generation (CNG).

## Stability Level

Stable, unless otherwise indicated

## Functions

xmlSecKeyDataPtr | xmlSecMSCngCertAdopt ()
BCRYPT_KEY_HANDLE | xmlSecMSCngKeyDataGetPubKey ()
NCRYPT_KEY_HANDLE | xmlSecMSCngKeyDataGetPrivKey ()

## Description

## Functions

### xmlSecMSCngCertAdopt ()

    xmlSecKeyDataPtr
    xmlSecMSCngCertAdopt (PCCERT_CONTEXT pCert,
                          xmlSecKeyDataType type);

Creates key data value from the cert.

#### Parameters

pCert | the pointer to cert. |
type | the expected key type. |

#### Returns

pointer to newly created xmlsec key or NULL if an error occurs.

### xmlSecMSCngKeyDataGetPubKey ()

    BCRYPT_KEY_HANDLE
    xmlSecMSCngKeyDataGetPubKey (xmlSecKeyDataPtr data);

Native MSCng public key retrieval from xmlsec keydata. The returned key must not be destroyed by the caller.

#### Parameters

data | the key data to retrieve certificate from. |

#### Returns

key on success or 0 otherwise.

### xmlSecMSCngKeyDataGetPrivKey ()

    NCRYPT_KEY_HANDLE
    xmlSecMSCngKeyDataGetPrivKey (xmlSecKeyDataPtr data);

Native MSCng private key retrieval from xmlsec keydata. The returned key must not be destroyed by the caller.

#### Parameters

data | the key data to retrieve certificate from. |

#### Returns

key on success or 0 otherwise.