src/key_reset.h
author Krista Bennett <krista@pep-project.org>
Mon, 17 Sep 2018 15:31:48 +0200
branchENGINE-398
changeset 2948 3f66f366dc5f
parent 2947 4b525ec0f95c
child 2950 753276eb09ec
permissions -rw-r--r--
ENGINE-398: removal of key from db after reset
     1 // This file is under GNU General Public License 3.0
     2 // see LICENSE.txt
     3 
     4 #pragma once
     5 
     6 #include "key_reset.h"
     7 
     8 #include "pEpEngine.h"
     9 #include "keymanagement.h"
    10 #include "message.h"
    11 #include "message_api.h"
    12 #include "cryptotech.h"
    13 
    14 #ifdef __cplusplus
    15 extern "C" {
    16 #endif
    17 
    18 // key_reset() - reset the database status for a key, removing all trust information
    19 //               and default database connections. For own keys, also revoke the key
    20 //               and communicate the revocation and new key to partners we have sent
    21 //               mail to recently from the specific identity (i.e. address/user_id)
    22 //               that contacted them. We also in this case set up information so that
    23 //               if someone we mail uses the wrong key and wasn't yet contacted,
    24 //               we can send them the reset information from the right address.
    25 //
    26 //               Can be called manually or through another protocol.
    27 //
    28 //  parameters:
    29 //      session (in)            session handle
    30 //      fpr (in)                fingerprint of key to reset. If NULL and ident is NULL,
    31 //                              we reset all keys for the own user. If NULL and ident is
    32 //                              an own identity, we reset the default key for that
    33 //                              identity. If that own identity has no default key, we
    34 //                              reset the user default.
    35 //                              if it is NULL and there is a non-own identity, this is
    36 //                              currently undefined and will return an error. Later, we
    37 //                              may decide on semantics for it (e.g. remove all keys
    38 //                              in the DB for that identity)
    39 //      ident (in)              identity for which the key reset should occur.
    40 //                              if NULL and fpr is non-NULL, we'll reset the key for all
    41 //                              associated identities. If both ident and fpr are NULL, see 
    42 //                              the fpr arg documentation.
    43 //
    44 //
    45 DYNAMIC_API PEP_STATUS key_reset(
    46         PEP_SESSION session,
    47         const char* fpr,
    48         pEp_identity* ident
    49     );
    50 
    51 PEP_STATUS has_key_reset_been_sent(
    52         PEP_SESSION session, 
    53         const char* user_id, 
    54         const char* revoked_fpr,
    55         bool* contacted);
    56 
    57 PEP_STATUS set_reset_contact_notified(
    58         PEP_SESSION session,
    59         const char* revoke_fpr,
    60         const char* contact_id
    61     );
    62 
    63 PEP_STATUS receive_key_reset(PEP_SESSION session,
    64                              message* reset_msg);
    65 
    66 PEP_STATUS create_standalone_key_reset_message(PEP_SESSION session,
    67                                                message** dst, 
    68                                                pEp_identity* recip,
    69                                                const char* old_fpr,
    70                                                const char* new_fpr);
    71                                                
    72 PEP_STATUS send_key_reset_to_recents(PEP_SESSION session,
    73                                      const char* old_fpr, 
    74                                      const char* new_fpr);
    75     
    76 #ifdef __cplusplus
    77 }
    78 #endif