Guardtime KSI c SDK
|
Typedefs | |
typedef enum KSI_HashChainLinkIdentityType_en | KSI_HashChainLinkIdentityType |
Enumerations | |
enum | KSI_HashChainLinkIdentityType_en { KSI_IDENTITY_TYPE_LEGACY_ID, KSI_IDENTITY_TYPE_METADATA, KSI_IDENTITY_TYPE_UNKNOWN } |
This module contains hash chain computation methods. General hash chains are represented as a list of KSI_HashChainLink objects, where the first element is also the first sibling.
Hash chain link identity type.
Hash chain link identity type.
int KSI_AggregationHashChain_aggregate | ( | KSI_AggregationHashChain * | aggr, |
int | startLevel, | ||
int * | endLevel, | ||
KSI_DataHash ** | root | ||
) |
Aggregate the aggregation chain.
[in] | aggr | The aggregation chain. |
[in] | startLevel | The level of the first chain link. |
[out] | endLevel | The level of the root node. Can be NULL. |
[out] | root | Pointer to the receiving pointer. Can be NULL. |
int KSI_AggregationHashChain_calculateShape | ( | const KSI_AggregationHashChain * | chn, |
KSI_uint64_t * | shape | ||
) |
This function will represent the shape of the aggregation chain. The bits represent the path from the root of the tree to the location of a hash value as a sequence of moves from a parent node in the tree to either the left or right child (bit values 0 and 1, respectively). Each bit sequence starts with a 1-bit to make sure no left most 0-bits are lost.
[in] | chn | The aggregation chain. |
[out] | shape | Pointer to the receiving variable. |
int KSI_AggregationHashChain_compare | ( | const KSI_AggregationHashChain ** | left, |
const KSI_AggregationHashChain ** | right | ||
) |
void KSI_AggregationHashChain_free | ( | KSI_AggregationHashChain * | aggr | ) |
Cleanup method for the aggregation hash chain.
[in] | aggr | Aggregation hash chain. |
int KSI_AggregationHashChain_getAggregationTime | ( | const KSI_AggregationHashChain * | aggr, |
KSI_Integer ** | aggregationTime | ||
) |
int KSI_AggregationHashChain_getAggrHashId | ( | const KSI_AggregationHashChain * | aggr, |
KSI_Integer ** | aggrHashId | ||
) |
int KSI_AggregationHashChain_getChain | ( | const KSI_AggregationHashChain * | aggr, |
KSI_LIST(KSI_HashChainLink)** | chain | ||
) |
int KSI_AggregationHashChain_getChainIndex | ( | const KSI_AggregationHashChain * | aggr, |
KSI_LIST(KSI_Integer)** | chainIndex | ||
) |
int KSI_AggregationHashChain_getIdentity | ( | const KSI_AggregationHashChain * | aggr, |
KSI_HashChainLinkIdentityList ** | identity | ||
) |
Get aggregation hash chain identity. The returned list consists of individual hash chain link identities. The identities in the list are ordered - the higher-link identity is before lower-link identity.
[in] | aggr | Aggregation hash chain. |
[in] | identity | Pointer to the receiving pointer. |
int KSI_AggregationHashChain_getInputData | ( | const KSI_AggregationHashChain * | aggr, |
KSI_OctetString ** | inputData | ||
) |
int KSI_AggregationHashChain_getInputHash | ( | const KSI_AggregationHashChain * | aggr, |
KSI_DataHash ** | inputHash | ||
) |
int KSI_AggregationHashChain_new | ( | KSI_CTX * | ctx, |
KSI_AggregationHashChain ** | out | ||
) |
Aggregation hash chain constructor.
[in] | ctx | KSI context. |
[out] | out | Pointer to the receiving pointer. |
KSI_AggregationHashChain* KSI_AggregationHashChain_ref | ( | KSI_AggregationHashChain * | o | ) |
[in] | o | Pointer to KSI_AggregationHashChain * |
NULL
on error. * int KSI_AggregationHashChain_setAggregationTime | ( | KSI_AggregationHashChain * | aggr, |
KSI_Integer * | aggregationTime | ||
) |
int KSI_AggregationHashChain_setAggrHashId | ( | KSI_AggregationHashChain * | aggr, |
KSI_Integer * | aggrHashId | ||
) |
int KSI_AggregationHashChain_setChain | ( | KSI_AggregationHashChain * | aggr, |
KSI_LIST(KSI_HashChainLink)* | chain | ||
) |
int KSI_AggregationHashChain_setChainIndex | ( | KSI_AggregationHashChain * | aggr, |
KSI_LIST(KSI_Integer)* | chainIndex | ||
) |
int KSI_AggregationHashChain_setInputData | ( | KSI_AggregationHashChain * | aggr, |
KSI_OctetString * | inputData | ||
) |
int KSI_AggregationHashChain_setInputHash | ( | KSI_AggregationHashChain * | aggr, |
KSI_DataHash * | inputHash | ||
) |
int KSI_AggregationHashChain_writeBytes | ( | KSI_AggregationHashChain * | o, |
unsigned char * | buf, | ||
size_t | buf_size, | ||
size_t * | buf_len, | ||
int | opt | ||
) |
[in] | o | Object to be serialized. * |
[in] | buf | Pointer to pre-allocated buffer. * |
[in] | buf_size | Buffer size. * |
[out] | buf_len | Serialized buffer length. * |
[in] | opt | Serialization options. * |
int KSI_AggregationHashChainList_aggregate | ( | KSI_AggregationHashChainList * | chainList, |
KSI_CTX * | ctx, | ||
int | level, | ||
KSI_DataHash ** | outputHash | ||
) |
This function aggregates the aggregation hash chain list and returns the result hash via outputHash
parameter.
[in] | chainList | Hash chain list (list of hash chains). |
[in] | ctx | KSI context. |
[in] | level | Aggregation level. |
[out] | outputHash | Pointer to the receiving pointer to data hash object. |
int KSI_CalendarHashChain_aggregate | ( | KSI_CalendarHashChain * | chain, |
KSI_DataHash ** | hsh | ||
) |
int KSI_CalendarHashChain_calculateAggregationTime | ( | const KSI_CalendarHashChain * | chain, |
time_t * | aggrTime | ||
) |
void KSI_CalendarHashChain_free | ( | KSI_CalendarHashChain * | t | ) |
KSI_CalendarHashChain
int KSI_CalendarHashChain_getAggregationTime | ( | const KSI_CalendarHashChain * | t, |
KSI_Integer ** | aggregationTime | ||
) |
int KSI_CalendarHashChain_getHashChain | ( | const KSI_CalendarHashChain * | t, |
KSI_LIST(KSI_HashChainLink)** | hashChain | ||
) |
int KSI_CalendarHashChain_getInputHash | ( | const KSI_CalendarHashChain * | t, |
KSI_DataHash ** | inputHash | ||
) |
int KSI_CalendarHashChain_getPublicationTime | ( | const KSI_CalendarHashChain * | t, |
KSI_Integer ** | publicationTime | ||
) |
int KSI_CalendarHashChain_new | ( | KSI_CTX * | ctx, |
KSI_CalendarHashChain ** | t | ||
) |
KSI_CalendarHashChain* KSI_CalendarHashChain_ref | ( | KSI_CalendarHashChain * | o | ) |
[in] | o | Pointer to KSI_CalendarHashChain * |
NULL
on error. * int KSI_CalendarHashChain_setAggregationTime | ( | KSI_CalendarHashChain * | t, |
KSI_Integer * | aggregationTime | ||
) |
int KSI_CalendarHashChain_setHashChain | ( | KSI_CalendarHashChain * | t, |
KSI_LIST(KSI_HashChainLink)* | hashChain | ||
) |
int KSI_CalendarHashChain_setInputHash | ( | KSI_CalendarHashChain * | t, |
KSI_DataHash * | inputHash | ||
) |
int KSI_CalendarHashChain_setPublicationTime | ( | KSI_CalendarHashChain * | t, |
KSI_Integer * | publicationTime | ||
) |
int KSI_CalendarHashChain_verifyCompatibilityTo | ( | const KSI_CalendarHashChain * | a, |
const KSI_CalendarHashChain * | b | ||
) |
Checks if the two calendar hash chains are compatible with each other. The function performs the following checks:
[in] | a | The first calendar hash chain. |
[in] | b | The second calendar hash chain. |
int KSI_CalendarHashChain_writeBytes | ( | KSI_CalendarHashChain * | o, |
unsigned char * | buf, | ||
size_t | buf_size, | ||
size_t * | buf_len, | ||
int | opt | ||
) |
[in] | o | Object to be serialized. * |
[in] | buf | Pointer to pre-allocated buffer. * |
[in] | buf_size | Buffer size. * |
[out] | buf_len | Serialized buffer length. * |
[in] | opt | Serialization options. * |
int KSI_CalendarHashChainLink_fromTlv | ( | KSI_TLV * | tlv, |
KSI_CalendarHashChainLink ** | o | ||
) |
Function to convert a plain KSI_TLV to a KSI_CalendarHashChainLink . The TLV meta data (i.e. tag, length and flags) are not preserved.
[in] | tlv | Pointer to KSI_TLV. |
[out] | o | Pointer to receiving pointer. |
KSI_OK
, when operation succeeded, otherwise an error code). int KSI_CalendarHashChainLink_toTlv | ( | KSI_CTX * | ctx, |
const KSI_CalendarHashChainLink * | o, | ||
unsigned | tag, | ||
int | isNonCritical, | ||
int | isForward, | ||
KSI_TLV ** | tlv | ||
) |
Function to convert a KSI_CalendarHashChainLink to a plain KSI_TLV object.
[in] | ctx | KSI context. |
[in] | o | Pointer to KSI_CalendarHashChainLink |
[in] | tag | Tag value of the KSI_TLV |
[in] | isNonCritical | Flag is-non-critical. |
[in] | isForward | Flag is-forward. |
[out] | tlv | Pointer to the receiving pointer. |
KSI_OK
, when operation succeeded, otherwise an error code). int KSI_HashChain_aggregate | ( | KSI_CTX * | , |
KSI_LIST(KSI_HashChainLink)* | chain, | ||
const KSI_DataHash * | inputHash, | ||
int | startLevel, | ||
KSI_HashAlgorithm | algo_id, | ||
int * | endLevel, | ||
KSI_DataHash ** | outputHash | ||
) |
This function aggregates the hashchain and returns the result hash via outputHash
parameter.
[in] | chain | Hash chain (list of hash chain links) |
[in] | inputHash | Input hash value. |
[in] | startLevel | The initial level of this hash chain. |
[in] | algo_id | Hash algorithm to be used to calculate the next value. |
[out] | endLevel | Pointer to the receiving end level variable. |
[out] | outputHash | Pointer to the receiving pointer to data hash object. |
int KSI_HashChain_aggregateCalendar | ( | KSI_CTX * | , |
KSI_LIST(KSI_HashChainLink)* | chain, | ||
const KSI_DataHash * | inputHash, | ||
KSI_DataHash ** | outputHash | ||
) |
This function aggregates the calendar hash chain and returns the result hash via outputHash
parameter.
[in] | chain | Hash chain. |
[in] | inputHash | Input hash value. |
[out] | outputHash | Pointer to the receiving pointer to data hash object. |
void KSI_HashChainLink_free | ( | KSI_HashChainLink * | t | ) |
Free the resources of a KSI_HashChainLink
[in] | t | Pointer to KSI_HashChainLink |
int KSI_HashChainLink_fromTlv | ( | KSI_TLV * | tlv, |
KSI_HashChainLink ** | o | ||
) |
Function to convert a plain KSI_TLV to a KSI_HashChainLink . The TLV meta data (i.e. tag, length and flags) are not preserved.
[in] | tlv | Pointer to KSI_TLV. |
[out] | o | Pointer to receiving pointer. |
KSI_OK
, when operation succeeded, otherwise an error code). int KSI_HashChainLink_getImprint | ( | const KSI_HashChainLink * | t, |
KSI_DataHash ** | imprint | ||
) |
Getter method for imprint
.
[in] | t | Pointer to KSI_HashChainLink. |
[out] | imprint | Pointer to receiving pointer. |
t
. int KSI_HashChainLink_getIsLeft | ( | const KSI_HashChainLink * | t, |
int * | isLeft | ||
) |
Getter method for isLeft
.
[in] | t | Pointer to KSI_HashChainLink. |
[out] | isLeft | Pointer to receiving pointer. |
int KSI_HashChainLink_getLegacyId | ( | const KSI_HashChainLink * | t, |
KSI_OctetString ** | legacyId | ||
) |
Getter method for legacyId
.
[in] | t | Pointer to KSI_HashChainLink. |
[out] | legacyId | Pointer to receiving pointer. |
t
. int KSI_HashChainLink_getLevelCorrection | ( | const KSI_HashChainLink * | t, |
KSI_Integer ** | levelCorrection | ||
) |
Getter method for levelCorrection
.
[in] | t | Pointer to KSI_HashChainLink. |
[out] | levelCorrection | Pointer to receiving pointer. |
t
. int KSI_HashChainLink_getMetaData | ( | const KSI_HashChainLink * | t, |
KSI_MetaDataElement ** | metaData | ||
) |
Getter method for metaData
.
[in] | t | Pointer to KSI_HashChainLink. |
[out] | metaData | Pointer to receiving pointer. |
t
. int KSI_HashChainLink_LegacyId_fromTlv | ( | KSI_TLV * | tlv, |
KSI_OctetString ** | legacyId | ||
) |
int KSI_HashChainLink_LegacyId_toTlv | ( | KSI_CTX * | ctx, |
const KSI_OctetString * | legacyId, | ||
unsigned | tag, | ||
int | isNonCritical, | ||
int | isForward, | ||
KSI_TLV ** | tlv | ||
) |
int KSI_HashChainLink_new | ( | KSI_CTX * | ctx, |
KSI_HashChainLink ** | t | ||
) |
Creates a new empty KSI_HashChainLink.
[in] | ctx | KSI context. |
[out] | t | Pointer to the receiving pointer. |
int KSI_HashChainLink_setImprint | ( | KSI_HashChainLink * | t, |
KSI_DataHash * | imprint | ||
) |
Setter method for imprint
.
[in] | t | Pointer to KSI_HashChainLink. |
[in] | imprint | Pointer to receiving pointer. |
t
and will be freed by KSI_HashChainLink_free. int KSI_HashChainLink_setIsLeft | ( | KSI_HashChainLink * | t, |
int | isLeft | ||
) |
Setter method for isLeft
.
[in] | t | Pointer to KSI_HashChainLink. |
[in] | isLeft | Pointer to receiving pointer. |
int KSI_HashChainLink_setLegacyId | ( | KSI_HashChainLink * | t, |
KSI_OctetString * | legacyId | ||
) |
Setter method for legacyId
.
[in] | t | Pointer to KSI_HashChainLink. |
[in] | legacyId | Pointer to receiving pointer. |
t
and will be freed by KSI_HashChainLink_free. int KSI_HashChainLink_setLevelCorrection | ( | KSI_HashChainLink * | t, |
KSI_Integer * | levelCorrection | ||
) |
Setter method for levelCorrection
.
[in] | t | Pointer to KSI_HashChainLink. |
[in] | levelCorrection | Pointer to receiving pointer. |
t
and will be freed by KSI_HashChainLink_free. int KSI_HashChainLink_setMetaData | ( | KSI_HashChainLink * | t, |
KSI_MetaDataElement * | metaData | ||
) |
Setter method for metaData
.
[in] | t | Pointer to KSI_HashChainLink. |
[in] | metaData | Pointer to receiving pointer. |
t
and will be freed by KSI_HashChainLink_free. int KSI_HashChainLink_toTlv | ( | KSI_CTX * | ctx, |
const KSI_HashChainLink * | o, | ||
unsigned | tag, | ||
int | isNonCritical, | ||
int | isForward, | ||
KSI_TLV ** | tlv | ||
) |
Function to convert a KSI_HashChainLink to a plain KSI_TLV object.
[in] | ctx | KSI context. |
[in] | o | Pointer to KSI_HashChainLink |
[in] | tag | Tag value of the KSI_TLV |
[in] | isNonCritical | Flag is-non-critical. |
[in] | isForward | Flag is-forward. |
[out] | tlv | Pointer to the receiving pointer. |
KSI_OK
, when operation succeeded, otherwise an error code). void KSI_HashChainLinkIdentity_free | ( | KSI_HashChainLinkIdentity * | identity | ) |
int KSI_HashChainLinkIdentity_getClientId | ( | const KSI_HashChainLinkIdentity * | o, |
KSI_Utf8String ** | v | ||
) |
int KSI_HashChainLinkIdentity_getMachineId | ( | const KSI_HashChainLinkIdentity * | o, |
KSI_Utf8String ** | v | ||
) |
int KSI_HashChainLinkIdentity_getRequestTime | ( | const KSI_HashChainLinkIdentity * | o, |
KSI_Integer ** | v | ||
) |
int KSI_HashChainLinkIdentity_getSequenceNr | ( | const KSI_HashChainLinkIdentity * | o, |
KSI_Integer ** | v | ||
) |
int KSI_HashChainLinkIdentity_getType | ( | const KSI_HashChainLinkIdentity * | o, |
KSI_HashChainLinkIdentityType * | v | ||
) |
KSI_HashChainLinkIdentity* KSI_HashChainLinkIdentity_ref | ( | KSI_HashChainLinkIdentity * | o | ) |
[in] | o | Pointer to KSI_HashChainLinkIdentity * |
NULL
on error. * int KSI_Signature_appendAggregationChain | ( | KSI_Signature * | sig, |
KSI_AggregationHashChain * | aggr | ||
) |