Guardtime KSI c SDK
|
Typedefs | |
typedef struct KSI_HmacHasher_st | KSI_HmacHasher |
Functions | |
int | KSI_base32Decode (const char *base32, unsigned char **data, size_t *data_len) |
int | KSI_base32Encode (const unsigned char *data, size_t data_len, size_t group_len, char **encoded) |
unsigned long | KSI_crc32 (const void *data, size_t length, unsigned long ival) |
int | KSI_HMAC_create (KSI_CTX *ctx, KSI_HashAlgorithm algo_id, const char *key, const unsigned char *data, size_t data_len, KSI_DataHash **hmac) |
int | KSI_HmacHasher_open (KSI_CTX *ctx, KSI_HashAlgorithm algo_id, const char *key, KSI_HmacHasher **hasher) |
int | KSI_HmacHasher_reset (KSI_HmacHasher *hasher) |
int | KSI_HmacHasher_add (KSI_HmacHasher *hasher, const void *data, size_t data_length) |
int | KSI_HmacHasher_close (KSI_HmacHasher *hasher, KSI_DataHash **hmac) |
void | KSI_HmacHasher_free (KSI_HmacHasher *hasher) |
typedef struct KSI_HmacHasher_st KSI_HmacHasher |
This structure is used for calculating the HMAC hash values.
int KSI_base32Decode | ( | const char * | base32, |
unsigned char ** | data, | ||
size_t * | data_len | ||
) |
Decodes given base32 encoded data.
[in] | base32 | Pointer to the base32 encoded source string. |
[out] | data | Pointer to the receiving pointer. |
[out] | data_len | Pointer to the raw value length variable. |
data
. int KSI_base32Encode | ( | const unsigned char * | data, |
size_t | data_len, | ||
size_t | group_len, | ||
char ** | encoded | ||
) |
Encodes given binary data to base32.
[in] | data | Pointer to the input data. |
[in] | data_len | Length of the input data. |
[in] | group_len | Length of a group (the groups are separated with '-') |
[out] | encoded | Pointer to the receiving pointer. |
encoded
. unsigned long KSI_crc32 | ( | const void * | data, |
size_t | length, | ||
unsigned long | ival | ||
) |
Calculates CRC32 checksum.
[in] | data | Pointer to the data. |
[in] | length | Length of the data. |
[in] | ival | Initial value. Pass 0 for the first or single call to this function and pass result from the previous call for the next part of the data. |
int KSI_HMAC_create | ( | KSI_CTX * | ctx, |
KSI_HashAlgorithm | algo_id, | ||
const char * | key, | ||
const unsigned char * | data, | ||
size_t | data_len, | ||
KSI_DataHash ** | hmac | ||
) |
Creates a KSI_DataHash representing the HMAC value calculated by the key and data using alg
as the hash algorithm.
[in] | ctx | KSI context. |
[in] | algo_id | Hash algorithm ID see KSI_Hash |
[in] | key | Key value for the HMAC. |
[in] | data | Pointer to the data to be HMAC'ed. |
[in] | data_len | Length of the data. |
[out] | hmac | Pointer to the receiving pointer. |
int KSI_HmacHasher_add | ( | KSI_HmacHasher * | hasher, |
const void * | data, | ||
size_t | data_length | ||
) |
Adds data to an open HMAC computation.
[in] | hasher | Hasher object. |
[in] | data | Pointer to the data to be hashed. |
[in] | data_length | Length of the hashed data. |
int KSI_HmacHasher_close | ( | KSI_HmacHasher * | hasher, |
KSI_DataHash ** | hmac | ||
) |
Finalizes an HMAC computation.
[in] | hasher | Hasher object. |
[out] | hmac | Pointer that will receive pointer to the hash object. |
void KSI_HmacHasher_free | ( | KSI_HmacHasher * | hasher | ) |
int KSI_HmacHasher_open | ( | KSI_CTX * | ctx, |
KSI_HashAlgorithm | algo_id, | ||
const char * | key, | ||
KSI_HmacHasher ** | hasher | ||
) |
Starts an HMAC computation.
[in] | ctx | KSI context. |
[in] | algo_id | Identifier of the hash algorithm. See KSI_HashAlgorithm_en for possible values. |
[in] | key | Key value for the HMAC. |
[out] | hasher | Pointer that will receive pointer to the hasher object. |
int KSI_HmacHasher_reset | ( | KSI_HmacHasher * | hasher | ) |
Resets the state of the HMAC computation.
[in] | hasher | The hasher. |