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