## certkeys certkeys — Certificate keys support functions for Microsoft Crypto API. |

## Stability Level

Stable, unless otherwise indicated

## Functions

PCCERT_CONTEXT | xmlSecMSCryptoKeyDataGetCert ()
HCRYPTKEY | xmlSecMSCryptoKeyDataGetKey ()
HCRYPTKEY | xmlSecMSCryptoKeyDataGetDecryptKey ()
PCCERT_CONTEXT | xmlSecMSCryptoCertDup ()
xmlSecKeyDataPtr | xmlSecMSCryptoCertAdopt ()
HCRYPTPROV | xmlSecMSCryptoKeyDataGetMSCryptoProvider ()
DWORD | xmlSecMSCryptoKeyDataGetMSCryptoKeySpec ()
PCRYPT_KEY_PROV_INFO | xmlSecMSCryptoKeyDataGetMSCryptoProviderInfo ()

## Description

## Functions

### xmlSecMSCryptoKeyDataGetCert ()

    PCCERT_CONTEXT
    xmlSecMSCryptoKeyDataGetCert (xmlSecKeyDataPtr data);

Native MSCrypto certificate retrieval from xmlsec keydata. The returned PCCERT_CONTEXT must not be released by the caller.

#### Parameters

data | the key data to retrieve certificate from. |

#### Returns

PCCERT_CONTEXT on success or NULL otherwise.

### xmlSecMSCryptoKeyDataGetKey ()

    HCRYPTKEY
    xmlSecMSCryptoKeyDataGetKey (xmlSecKeyDataPtr data,
                                 xmlSecKeyDataType type);

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

#### Parameters

data | the key data to retrieve certificate from. |
type | type of key requested (public/private) |

#### Returns

HKEY on success or NULL otherwise.

### xmlSecMSCryptoKeyDataGetDecryptKey ()

    HCRYPTKEY
    xmlSecMSCryptoKeyDataGetDecryptKey (xmlSecKeyDataPtr data);

Native MSCrypto decrypt key retrieval from xmlsec keydata. The returned HKEY must not be destroyed by the caller.

#### Parameters

data | the key data pointer |

#### Returns

HKEY on success or NULL otherwise.

### xmlSecMSCryptoCertDup ()

    PCCERT_CONTEXT
    xmlSecMSCryptoCertDup (PCCERT_CONTEXT pCert);

Duplicates the `pCert` .

#### Parameters

pCert | the pointer to cert. |

#### Returns

pointer to newly created PCCERT_CONTEXT object or NULL if an error occurs.

### xmlSecMSCryptoCertAdopt ()

    xmlSecKeyDataPtr
    xmlSecMSCryptoCertAdopt (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.

### xmlSecMSCryptoKeyDataGetMSCryptoProvider ()

    HCRYPTPROV
    xmlSecMSCryptoKeyDataGetMSCryptoProvider
                                   (xmlSecKeyDataPtr data);

Gets crypto provider handle

#### Parameters

data | the key data |

#### Returns

the crypto provider handler or 0 if there is an error.

### xmlSecMSCryptoKeyDataGetMSCryptoKeySpec ()

    DWORD
    xmlSecMSCryptoKeyDataGetMSCryptoKeySpec
                                   (xmlSecKeyDataPtr data);

Gets key spec info.

#### Parameters

data | the key data |

#### Returns

the key spec info from key data

### xmlSecMSCryptoKeyDataGetMSCryptoProviderInfo ()

    PCRYPT_KEY_PROV_INFO
    xmlSecMSCryptoKeyDataGetMSCryptoProviderInfo
                                   (xmlSecKeyDataPtr data);

Gets key provider info.

#### Parameters

data | the key data |

#### Returns

the key provider info.

## Types and Values