test: guess_raw_type: plain signed incoming message
[libisds.git] / src / crypto.h
blob3c8094524e073a6878318ef8709b6d83aca3a3c6
1 #ifndef __ISDS_CRYPTO_H__
2 #define __ISDS_CRYPTO_H__
4 #include "isds.h"
6 /* Inicialize libgrcypt if not yet done by application or other library.
7 * @current_version is static string describing cerrent gcrypt version
8 * @return IE_SUCCESS if everything is O.k. */
9 isds_error init_gcrypt(const char **current_version);
11 /* Computes hash from @input with @length and store it into @hash.
12 * The hash algoritm is defined inside @hash.
13 * @input is input block to hash
14 * @length is @input block length in bytes
15 * @hash input algoritm, output hash value and hash length; hash value will be
16 * reallocated, it's always valid pointer or NULL (before and after call) */
17 isds_error compute_hash(const void *input, const size_t length,
18 struct isds_hash *hash);
20 /* Inicialize GPGME.
21 * @current_version is pointer to static string decribing currnet gpgme
22 * @return IE_SUCCESS if everything is O.k. */
23 isds_error init_gpgme(const char **current_version);
25 /* Free CMS data buffer allocated inside extract_cms_data().
26 * This is necesary because GPGME.
27 * @buffer is pointer to memory to free */
28 void cms_data_free(void *buffer);
30 /* Extract data from CMS (successor of PKCS#7)
31 * @context is session context
32 * @cms is input block with CMS structure
33 * @cms_length is @cms block length in bytes
34 * @data are automatically reallocated bit stream with data found in @cms
35 * You must free them with cms_data_free().
36 * @data_length is length of @data in bytes */
37 isds_error extract_cms_data(struct isds_ctx *context,
38 const void *cms, const size_t cms_length,
39 void **data, size_t *data_length);
41 #endif