x509: XML Security Library Reference Manual

## x509 x509 — X509 certificates implementation for MSCng. |

## Stability Level

Stable, unless otherwise indicated

## Functions

xmlSecKeyDataId | xmlSecMSCngKeyDataX509GetKlass ()
xmlSecKeyDataId | xmlSecMSCngKeyDataRawX509CertGetKlass ()
xmlSecKeyDataStoreId | xmlSecMSCngX509StoreGetKlass ()
PCCERT_CONTEXT | xmlSecMSCngKeyDataX509GetKeyCert ()
int | xmlSecMSCngKeyDataX509AdoptKeyCert ()
int | xmlSecMSCngKeyDataX509AdoptCert ()
int | xmlSecMSCngKeyDataX509AdoptCrl ()
int | xmlSecMSCngX509StoreAdoptCert ()
int | xmlSecMSCngX509StoreAdoptKeyStore ()
int | xmlSecMSCngX509StoreAdoptTrustedStore ()
int | xmlSecMSCngX509StoreAdoptUntrustedStore ()
PCCERT_CONTEXT | xmlSecMSCngX509StoreVerify ()

## Types and Values

#define | xmlSecMSCngKeyDataX509Id
#define | xmlSecMSCngKeyDataRawX509CertId
#define | xmlSecMSCngX509StoreId

## Description

## Functions

### xmlSecMSCngKeyDataX509GetKlass ()

    xmlSecKeyDataId
    xmlSecMSCngKeyDataX509GetKlass (void);

The MSCng X509 key data klass.

#### Returns

the X509 data klass.

### xmlSecMSCngKeyDataRawX509CertGetKlass ()

    xmlSecKeyDataId
    xmlSecMSCngKeyDataRawX509CertGetKlass (void);

The raw X509 certificates key data klass.

#### Returns

raw X509 certificates key data klass.

### xmlSecMSCngX509StoreGetKlass ()

    xmlSecKeyDataStoreId
    xmlSecMSCngX509StoreGetKlass (void);

The MSCng X509 certificates key data store klass.

#### Returns

pointer to MSCng X509 certificates key data store klass.

### xmlSecMSCngKeyDataX509GetKeyCert ()

    PCCERT_CONTEXT
    xmlSecMSCngKeyDataX509GetKeyCert (xmlSecKeyDataPtr data);

Gets the certificate from which the key was extracted.

#### Parameters

data | the pointer to X509 key data. |

#### Returns

the key's certificate or NULL if key data was not used for key extraction or an error occurs.

### xmlSecMSCngKeyDataX509AdoptKeyCert ()

    int
    xmlSecMSCngKeyDataX509AdoptKeyCert (xmlSecKeyDataPtr data,
                                        PCCERT_CONTEXT cert);

Adds certificate to the X509 key data and sets the it as the key's certificate in `data` . On success, the `data` owns the cert.

#### Parameters

data | the pointer to key data. |
cert | the pointer to certificates. |

#### Returns

0 on success or a negative value otherwise.

### xmlSecMSCngKeyDataX509AdoptCert ()

    int
    xmlSecMSCngKeyDataX509AdoptCert (xmlSecKeyDataPtr data,
                                     PCCERT_CONTEXT cert);

Adds `cert` to `data` as a certificate. On success, `data` owns the `cert` .

#### Parameters

data | the pointer to key data. |
cert | the pointer to certificates. |

#### Returns

0 on success or a negative value otherwise.

### xmlSecMSCngKeyDataX509AdoptCrl ()

    int
    xmlSecMSCngKeyDataX509AdoptCrl (xmlSecKeyDataPtr data,
                                    PCCRL_CONTEXT crl);

Adds CRL to the X509 key data.

#### Parameters

data | the pointer to X509 key data. |
crl | the pointer to MSCng X509 CRL. |

#### Returns

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

### xmlSecMSCngX509StoreAdoptCert ()

    int
    xmlSecMSCngX509StoreAdoptCert (xmlSecKeyDataStorePtr store,
                                   PCCERT_CONTEXT cert,
                                   xmlSecKeyDataType type);

Adds trusted (root) or untrusted certificate to the store.

#### Parameters

store | the pointer to X509 key data store klass. |
cert | the pointer to PCCERT_CONTEXT X509 certificate. |
type | the certificate type (trusted/untrusted). |

#### Returns

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

### xmlSecMSCngX509StoreAdoptKeyStore ()

    int
    xmlSecMSCngX509StoreAdoptKeyStore (xmlSecKeyDataStorePtr store,
                                       HCERTSTORE keyStore);

Adds `keyStore` to the list of key stores.

#### Parameters

store | the pointer to X509 key data store klass. |
keyStore | the pointer to keys store. |

#### Returns

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

### xmlSecMSCngX509StoreAdoptTrustedStore ()

    int
    xmlSecMSCngX509StoreAdoptTrustedStore (xmlSecKeyDataStorePtr store,
                                           HCERTSTORE trustedStore);

Adds `trustedStore` to the list of trusted certs stores.

#### Parameters

store | the pointer to X509 key data store klass. |
trustedStore | the pointer to certs store. |

#### Returns

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

### xmlSecMSCngX509StoreAdoptUntrustedStore ()

    int
    xmlSecMSCngX509StoreAdoptUntrustedStore
                                   (xmlSecKeyDataStorePtr store,
                                    HCERTSTORE untrustedStore);

Adds `trustedStore` to the list of untrusted certs stores.

#### Parameters

store | the pointer to X509 key data store klass. |
untrustedStore | the pointer to certs store. |

#### Returns

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

### xmlSecMSCngX509StoreVerify ()

    PCCERT_CONTEXT
    xmlSecMSCngX509StoreVerify (xmlSecKeyDataStorePtr store,
                                HCERTSTORE certs,
                                xmlSecKeyInfoCtx *keyInfoCtx);

Verifies `certs` list.

#### Parameters

store | the pointer to X509 certificate context store klass. |
certs | the untrusted certificates stack. |
keyInfoCtx | the pointer to <dsig:KeyInfo/> element processing context. |

#### Returns

pointer to the first verified certificate from `certs` .

## Types and Values

### xmlSecMSCngKeyDataX509Id

    #define             xmlSecMSCngKeyDataX509Id

The MSCng X509 data klass.

### xmlSecMSCngKeyDataRawX509CertId

    #define             xmlSecMSCngKeyDataRawX509CertId

The MSCng raw X509 certificate klass.

### xmlSecMSCngX509StoreId

    #define             xmlSecMSCngX509StoreId

The MSCng X509 store klass.