Repository navigation
API XMLSec MSCrypto CertKeys
API Group: xmlsec_mscrypto_certkeys
Certificate-based key handling for the MSCrypto back-end.
Certificate keys support functions for Microsoft Crypto API.
PCCERT_CONTEXT xmlSecMSCryptoKeyDataGetCert(xmlSecKeyDataPtr data);Source: include/xmlsec/mscrypto/certkeys.h
Native MSCrypto certificate retrieval from xmlsec keydata.
Parameters:
-
data— the key data to retrieve certificate from. Returned PCCERT_CONTEXT must not be released by the caller.
Returns: PCCERT_CONTEXT on success or NULL otherwise.
HCRYPTKEY xmlSecMSCryptoKeyDataGetKey(xmlSecKeyDataPtr data, xmlSecKeyDataType type);Source: include/xmlsec/mscrypto/certkeys.h
Native MSCrypto key retrieval from xmlsec keydata.
Parameters:
-
data— the key data to retrieve the key from. -
type— type of key requested (public/private); currently ignored, the key is returned regardless of the requested type. Returned HKEY must not be destroyed by the caller.
Returns: HKEY on success or NULL otherwise.
HCRYPTKEY xmlSecMSCryptoKeyDataGetDecryptKey(xmlSecKeyDataPtr data);Source: include/xmlsec/mscrypto/certkeys.h
Native MSCrypto decrypt key retrieval from xmlsec keydata.
Parameters:
-
data— the key data pointer Returned HKEY must be destroyed by the caller using CryptDestroyKey.
The keyspec recorded in the key data (ctx->dwKeySpec) is used to retrieve the user key: certificate-based and generated key pairs are acquired/created as AT_SIGNATURE, so hardcoding AT_KEYEXCHANGE made decrypt/keywrap retrieval fail with "wrong key type" on CSPs that enforce aiKeyAlg. When no keyspec was recorded, the legacy AT_KEYEXCHANGE default is kept.
Returns: HKEY on success or NULL otherwise.
PCCERT_CONTEXT xmlSecMSCryptoCertDup(PCCERT_CONTEXT pCert);Source: include/xmlsec/mscrypto/certkeys.h
Duplicates the pCert.
Parameters:
-
pCert— the pointer to cert. The returned PCCERT_CONTEXT must be released by the caller with CertFreeCertificateContext.
Returns: pointer to newly created PCCERT_CONTEXT object or NULL if an error occurs.
xmlSecKeyDataPtr xmlSecMSCryptoCertAdopt(PCCERT_CONTEXT pCert, xmlSecKeyDataType type);Source: include/xmlsec/mscrypto/certkeys.h
Creates key data value from the cert.
Parameters:
-
pCert— the pointer to cert. -
type— the expected key type. On success, the function takes ownership of the certificate context; the caller must not free it afterwards. On failure the function does not take ownership and the caller must freepCert.
Returns: pointer to newly created xmlsec key or NULL if an error occurs.
HCRYPTPROV xmlSecMSCryptoKeyDataGetMSCryptoProvider(xmlSecKeyDataPtr data);Source: include/xmlsec/mscrypto/certkeys.h
Gets crypto provider handle.
Parameters:
-
data— the key data
Returns: the crypto provider handle or 0 if there is an error.
DWORD xmlSecMSCryptoKeyDataGetMSCryptoKeySpec(xmlSecKeyDataPtr data);Source: include/xmlsec/mscrypto/certkeys.h
Gets key spec info.
Parameters:
-
data— the key data
Returns: the key spec info from key data
PCRYPT_KEY_PROV_INFO xmlSecMSCryptoKeyDataGetMSCryptoProviderInfo(xmlSecKeyDataPtr data);Source: include/xmlsec/mscrypto/certkeys.h
Gets key provider info.
Parameters:
-
data— the key data The returned buffer is allocated by the library and must be freed by the caller with xmlFree.
Returns: the key provider info.