src/key_reset.h
author Krista Bennett <krista@pep-project.org>
Tue, 18 Sep 2018 11:49:15 +0200
branchENGINE-398
changeset 2950 753276eb09ec
parent 2948 3f66f366dc5f
child 3495 b4d3e47eab14
permissions -rw-r--r--
ENGINE-398: added caveat about ident->fpr
     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 //      Note: ident->fpr is always ignored
    45 //
    46 //
    47 DYNAMIC_API PEP_STATUS key_reset(
    48         PEP_SESSION session,
    49         const char* fpr,
    50         pEp_identity* ident
    51     );
    52 
    53 PEP_STATUS has_key_reset_been_sent(
    54         PEP_SESSION session, 
    55         const char* user_id, 
    56         const char* revoked_fpr,
    57         bool* contacted);
    58 
    59 PEP_STATUS set_reset_contact_notified(
    60         PEP_SESSION session,
    61         const char* revoke_fpr,
    62         const char* contact_id
    63     );
    64 
    65 PEP_STATUS receive_key_reset(PEP_SESSION session,
    66                              message* reset_msg);
    67 
    68 PEP_STATUS create_standalone_key_reset_message(PEP_SESSION session,
    69                                                message** dst, 
    70                                                pEp_identity* recip,
    71                                                const char* old_fpr,
    72                                                const char* new_fpr);
    73                                                
    74 PEP_STATUS send_key_reset_to_recents(PEP_SESSION session,
    75                                      const char* old_fpr, 
    76                                      const char* new_fpr);
    77     
    78 #ifdef __cplusplus
    79 }
    80 #endif