![]() |
![]() |
![]() |
GnuTLS API Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
int gnutls_cipher_add_auth (gnutls_cipher_hd_t handle
,const void *text
,size_t text_size
); int gnutls_cipher_decrypt (const gnutls_cipher_hd_t handle
,void *ciphertext
,size_t ciphertextlen
); int gnutls_cipher_decrypt2 (gnutls_cipher_hd_t handle
,const void *ciphertext
,size_t ciphertextlen
,void *text
,size_t textlen
); void gnutls_cipher_deinit (gnutls_cipher_hd_t handle
); int gnutls_cipher_encrypt (const gnutls_cipher_hd_t handle
,void *text
,size_t textlen
); int gnutls_cipher_encrypt2 (gnutls_cipher_hd_t handle
,const void *text
,size_t textlen
,void *ciphertext
,size_t ciphertextlen
); int gnutls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm
); size_t gnutls_cipher_get_key_size (gnutls_cipher_algorithm_t algorithm
); typedef gnutls_cipher_hd_t; int gnutls_cipher_init (gnutls_cipher_hd_t *handle
,gnutls_cipher_algorithm_t cipher
,const gnutls_datum_t *key
,const gnutls_datum_t *iv
); void gnutls_cipher_set_iv (gnutls_cipher_hd_t handle
,void *iv
,size_t ivlen
); int gnutls_cipher_tag (gnutls_cipher_hd_t handle
,void *tag
,size_t tag_size
); int gnutls_hash (gnutls_hash_hd_t handle
,const void *text
,size_t textlen
); void gnutls_hash_deinit (gnutls_hash_hd_t handle
,void *digest
); int gnutls_hash_fast (gnutls_digest_algorithm_t algorithm
,const void *text
,size_t textlen
,void *digest
); int gnutls_hash_get_len (gnutls_digest_algorithm_t algorithm
); typedef gnutls_hash_hd_t; int gnutls_hash_init (gnutls_hash_hd_t *dig
,gnutls_digest_algorithm_t algorithm
); void gnutls_hash_output (gnutls_hash_hd_t handle
,void *digest
); int gnutls_hmac (gnutls_hmac_hd_t handle
,const void *text
,size_t textlen
); void gnutls_hmac_deinit (gnutls_hmac_hd_t handle
,void *digest
); int gnutls_hmac_fast (gnutls_mac_algorithm_t algorithm
,const void *key
,size_t keylen
,const void *text
,size_t textlen
,void *digest
); int gnutls_hmac_get_len (gnutls_mac_algorithm_t algorithm
); typedef gnutls_hmac_hd_t; int gnutls_hmac_init (gnutls_hmac_hd_t *dig
,gnutls_mac_algorithm_t algorithm
,const void *key
,size_t keylen
); void gnutls_hmac_output (gnutls_hmac_hd_t handle
,void *digest
); size_t gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm
); int gnutls_rnd (gnutls_rnd_level_t level
,void *data
,size_t len
); enum gnutls_rnd_level_t; void gnutls_rnd_refresh (void
);
int gnutls_cipher_add_auth (gnutls_cipher_hd_t handle
,const void *text
,size_t text_size
);
This function operates on authenticated encryption with associated data (AEAD) ciphers and authenticate the input data. This function can only be called once and before any encryption operations.
|
is a gnutls_cipher_hd_t structure. |
|
the data to be authenticated |
|
The length of the data |
Returns : |
Zero or a negative error code on error. |
Since 3.0
int gnutls_cipher_decrypt (const gnutls_cipher_hd_t handle
,void *ciphertext
,size_t ciphertextlen
);
This function will decrypt the given data using the algorithm specified by the context.
|
is a gnutls_cipher_hd_t structure. |
|
the data to encrypt |
|
The length of data to encrypt |
Returns : |
Zero or a negative error code on error. |
Since 2.10.0
int gnutls_cipher_decrypt2 (gnutls_cipher_hd_t handle
,const void *ciphertext
,size_t ciphertextlen
,void *text
,size_t textlen
);
This function will decrypt the given data using the algorithm specified by the context.
|
is a gnutls_cipher_hd_t structure. |
|
the data to encrypt |
|
The length of data to encrypt |
|
the decrypted data |
|
The available length for decrypted data |
Returns : |
Zero or a negative error code on error. |
Since 2.12.0
void gnutls_cipher_deinit (gnutls_cipher_hd_t handle
);
This function will deinitialize all resources occupied by the given encryption context.
|
is a gnutls_cipher_hd_t structure. |
Since 2.10.0
int gnutls_cipher_encrypt (const gnutls_cipher_hd_t handle
,void *text
,size_t textlen
);
This function will encrypt the given data using the algorithm specified by the context.
|
is a gnutls_cipher_hd_t structure. |
|
the data to encrypt |
|
The length of data to encrypt |
Returns : |
Zero or a negative error code on error. |
Since 2.10.0
int gnutls_cipher_encrypt2 (gnutls_cipher_hd_t handle
,const void *text
,size_t textlen
,void *ciphertext
,size_t ciphertextlen
);
This function will encrypt the given data using the algorithm specified by the context.
|
is a gnutls_cipher_hd_t structure. |
|
the data to encrypt |
|
The length of data to encrypt |
|
the encrypted data |
|
The available length for encrypted data |
Returns : |
Zero or a negative error code on error. |
Since 2.12.0
int gnutls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm
);
Get block size for encryption algorithm.
|
is an encryption algorithm |
Returns : |
block size for encryption algorithm. |
Since 2.10.0
size_t gnutls_cipher_get_key_size (gnutls_cipher_algorithm_t algorithm
);
Get key size for cipher.
|
is an encryption algorithm |
Returns : |
length (in bytes) of the given cipher's key size, or 0 if the given cipher is invalid. |
int gnutls_cipher_init (gnutls_cipher_hd_t *handle
,gnutls_cipher_algorithm_t cipher
,const gnutls_datum_t *key
,const gnutls_datum_t *iv
);
This function will initialize an context that can be used for encryption/decryption of data. This will effectively use the current crypto backend in use by gnutls or the cryptographic accelerator in use.
|
is a gnutls_cipher_hd_t structure. |
|
the encryption algorithm to use |
|
The key to be used for encryption |
|
The IV to use (if not applicable set NULL) |
Returns : |
Zero or a negative error code on error. |
Since 2.10.0
void gnutls_cipher_set_iv (gnutls_cipher_hd_t handle
,void *iv
,size_t ivlen
);
This function will set the IV to be used for the next encryption block.
|
is a gnutls_cipher_hd_t structure. |
|
the IV to set |
|
The length of the IV |
Since 3.0
int gnutls_cipher_tag (gnutls_cipher_hd_t handle
,void *tag
,size_t tag_size
);
This function operates on authenticated encryption with associated data (AEAD) ciphers and will return the output tag.
|
is a gnutls_cipher_hd_t structure. |
|
will hold the tag |
|
The length of the tag to return |
Returns : |
Zero or a negative error code on error. |
Since 3.0
int gnutls_hash (gnutls_hash_hd_t handle
,const void *text
,size_t textlen
);
This function will hash the given data using the algorithm specified by the context.
|
is a gnutls_cipher_hd_t structure. |
|
the data to hash |
|
The length of data to hash |
Returns : |
Zero or a negative error code on error. |
Since 2.10.0
void gnutls_hash_deinit (gnutls_hash_hd_t handle
,void *digest
);
This function will deinitialize all resources occupied by the given hash context.
|
is a gnutls_hash_hd_t structure. |
|
is the output value of the hash |
Since 2.10.0
int gnutls_hash_fast (gnutls_digest_algorithm_t algorithm
,const void *text
,size_t textlen
,void *digest
);
This convenience function will hash the given data and return output on a single call.
|
the hash algorithm to use |
|
the data to hash |
|
The length of data to hash |
|
is the output value of the hash |
Returns : |
Zero or a negative error code on error. |
Since 2.10.0
int gnutls_hash_get_len (gnutls_digest_algorithm_t algorithm
);
This function will return the length of the output data of the given hash algorithm.
|
the hash algorithm to use |
Returns : |
The length or zero on error. |
Since 2.10.0
int gnutls_hash_init (gnutls_hash_hd_t *dig
,gnutls_digest_algorithm_t algorithm
);
This function will initialize an context that can be used to produce a Message Digest of data. This will effectively use the current crypto backend in use by gnutls or the cryptographic accelerator in use.
|
is a gnutls_hash_hd_t structure. |
|
the hash algorithm to use |
Returns : |
Zero or a negative error code on error. |
Since 2.10.0
void gnutls_hash_output (gnutls_hash_hd_t handle
,void *digest
);
This function will output the current hash value and reset the state of the hash.
|
is a gnutls_hash_hd_t structure. |
|
is the output value of the hash |
Since 2.10.0
int gnutls_hmac (gnutls_hmac_hd_t handle
,const void *text
,size_t textlen
);
This function will hash the given data using the algorithm specified by the context.
|
is a gnutls_cipher_hd_t structure. |
|
the data to hash |
|
The length of data to hash |
Returns : |
Zero or a negative error code on error. |
Since 2.10.0
void gnutls_hmac_deinit (gnutls_hmac_hd_t handle
,void *digest
);
This function will deinitialize all resources occupied by the given hmac context.
|
is a gnutls_hmac_hd_t structure. |
|
is the output value of the MAC |
Since 2.10.0
int gnutls_hmac_fast (gnutls_mac_algorithm_t algorithm
,const void *key
,size_t keylen
,const void *text
,size_t textlen
,void *digest
);
This convenience function will hash the given data and return output on a single call.
|
the hash algorithm to use |
|
the key to use |
|
The length of the key |
|
the data to hash |
|
The length of data to hash |
|
is the output value of the hash |
Returns : |
Zero or a negative error code on error. |
Since 2.10.0
int gnutls_hmac_get_len (gnutls_mac_algorithm_t algorithm
);
This function will return the length of the output data of the given hmac algorithm.
|
the hmac algorithm to use |
Returns : |
The length or zero on error. |
Since 2.10.0
int gnutls_hmac_init (gnutls_hmac_hd_t *dig
,gnutls_mac_algorithm_t algorithm
,const void *key
,size_t keylen
);
This function will initialize an context that can be used to produce a Message Authentication Code (MAC) of data. This will effectively use the current crypto backend in use by gnutls or the cryptographic accelerator in use.
|
is a gnutls_hmac_hd_t structure. |
|
the HMAC algorithm to use |
|
The key to be used for encryption |
|
The length of the key |
Returns : |
Zero or a negative error code on error. |
Since 2.10.0
void gnutls_hmac_output (gnutls_hmac_hd_t handle
,void *digest
);
This function will output the current MAC value and reset the state of the MAC.
|
is a gnutls_hmac_hd_t structure. |
|
is the output value of the MAC |
Since 2.10.0
size_t gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm
);
Get size of MAC key.
|
is an encryption algorithm |
Returns : |
length (in bytes) of the given MAC key size, or 0 if the given MAC algorithm is invalid. |
int gnutls_rnd (gnutls_rnd_level_t level
,void *data
,size_t len
);
This function will generate random data and store it to output buffer.
|
a security level |
|
place to store random bytes |
|
The requested size |
Returns : |
Zero or a negative error code on error. |
Since 2.12.0
typedef enum { GNUTLS_RND_NONCE = 0, GNUTLS_RND_RANDOM = 1, GNUTLS_RND_KEY = 2 } gnutls_rnd_level_t;
Enumeration of random quality levels.