- Home
- Download
- News
- Documentation

- FAQ
- Tutorial
- API reference
- Examples

- XML Digital Signature

- Online Verifier

- XML Encryption
- XML Canonicalization
- Reporting Bugs
- Mailing list
- Related
- Authors

# certkeys

## Name

certkeys -- MS Crypto certificates helper functions.

## Synopsis

    PCCERT_CONTEXTxmlSecMSCryptoKeyDataGetCert        (xmlSecKeyDataPtr data);
    HCRYPTKEYxmlSecMSCryptoKeyDataGetKey         (xmlSecKeyDataPtr data,
                                                             xmlSecKeyDataType type);
    HCRYPTKEYxmlSecMSCryptoKeyDataGetDecryptKey  (xmlSecKeyDataPtr data);
    PCCERT_CONTEXTxmlSecMSCryptoCertDup               (PCCERT_CONTEXT pCert);
    xmlSecKeyDataPtr    xmlSecMSCryptoCertAdopt             (PCCERT_CONTEXT pCert,
                                                             xmlSecKeyDataType type);
    HCRYPTPROVxmlSecMSCryptoKeyDataGetMSCryptoProvider
                                                            (xmlSecKeyDataPtr data);
    DWORDxmlSecMSCryptoKeyDataGetMSCryptoKeySpec
                                                            (xmlSecKeyDataPtr data);

## Description

MS Crypto certificates helper functions.

## Details

### xmlSecMSCryptoKeyDataGetCert ()

    PCCERT_CONTEXT      xmlSecMSCryptoKeyDataGetCert        (xmlSecKeyDataPtr data);

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

`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.

`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.

`data` : | the key data pointer
Returns : | HKEY on success or NULL otherwise.

### xmlSecMSCryptoCertDup ()

    PCCERT_CONTEXT      xmlSecMSCryptoCertDup               (PCCERT_CONTEXT pCert);

Duplicates the `pCert`.

`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.

`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

`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.

`data` : | the key data
Returns : | the key spec info from key data