adding trust_personal_key()
authorVolker Birk <vb@pep-project.org>
Mon, 28 Sep 2015 11:08:26 +0200
changeset 3543e5db18f227b
parent 352 d579d4c03cf4
child 355 d12fe5ea49e0
adding trust_personal_key()
src/keymanagement.c
src/keymanagement.h
     1.1 --- a/src/keymanagement.c	Tue Sep 22 10:24:04 2015 +0200
     1.2 +++ b/src/keymanagement.c	Mon Sep 28 11:08:26 2015 +0200
     1.3 @@ -332,3 +332,31 @@
     1.4      return status;
     1.5  }
     1.6  
     1.7 +DYNAMIC_API PEP_STATUS trust_personal_key(
     1.8 +        PEP_SESSION session,
     1.9 +        pEp_identity *ident
    1.10 +    )
    1.11 +{
    1.12 +    PEP_STATUS status = PEP_STATUS_OK;
    1.13 +
    1.14 +    assert(session);
    1.15 +    assert(ident);
    1.16 +    assert(!EMPTY(ident->address));
    1.17 +    assert(!EMPTY(ident->user_id));
    1.18 +    assert(!EMPTY(ident->fpr));
    1.19 +    assert(!ident->me);
    1.20 +
    1.21 +    if (!ident || EMPTY(ident->address) || EMPTY(ident->user_id) ||
    1.22 +            EMPTY(ident->fpr) || ident->me)
    1.23 +        return PEP_ILLEGAL_VALUE;
    1.24 +
    1.25 +    status = update_identity(session, ident);
    1.26 +    if (status != PEP_STATUS_OK)
    1.27 +        return status;
    1.28 +
    1.29 +    ident->comm_type |= PEP_ct_confirmed;
    1.30 +
    1.31 +    status = update_identity(session, ident);
    1.32 +    return status;
    1.33 +}
    1.34 +
     2.1 --- a/src/keymanagement.h	Tue Sep 22 10:24:04 2015 +0200
     2.2 +++ b/src/keymanagement.h	Mon Sep 28 11:08:26 2015 +0200
     2.3 @@ -122,6 +122,21 @@
     2.4  DYNAMIC_API PEP_STATUS key_compromized(PEP_SESSION session, const char *fpr);
     2.5  
     2.6  
     2.7 +// trust_personal_key() - mark a key as trusted with a person
     2.8 +//
     2.9 +//  parameters:
    2.10 +//      session (in)        session to use
    2.11 +//      ident (in)          person and key to trust in
    2.12 +//
    2.13 +//  caveat:
    2.14 +//      the fields user_id, address and fpr must be supplied
    2.15 +
    2.16 +DYNAMIC_API PEP_STATUS trust_personal_key(
    2.17 +        PEP_SESSION session,
    2.18 +        pEp_identity *ident
    2.19 +    );
    2.20 +
    2.21 +
    2.22  #ifdef __cplusplus
    2.23  }
    2.24  #endif