src/pgp_gpg.h
branchsync
changeset 2945 8c2cc198fc8d
parent 2458 2dfe65bd3613
child 2946 bacb52cb79d0
     1.1 --- a/src/pgp_gpg.h	Sat Sep 15 12:01:08 2018 +0200
     1.2 +++ b/src/pgp_gpg.h	Sat Sep 15 14:36:03 2018 +0200
     1.3 @@ -5,48 +5,107 @@
     1.4  
     1.5  #include "pEpEngine.h"
     1.6  
     1.7 +
     1.8 +// pgp_init(): initialize PGP backend
     1.9 +//
    1.10 +//  parameters:
    1.11 +//      session (in)        session handle
    1.12 +//      in_first (in)       true if this is the first session
    1.13 +//
    1.14 +//  return value:
    1.15 +//      PEP_STATUS_OK if PGP backend was successfully initialized
    1.16 +//      or any other value on error
    1.17 +
    1.18  PEP_STATUS pgp_init(PEP_SESSION session, bool in_first);
    1.19 +
    1.20 +
    1.21 +// pgp_release(): release PGP backend
    1.22 +//
    1.23 +//  paramters:
    1.24 +//      session (in)        session handle
    1.25 +//      out_last (in)       true if this is the last session to release
    1.26 +
    1.27  void pgp_release(PEP_SESSION session, bool out_last);
    1.28  
    1.29 +
    1.30 +// pgp_decrypt_and_verify(): decrypt and verify cyphertext
    1.31 +//
    1.32 +//  parameters:
    1.33 +//      session (in)        session handle
    1.34 +//      ctext (in)          bytes with ciphertext
    1.35 +//      csize (in)          size of ciphertext in bytes
    1.36 +//      dsigtext (in)       pointer to bytes with detached signature
    1.37 +//                          or NULL if no detached signature
    1.38 +//      dsigsize (in)       size of detached signature in bytes
    1.39 +//      ptext (out)         pointer to receive plaintext
    1.40 +//      psize (out)         size of plaintext delivered
    1.41 +//      keylist (out)       list of keys being used
    1.42 +
    1.43  PEP_STATUS pgp_decrypt_and_verify(
    1.44 -        PEP_SESSION session, const char *ctext, size_t csize,
    1.45 -        const char *dsigtext, size_t dsigsize,
    1.46 -        char **ptext, size_t *psize, stringlist_t **keylist
    1.47 +        PEP_SESSION session,
    1.48 +        const char *ctext,
    1.49 +        size_t csize,
    1.50 +        const char *dsigtext,
    1.51 +        size_t dsigsize,
    1.52 +        char **ptext,
    1.53 +        size_t *psize,
    1.54 +        stringlist_t **keylist
    1.55      );
    1.56  
    1.57 +
    1.58  PEP_STATUS pgp_encrypt_and_sign(
    1.59 -        PEP_SESSION session, const stringlist_t *keylist, const char *ptext,
    1.60 -        size_t psize, char **ctext, size_t *csize
    1.61 +        PEP_SESSION session,
    1.62 +        const stringlist_t *keylist,
    1.63 +        const char *ptext,
    1.64 +        size_t psize,
    1.65 +        char **ctext,
    1.66 +        size_t *csize
    1.67      );
    1.68  
    1.69  PEP_STATUS pgp_encrypt_only(
    1.70 -        PEP_SESSION session, const stringlist_t *keylist, const char *ptext,
    1.71 -        size_t psize, char **ctext, size_t *csize
    1.72 +        PEP_SESSION session,
    1.73 +        const stringlist_t *keylist,
    1.74 +        const char *ptext,
    1.75 +        size_t psize,
    1.76 +        char **ctext,
    1.77 +        size_t *csize
    1.78      );
    1.79  
    1.80  
    1.81  PEP_STATUS pgp_verify_text(
    1.82 -        PEP_SESSION session, const char *text, size_t size,
    1.83 -        const char *signature, size_t sig_size, stringlist_t **keylist
    1.84 +        PEP_SESSION session,
    1.85 +        const char *text,
    1.86 +        size_t size,
    1.87 +        const char *signature,
    1.88 +        size_t sig_size,
    1.89 +        stringlist_t **keylist
    1.90      );
    1.91  
    1.92  PEP_STATUS pgp_delete_keypair(PEP_SESSION session, const char *fpr);
    1.93  
    1.94  PEP_STATUS pgp_export_keydata(
    1.95 -        PEP_SESSION session, const char *fpr, char **key_data, size_t *size,
    1.96 +        PEP_SESSION session,
    1.97 +        const char *fpr,
    1.98 +        char **key_data,
    1.99 +        size_t *size,
   1.100          bool secret
   1.101      );
   1.102  
   1.103  PEP_STATUS pgp_find_keys(
   1.104 -        PEP_SESSION session, const char *pattern, stringlist_t **keylist
   1.105 +        PEP_SESSION session,
   1.106 +        const char *pattern,
   1.107 +        stringlist_t **keylist
   1.108      );
   1.109  
   1.110  PEP_STATUS pgp_list_keyinfo(
   1.111 -        PEP_SESSION session, const char* pattern, stringpair_list_t** keyinfo_list
   1.112 +        PEP_SESSION session,
   1.113 +        const char* pattern,
   1.114 +        stringpair_list_t** keyinfo_list
   1.115      );
   1.116  
   1.117  PEP_STATUS pgp_generate_keypair(
   1.118 -        PEP_SESSION session, pEp_identity *identity
   1.119 +        PEP_SESSION session,
   1.120 +        pEp_identity *identity
   1.121      );
   1.122  
   1.123  PEP_STATUS pgp_get_key_rating(
   1.124 @@ -55,13 +114,22 @@
   1.125          PEP_comm_type *comm_type
   1.126      );
   1.127  
   1.128 -PEP_STATUS pgp_import_keydata(PEP_SESSION session, const char *key_data,
   1.129 -                              size_t size, identity_list **private_idents);
   1.130 +PEP_STATUS pgp_import_keydata(
   1.131 +        PEP_SESSION session,
   1.132 +        const char *key_data,
   1.133 +        size_t size,
   1.134 +        identity_list **private_idents
   1.135 +    );
   1.136  
   1.137 -PEP_STATUS pgp_import_private_keydata(PEP_SESSION session, const char *key_data,
   1.138 -                                      size_t size, identity_list **private_idents);
   1.139 +PEP_STATUS pgp_import_private_keydata(
   1.140 +        PEP_SESSION session,
   1.141 +        const char *key_data,
   1.142 +        size_t size,
   1.143 +        identity_list **private_idents
   1.144 +    );
   1.145  
   1.146  PEP_STATUS pgp_recv_key(PEP_SESSION session, const char *pattern);
   1.147 +
   1.148  PEP_STATUS pgp_send_key(PEP_SESSION session, const char *pattern);
   1.149  
   1.150  PEP_STATUS pgp_renew_key(
   1.151 @@ -98,16 +166,20 @@
   1.152  PEP_STATUS pgp_contains_priv_key(
   1.153          PEP_SESSION session, 
   1.154          const char *fpr,
   1.155 -        bool *has_private);
   1.156 +        bool *has_private
   1.157 +    );
   1.158  
   1.159  PEP_STATUS pgp_find_private_keys(
   1.160 -    PEP_SESSION session, const char *pattern, stringlist_t **keylist
   1.161 -);
   1.162 +        PEP_SESSION session,
   1.163 +        const char *pattern,
   1.164 +        stringlist_t **keylist
   1.165 +    );
   1.166  
   1.167  PEP_STATUS pgp_binary(const char **path);
   1.168  
   1.169  // Returns first failure status, if there were any. Keys may have been
   1.170  // imported into DB regardless of status.
   1.171 +
   1.172  PEP_STATUS pgp_import_ultimately_trusted_keypairs(PEP_SESSION session);
   1.173  
   1.174  /* Really only internal. */