src/pgp_netpgp.c
changeset 286 bac6a8feb1cf
parent 279 99e9815751fa
child 313 b79ff01373d6
     1.1 --- a/src/pgp_netpgp.c	Sun May 17 00:58:43 2015 +0200
     1.2 +++ b/src/pgp_netpgp.c	Sat May 23 00:11:18 2015 +0200
     1.3 @@ -505,11 +505,13 @@
     1.4      if ((userid = netpgp_getvar(&netpgp, "userid")) == NULL || 
     1.5          (keypair = pgp_getkeybyname(netpgp.io, 
     1.6                                      netpgp.secring, 
     1.7 -                                    userid)) == NULL ||
     1.8 -        (seckey = pgp_decrypt_seckey(keypair, NULL /*passfp*/)) == NULL) {
     1.9 +                                    userid)) == NULL) {
    1.10          return PEP_UNKNOWN_ERROR;
    1.11      }
    1.12  
    1.13 +    /* TODO select data signing subkey if defined */
    1.14 +    seckey = &keypair->key.seckey;
    1.15 +
    1.16      hashalg = netpgp_getvar(&netpgp, "hash");
    1.17      // netpgp (l)imitation - XXX why ? 
    1.18      if (seckey->pubkey.alg == PGP_PKA_DSA) {
    1.19 @@ -657,8 +659,6 @@
    1.20      pgp_keyring_t tmpring;
    1.21  	pgp_validation_t *vresult;
    1.22  
    1.23 -    /* XXX TODO : replace/update key if already in ring */
    1.24 -
    1.25      if ((public = (newkey->type == PGP_PTAG_CT_PUBLIC_KEY))){
    1.26          pubkey = *newkey;
    1.27      } else {
    1.28 @@ -715,6 +715,9 @@
    1.29          if (!public) goto free_pubkey;
    1.30          return result;
    1.31      }
    1.32 +
    1.33 +    /* XXX TODO : replace/update key if already in ring */
    1.34 +
    1.35      // Append key to netpgp's rings (key ownership transfered)
    1.36      if (!public && !pgp_keyring_add(netpgp->secring, newkey)){
    1.37          result = PEP_OUT_OF_MEMORY;