ENGINE_420: shelving again - this time, added private key export. ENGINE-420
authorKrista Bennett <krista@pep-project.org>
Wed, 11 Apr 2018 15:52:32 +0200
branchENGINE-420
changeset 25916f54f095b7ec
parent 2590 7067ba51ec76
child 2592 d1cb6fd3ded2
ENGINE_420: shelving again - this time, added private key export.
src/message_api.c
     1.1 --- a/src/message_api.c	Wed Apr 11 15:29:12 2018 +0200
     1.2 +++ b/src/message_api.c	Wed Apr 11 15:52:32 2018 +0200
     1.3 @@ -1887,11 +1887,27 @@
     1.4                  
     1.5      // Ok, so all the things are now allowed.
     1.6      // So let's get our own private key and roll with it.
     1.7 -                
     1.8 -                
     1.9 +    char* priv_key_data = NULL;
    1.10 +    size_t priv_key_size = 0;
    1.11 +    
    1.12 +    status = export_key(session, own_private_fpr, &priv_key_data, 
    1.13 +                        &priv_key_size, true);
    1.14 +
    1.15 +    if (status != PEP_STATUS_OK)
    1.16 +        goto pep_free;
    1.17 +    
    1.18 +    if (!priv_key_data) {
    1.19 +        status = PEP_CANNOT_EXPORT_KEY;
    1.20 +        goto pep_free;
    1.21 +    }
    1.22 +    
    1.23 +    // Ok, fine... let's encrypt yon blob.
    1.24  pep_free:
    1.25      free(own_id);
    1.26      free(default_id);
    1.27 +    free(priv_key_data);
    1.28 +    free(own_private_fpr);
    1.29 +    free_identity(own_identity);
    1.30      return status;
    1.31  }
    1.32