src/pgp_netpgp.h
author Edouard Tisserant
Mon, 25 Apr 2016 14:53:45 +0200
branchasync_key_management
changeset 539 c8a4c7b86064
parent 226 a2079f2f7a8c
child 709 6552cf0a1928
permissions -rw-r--r--
This is Work in Progress branch for async key management.
- All DB operation altering identity, person, trust, pgp_keypair tables
are now serialized in key management thread.
- myself() returns immediately.
- Database is updated asynchronously, by key management thread.
- update_identity() and mysel() returned identity reflects input confronted
to informations immediately available in pEpEngine. Changes to DB are
applied later.
- confront_identity() is resposnible to selectively modify given identity
according to content of DB and keyrings but without changing pEp state.
It detects if confrontation resulted in some changes deserving to be
examined. It is called by update_identity() and myself() before queueing
identity to be examined by key management thread.
- Key management itself calls confront_identity() in order to detect and
mitigate concurrent conflicting operation on same identity.
- ensure_own_key() is also called by key management to deal with cases
where own identity key is inexistant, revoked or expired.
- examine_identity() as well as retrieve_next_identity() got their signature
updated, and adapters have to update. Those callbacks are now also used to
signal keymanagement activity to the app, thus avoiding app writer to poll
identity or message colors when waiting for long operation to complete
(i.e. key gen)
- Updated some SQL :
- Now address and user_id ar together primary key of identity.
- Use of still unused pgp_keypair.created column to mark own key pair
- Added sql_get_pgp_keypair_created
- Ensured consistant storage and comparing of fingerprints (spaces, case)
- Added sql_get_best_user as a (questionable) fallback for app
developper that would still not give identity.user_id after already having
already created a person for that identity/address.
- Changed mark_as_compromized into a more generic set_fpr_trust, with
comm_type given as a parameter, not anymore hard-coded in SQL statement.
- Added test to detect revoked key in pgp_netpgp.c + various minor fixes.
- Renamed key_compromized() to key_mistrusted()
Edouard@174
     1
#pragma once
Edouard@174
     2
Edouard@174
     3
#include "pEpEngine.h"
Edouard@174
     4
Edouard@174
     5
PEP_STATUS pgp_init(PEP_SESSION session, bool in_first);
Edouard@174
     6
void pgp_release(PEP_SESSION session, bool out_last);
Edouard@174
     7
Edouard@174
     8
PEP_STATUS pgp_decrypt_and_verify(
Edouard@174
     9
        PEP_SESSION session, const char *ctext, size_t csize,
Edouard@174
    10
        char **ptext, size_t *psize, stringlist_t **keylist
Edouard@174
    11
    );
Edouard@174
    12
Edouard@174
    13
PEP_STATUS pgp_encrypt_and_sign(
Edouard@174
    14
        PEP_SESSION session, const stringlist_t *keylist, const char *ptext,
Edouard@174
    15
        size_t psize, char **ctext, size_t *csize
Edouard@174
    16
    );
Edouard@174
    17
Edouard@174
    18
PEP_STATUS pgp_verify_text(
Edouard@174
    19
        PEP_SESSION session, const char *text, size_t size,
Edouard@174
    20
        const char *signature, size_t sig_size, stringlist_t **keylist
Edouard@174
    21
    );
Edouard@174
    22
Edouard@174
    23
PEP_STATUS pgp_delete_keypair(PEP_SESSION session, const char *fpr);
Edouard@174
    24
Edouard@179
    25
PEP_STATUS pgp_export_keydata(
Edouard@174
    26
        PEP_SESSION session, const char *fpr, char **key_data, size_t *size
Edouard@174
    27
    );
Edouard@174
    28
Edouard@174
    29
PEP_STATUS pgp_find_keys(
Edouard@174
    30
        PEP_SESSION session, const char *pattern, stringlist_t **keylist
Edouard@174
    31
    );
Edouard@174
    32
Edouard@174
    33
PEP_STATUS pgp_generate_keypair(
Edouard@174
    34
        PEP_SESSION session, pEp_identity *identity
Edouard@174
    35
    );
Edouard@174
    36
Edouard@174
    37
PEP_STATUS pgp_get_key_rating(
Edouard@174
    38
        PEP_SESSION session,
Edouard@174
    39
        const char *fpr,
Edouard@174
    40
        PEP_comm_type *comm_type
Edouard@174
    41
    );
Edouard@174
    42
Edouard@179
    43
PEP_STATUS pgp_import_keydata(PEP_SESSION session, const char *key_data,
Edouard@174
    44
        size_t size);
Edouard@174
    45
Edouard@174
    46
PEP_STATUS pgp_recv_key(PEP_SESSION session, const char *pattern);
Edouard@174
    47
PEP_STATUS pgp_send_key(PEP_SESSION session, const char *pattern);
Edouard@174
    48
Edouard@210
    49
PEP_STATUS pgp_renew_key(
Edouard@210
    50
        PEP_SESSION session,
Edouard@210
    51
        const char *fpr,
Edouard@210
    52
        const timestamp *ts
Edouard@210
    53
    );
Edouard@210
    54
Edouard@226
    55
PEP_STATUS pgp_revoke_key(
Edouard@226
    56
        PEP_SESSION session,
Edouard@226
    57
        const char *fpr,
Edouard@226
    58
        const char *reason
Edouard@226
    59
    );
Edouard@226
    60
Edouard@226
    61
PEP_STATUS pgp_key_expired(
Edouard@226
    62
        PEP_SESSION session,
Edouard@226
    63
        const char *fpr,
Edouard@226
    64
        bool *expired
Edouard@226
    65
    );
Edouard@226
    66
Edouard@539
    67
PEP_STATUS pgp_key_revoked(
Edouard@539
    68
        PEP_SESSION session,
Edouard@539
    69
        const char *fpr,
Edouard@539
    70
        bool *revoked
Edouard@539
    71
    );