11 #include "dynamic_api.h"
12 #include "stringlist.h"
13 #include "stringpair.h"
14 #include "timestamp.h"
16 #define PEP_VERSION "1.0" // protocol version
18 #define PEP_OWN_USERID "pEp_own_userId"
23 // Unicode data has to be normalized to NFC before calling
24 // UTF-8 strings are UTF-8 encoded C strings (zero terminated)
28 typedef struct _pEpSession * PEP_SESSION;
33 PEP_INIT_CANNOT_LOAD_GPGME = 0x0110,
34 PEP_INIT_GPGME_INIT_FAILED = 0x0111,
35 PEP_INIT_NO_GPG_HOME = 0x0112,
36 PEP_INIT_NETPGP_INIT_FAILED = 0x0113,
38 PEP_INIT_SQLITE3_WITHOUT_MUTEX = 0x0120,
39 PEP_INIT_CANNOT_OPEN_DB = 0x0121,
40 PEP_INIT_CANNOT_OPEN_SYSTEM_DB = 0x0122,
42 PEP_KEY_NOT_FOUND = 0x0201,
43 PEP_KEY_HAS_AMBIG_NAME = 0x0202,
44 PEP_GET_KEY_FAILED = 0x0203,
45 PEP_CANNOT_EXPORT_KEY = 0x0204,
47 PEP_CANNOT_FIND_IDENTITY = 0x0301,
48 PEP_CANNOT_SET_PERSON = 0x0381,
49 PEP_CANNOT_SET_PGP_KEYPAIR = 0x0382,
50 PEP_CANNOT_SET_IDENTITY = 0x0383,
51 PEP_CANNOT_SET_TRUST = 0x0384,
52 PEP_KEY_BLACKLISTED = 0x0385,
54 PEP_UNENCRYPTED = 0x0400,
55 PEP_VERIFIED = 0x0401,
56 PEP_DECRYPTED = 0x0402,
57 PEP_DECRYPTED_AND_VERIFIED = 0x0403,
58 PEP_DECRYPT_WRONG_FORMAT = 0x0404,
59 PEP_DECRYPT_NO_KEY = 0x0405,
60 PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH = 0x0406,
61 PEP_VERIFY_NO_KEY = 0x0407,
62 PEP_VERIFIED_AND_TRUSTED = 0x0408,
63 PEP_CANNOT_DECRYPT_UNKNOWN = 0x04ff,
65 PEP_TRUSTWORD_NOT_FOUND = 0x0501,
67 PEP_CANNOT_CREATE_KEY = 0x0601,
68 PEP_CANNOT_SEND_KEY = 0x0602,
70 PEP_PHRASE_NOT_FOUND = 0x0701,
72 PEP_SEND_FUNCTION_NOT_REGISTERED = 0x0801,
73 PEP_CONTRAINTS_VIOLATED = 0x0802,
74 PEP_CANNOT_ENCODE = 0x0803,
76 PEP_SYNC_NO_TRUSTWORDS_CALLBACK = 0x0901,
77 PEP_SYNC_ILLEGAL_MESSAGE = 0x0902,
78 PEP_SYNC_NO_INJECT_CALLBACK = 0x0903,
80 PEP_SEQUENCE_VIOLATED = 0x0970,
81 PEP_CANNOT_INCREASE_SEQUENCE = 0x0971,
82 PEP_CANNOT_SET_SEQUENCE_VALUE = 0x0972,
83 PEP_OWN_SEQUENCE = 0x097f,
85 PEP_SYNC_STATEMACHINE_ERROR = 0x0980,
86 PEP_SYNC_NO_TRUST = 0x0981,
87 PEP_STATEMACHINE_INVALID_STATE = 0x0982,
88 PEP_STATEMACHINE_INVALID_EVENT = 0x0983,
89 PEP_STATEMACHINE_INVALID_CONDITION = 0x0984,
90 PEP_STATEMACHINE_INVALID_ACTION = 0x0985,
92 PEP_COMMIT_FAILED = 0xff01,
93 PEP_MESSAGE_CONSUMED = 0xff02,
95 PEP_RECORD_NOT_FOUND = -6,
96 PEP_CANNOT_CREATE_TEMP_FILE = -5,
97 PEP_ILLEGAL_VALUE = -4,
98 PEP_BUFFER_TOO_SMALL = -3,
99 PEP_OUT_OF_MEMORY = -2,
100 PEP_UNKNOWN_ERROR = -1
104 // INIT_STATUS init() - initialize pEpEngine for a thread
107 // session (out) init() allocates session memory and returns a pointer
111 // PEP_STATUS_OK = 0 if init() succeeds
112 // PEP_INIT_SQLITE3_WITHOUT_MUTEX if SQLite3 was compiled with
113 // SQLITE_THREADSAFE 0
114 // PEP_INIT_CANNOT_LOAD_GPGME if libgpgme.dll cannot be found
115 // PEP_INIT_GPGME_INIT_FAILED if GPGME init fails
116 // PEP_INIT_CANNOT_OPEN_DB if user's management db cannot be
118 // PEP_INIT_CANNOT_OPEN_SYSTEM_DB if system's management db cannot be
122 // the pointer is valid only if the return value is PEP_STATUS_OK
123 // in other case a NULL pointer will be returned; a valid handle must
124 // be released using release() when it's no longer needed
126 // the caller has to guarantee that the first call to this function
127 // will succeed before further calls can be done
129 DYNAMIC_API PEP_STATUS init(PEP_SESSION *session);
132 // void release() - release thread session handle
135 // session (in) session handle to release
138 // the last release() can be called only when all other release() calls
141 DYNAMIC_API void release(PEP_SESSION session);
144 // config_passive_mode() - enable passive mode
147 // session (in) session handle
148 // enable (in) flag if enabled or disabled
150 DYNAMIC_API void config_passive_mode(PEP_SESSION session, bool enable);
153 // config_unencrypted_subject() - disable subject encryption
156 // session (in) session handle
157 // enable (in) flag if enabled or disabled
159 DYNAMIC_API void config_unencrypted_subject(PEP_SESSION session, bool enable);
162 // config_use_only_own_private_keys() - enable passive mode
165 // session (in) session handle
166 // enable (in) flag if enabled or disabled
168 DYNAMIC_API void config_use_only_own_private_keys(PEP_SESSION session, bool enable);
171 // decrypt_and_verify() - decrypt and/or verify a message
174 // session (in) session handle
175 // ctext (in) cipher text to decrypt and/or verify
176 // csize (in) size of cipher text
177 // ptext (out) pointer to internal buffer with plain text
178 // psize (out) size of plain text
179 // keylist (out) list of key ids which where used to encrypt
182 // PEP_UNENCRYPTED message was unencrypted and not signed
183 // PEP_VERIFIED message was unencrypted, signature matches
184 // PEP_DECRYPTED message is decrypted now, no signature
185 // PEP_DECRYPTED_AND_VERIFIED message is decrypted now and verified
186 // PEP_DECRYPT_WRONG_FORMAT message has wrong format to handle
187 // PEP_DECRYPT_NO_KEY key not available to decrypt and/or verify
188 // PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH wrong signature
191 // the ownerships of ptext as well as keylist are going to the caller
192 // the caller must use free() (or an Windoze pEp_free()) and
193 // free_stringlist() to free them
195 // if this function failes an error message may be the first element of
196 // keylist and the other elements may be the keys used for encryption
198 DYNAMIC_API PEP_STATUS decrypt_and_verify(
199 PEP_SESSION session, const char *ctext, size_t csize,
200 char **ptext, size_t *psize, stringlist_t **keylist
204 // verify_text() - verfy plain text with a digital signature
207 // session (in) session handle
208 // text (in) text to verify
209 // size (in) size of text
210 // signature (in) signature text
211 // sig_size (in) size of signature
212 // keylist (out) list of key ids which where used to encrypt or NULL on
216 // PEP_VERIFIED message was unencrypted, signature matches
217 // PEP_DECRYPT_NO_KEY key not available to decrypt and/or verify
218 // PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH wrong signature
220 DYNAMIC_API PEP_STATUS verify_text(
221 PEP_SESSION session, const char *text, size_t size,
222 const char *signature, size_t sig_size, stringlist_t **keylist
226 // encrypt_and_sign() - encrypt and sign a message
229 // session (in) session handle
230 // keylist (in) list of key ids to encrypt with as C strings
231 // ptext (in) plain text to decrypt and/or verify
232 // psize (in) size of plain text
233 // ctext (out) pointer to internal buffer with cipher text
234 // csize (out) size of cipher text
237 // PEP_STATUS_OK = 0 encryption and signing succeeded
238 // PEP_KEY_NOT_FOUND at least one of the receipient keys
239 // could not be found
240 // PEP_KEY_HAS_AMBIG_NAME at least one of the receipient keys has
242 // PEP_GET_KEY_FAILED cannot retrieve key
245 // the ownership of ctext is going to the caller
246 // the caller is responsible to free() it (on Windoze use pEp_free())
247 // the first key in keylist is being used to sign the message
248 // this implies there has to be a private key for that keypair
250 DYNAMIC_API PEP_STATUS encrypt_and_sign(
251 PEP_SESSION session, const stringlist_t *keylist, const char *ptext,
252 size_t psize, char **ctext, size_t *csize
256 // log_event() - log a user defined event defined by UTF-8 encoded strings into
260 // session (in) session handle
261 // title (in) C string with event name
262 // entity (in) C string with name of entity which is logging
263 // description (in) C string with long description for event or NULL if
265 // comment (in) C string with user defined comment or NULL if
269 // PEP_STATUS_OK log entry created
271 DYNAMIC_API PEP_STATUS log_event(
275 const char *description,
280 // trustword() - get the corresponding trustword for a 16 bit value
283 // session (in) session handle
284 // value (in) value to find a trustword for
285 // lang (in) C string with ISO 639-1 language code
286 // word (out) pointer to C string with trustword UTF-8 encoded
287 // NULL if language is not supported or trustword
288 // wordlist is damaged or unavailable
289 // wsize (out) length of trustword
292 // PEP_STATUS_OK trustword retrieved
293 // PEP_TRUSTWORD_NOT_FOUND trustword not found
296 // the word pointer goes to the ownership of the caller
297 // the caller is responsible to free() it (on Windoze use pEp_free())
299 DYNAMIC_API PEP_STATUS trustword(
300 PEP_SESSION session, uint16_t value, const char *lang,
301 char **word, size_t *wsize
305 // trustwords() - get trustwords for a string of hex values of a fingerprint
308 // session (in) session handle
309 // fingerprint (in) C string with hex values to find trustwords for
310 // lang (in) C string with ISO 639-1 language code
311 // words (out) pointer to C string with trustwords UTF-8 encoded,
312 // separated by a blank each
313 // NULL if language is not supported or trustword
314 // wordlist is damaged or unavailable
315 // wsize (out) length of trustwords string
316 // max_words (in) only generate a string with max_words;
317 // if max_words == 0 there is no such limit
320 // PEP_STATUS_OK trustwords retrieved
321 // PEP_OUT_OF_MEMORY out of memory
322 // PEP_TRUSTWORD_NOT_FOUND at least one trustword not found
325 // the word pointer goes to the ownership of the caller
326 // the caller is responsible to free() it (on Windoze use pEp_free())
328 // DON'T USE THIS FUNCTION FROM HIGH LEVEL LANGUAGES!
330 // Better implement a simple one in the adapter yourself using trustword(), and
331 // return a list of trustwords.
332 // This function is provided for being used by C and C++ programs only.
334 DYNAMIC_API PEP_STATUS trustwords(
335 PEP_SESSION session, const char *fingerprint, const char *lang,
336 char **words, size_t *wsize, int max_words
340 // TODO: increase versions in pEp.asn1 if rating changes
342 typedef enum _PEP_comm_type {
345 // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
347 PEP_ct_no_encryption = 0x01, // generic
348 PEP_ct_no_encrypted_channel = 0x02,
349 PEP_ct_key_not_found = 0x03,
350 PEP_ct_key_expired = 0x04,
351 PEP_ct_key_revoked = 0x05,
352 PEP_ct_key_b0rken = 0x06,
353 PEP_ct_my_key_not_included = 0x09,
355 PEP_ct_security_by_obscurity = 0x0a,
356 PEP_ct_b0rken_crypto = 0x0b,
357 PEP_ct_key_too_short = 0x0c,
359 PEP_ct_compromized = 0x0e, // known compromized connection
360 PEP_ct_mistrusted = 0x0f, // known mistrusted key
362 // range 0x10 to 0x3f: unconfirmed encryption
364 PEP_ct_unconfirmed_encryption = 0x10, // generic
365 PEP_ct_OpenPGP_weak_unconfirmed = 0x11, // RSA 1024 is weak
367 PEP_ct_to_be_checked = 0x20, // generic
368 PEP_ct_SMIME_unconfirmed = 0x21,
369 PEP_ct_CMS_unconfirmed = 0x22,
371 PEP_ct_strong_but_unconfirmed = 0x30, // generic
372 PEP_ct_OpenPGP_unconfirmed = 0x38, // key at least 2048 bit RSA or EC
373 PEP_ct_OTR_unconfirmed = 0x3a,
375 // range 0x40 to 0x7f: unconfirmed encryption and anonymization
377 PEP_ct_unconfirmed_enc_anon = 0x40, // generic
378 PEP_ct_pEp_unconfirmed = 0x7f,
380 PEP_ct_confirmed = 0x80, // this bit decides if trust is confirmed
382 // range 0x81 to 0x8f: reserved
383 // range 0x90 to 0xbf: confirmed encryption
385 PEP_ct_confirmed_encryption = 0x90, // generic
386 PEP_ct_OpenPGP_weak = 0x91, // RSA 1024 is weak
388 PEP_ct_to_be_checked_confirmed = 0xa0, //generic
392 PEP_ct_strong_encryption = 0xb0, // generic
393 PEP_ct_OpenPGP = 0xb8, // key at least 2048 bit RSA or EC
396 // range 0xc0 to 0xff: confirmed encryption and anonymization
398 PEP_ct_confirmed_enc_anon = 0xc0, // generic
402 typedef enum _identity_flags {
403 // the first octet flags are app defined settings
404 PEP_idf_not_for_sync = 1, // don't use this identity for sync
405 PEP_idf_list = 2, // identity of list of persons
407 // the second octet flags are calculated
408 PEP_idf_devicegroup = 256 // identity of a device group member
411 typedef unsigned int identity_flags_t;
413 typedef struct _pEp_identity {
414 char *address; // C string with address UTF-8 encoded
415 char *fpr; // C string with fingerprint UTF-8 encoded
416 char *user_id; // C string with user ID UTF-8 encoded
417 char *username; // C string with user name UTF-8 encoded
418 PEP_comm_type comm_type; // type of communication with this ID
419 char lang[3]; // language of conversation
420 // ISO 639-1 ALPHA-2, last byte is 0
421 bool me; // if this is the local user herself/himself
422 identity_flags_t flags; // identity_flag1 | identity_flag2 | ...
425 typedef struct _identity_list {
427 struct _identity_list *next;
431 // new_identity() - allocate memory and set the string and size fields
434 // address (in) UTF-8 string or NULL
435 // fpr (in) UTF-8 string or NULL
436 // user_id (in) UTF-8 string or NULL
437 // username (in) UTF-8 string or NULL
440 // pEp_identity struct or NULL if out of memory
443 // the strings are copied; the original strings are still being owned by
446 DYNAMIC_API pEp_identity *new_identity(
447 const char *address, const char *fpr, const char *user_id,
452 // identity_dup() - allocate memory and duplicate
455 // src (in) identity to duplicate
458 // pEp_identity struct or NULL if out of memory
461 // the strings are copied; the original strings are still being owned by
464 DYNAMIC_API pEp_identity *identity_dup(const pEp_identity *src);
467 // free_identity() - free all memory being occupied by a pEp_identity struct
470 // identity (in) struct to release
473 // not only the struct but also all string memory referenced by the
474 // struct is being freed; all pointers inside are invalid afterwards
476 DYNAMIC_API void free_identity(pEp_identity *identity);
479 // get_identity() - get identity information
482 // session (in) session handle
483 // address (in) C string with communication address, UTF-8 encoded
484 // user_id (in) unique C string to identify person that identity
486 // identity (out) pointer to pEp_identity structure with results or
490 // address and user_id are being copied; the original strings remains in
491 // the ownership of the caller
492 // the resulting pEp_identity structure goes to the ownership of the
493 // caller and has to be freed with free_identity() when not in use any
496 DYNAMIC_API PEP_STATUS get_identity(
500 pEp_identity **identity
503 // set_identity() - set identity information
506 // session (in) session handle
507 // identity (in) pointer to pEp_identity structure
510 // PEP_STATUS_OK = 0 encryption and signing succeeded
511 // PEP_CANNOT_SET_PERSON writing to table person failed
512 // PEP_CANNOT_SET_PGP_KEYPAIR writing to table pgp_keypair failed
513 // PEP_CANNOT_SET_IDENTITY writing to table identity failed
514 // PEP_COMMIT_FAILED SQL commit failed
515 // PEP_KEY_BLACKLISTED Key blacklisted, cannot set identity
518 // address, fpr, user_id and username must be given
520 DYNAMIC_API PEP_STATUS set_identity(
521 PEP_SESSION session, const pEp_identity *identity
525 // set_identity_flags() - update identity flags on existing identity
528 // session (in) session handle
529 // identity (in,out) pointer to pEp_identity structure
530 // flags (in) new value for flags
533 // PEP_STATUS_OK = 0 encryption and signing succeeded
534 // PEP_CANNOT_SET_IDENTITY update of identity failed
537 // address and user_id must be given in identity
539 DYNAMIC_API PEP_STATUS set_identity_flags(
541 pEp_identity *identity,
546 // mark_as_compromized() - mark key in trust db as compromized
549 // session (in) session handle
550 // fpr (in) fingerprint of key to mark
552 DYNAMIC_API PEP_STATUS mark_as_compromized(
558 // generate_keypair() - generate a new key pair and add it to the key ring
561 // session (in) session handle
562 // identity (inout) pointer to pEp_identity structure
565 // PEP_STATUS_OK = 0 encryption and signing succeeded
566 // PEP_ILLEGAL_VALUE illegal values for identity fields given
567 // PEP_CANNOT_CREATE_KEY key engine is on strike
570 // address and username fields must be set to UTF-8 strings
571 // the fpr field must be set to NULL
573 // this function allocates a string and sets set fpr field of identity
574 // the caller is responsible to call free() for that string or use
575 // free_identity() on the struct
577 DYNAMIC_API PEP_STATUS generate_keypair(
578 PEP_SESSION session, pEp_identity *identity
582 // delete_keypair() - delete a public key or a key pair from the key ring
585 // session (in) session handle
586 // fpr (in) C string with key id or fingerprint of the
590 // PEP_STATUS_OK = 0 key was successfully deleted
591 // PEP_KEY_NOT_FOUND key not found
592 // PEP_ILLEGAL_VALUE not a valid key id or fingerprint
593 // PEP_KEY_HAS_AMBIG_NAME fpr does not uniquely identify a key
594 // PEP_OUT_OF_MEMORY out of memory
596 DYNAMIC_API PEP_STATUS delete_keypair(PEP_SESSION session, const char *fpr);
599 // import_key() - import key from data
602 // session (in) session handle
603 // key_data (in) key data, i.e. ASCII armored OpenPGP key
604 // size (in) amount of data to handle
605 // private_keys (out) list of private keys that have been imported
608 // PEP_STATUS_OK = 0 key was successfully imported
609 // PEP_OUT_OF_MEMORY out of memory
610 // PEP_ILLEGAL_VALUE there is no key data to import
613 // private_keys goes to the ownership of the caller
614 // private_keys can be left NULL, it is then ignored
616 DYNAMIC_API PEP_STATUS import_key(
618 const char *key_data,
620 identity_list **private_keys
624 // export_key() - export ascii armored key
627 // session (in) session handle
628 // fpr (in) key id or fingerprint of key
629 // key_data (out) ASCII armored OpenPGP key
630 // size (out) amount of data to handle
633 // PEP_STATUS_OK = 0 key was successfully exported
634 // PEP_OUT_OF_MEMORY out of memory
635 // PEP_KEY_NOT_FOUND key not found
638 // the key_data goes to the ownership of the caller
639 // the caller is responsible to free() it (on Windoze use pEp_free())
641 DYNAMIC_API PEP_STATUS export_key(
642 PEP_SESSION session, const char *fpr, char **key_data, size_t *size
646 // export_secret_key() - export secret key ascii armored
649 // session (in) session handle
650 // fpr (in) fingerprint of key, at least 16 hex digits
651 // key_data (out) ASCII armored OpenPGP secret key
652 // size (out) amount of data to handle
655 // PEP_STATUS_OK = 0 key was successfully exported
656 // PEP_OUT_OF_MEMORY out of memory
657 // PEP_KEY_NOT_FOUND key not found
658 // PEP_CANNOT_EXPORT_KEY cannot export secret key (i.e. it's on an HKS)
661 // the key_data goes to the ownership of the caller
662 // the caller is responsible to free() it (on Windoze use pEp_free())
663 // beware of leaking secret key data - overwrite it in memory after use
665 DYNAMIC_API PEP_STATUS export_secrect_key(
666 PEP_SESSION session, const char *fpr, char **key_data, size_t *size
670 // recv_key() - update key(s) from keyserver
673 // session (in) session handle
674 // pattern (in) key id, user id or address to search for as
677 DYNAMIC_API PEP_STATUS recv_key(PEP_SESSION session, const char *pattern);
680 // find_keys() - find keys in keyring
683 // session (in) session handle
684 // pattern (in) key id, user id or address to search for as
686 // keylist (out) list of fingerprints found or NULL on error
689 // the ownerships of keylist isgoing to the caller
690 // the caller must use free_stringlist() to free it
693 DYNAMIC_API PEP_STATUS find_keys(
694 PEP_SESSION session, const char *pattern, stringlist_t **keylist
697 // send_key() - send key(s) to keyserver
700 // session (in) session handle
701 // pattern (in) key id, user id or address to search for as
704 DYNAMIC_API PEP_STATUS send_key(PEP_SESSION session, const char *pattern);
707 // pEp_free() - free memory allocated by pEp engine
710 // p (in) pointer to free
712 // The reason for this function is that heap management can be a pretty
713 // complex task with Windoze. This free() version calls the free()
714 // implementation of the C runtime library which was used to build pEp engine,
715 // so you're using the correct heap. For more information, see:
716 // <http://msdn.microsoft.com/en-us/library/windows/desktop/aa366711(v=vs.85).aspx>
718 DYNAMIC_API void pEp_free(void *p);
721 // get_trust() - get the trust level a key has for a person
724 // session (in) session handle
725 // identity (inout) user_id and fpr to check as UTF-8 strings (in)
726 // user_id and comm_type as result (out)
728 // this function modifies the given identity struct; the struct remains in
729 // the ownership of the caller
730 // if the trust level cannot be determined identity->comm_type is set
733 DYNAMIC_API PEP_STATUS get_trust(PEP_SESSION session, pEp_identity *identity);
736 // least_trust() - get the least known trust level for a key in the database
739 // session (in) session handle
740 // fpr (in) fingerprint of key to check
741 // comm_type (out) least comm_type as result (out)
743 // if the trust level cannot be determined comm_type is set to PEP_ct_unknown
745 DYNAMIC_API PEP_STATUS least_trust(
748 PEP_comm_type *comm_type
752 // get_key_rating() - get the rating a bare key has
755 // session (in) session handle
756 // fpr (in) unique identifyer for key as UTF-8 string
757 // comm_type (out) key rating
759 // if an error occurs, *comm_type is set to PEP_ct_unknown and an error
762 DYNAMIC_API PEP_STATUS get_key_rating(
765 PEP_comm_type *comm_type
769 // renew_key() - renew an expired key
772 // session (in) session handle
773 // fpr (in) ID of key to renew as UTF-8 string
774 // ts (in) timestamp when key should expire or NULL for
777 DYNAMIC_API PEP_STATUS renew_key(
784 // revoke_key() - revoke a key
787 // session (in) session handle
788 // fpr (in) ID of key to revoke as UTF-8 string
789 // reason (in) text with reason for revoke as UTF-8 string
790 // or NULL if reason unknown
793 // reason text must not include empty lines
794 // this function is meant for internal use only; better use
795 // key_compromized() of keymanagement API
797 DYNAMIC_API PEP_STATUS revoke_key(
804 // key_expired() - flags if a key is already expired
807 // session (in) session handle
808 // fpr (in) ID of key to check as UTF-8 string
809 // when (in) UTC time of when should expiry be considered
810 // expired (out) flag if key expired
812 DYNAMIC_API PEP_STATUS key_expired(
820 // key_revoked() - flags if a key is already revoked
823 // session (in) session handle
824 // fpr (in) ID of key to check as UTF-8 string
825 // revoked (out) flag if key revoked
827 DYNAMIC_API PEP_STATUS key_revoked(
834 // get_crashdump_log() - get the last log messages out
837 // session (in) session handle
838 // maxlines (in) maximum number of lines (0 for default)
839 // logdata (out) logdata as string in double quoted CSV format
842 // column3 is description
843 // column4 is comment
846 // the ownership of logdata goes to the caller
848 DYNAMIC_API PEP_STATUS get_crashdump_log(
855 // get_languagelist() - get the list of languages
858 // session (in) session handle
859 // languages (out) languages as string in double quoted CSV format
860 // column 1 is the ISO 639-1 language code
861 // column 2 is the name of the language
864 // the ownership of languages goes to the caller
866 DYNAMIC_API PEP_STATUS get_languagelist(
872 // get_phrase() - get phrase in a dedicated language through i18n
875 // session (in) session handle
876 // lang (in) C string with ISO 639-1 language code
877 // phrase_id (in) id of phrase in i18n
878 // phrase (out) phrase as UTF-8 string
881 // the ownership of phrase goes to the caller
883 DYNAMIC_API PEP_STATUS get_phrase(
891 // sequence_value() - raise the value of a named sequence and retrieve it
894 // session (in) session handle
895 // name (inout) name of sequence or char[37] set to {0, }
896 // for new own sequence named as UUID
897 // value (inout) value of sequence value to test or 0 for
898 // getting next value
901 // PEP_STATUS_OK no error, not own sequence
902 // PEP_SEQUENCE_VIOLATED if sequence violated
903 // PEP_CANNOT_INCREASE_SEQUENCE if sequence cannot be increased
904 // PEP_OWN_SEQUENCE if own sequence
906 DYNAMIC_API PEP_STATUS sequence_value(
913 // set_revoked() - records relation between a revoked key and its replacement
916 // session (in) session handle
917 // revoked_fpr (in) revoked fingerprint
918 // replacement_fpr (in) replacement key fingerprint
919 // revocation_date (in) revocation date
921 DYNAMIC_API PEP_STATUS set_revoked(
923 const char *revoked_fpr,
924 const char *replacement_fpr,
925 const uint64_t revocation_date
929 // get_revoked() - find revoked key that may have been replaced by given key, if any
932 // session (in) session handle
933 // fpr (in) given fingerprint
934 // revoked_fpr (out) revoked fingerprint
935 // revocation_date (out) revocation date
937 DYNAMIC_API PEP_STATUS get_revoked(
941 uint64_t *revocation_date
945 // key_created() - get creation date of a key
948 // session (in) session handle
949 // fpr (in) fingerprint of key
950 // created (out) date of creation
952 PEP_STATUS key_created(
959 // get_engine_version() - returns the current version of pEpEngine (this is different
960 // from the pEp protocol version!)
964 // return_value: const char* to the engine version string constant
966 DYNAMIC_API const char* get_engine_version();
968 DYNAMIC_API PEP_STATUS reset_peptest_hack(PEP_SESSION session);