Guardtime KSI c SDK
|
Typedefs | |
typedef struct KSI_PublicationsFile_st | KSI_PublicationsFile |
Publication file is a trust anchor for verifying KSI Blockchain signatures. It contains a list of public-key certificates for verifying authentication records and publications for verifying calendar hash chains. Publication file has the following components that must appear in the following order:
typedef struct KSI_PublicationsFile_st KSI_PublicationsFile |
void KSI_PublicationData_free | ( | KSI_PublicationData * | t | ) |
KSI_PublicationData
int KSI_PublicationData_fromBase32 | ( | KSI_CTX * | ctx, |
const char * | publication, | ||
KSI_PublicationData ** | published_data | ||
) |
Converts the base-32 encoded publicationstring into KSI_PublicationData object.
[in] | ctx | KSI context. |
[in] | publication | Pointer to base-32 encoded publications string. |
[out] | published_data | Pointer to the receiving pointer. |
int KSI_PublicationData_fromTlv | ( | KSI_TLV * | tlv, |
KSI_PublicationData ** | data | ||
) |
int KSI_PublicationData_getBaseTlv | ( | const KSI_PublicationData * | o, |
KSI_TLV ** | baseTlv | ||
) |
int KSI_PublicationData_getImprint | ( | const KSI_PublicationData * | t, |
KSI_DataHash ** | imprint | ||
) |
int KSI_PublicationData_getTime | ( | const KSI_PublicationData * | t, |
KSI_Integer ** | time | ||
) |
int KSI_PublicationData_new | ( | KSI_CTX * | ctx, |
KSI_PublicationData ** | t | ||
) |
KSI_PublicationData* KSI_PublicationData_ref | ( | KSI_PublicationData * | o | ) |
[in] | o | Pointer to KSI_PublicationData * |
NULL
on error. * int KSI_PublicationData_setBaseTlv | ( | KSI_PublicationData * | o, |
KSI_TLV * | baseTlv | ||
) |
int KSI_PublicationData_setImprint | ( | KSI_PublicationData * | t, |
KSI_DataHash * | imprint | ||
) |
int KSI_PublicationData_setTime | ( | KSI_PublicationData * | t, |
KSI_Integer * | time | ||
) |
int KSI_PublicationData_toBase32 | ( | const KSI_PublicationData * | published_data, |
char ** | publication | ||
) |
Function to concert the published data into a base-32 encoded null-terminated string.
[in] | published_data | Pointer to the published data object. |
[out] | publication | Pointer to the receiving pointer. |
char* KSI_PublicationData_toString | ( | const KSI_PublicationData * | t, |
char * | buffer, | ||
size_t | buffer_len | ||
) |
int KSI_PublicationData_toTlv | ( | KSI_CTX * | ctx, |
const KSI_PublicationData * | data, | ||
unsigned | tag, | ||
int | isNonCritical, | ||
int | isForward, | ||
KSI_TLV ** | tlv | ||
) |
int KSI_PublicationRecord_clone | ( | const KSI_PublicationRecord * | rec, |
KSI_PublicationRecord ** | clone | ||
) |
void KSI_PublicationRecord_free | ( | KSI_PublicationRecord * | t | ) |
KSI_PublicationRecord
int KSI_PublicationRecord_getPublicationRefList | ( | const KSI_PublicationRecord * | t, |
KSI_LIST(KSI_Utf8String)** | publicationRef | ||
) |
int KSI_PublicationRecord_getPublishedData | ( | const KSI_PublicationRecord * | t, |
KSI_PublicationData ** | publishedData | ||
) |
int KSI_PublicationRecord_getRepositoryUriList | ( | const KSI_PublicationRecord * | t, |
KSI_LIST(KSI_Utf8String)** | repUriList | ||
) |
int KSI_PublicationRecord_new | ( | KSI_CTX * | ctx, |
KSI_PublicationRecord ** | t | ||
) |
KSI_PublicationRecord* KSI_PublicationRecord_ref | ( | KSI_PublicationRecord * | o | ) |
[in] | o | Pointer to KSI_PublicationRecord * |
NULL
on error. * int KSI_PublicationRecord_setPublicationRefList | ( | KSI_PublicationRecord * | t, |
KSI_LIST(KSI_Utf8String)* | publicationRef | ||
) |
int KSI_PublicationRecord_setPublishedData | ( | KSI_PublicationRecord * | t, |
KSI_PublicationData * | publishedData | ||
) |
int KSI_PublicationRecord_setRepositoryUriList | ( | KSI_PublicationRecord * | t, |
KSI_LIST(KSI_Utf8String)* | repUriList | ||
) |
char* KSI_PublicationRecord_toString | ( | const KSI_PublicationRecord * | t, |
char * | buffer, | ||
size_t | buffer_len | ||
) |
int KSI_PublicationRecord_writeBytes | ( | KSI_PublicationRecord * | 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_PublicationsFile_findPublication | ( | const KSI_PublicationsFile * | trust, |
const KSI_PublicationRecord * | inRec, | ||
KSI_PublicationRecord ** | outRec | ||
) |
int KSI_PublicationsFile_findPublicationByTime | ( | const KSI_PublicationsFile * | trust, |
const KSI_Integer * | time, | ||
KSI_PublicationRecord ** | outRec | ||
) |
void KSI_PublicationsFile_free | ( | KSI_PublicationsFile * | pubFile | ) |
Function for freeing publicationsfile object.
[in] | pubFile | Publicationsfile to be freed. |
int KSI_PublicationsFile_fromFile | ( | KSI_CTX * | ctx, |
const char * | fileName, | ||
KSI_PublicationsFile ** | pubFile | ||
) |
A convenience function for loading a publications file from an actual file.
[in] | ctx | KSI context. |
[in] | fileName | Publications file filename. |
[out] | pubFile | Pointer to the receiving pointer. |
fopen
. Alternate Data Streams (WIndows NTFS) and Resource Forks (OS X HFS) may or may not be supported, depending on the C standard library used in the application. int KSI_PublicationsFile_getCertConstraints | ( | const KSI_PublicationsFile * | pubFile, |
KSI_CertConstraint ** | certConstraints | ||
) |
Publicationsfile certificate constraints getter method.
[in] | pubFile | Publications file. |
[out] | certConstraints | Pointer to receiving pointer. |
int KSI_PublicationsFile_getCertificates | ( | const KSI_PublicationsFile * | pubFile, |
KSI_LIST(KSI_CertificateRecord)** | certificates | ||
) |
Publicationsfile certificate list getter method.
[in] | pubFile | Publications file. |
[out] | certificates | Pointer to receiving pointer. |
int KSI_PublicationsFile_getHeader | ( | const KSI_PublicationsFile * | pubFile, |
KSI_PublicationsHeader ** | header | ||
) |
Publicationsfile header getter method.
[in] | pubFile | Publicationsfile object. |
[out] | header | Pointer to receiving pointer. |
int KSI_PublicationsFile_getLatestPublication | ( | const KSI_PublicationsFile * | pubFile, |
const KSI_Integer * | pubTime, | ||
KSI_PublicationRecord ** | pubRec | ||
) |
Search latest publication by time. The last available publication (published after the given time pubTime
) is returned via the output parameter pubRec
if found, otherwise pubRec
is evaluated to NULL.
[in] | pubFile | Publications file. |
[in] | pubTime | Publication time. If this is NULL , latest publication in the file is returned. |
[out] | pubRec | Pointer to receiving pointer. |
int KSI_PublicationsFile_getNearestPublication | ( | const KSI_PublicationsFile * | pubFile, |
const KSI_Integer * | pubTime, | ||
KSI_PublicationRecord ** | pubRec | ||
) |
Search nearest publication by time. The next available publication (published after the given time pubTime
) is returned via the output parameter pubRec
if found, otherwise pubRec
is evaluated to NULL.
[in] | pubFile | Publications file. |
[in] | pubTime | Publication time. |
[out] | pubRec | Pointer to receiving pointer. |
int KSI_PublicationsFile_getPKICertificateById | ( | const KSI_PublicationsFile * | pubFile, |
const KSI_OctetString * | id, | ||
KSI_PKICertificate ** | cert | ||
) |
PKI Certificate search function by certificate Id.
[in] | pubFile | Publications file. |
[in] | id | Certificate id. |
[out] | cert | Pointer to receiving pointer. |
int KSI_PublicationsFile_getPublicationDataByPublicationString | ( | const KSI_PublicationsFile * | pubFile, |
const char * | pubString, | ||
KSI_PublicationRecord ** | pubRec | ||
) |
Search publication by publication string. The publication is returned via output parameter pubRec
if found, otherwise pubRec
is evaluated to NULL.
[in] | pubFile | Publications file. |
[in] | pubString | Publication string. |
[out] | pubRec | Pointer to receiving pointer. |
int KSI_PublicationsFile_getPublicationDataByTime | ( | const KSI_PublicationsFile * | pubFile, |
const KSI_Integer * | pubTime, | ||
KSI_PublicationRecord ** | pubRec | ||
) |
Search publication by exact time. The publication is returned via output parameter pubRec
if found, otherwise pubRec
is evaluated to NULL.
[in] | pubFile | Publications file. |
[in] | pubTime | Publication time. |
[out] | pubRec | Pointer to receiving pointer. |
int KSI_PublicationsFile_getPublications | ( | const KSI_PublicationsFile * | pubFile, |
KSI_LIST(KSI_PublicationRecord)** | publications | ||
) |
Publicationsfile publications list getter method.
[in] | pubFile | Publications file. |
[out] | publications | Pointer to receiving pointer. |
int KSI_PublicationsFile_getSignature | ( | const KSI_PublicationsFile * | pubFile, |
KSI_PKISignature ** | signature | ||
) |
Publicationsfile signature getter method.
[in] | pubFile | Publications file. |
[out] | signature | Pointer to receiving pointer. |
int KSI_PublicationsFile_getSignedDataLength | ( | const KSI_PublicationsFile * | pubFile, |
size_t * | signedDataLength | ||
) |
Publications file signed data length getter. It describes how many first bytes of serialized publications file are or are going to be signed with PKI signature. If publications file is changed it must be serialized to get valid result
[in] | pubFile | Publications file. |
signedDataLength |
int KSI_PublicationsFile_new | ( | KSI_CTX * | ctx, |
KSI_PublicationsFile ** | pubFile | ||
) |
This function creates an empty publications file.
[in] | ctx | KSI context. |
[out] | pubFile | Pointer to receiving pointer. |
int KSI_PublicationsFile_parse | ( | KSI_CTX * | ctx, |
const void * | raw, | ||
size_t | raw_len, | ||
KSI_PublicationsFile ** | pubFile | ||
) |
Function to parse the raw publicationsfile.
[in] | ctx | KSI context. |
[in] | raw | Pointer to the raw publications file. |
[in] | raw_len | Length of the raw publications file. |
[out] | pubFile | Pointer to the receiving pointer to the publications file object. |
KSI_PublicationsFile* KSI_PublicationsFile_ref | ( | KSI_PublicationsFile * | o | ) |
[in] | o | Pointer to KSI_PublicationsFile * |
NULL
on error. * int KSI_PublicationsFile_serialize | ( | KSI_CTX * | ctx, |
KSI_PublicationsFile * | pubFile, | ||
char ** | raw, | ||
size_t * | raw_len | ||
) |
This function serializes the publications file object into raw data.
[in] | ctx | KSI context. |
[in] | pubFile | Publications file. |
[out] | raw | Pointer to the pointer to output buffer. |
[out] | raw_len | Pointer to the length of the buffer variable. |
int KSI_PublicationsFile_setCertConstraints | ( | KSI_PublicationsFile * | pubFile, |
const KSI_CertConstraint * | arr | ||
) |
Specifies file-specific constraints for verifying the publications file PKI certificate. The file-specific constraints, if set, override the default constraints in the KSI context. The input consists of an array of OID and expected value pairs terminated by a pair of two NULLs. Except in the last terminating NULL pair, the expected value may not be NULL - this will make the function return KSI_INVALID_ARGUMENT. File-specific constraints can be cleared with a NULL in place of arr
.
[in] | pubFile | Publications file for which to set the constraints. |
[in] | arr | Array of OID and value pairs, terminated by a pair of NULLs. |
int KSI_PublicationsFile_setCertificates | ( | KSI_PublicationsFile * | pubFile, |
KSI_LIST(KSI_CertificateRecord)* | certificates | ||
) |
Publicationsfile certificate list setter method.
[in] | pubFile | Publications file. |
[in] | certificates | Pointer to the list of certificates. |
int KSI_PublicationsFile_setHeader | ( | KSI_PublicationsFile * | pubFile, |
KSI_PublicationsHeader * | header | ||
) |
Publicationsfile header setter method.
[in] | pubFile | Publications file. |
[in] | header | Pointer to the list of certificates. |
int KSI_PublicationsFile_setPublications | ( | KSI_PublicationsFile * | pubFile, |
KSI_LIST(KSI_PublicationRecord)* | publications | ||
) |
Publicationsfile publications list setter method.
[in] | pubFile | Publications file. |
[in] | publications | Pointer to the list of publications. |
int KSI_PublicationsFile_setSignature | ( | KSI_PublicationsFile * | pubFile, |
KSI_PKISignature * | signature | ||
) |
Publicationsfile signature setter method.
[in] | pubFile | Publications file. |
[in] | signature | Pointer to KSI signature object. |
int KSI_PublicationsFile_verify | ( | const KSI_PublicationsFile * | pubFile, |
KSI_CTX * | ctx | ||
) |
Verify PKI signature of the publications file using the PKI truststore.
[in] | pubFile | Publications file. |
[in] | ctx | KSI context. |