Put in private key check in set_own_key.
authorKrista Bennett <krista@pep-project.org>
Tue, 07 Aug 2018 14:33:18 +0200
changeset 280565829c954ea7
parent 2803 fadf1e8e22ff
child 2806 d958333b87d0
Put in private key check in set_own_key.
src/keymanagement.c
     1.1 --- a/src/keymanagement.c	Tue Aug 07 14:24:15 2018 +0200
     1.2 +++ b/src/keymanagement.c	Tue Aug 07 14:33:18 2018 +0200
     1.3 @@ -1704,6 +1704,15 @@
     1.4      if (status != PEP_STATUS_OK && status != PEP_GET_KEY_FAILED && status != PEP_KEY_UNSUITABLE)
     1.5          return status;
     1.6      status = PEP_STATUS_OK;
     1.7 +
     1.8 +    bool private = false;
     1.9 +    status = contains_priv_key(session, fpr, &private);
    1.10 +    
    1.11 +    if (status != PEP_STATUS_OK)
    1.12 +        return status;
    1.13 +        
    1.14 +    if (!private)
    1.15 +        return PEP_KEY_UNSUITABLE;
    1.16   
    1.17      if (me->fpr)
    1.18          free(me->fpr);