crypto: XML Security Library Reference Manual

## crypto crypto — Crypto transforms implementation for Microsoft Cryptography API: Next Generation (CNG). |

## Stability Level

Stable, unless otherwise indicated

## Functions

xmlSecCryptoDLFunctionsPtr | xmlSecCryptoGetFunctions_mscng ()
int | xmlSecMSCngGenerateRandom ()
int | xmlSecMSCngInit ()
int | xmlSecMSCngShutdown ()
int | xmlSecMSCngKeysMngrInit ()
xmlSecKeyDataId | xmlSecMSCngKeyDataDsaGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformDsaSha1GetKlass ()
xmlSecKeyDataId | xmlSecMSCngKeyDataRsaGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformRsaMd5GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformRsaSha1GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformRsaSha256GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformRsaSha384GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformRsaSha512GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformRsaPkcs1GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformRsaOaepGetKlass ()
xmlSecKeyDataId | xmlSecMSCngKeyDataEcdsaGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformEcdsaSha1GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformEcdsaSha256GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformEcdsaSha384GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformEcdsaSha512GetKlass ()
xmlSecKeyDataId | xmlSecMSCngKeyDataDesGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformDes3CbcGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformKWDes3GetKlass ()
xmlSecKeyDataId | xmlSecMSCngKeyDataHmacGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformHmacMd5GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformHmacSha1GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformHmacSha256GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformHmacSha384GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformHmacSha512GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformMd5GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformSha1GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformSha256GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformSha384GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformSha512GetKlass ()
xmlSecKeyDataId | xmlSecMSCngKeyDataAesGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformAes128CbcGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformAes192CbcGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformAes256CbcGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformAes128GcmGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformAes192GcmGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformAes256GcmGetKlass ()
xmlSecTransformId | xmlSecMSCngTransformKWAes128GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformKWAes192GetKlass ()
xmlSecTransformId | xmlSecMSCngTransformKWAes256GetKlass ()

## Types and Values

#define | xmlSecMSCngKeyDataDsaId
#define | xmlSecMSCngTransformDsaSha1Id
#define | xmlSecMSCngKeyDataRsaId
#define | xmlSecMSCngTransformRsaMd5Id
#define | xmlSecMSCngTransformRsaSha1Id
#define | xmlSecMSCngTransformRsaSha256Id
#define | xmlSecMSCngTransformRsaSha384Id
#define | xmlSecMSCngTransformRsaSha512Id
#define | xmlSecMSCngTransformRsaPkcs1Id
#define | xmlSecMSCngTransformRsaOaepId
#define | xmlSecMSCngKeyDataEcdsaId
#define | xmlSecMSCngTransformEcdsaSha1Id
#define | xmlSecMSCngTransformEcdsaSha256Id
#define | xmlSecMSCngTransformEcdsaSha384Id
#define | xmlSecMSCngTransformEcdsaSha512Id
#define | xmlSecMSCngKeyDataDesId
#define | xmlSecMSCngTransformDes3CbcId
#define | xmlSecMSCngTransformKWDes3Id
#define | xmlSecMSCngKeyDataHmacId
#define | xmlSecMSCngTransformHmacMd5Id
#define | xmlSecMSCngTransformHmacSha1Id
#define | xmlSecMSCngTransformHmacSha256Id
#define | xmlSecMSCngTransformHmacSha384Id
#define | xmlSecMSCngTransformHmacSha512Id
#define | xmlSecMSCngTransformMd5Id
#define | xmlSecMSCngTransformSha1Id
#define | xmlSecMSCngTransformSha256Id
#define | xmlSecMSCngTransformSha384Id
#define | xmlSecMSCngTransformSha512Id
#define | xmlSecMSCngKeyDataAesId
#define | xmlSecMSCngTransformAes128CbcId
#define | xmlSecMSCngTransformAes192CbcId
#define | xmlSecMSCngTransformAes256CbcId
#define | xmlSecMSCngTransformAes128GcmId
#define | xmlSecMSCngTransformAes192GcmId
#define | xmlSecMSCngTransformAes256GcmId
#define | xmlSecMSCngTransformKWAes128Id
#define | xmlSecMSCngTransformKWAes192Id
#define | xmlSecMSCngTransformKWAes256Id

## Description

## Functions

### xmlSecCryptoGetFunctions_mscng ()

    xmlSecCryptoDLFunctionsPtr
    xmlSecCryptoGetFunctions_mscng (void);

Gets the pointer to xmlsec-mscng functions table.

#### Returns

the xmlsec-mscng functions table or NULL if an error occurs.

### xmlSecMSCngGenerateRandom ()

    int
    xmlSecMSCngGenerateRandom (xmlSecBufferPtr buffer,
                               xmlSecSize size);

`xmlSecMSCngGenerateRandom` is deprecated and should not be used in newly-written code.

Generates `size` random bytes and puts result in `buffer` (not implemented yet).

#### Parameters

buffer | the destination buffer. |
size | the numer of bytes to generate. |

#### Returns

0 on success or a negative value otherwise.

### xmlSecMSCngInit ()

    int
    xmlSecMSCngInit (void);

XMLSec library specific crypto engine initialization.

#### Returns

0 on success or a negative value otherwise.

### xmlSecMSCngShutdown ()

    int
    xmlSecMSCngShutdown (void);

XMLSec library specific crypto engine shutdown.

#### Returns

0 on success or a negative value otherwise.

### xmlSecMSCngKeysMngrInit ()

    int
    xmlSecMSCngKeysMngrInit (xmlSecKeysMngrPtr mngr);

Adds MSCng specific key data stores in keys manager.

#### Parameters

mngr | the pointer to keys manager. |

#### Returns

0 on success or a negative value otherwise.

### xmlSecMSCngKeyDataDsaGetKlass ()

    xmlSecKeyDataId
    xmlSecMSCngKeyDataDsaGetKlass (void);

The MSCng DSA CertKey data klass.

#### Returns

pointer to MSCng DSA key data klass.

### xmlSecMSCngTransformDsaSha1GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformDsaSha1GetKlass (void);

The DSA-SHA1 signature transform klass.

#### Returns

DSA-SHA1 signature transform klass.

### xmlSecMSCngKeyDataRsaGetKlass ()

    xmlSecKeyDataId
    xmlSecMSCngKeyDataRsaGetKlass (void);

The MSCng RSA CertKey data klass.

#### Returns

pointer to MSCng RSA key data klass.

### xmlSecMSCngTransformRsaMd5GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformRsaMd5GetKlass (void);

The RSA-MD5 signature transform klass.

#### Returns

RSA-MD5 signature transform klass.

### xmlSecMSCngTransformRsaSha1GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformRsaSha1GetKlass (void);

The RSA-SHA1 signature transform klass.

#### Returns

RSA-SHA1 signature transform klass.

### xmlSecMSCngTransformRsaSha256GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformRsaSha256GetKlass (void);

The RSA-SHA256 signature transform klass.

#### Returns

RSA-SHA256 signature transform klass.

### xmlSecMSCngTransformRsaSha384GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformRsaSha384GetKlass (void);

The RSA-SHA384 signature transform klass.

#### Returns

RSA-SHA384 signature transform klass.

### xmlSecMSCngTransformRsaSha512GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformRsaSha512GetKlass (void);

The RSA-SHA512 signature transform klass.

#### Returns

RSA-SHA512 signature transform klass.

### xmlSecMSCngTransformRsaPkcs1GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformRsaPkcs1GetKlass (void);

The RSA-PKCS1 key transport transform klass.

#### Returns

RSA-PKCS1 key transport transform klass.

### xmlSecMSCngTransformRsaOaepGetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformRsaOaepGetKlass (void);

The RSA-OAEP key transport transform klass.

#### Returns

RSA-OAEP key transport transform klass.

### xmlSecMSCngKeyDataEcdsaGetKlass ()

    xmlSecKeyDataId
    xmlSecMSCngKeyDataEcdsaGetKlass (void);

The MSCng ECDSA CertKey data klass.

#### Returns

pointer to MSCng ECDSA key data klass.

### xmlSecMSCngTransformEcdsaSha1GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformEcdsaSha1GetKlass (void);

The ECDSA-SHA1 signature transform klass.

#### Returns

ECDSA-SHA1 signature transform klass.

### xmlSecMSCngTransformEcdsaSha256GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformEcdsaSha256GetKlass
                                   (void);

The ECDSA-SHA256 signature transform klass.

#### Returns

ECDSA-SHA256 signature transform klass.

### xmlSecMSCngTransformEcdsaSha384GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformEcdsaSha384GetKlass
                                   (void);

The ECDSA-SHA384 signature transform klass.

#### Returns

ECDSA-SHA384 signature transform klass.

### xmlSecMSCngTransformEcdsaSha512GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformEcdsaSha512GetKlass
                                   (void);

The ECDSA-SHA512 signature transform klass.

#### Returns

ECDSA-SHA512 signature transform klass.

### xmlSecMSCngKeyDataDesGetKlass ()

    xmlSecKeyDataId
    xmlSecMSCngKeyDataDesGetKlass (void);

The DES key data klass.

#### Returns

DES key data klass.

### xmlSecMSCngTransformDes3CbcGetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformDes3CbcGetKlass (void);

Triple DES CBC encryption transform klass.

#### Returns

pointer to Triple DES encryption transform.

### xmlSecMSCngTransformKWDes3GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformKWDes3GetKlass (void);

The Triple DES key wrapper transform klass.

#### Returns

Triple DES key wrapper transform klass.

### xmlSecMSCngKeyDataHmacGetKlass ()

    xmlSecKeyDataId
    xmlSecMSCngKeyDataHmacGetKlass (void);

The HMAC key data klass.

#### Returns

HMAC key data klass.

### xmlSecMSCngTransformHmacMd5GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformHmacMd5GetKlass (void);

The HMAC-MD5 transform klass.

#### Returns

the HMAC-MD5 transform klass.

### xmlSecMSCngTransformHmacSha1GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformHmacSha1GetKlass (void);

The HMAC-SHA1 transform klass.

#### Returns

the HMAC-SHA1 transform klass.

### xmlSecMSCngTransformHmacSha256GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformHmacSha256GetKlass
                                   (void);

The HMAC-SHA256 transform klass.

#### Returns

the HMAC-SHA256 transform klass.

### xmlSecMSCngTransformHmacSha384GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformHmacSha384GetKlass
                                   (void);

The HMAC-SHA384 transform klass.

#### Returns

the HMAC-SHA384 transform klass.

### xmlSecMSCngTransformHmacSha512GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformHmacSha512GetKlass
                                   (void);

The HMAC-SHA512 transform klass.

#### Returns

the HMAC-SHA512 transform klass.

### xmlSecMSCngTransformMd5GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformMd5GetKlass (void);

MD-5 digest transform klass.

#### Returns

pointer to MD-5 digest transform klass.

### xmlSecMSCngTransformSha1GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformSha1GetKlass (void);

SHA-1 digest transform klass.

#### Returns

pointer to SHA-1 digest transform klass.

### xmlSecMSCngTransformSha256GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformSha256GetKlass (void);

SHA-256 digest transform klass.

#### Returns

pointer to SHA-256 digest transform klass.

### xmlSecMSCngTransformSha384GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformSha384GetKlass (void);

SHA-256 digest transform klass.

#### Returns

pointer to SHA-256 digest transform klass.

### xmlSecMSCngTransformSha512GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformSha512GetKlass (void);

SHA-512 digest transform klass.

#### Returns

pointer to SHA-512 digest transform klass.

### xmlSecMSCngKeyDataAesGetKlass ()

    xmlSecKeyDataId
    xmlSecMSCngKeyDataAesGetKlass (void);

The AES key data klass.

#### Returns

AES key data klass.

### xmlSecMSCngTransformAes128CbcGetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformAes128CbcGetKlass (void);

AES 128 CBC encryption transform klass.

#### Returns

pointer to AES 128 CBC encryption transform.

### xmlSecMSCngTransformAes192CbcGetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformAes192CbcGetKlass (void);

AES 192 CBC encryption transform klass.

#### Returns

pointer to AES 192 CBC encryption transform.

### xmlSecMSCngTransformAes256CbcGetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformAes256CbcGetKlass (void);

AES 256 CBC encryption transform klass.

#### Returns

pointer to AES 256 CBC encryption transform.

### xmlSecMSCngTransformAes128GcmGetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformAes128GcmGetKlass (void);

AES 128 GCM encryption transform klass.

#### Returns

pointer to AES 128 GCM encryption transform.

### xmlSecMSCngTransformAes192GcmGetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformAes192GcmGetKlass (void);

AES 192 GCM encryption transform klass.

#### Returns

pointer to AES 192 GCM encryption transform.

### xmlSecMSCngTransformAes256GcmGetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformAes256GcmGetKlass (void);

AES 256 GCM encryption transform klass.

#### Returns

pointer to AES 256 GCM encryption transform.

### xmlSecMSCngTransformKWAes128GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformKWAes128GetKlass (void);

The AES-128 key wrapper transform klass.

#### Returns

AES-128 key wrapper transform klass.

### xmlSecMSCngTransformKWAes192GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformKWAes192GetKlass (void);

The AES-192 key wrapper transform klass.

#### Returns

AES-192 key wrapper transform klass.

### xmlSecMSCngTransformKWAes256GetKlass ()

    xmlSecTransformId
    xmlSecMSCngTransformKWAes256GetKlass (void);

The AES-256 key wrapper transform klass.

#### Returns

AES-256 key wrapper transform klass.

## Types and Values

### xmlSecMSCngKeyDataDsaId

    #define             xmlSecMSCngKeyDataDsaId

The DSA key klass.

### xmlSecMSCngTransformDsaSha1Id

    #define             xmlSecMSCngTransformDsaSha1Id

The DSA-SHA1 signature transform klass.

### xmlSecMSCngKeyDataRsaId

    #define             xmlSecMSCngKeyDataRsaId

The RSA key klass.

### xmlSecMSCngTransformRsaMd5Id

    #define             xmlSecMSCngTransformRsaMd5Id

The RSA-MD5 signature transform klass.

### xmlSecMSCngTransformRsaSha1Id

    #define             xmlSecMSCngTransformRsaSha1Id

The RSA-SHA1 signature transform klass.

### xmlSecMSCngTransformRsaSha256Id

    #define             xmlSecMSCngTransformRsaSha256Id

The RSA-SHA256 signature transform klass.

### xmlSecMSCngTransformRsaSha384Id

    #define             xmlSecMSCngTransformRsaSha384Id

The RSA-SHA384 signature transform klass.

### xmlSecMSCngTransformRsaSha512Id

    #define             xmlSecMSCngTransformRsaSha512Id

The RSA-SHA512 signature transform klass.

### xmlSecMSCngTransformRsaPkcs1Id

    #define             xmlSecMSCngTransformRsaPkcs1Id

The RSA PKCS1 key transport transform klass.

### xmlSecMSCngTransformRsaOaepId

    #define             xmlSecMSCngTransformRsaOaepId

The RSA OAEP key transport transform klass.

### xmlSecMSCngKeyDataEcdsaId

    #define             xmlSecMSCngKeyDataEcdsaId

The ECDSA key klass.

### xmlSecMSCngTransformEcdsaSha1Id

    #define             xmlSecMSCngTransformEcdsaSha1Id

The ECDSA-SHA1 signature transform klass.

### xmlSecMSCngTransformEcdsaSha256Id

    #define             xmlSecMSCngTransformEcdsaSha256Id

The ECDSA-SHA256 signature transform klass.

### xmlSecMSCngTransformEcdsaSha384Id

    #define             xmlSecMSCngTransformEcdsaSha384Id

The ECDSA-SHA384 signature transform klass.

### xmlSecMSCngTransformEcdsaSha512Id

    #define             xmlSecMSCngTransformEcdsaSha512Id

The ECDSA-SHA512 signature transform klass.

### xmlSecMSCngKeyDataDesId

    #define             xmlSecMSCngKeyDataDesId

The DES key data klass.

### xmlSecMSCngTransformDes3CbcId

    #define             xmlSecMSCngTransformDes3CbcId

The DES3 CBC cipher transform klass.

### xmlSecMSCngTransformKWDes3Id

    #define             xmlSecMSCngTransformKWDes3Id

The DES3 KW transform klass.

### xmlSecMSCngKeyDataHmacId

    #define             xmlSecMSCngKeyDataHmacId

The HMAC key klass.

### xmlSecMSCngTransformHmacMd5Id

    #define             xmlSecMSCngTransformHmacMd5Id

The HMAC-MD5 signature transform klass.

### xmlSecMSCngTransformHmacSha1Id

    #define             xmlSecMSCngTransformHmacSha1Id

The HMAC-SHA1 signature transform klass.

### xmlSecMSCngTransformHmacSha256Id

    #define             xmlSecMSCngTransformHmacSha256Id

The HMAC-SHA256 signature transform klass.

### xmlSecMSCngTransformHmacSha384Id

    #define             xmlSecMSCngTransformHmacSha384Id

The HMAC-SHA384 signature transform klass.

### xmlSecMSCngTransformHmacSha512Id

    #define             xmlSecMSCngTransformHmacSha512Id

The HMAC-SHA512 signature transform klass.

### xmlSecMSCngTransformMd5Id

    #define             xmlSecMSCngTransformMd5Id

The MD5 digest transform klass.

### xmlSecMSCngTransformSha1Id

    #define             xmlSecMSCngTransformSha1Id

The SHA1 digest transform klass.

### xmlSecMSCngTransformSha256Id

    #define             xmlSecMSCngTransformSha256Id

The SHA256 digest transform klass.

### xmlSecMSCngTransformSha384Id

    #define             xmlSecMSCngTransformSha384Id

The SHA384 digest transform klass.

### xmlSecMSCngTransformSha512Id

    #define             xmlSecMSCngTransformSha512Id

The SHA512 digest transform klass.

### xmlSecMSCngKeyDataAesId

    #define             xmlSecMSCngKeyDataAesId

The AES key data klass.

### xmlSecMSCngTransformAes128CbcId

    #define             xmlSecMSCngTransformAes128CbcId

The AES128 CBC cipher transform klass.

### xmlSecMSCngTransformAes192CbcId

    #define             xmlSecMSCngTransformAes192CbcId

The AES192 CBC cipher transform klass.

### xmlSecMSCngTransformAes256CbcId

    #define             xmlSecMSCngTransformAes256CbcId

The AES256 CBC cipher transform klass.

### xmlSecMSCngTransformAes128GcmId

    #define             xmlSecMSCngTransformAes128GcmId

The AES128 GCM cipher transform klass.

### xmlSecMSCngTransformAes192GcmId

    #define             xmlSecMSCngTransformAes192GcmId

The AES192 GCM cipher transform klass.

### xmlSecMSCngTransformAes256GcmId

    #define             xmlSecMSCngTransformAes256GcmId

The AES256 GCM cipher transform klass.

### xmlSecMSCngTransformKWAes128Id

    #define             xmlSecMSCngTransformKWAes128Id

The AES 128 key wrap transform klass.

### xmlSecMSCngTransformKWAes192Id

    #define             xmlSecMSCngTransformKWAes192Id

The AES 192 key wrap transform klass.

### xmlSecMSCngTransformKWAes256Id

    #define             xmlSecMSCngTransformKWAes256Id

The AES 256 key wrap transform klass.