crypto: XML Security Library Reference Manual

## crypto crypto — Crypto transforms implementation for GnuTLS. |

## Stability Level

Stable, unless otherwise indicated

## Functions

xmlSecCryptoDLFunctionsPtr | xmlSecCryptoGetFunctions_gnutls ()
int | xmlSecGnuTLSInit ()
int | xmlSecGnuTLSShutdown ()
int | xmlSecGnuTLSKeysMngrInit ()
int | xmlSecGnuTLSGenerateRandom ()
xmlSecKeyDataId | xmlSecGnuTLSKeyDataAesGetKlass ()
int | xmlSecGnuTLSKeyDataAesSet ()
xmlSecTransformId | xmlSecGnuTLSTransformAes128CbcGetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformAes192CbcGetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformAes256CbcGetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformKWAes128GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformKWAes192GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformKWAes256GetKlass ()
xmlSecKeyDataId | xmlSecGnuTLSKeyDataDesGetKlass ()
int | xmlSecGnuTLSKeyDataDesSet ()
xmlSecTransformId | xmlSecGnuTLSTransformDes3CbcGetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformKWDes3GetKlass ()
xmlSecKeyDataId | xmlSecGnuTLSKeyDataDsaGetKlass ()
int | xmlSecGnuTLSKeyDataDsaAdoptPrivateKey ()
int | xmlSecGnuTLSKeyDataDsaAdoptPublicKey ()
xmlSecTransformId | xmlSecGnuTLSTransformDsaSha1GetKlass ()
xmlSecKeyDataId | xmlSecGnuTLSKeyDataHmacGetKlass ()
int | xmlSecGnuTLSKeyDataHmacSet ()
xmlSecTransformId | xmlSecGnuTLSTransformHmacMd5GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformHmacRipemd160GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformHmacSha1GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformHmacSha256GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformHmacSha384GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformHmacSha512GetKlass ()
xmlSecKeyDataId | xmlSecGnuTLSKeyDataRsaGetKlass ()
int | xmlSecGnuTLSKeyDataRsaAdoptPrivateKey ()
int | xmlSecGnuTLSKeyDataRsaAdoptPublicKey ()
xmlSecTransformId | xmlSecGnuTLSTransformRsaMd5GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformRsaRipemd160GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformRsaSha1GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformRsaSha256GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformRsaSha384GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformRsaSha512GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformSha1GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformSha256GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformSha384GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformSha512GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformMd5GetKlass ()
xmlSecTransformId | xmlSecGnuTLSTransformRipemd160GetKlass ()

## Types and Values

#define | xmlSecGnuTLSKeyDataAesId
#define | xmlSecGnuTLSTransformAes128CbcId
#define | xmlSecGnuTLSTransformAes192CbcId
#define | xmlSecGnuTLSTransformAes256CbcId
#define | xmlSecGnuTLSTransformKWAes128Id
#define | xmlSecGnuTLSTransformKWAes192Id
#define | xmlSecGnuTLSTransformKWAes256Id
#define | xmlSecGnuTLSKeyDataDesId
#define | xmlSecGnuTLSTransformDes3CbcId
#define | xmlSecGnuTLSTransformKWDes3Id
#define | xmlSecGnuTLSKeyDataDsaId
#define | xmlSecGnuTLSTransformDsaSha1Id
#define | xmlSecGnuTLSKeyDataHmacId
#define | xmlSecGnuTLSTransformHmacMd5Id
#define | xmlSecGnuTLSTransformHmacRipemd160Id
#define | xmlSecGnuTLSTransformHmacSha1Id
#define | xmlSecGnuTLSTransformHmacSha256Id
#define | xmlSecGnuTLSTransformHmacSha384Id
#define | xmlSecGnuTLSTransformHmacSha512Id
#define | xmlSecGnuTLSKeyDataRsaId
#define | xmlSecGnuTLSTransformRsaMd5Id
#define | xmlSecGnuTLSTransformRsaRipemd160Id
#define | xmlSecGnuTLSTransformRsaSha1Id
#define | xmlSecGnuTLSTransformRsaSha256Id
#define | xmlSecGnuTLSTransformRsaSha384Id
#define | xmlSecGnuTLSTransformRsaSha512Id
#define | xmlSecGnuTLSTransformSha1Id
#define | xmlSecGnuTLSTransformSha256Id
#define | xmlSecGnuTLSTransformSha384Id
#define | xmlSecGnuTLSTransformSha512Id
#define | xmlSecGnuTLSTransformMd5Id
#define | xmlSecGnuTLSTransformRipemd160Id

## Description

## Functions

### xmlSecCryptoGetFunctions_gnutls ()

    xmlSecCryptoDLFunctionsPtr
    xmlSecCryptoGetFunctions_gnutls (void);

Gets the pointer to xmlsec-gnutls functions table.

#### Returns

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

### xmlSecGnuTLSInit ()

    int
    xmlSecGnuTLSInit (void);

XMLSec library specific crypto engine initialization.

#### Returns

0 on success or a negative value otherwise.

### xmlSecGnuTLSShutdown ()

    int
    xmlSecGnuTLSShutdown (void);

XMLSec library specific crypto engine shutdown.

#### Returns

0 on success or a negative value otherwise.

### xmlSecGnuTLSKeysMngrInit ()

    int
    xmlSecGnuTLSKeysMngrInit (xmlSecKeysMngrPtr mngr);

Adds GnuTLS specific key data stores in keys manager.

#### Parameters

mngr | the pointer to keys manager. |

#### Returns

0 on success or a negative value otherwise.

### xmlSecGnuTLSGenerateRandom ()

    int
    xmlSecGnuTLSGenerateRandom (xmlSecBufferPtr buffer,
                                xmlSecSize size);

Generates `size` random bytes and puts result in `buffer` .

#### Parameters

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

#### Returns

0 on success or a negative value otherwise.

### xmlSecGnuTLSKeyDataAesGetKlass ()

    xmlSecKeyDataId
    xmlSecGnuTLSKeyDataAesGetKlass (void);

The AES key data klass.

#### Returns

AES key data klass.

### xmlSecGnuTLSKeyDataAesSet ()

    int
    xmlSecGnuTLSKeyDataAesSet (xmlSecKeyDataPtr data,
                               const xmlSecByte *buf,
                               xmlSecSize bufSize);

Sets the value of AES key data.

#### Parameters

data | the pointer to AES key data. |
buf | the pointer to key value. |
bufSize | the key value size (in bytes). |

#### Returns

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

### xmlSecGnuTLSTransformAes128CbcGetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformAes128CbcGetKlass
                                   (void);

AES 128 CBC encryption transform klass.

#### Returns

pointer to AES 128 CBC encryption transform.

### xmlSecGnuTLSTransformAes192CbcGetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformAes192CbcGetKlass
                                   (void);

AES 192 CBC encryption transform klass.

#### Returns

pointer to AES 192 CBC encryption transform.

### xmlSecGnuTLSTransformAes256CbcGetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformAes256CbcGetKlass
                                   (void);

AES 256 CBC encryption transform klass.

#### Returns

pointer to AES 256 CBC encryption transform.

### xmlSecGnuTLSTransformKWAes128GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformKWAes128GetKlass (void);

The AES-128 kew wrapper transform klass.

#### Returns

AES-128 kew wrapper transform klass.

### xmlSecGnuTLSTransformKWAes192GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformKWAes192GetKlass (void);

The AES-192 kew wrapper transform klass.

#### Returns

AES-192 kew wrapper transform klass.

### xmlSecGnuTLSTransformKWAes256GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformKWAes256GetKlass (void);

The AES-256 kew wrapper transform klass.

#### Returns

AES-256 kew wrapper transform klass.

### xmlSecGnuTLSKeyDataDesGetKlass ()

    xmlSecKeyDataId
    xmlSecGnuTLSKeyDataDesGetKlass (void);

The DES key data klass.

#### Returns

DES key data klass.

### xmlSecGnuTLSKeyDataDesSet ()

    int
    xmlSecGnuTLSKeyDataDesSet (xmlSecKeyDataPtr data,
                               const xmlSecByte *buf,
                               xmlSecSize bufSize);

Sets the value of DES key data.

#### Parameters

data | the pointer to DES key data. |
buf | the pointer to key value. |
bufSize | the key value size (in bytes). |

#### Returns

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

### xmlSecGnuTLSTransformDes3CbcGetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformDes3CbcGetKlass (void);

Triple DES CBC encryption transform klass.

#### Returns

pointer to Triple DES encryption transform.

### xmlSecGnuTLSTransformKWDes3GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformKWDes3GetKlass (void);

The Triple DES key wrapper transform klass.

#### Returns

Triple DES key wrapper transform klass.

### xmlSecGnuTLSKeyDataDsaGetKlass ()

    xmlSecKeyDataId
    xmlSecGnuTLSKeyDataDsaGetKlass (void);

The DSA key data klass.

#### Returns

pointer to DSA key data klass.

### xmlSecGnuTLSKeyDataDsaAdoptPrivateKey ()

    int
    xmlSecGnuTLSKeyDataDsaAdoptPrivateKey (xmlSecKeyDataPtr data,
                                           gnutls_x509_privkey_t dsa_key);

Sets the value of DSA key data.

#### Parameters

data | the pointer to DSA key data. |
dsa_key | the pointer to GnuTLS DSA private key. |

#### Returns

0 on success or a negative value otherwise.

### xmlSecGnuTLSKeyDataDsaAdoptPublicKey ()

    int
    xmlSecGnuTLSKeyDataDsaAdoptPublicKey (xmlSecKeyDataPtr data,
                                          gnutls_datum_t *p,
                                          gnutls_datum_t *q,
                                          gnutls_datum_t *g,
                                          gnutls_datum_t *y);

Sets the value of DSA key data.

#### Parameters

data | the pointer to DSA key data. |
p | the pointer to p component of the DSA public key |
q | the pointer to q component of the DSA public key |
g | the pointer to g component of the DSA public key |
y | the pointer to y component of the DSA public key |

#### Returns

0 on success or a negative value otherwise.

### xmlSecGnuTLSTransformDsaSha1GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformDsaSha1GetKlass (void);

The DSA-SHA1 signature transform klass.

#### Returns

DSA-SHA1 signature transform klass.

### xmlSecGnuTLSKeyDataHmacGetKlass ()

    xmlSecKeyDataId
    xmlSecGnuTLSKeyDataHmacGetKlass (void);

The HMAC key data klass.

#### Returns

HMAC key data klass.

### xmlSecGnuTLSKeyDataHmacSet ()

    int
    xmlSecGnuTLSKeyDataHmacSet (xmlSecKeyDataPtr data,
                                const xmlSecByte *buf,
                                xmlSecSize bufSize);

Sets the value of HMAC key data.

#### Parameters

data | the pointer to HMAC key data. |
buf | the pointer to key value. |
bufSize | the key value size (in bytes). |

#### Returns

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

### xmlSecGnuTLSTransformHmacMd5GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformHmacMd5GetKlass (void);

The HMAC-MD5 transform klass.

#### Returns

the HMAC-MD5 transform klass.

### xmlSecGnuTLSTransformHmacRipemd160GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformHmacRipemd160GetKlass
                                   (void);

The HMAC-RIPEMD160 transform klass.

#### Returns

the HMAC-RIPEMD160 transform klass.

### xmlSecGnuTLSTransformHmacSha1GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformHmacSha1GetKlass (void);

The HMAC-SHA1 transform klass.

#### Returns

the HMAC-SHA1 transform klass.

### xmlSecGnuTLSTransformHmacSha256GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformHmacSha256GetKlass
                                   (void);

The HMAC-SHA256 transform klass.

#### Returns

the HMAC-SHA256 transform klass.

### xmlSecGnuTLSTransformHmacSha384GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformHmacSha384GetKlass
                                   (void);

The HMAC-SHA384 transform klass.

#### Returns

the HMAC-SHA384 transform klass.

### xmlSecGnuTLSTransformHmacSha512GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformHmacSha512GetKlass
                                   (void);

The HMAC-SHA512 transform klass.

#### Returns

the HMAC-SHA512 transform klass.

### xmlSecGnuTLSKeyDataRsaGetKlass ()

    xmlSecKeyDataId
    xmlSecGnuTLSKeyDataRsaGetKlass (void);

The GnuTLS RSA key data klass.

#### Returns

pointer to GnuTLS RSA key data klass.

### xmlSecGnuTLSKeyDataRsaAdoptPrivateKey ()

    int
    xmlSecGnuTLSKeyDataRsaAdoptPrivateKey (xmlSecKeyDataPtr data,
                                           gnutls_x509_privkey_t rsa_key);

Sets the value of RSA key data.

#### Parameters

data | the pointer to RSA key data. |
rsa_key | the pointer to GnuTLS RSA private key. |

#### Returns

0 on success or a negative value otherwise.

### xmlSecGnuTLSKeyDataRsaAdoptPublicKey ()

    int
    xmlSecGnuTLSKeyDataRsaAdoptPublicKey (xmlSecKeyDataPtr data,
                                          gnutls_datum_t *m,
                                          gnutls_datum_t *e);

Sets the value of RSA key data.

#### Parameters

data | the pointer to RSA key data. |
m | the pointer to m component of the RSA public key |
e | the pointer to e component of the RSA public key |

#### Returns

0 on success or a negative value otherwise.

### xmlSecGnuTLSTransformRsaMd5GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformRsaMd5GetKlass (void);

The RSA-MD5 signature transform klass.

#### Returns

RSA-MD5 signature transform klass.

### xmlSecGnuTLSTransformRsaRipemd160GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformRsaRipemd160GetKlass
                                   (void);

The RSA-RIPEMD160 signature transform klass.

#### Returns

RSA-RIPEMD160 signature transform klass.

### xmlSecGnuTLSTransformRsaSha1GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformRsaSha1GetKlass (void);

The RSA-SHA1 signature transform klass.

#### Returns

RSA-SHA1 signature transform klass.

### xmlSecGnuTLSTransformRsaSha256GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformRsaSha256GetKlass
                                   (void);

The RSA-SHA256 signature transform klass.

#### Returns

RSA-SHA256 signature transform klass.

### xmlSecGnuTLSTransformRsaSha384GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformRsaSha384GetKlass
                                   (void);

The RSA-SHA384 signature transform klass.

#### Returns

RSA-SHA384 signature transform klass.

### xmlSecGnuTLSTransformRsaSha512GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformRsaSha512GetKlass
                                   (void);

The RSA-SHA512 signature transform klass.

#### Returns

RSA-SHA512 signature transform klass.

### xmlSecGnuTLSTransformSha1GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformSha1GetKlass (void);

SHA-1 digest transform klass.

#### Returns

pointer to SHA-1 digest transform klass.

### xmlSecGnuTLSTransformSha256GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformSha256GetKlass (void);

SHA256 digest transform klass.

#### Returns

pointer to SHA256 digest transform klass.

### xmlSecGnuTLSTransformSha384GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformSha384GetKlass (void);

SHA384 digest transform klass.

#### Returns

pointer to SHA384 digest transform klass.

### xmlSecGnuTLSTransformSha512GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformSha512GetKlass (void);

SHA512 digest transform klass.

#### Returns

pointer to SHA512 digest transform klass.

### xmlSecGnuTLSTransformMd5GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformMd5GetKlass (void);

MD5 digest transform klass.

#### Returns

pointer to MD5 digest transform klass.

### xmlSecGnuTLSTransformRipemd160GetKlass ()

    xmlSecTransformId
    xmlSecGnuTLSTransformRipemd160GetKlass
                                   (void);

RIPEMD160 digest transform klass.

#### Returns

pointer to RIPEMD160 digest transform klass.

## Types and Values

### xmlSecGnuTLSKeyDataAesId

    #define             xmlSecGnuTLSKeyDataAesId

The AES key data klass.

### xmlSecGnuTLSTransformAes128CbcId

    #define             xmlSecGnuTLSTransformAes128CbcId

The AES128 CBC cipher transform klass.

### xmlSecGnuTLSTransformAes192CbcId

    #define             xmlSecGnuTLSTransformAes192CbcId

The AES192 CBC cipher transform klass.

### xmlSecGnuTLSTransformAes256CbcId

    #define             xmlSecGnuTLSTransformAes256CbcId

The AES256 CBC cipher transform klass.

### xmlSecGnuTLSTransformKWAes128Id

    #define             xmlSecGnuTLSTransformKWAes128Id

The AES 128 key wrap transform klass.

### xmlSecGnuTLSTransformKWAes192Id

    #define             xmlSecGnuTLSTransformKWAes192Id

The AES 192 key wrap transform klass.

### xmlSecGnuTLSTransformKWAes256Id

    #define             xmlSecGnuTLSTransformKWAes256Id

The AES 256 key wrap transform klass.

### xmlSecGnuTLSKeyDataDesId

    #define             xmlSecGnuTLSKeyDataDesId

The DES key data klass.

### xmlSecGnuTLSTransformDes3CbcId

    #define             xmlSecGnuTLSTransformDes3CbcId

The DES3 CBC cipher transform klass.

### xmlSecGnuTLSTransformKWDes3Id

    #define             xmlSecGnuTLSTransformKWDes3Id

The DES3 KW transform klass.

### xmlSecGnuTLSKeyDataDsaId

    #define             xmlSecGnuTLSKeyDataDsaId

The DSA key klass.

### xmlSecGnuTLSTransformDsaSha1Id

    #define             xmlSecGnuTLSTransformDsaSha1Id

The DSA SHA1 signature transform klass.

### xmlSecGnuTLSKeyDataHmacId

    #define             xmlSecGnuTLSKeyDataHmacId

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

The HMAC key klass.

### xmlSecGnuTLSTransformHmacMd5Id

    #define             xmlSecGnuTLSTransformHmacMd5Id

The HMAC with MD5 signature transform klass.

### xmlSecGnuTLSTransformHmacRipemd160Id

    #define             xmlSecGnuTLSTransformHmacRipemd160Id

The HMAC with RipeMD160 signature transform klass.

### xmlSecGnuTLSTransformHmacSha1Id

    #define             xmlSecGnuTLSTransformHmacSha1Id

The HMAC with SHA1 signature transform klass.

### xmlSecGnuTLSTransformHmacSha256Id

    #define             xmlSecGnuTLSTransformHmacSha256Id

The HMAC with SHA256 signature transform klass.

### xmlSecGnuTLSTransformHmacSha384Id

    #define             xmlSecGnuTLSTransformHmacSha384Id

The HMAC with SHA384 signature transform klass.

### xmlSecGnuTLSTransformHmacSha512Id

    #define             xmlSecGnuTLSTransformHmacSha512Id

The HMAC with SHA512 signature transform klass.

### xmlSecGnuTLSKeyDataRsaId

    #define             xmlSecGnuTLSKeyDataRsaId

The RSA key klass.

### xmlSecGnuTLSTransformRsaMd5Id

    #define             xmlSecGnuTLSTransformRsaMd5Id

The RSA-MD5 signature transform klass.

### xmlSecGnuTLSTransformRsaRipemd160Id

    #define             xmlSecGnuTLSTransformRsaRipemd160Id

The RSA-RIPEMD160 signature transform klass.

### xmlSecGnuTLSTransformRsaSha1Id

    #define             xmlSecGnuTLSTransformRsaSha1Id

The RSA-SHA1 signature transform klass.

### xmlSecGnuTLSTransformRsaSha256Id

    #define             xmlSecGnuTLSTransformRsaSha256Id

The RSA-SHA256 signature transform klass.

### xmlSecGnuTLSTransformRsaSha384Id

    #define             xmlSecGnuTLSTransformRsaSha384Id

The RSA-SHA384 signature transform klass.

### xmlSecGnuTLSTransformRsaSha512Id

    #define             xmlSecGnuTLSTransformRsaSha512Id

The RSA-SHA512 signature transform klass.

### xmlSecGnuTLSTransformSha1Id

    #define             xmlSecGnuTLSTransformSha1Id

The HMAC with SHA1 signature transform klass.

### xmlSecGnuTLSTransformSha256Id

    #define             xmlSecGnuTLSTransformSha256Id

The HMAC with SHA256 signature transform klass.

### xmlSecGnuTLSTransformSha384Id

    #define             xmlSecGnuTLSTransformSha384Id

The HMAC with SHA384 signature transform klass.

### xmlSecGnuTLSTransformSha512Id

    #define             xmlSecGnuTLSTransformSha512Id

The HMAC with SHA512 signature transform klass.

### xmlSecGnuTLSTransformMd5Id

    #define             xmlSecGnuTLSTransformMd5Id

The MD5 digest transform klass.

### xmlSecGnuTLSTransformRipemd160Id

    #define             xmlSecGnuTLSTransformRipemd160Id

The RIPEMD160 digest transform klass.