/[winpt]/trunk/Src/wptKeyEdit.cpp
ViewVC logotype

Diff of /trunk/Src/wptKeyEdit.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 77 by twoaday, Mon Nov 14 15:01:01 2005 UTC revision 234 by twoaday, Tue Jun 27 10:16:41 2006 UTC
# Line 1  Line 1 
1  /* wptKeyEdit.cpp - GPG key edit abstraction  /* wptKeyEdit.cpp - GPG key edit abstraction
2   *      Copyright (C) 2005 Timo Schulz   *      Copyright (C) 2005, 2006 Timo Schulz
3   *      Copyright (C) 2005 g10 Code GmbH   *      Copyright (C) 2005 g10 Code GmbH
4   *   *
5   * This file is part of WinPT.   * This file is part of WinPT.
# Line 34  Line 34 
34  #include "wptW32API.h"  #include "wptW32API.h"
35  #include "wptGPG.h"  #include "wptGPG.h"
36  #include "wptErrors.h"  #include "wptErrors.h"
37    #include "wptUTF8.h"
38    
39    
40  /* Parse the colon status information of @line and store  /* Parse the colon status information of @line and store
# Line 74  rev_key_colon_handler (gpg_desig_rev_t * Line 75  rev_key_colon_handler (gpg_desig_rev_t *
75          if (pend == NULL)          if (pend == NULL)
76              break;              break;
77          switch (field) {          switch (field) {
78          case  4: r->pubkey_algo = (gpgme_pubkey_algo_t)atol (pend); break;          case  4:
79          case 10: strncpy (r->fpr, pend, 40); r->fpr[40] = 0; break;              r->pubkey_algo = (gpgme_pubkey_algo_t)atol (pend);
80                break;
81    
82            case 10:
83                strncpy (r->fpr, pend, 40);
84                r->fpr[40] = 0;
85                break;
86          }                }      
87      }      }
88      if (p)      if (p)
# Line 92  uid_inf_colon_handler (gpg_uid_info_t *i Line 99  uid_inf_colon_handler (gpg_uid_info_t *i
99  {  {
100      gpg_uid_info_t i, t;      gpg_uid_info_t i, t;
101      char *p, *pend;      char *p, *pend;
102        char *name;
103      int field = 0, len = 0;      int field = 0, len = 0;
104    
105      if (!line || strlen (line) < 3 || strncmp (line, "uid", 3))      if (!line || strlen (line) < 3 || strncmp (line, "uid", 3))
# Line 122  uid_inf_colon_handler (gpg_uid_info_t *i Line 130  uid_inf_colon_handler (gpg_uid_info_t *i
130              break;              break;
131    
132          case 10: /* user ID */          case 10: /* user ID */
133              i->name = (char *)calloc (1, strlen (pend)+1);              name = (char *)calloc (1, strlen (pend)+1);
134              if (!i->name)              if (!name)
135                  return gpg_error (GPG_ERR_ENOMEM);;                  return gpg_error (GPG_ERR_ENOMEM);;
136              gpg_decode_c_string (pend, &i->name, strlen (pend)+ 1);              gpg_decode_c_string (pend, &name, strlen (pend)+ 1);
137                i->name = utf8_to_native (name);
138                safe_free (name);
139              if (strchr (pend, '<') != NULL && strchr (pend, '>') != NULL) {              if (strchr (pend, '<') != NULL && strchr (pend, '>') != NULL) {
140                  int pos = strchr (i->name, '<')- i->name + 1;                  int pos = strchr (i->name, '<')- i->name + 1;
141                  int end = strchr (i->name, '>') - i->name;                  int end = strchr (i->name, '>') - i->name;
# Line 138  uid_inf_colon_handler (gpg_uid_info_t *i Line 148  uid_inf_colon_handler (gpg_uid_info_t *i
148    
149          case 13: /* preferences */          case 13: /* preferences */
150              if (strstr (pend, "mdc")) {              if (strstr (pend, "mdc")) {
151                    const char *s = "no-ks-modify";
152                  len = strlen (pend) - 4; /* ,mdc */                  len = strlen (pend) - 4; /* ,mdc */
153                  if (strstr (pend, "no-ks-modify")) {                  if (strstr (pend, s)) {
154                      i->flags.no_ks_modify = 1;                      i->flags.no_ks_modify = 1;
155                      len -= 13; /* ,no-ks-modify */                      len -= strlen (s)+1; /* ',' + s */
156                  }                  }
157                  i->prefs = (char*)calloc (1, len+1);                  i->prefs = (char*)calloc (1, len+1);
158                  if (!i->prefs)                  if (!i->prefs)
# Line 159  uid_inf_colon_handler (gpg_uid_info_t *i Line 170  uid_inf_colon_handler (gpg_uid_info_t *i
170              break;              break;
171    
172          case 14: /* index/flags */          case 14: /* index/flags */
173              i->index = atol (pend);              i->index = atoi (pend);
174              if (strchr (pend, 'r'))              if (strchr (pend, 'r'))
175                  i->flags.revoked = 1;                  i->flags.revoked = 1;
176              if (strchr (pend, 'p'))              if (strchr (pend, 'p'))
# Line 224  list2_handler (void *opaque, gpgme_statu Line 235  list2_handler (void *opaque, gpgme_statu
235      return 0;      return 0;
236  }  }
237    
238    
239  /* Dummy handler to get the colon data and then quit. */  /* Dummy handler to get the colon data and then quit. */
240  static gpgme_error_t  static gpgme_error_t
241  list_handler (void *opaque, gpgme_status_code_t code, const char *key, int fd)  list_handler (void *opaque, gpgme_status_code_t code, const char *key, int fd)
# Line 253  list_handler (void *opaque, gpgme_status Line 265  list_handler (void *opaque, gpgme_status
265  gpgme_error_t  gpgme_error_t
266  GpgKeyEdit::getDesignatedRevoker (gpg_desig_rev_t *r_rev)  GpgKeyEdit::getDesignatedRevoker (gpg_desig_rev_t *r_rev)
267  {  {
268      gpgme_data_t out=NULL;      gpgme_data_t out = NULL;
269      gpg_desig_rev_t rev = NULL;      gpg_desig_rev_t rev = NULL;
270      gpgme_error_t err;      gpgme_error_t err;
271      char buf[256];      char buf[256];
# Line 284  leave: Line 296  leave:
296      return err;      return err;
297  }  }
298    
299    
300  /* Retrieve all user ID information of the key set via setKey  /* Retrieve all user ID information of the key set via setKey
301     in @r_inf. The result also contains the user ID number which     in @r_inf. The result also contains the user ID number which
302     is needed to securely delete the user-ID. */     is needed to securely delete the user-ID. */
# Line 323  leave: Line 336  leave:
336  }  }
337    
338    
339  /* Construct an object with the given key in @key. */  /* Clear object. */
340  GpgKeyEdit::GpgKeyEdit (gpgme_key_t _key)  void
341    GpgKeyEdit::clear (void)
342  {  {
343      this->key = _key;      pass = NULL;    
     pass = NULL;  
     type = 0;  
344      name = NULL;      name = NULL;
345      cmt = NULL;      cmt = NULL;
346      email = NULL;      email = NULL;
347        type = 0;
348      cnt = 0;      cnt = 0;
349      cmd_sent = 0;      cmd_sent = 0;
350      resval = 0;      resval = 0;
351        uid_index = sig_index = key_index = -1;
352        key_has_passwd = true;
353    }
354    
355    
356    /* Construct an object with the given key in @key. */
357    GpgKeyEdit::GpgKeyEdit (gpgme_key_t _key)
358    {
359        clear ();
360        this->key = _key;
361      gpgme_new (&ctx); /* FIXME */      gpgme_new (&ctx); /* FIXME */
362  }  }
363    
364  /* Construct an object and fetch the key with the keyid @keyid. */  /* Construct an object and fetch the key with the keyid @keyid. */
365  GpgKeyEdit::GpgKeyEdit (const char *_keyid)  GpgKeyEdit::GpgKeyEdit (const char *_keyid)
366  {  {
367        clear ();
368      get_pubkey (_keyid, &this->key);      get_pubkey (_keyid, &this->key);
369      pass = NULL;      gpgme_new (&ctx); /* FIXME */    
     type = 0;  
     name = NULL;  
     cmt = NULL;  
     email = NULL;  
     cmd_sent = 0;  
     resval = 0;  
     gpgme_new (&ctx); /* FIXME */  
370  }  }
371    
372  /* Delete the given object. */  /* Delete the given object. */
# Line 367  void Line 384  void
384  GpgKeyEdit::reset (void)  GpgKeyEdit::reset (void)
385  {  {
386      cmd_sent = 0;      cmd_sent = 0;
387        cnt = 0;
388  }  }
389    
390    
# Line 394  GpgKeyEdit::setCallback (gpgme_progress_ Line 412  GpgKeyEdit::setCallback (gpgme_progress_
412      gpgme_set_progress_cb (ctx, cb, cb_value);      gpgme_set_progress_cb (ctx, cb, cb_value);
413  }  }
414    
415    
416    /* Clear the stored passphrase. */
417    void
418    GpgKeyEdit::clearPassphrase (void)
419    {
420        if (pass)
421            pass = NULL;
422    }
423    
424    
425    
426    /* Inidicate that a key is protected by  a passphrase or not. */
427    void
428    GpgKeyEdit::setNoPassphrase (bool val)
429    {
430        key_has_passwd = !val;
431    }
432    
433  /* Set the passphrase to @pass. */  /* Set the passphrase to @pass. */
434  void  void
435  GpgKeyEdit::setPassphrase (const char *_pass)  GpgKeyEdit::setPassphrase (const char *_pass)
# Line 441  GpgKeyEdit::getResult(void) Line 477  GpgKeyEdit::getResult(void)
477  }  }
478    
479    
480    /* Return the amount of days the key is valid. */
481    int
482    GpgKeyEdit::getValidDays (void)
483    {
484        return valid;
485    }
486    
487    
488  int  int
489  GpgKeyEdit::getType (void)  GpgKeyEdit::getType (void)
# Line 448  GpgKeyEdit::getType (void) Line 491  GpgKeyEdit::getType (void)
491      return type;      return type;
492  }  }
493    
494    
495    /* Add the notation data from @notation to the user ID
496       with the index @_uid_idx.
497       Return value: 0 on success.  */
498    gpgme_error_t
499    GpgKeyEdit::addNotation (int _uid_idx, const char *_notation)
500    {
501        if (!key)
502            return gpg_error (GPG_ERR_INV_OBJ);
503        if (key_has_passwd && !this->pass)
504            return gpg_error (GPG_ERR_INV_PASSPHRASE);
505    
506        type = GPG_EDITKEY_NOTATION;
507        this->uid_index = _uid_idx;
508        this->notation = (char*)_notation;
509        return gpg_editkey (this->ctx, this->key, this);
510    }
511    
512    
513  /* Sign the key stored in the object with the  /* Sign the key stored in the object with the
514     signing mode @mode and the signature class @sig_class.     signing mode @mode and the signature class @sig_class.
515     Return value: 0 on success. */     Return value: 0 on success. */
516  gpgme_error_t  gpgme_error_t
517  GpgKeyEdit::signKey (int mode, int _sig_class, const char *_exp_date)  GpgKeyEdit::signKey (int mode, int _sig_class, const char *_exp_date)
518  {  {
519      if (!this->key || !this->pass)      if (!this->key)
520          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
521        if (key_has_passwd && !this->pass)
522            return gpg_error (GPG_ERR_INV_PASSPHRASE);
523    
524      type = mode;      type = mode;
525      this->exp_date = _exp_date;      this->exp_date = _exp_date;
# Line 464  GpgKeyEdit::signKey (int mode, int _sig_ Line 528  GpgKeyEdit::signKey (int mode, int _sig_
528  }  }
529    
530    
531    /* Sign a single user-id with the index @_uid_index.
532       All other parameters are equal to signKey().
533       Return value: 0 on success. */
534    gpgme_error_t
535    GpgKeyEdit::signUserid (int _uid_idx, int mode, int _sig_class,
536                            const char *_exp_date)
537    {
538        if (!this->key)
539            return gpg_error (GPG_ERR_INV_OBJ);
540        if (key_has_passwd && !this->pass)
541            return gpg_error (GPG_ERR_INV_PASSPHRASE);
542    
543        this->uid_index = _uid_idx;
544        type = mode;
545        this->exp_date = _exp_date;
546        this->sig_class = _sig_class;
547        return gpg_editkey (this->ctx, this->key, this);
548    }
549    
550    
551  /* Set the ownertrust of the key stored in the object  /* Set the ownertrust of the key stored in the object
552     to the trust value @trust.     to the trust value @trust.
553     Return value: 0 on success. */     Return value: 0 on success. */
# Line 484  GpgKeyEdit::setTrust (gpgme_validity_t t Line 568  GpgKeyEdit::setTrust (gpgme_validity_t t
568  gpgme_error_t  gpgme_error_t
569  GpgKeyEdit::addUserid (const char *_name, const char *_cmt, const char *_email)  GpgKeyEdit::addUserid (const char *_name, const char *_cmt, const char *_email)
570  {  {
571      if (!this->key || !this->pass)      if (!this->key)
572          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
573        if (key_has_passwd && !this->pass)
574            return gpg_error (GPG_ERR_INV_PASSPHRASE);
575    
576      type = GPG_EDITKEY_ADDUID;      type = GPG_EDITKEY_ADDUID;
577      free_if_alloc (this->name);      free_if_alloc (this->name);
578      this->name = m_strdup (_name);      this->name = m_strdup (_name);
579      free_if_alloc (this->cmt);      free_if_alloc (this->cmt);
580      this->cmt = NULL;      this->cmt = NULL;
581      if (cmt != NULL)      if (_cmt != NULL)
582          this->cmt = m_strdup (_cmt);              this->cmt = m_strdup (_cmt);    
583      free_if_alloc (this->email);      free_if_alloc (this->email);
584      this->email = m_strdup (_email);      this->email = m_strdup (_email);
# Line 536  gpgme_error_t Line 622  gpgme_error_t
622  GpgKeyEdit::addSubkey (gpgme_pubkey_algo_t _pubkey_algo,  GpgKeyEdit::addSubkey (gpgme_pubkey_algo_t _pubkey_algo,
623                         unsigned int _pubkey_size, long _valid)                         unsigned int _pubkey_size, long _valid)
624  {  {
625      if (!this->key || !this->pass)      if (!this->key)
626          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
627        if (key_has_passwd && !this->pass)
628            return gpg_error (GPG_ERR_INV_PASSPHRASE);
629    
630      type = GPG_EDITKEY_ADDKEY;      type = GPG_EDITKEY_ADDKEY;
631      this->pubkey_algo = _pubkey_algo;      this->pubkey_algo = _pubkey_algo;
# Line 552  GpgKeyEdit::addSubkey (gpgme_pubkey_algo Line 640  GpgKeyEdit::addSubkey (gpgme_pubkey_algo
640  gpgme_error_t  gpgme_error_t
641  GpgKeyEdit::changePassphrase (const char *_new_pass, int allow_empty)  GpgKeyEdit::changePassphrase (const char *_new_pass, int allow_empty)
642  {  {
643      if (!this->key || !this->pass)      if (!this->key)
644          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
645        if (key_has_passwd && !this->pass)
646            return gpg_error (GPG_ERR_INV_PASSPHRASE);
647            
648      type = GPG_EDITKEY_PASSWD;      type = GPG_EDITKEY_PASSWD;
649      this->new_pass = _new_pass;      this->new_pass = _new_pass;
# Line 567  GpgKeyEdit::changePassphrase (const char Line 657  GpgKeyEdit::changePassphrase (const char
657  gpgme_error_t  gpgme_error_t
658  GpgKeyEdit::setPrimaryUserid (int _uid_index)  GpgKeyEdit::setPrimaryUserid (int _uid_index)
659  {  {
660      if (!this->key || !this->pass)      if (!this->key)
661          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
662        if (key_has_passwd && !this->pass)
663            return gpg_error (GPG_ERR_INV_PASSPHRASE);
664    
665      type = GPG_EDITKEY_PRIMARY;      type = GPG_EDITKEY_PRIMARY;
666      this->uid_index = _uid_index;      this->uid_index = _uid_index;
# Line 580  GpgKeyEdit::setPrimaryUserid (int _uid_i Line 672  GpgKeyEdit::setPrimaryUserid (int _uid_i
672     if @exp_days is true, exp_timestamp is already converted to days.     if @exp_days is true, exp_timestamp is already converted to days.
673     Return value: 0 on success. */     Return value: 0 on success. */
674  gpgme_error_t  gpgme_error_t
675  GpgKeyEdit::setKeyExpireDate (int _key_index,  GpgKeyEdit::setKeyExpireDate (int _key_index, long exp_timestamp,
676                                long exp_timestamp, bool exp_days)                                bool exp_days)
677  {  {
678      if (!this->key || !this->pass)      if (!this->key)
679          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
680        if (key_has_passwd && !this->pass)
681            return gpg_error (GPG_ERR_INV_PASSPHRASE);
682      if (!exp_days && exp_timestamp > 0 && exp_timestamp < time (NULL))      if (!exp_days && exp_timestamp > 0 && exp_timestamp < time (NULL))
683          return gpg_error (GPG_ERR_INV_ARG);          return gpg_error (GPG_ERR_INV_ARG);
684            
# Line 604  GpgKeyEdit::setKeyExpireDate (int _key_i Line 698  GpgKeyEdit::setKeyExpireDate (int _key_i
698  gpgme_error_t  gpgme_error_t
699  GpgKeyEdit::revokeUserid (int _uid_index)  GpgKeyEdit::revokeUserid (int _uid_index)
700  {  {
701      if (!this->key || !this->pass)      if (!this->key)
702          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
703        if (key_has_passwd && !this->pass)
704            return gpg_error (GPG_ERR_INV_PASSPHRASE);
705    
706      type = GPG_EDITKEY_REVUID;      type = GPG_EDITKEY_REVUID;
707      this->uid_index = _uid_index;      this->uid_index = _uid_index;
# Line 619  GpgKeyEdit::revokeUserid (int _uid_index Line 715  GpgKeyEdit::revokeUserid (int _uid_index
715  gpgme_error_t  gpgme_error_t
716  GpgKeyEdit::revokeSignature (int _uid_index, int _sig_index)  GpgKeyEdit::revokeSignature (int _uid_index, int _sig_index)
717  {  {
718      if (!this->key || !this->pass)      if (!this->key)
719          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
720        if (key_has_passwd && !this->pass)
721            return gpg_error (GPG_ERR_INV_PASSPHRASE);
722    
723      type = GPG_EDITKEY_REVSIG;      type = GPG_EDITKEY_REVSIG;
724      this->uid_index = _uid_index;      this->uid_index = _uid_index;
# Line 636  GpgKeyEdit::revokeSignature (int _uid_in Line 734  GpgKeyEdit::revokeSignature (int _uid_in
734  gpgme_error_t  gpgme_error_t
735  GpgKeyEdit::revokeSubkey (int _key_index, int _reason, const char *_cmt)  GpgKeyEdit::revokeSubkey (int _key_index, int _reason, const char *_cmt)
736  {  {
737      if (!this->key || !this->pass)      if (!this->key)
738          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
739        if (key_has_passwd && !this->pass)
740            return gpg_error (GPG_ERR_INV_PASSPHRASE);
741    
742      type = GPG_EDITKEY_REVKEY;      type = GPG_EDITKEY_REVKEY;
743      this->key_index = _key_index;      this->key_index = _key_index;
# Line 657  GpgKeyEdit::revokeSubkey (int _key_index Line 757  GpgKeyEdit::revokeSubkey (int _key_index
757  gpgme_error_t  gpgme_error_t
758  GpgKeyEdit::addDesignatedRevoker (const char *uid)  GpgKeyEdit::addDesignatedRevoker (const char *uid)
759  {  {
760      if (!this->key || !this->pass)      if (!this->key)
761          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
762        if (key_has_passwd && !this->pass)
763            return gpg_error (GPG_ERR_INV_PASSPHRASE);
764    
765      type = GPG_EDITKEY_ADDREV;      type = GPG_EDITKEY_ADDREV;
766      free_if_alloc (this->name);      free_if_alloc (this->name);
# Line 672  GpgKeyEdit::addDesignatedRevoker (const Line 774  GpgKeyEdit::addDesignatedRevoker (const
774  gpgme_error_t  gpgme_error_t
775  GpgKeyEdit::addPhotoid (const char *jpg_file)  GpgKeyEdit::addPhotoid (const char *jpg_file)
776  {  {
777      if (!this->key || !this->pass)      if (!this->key)
778          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
779        if (key_has_passwd && !this->pass)
780            return gpg_error (GPG_ERR_INV_PASSPHRASE);
781    
782      type = GPG_EDITKEY_ADDPHOTO;      type = GPG_EDITKEY_ADDPHOTO;
783      this->url = jpg_file;      this->url = jpg_file;
# Line 701  GpgKeyEdit::disable (void) Line 805  GpgKeyEdit::disable (void)
805  }  }
806    
807    
808    /* Remove unusable parts and all signatures from a key. */
809    gpgme_error_t
810    GpgKeyEdit::minimizeKey (void)
811    {
812        if (!this->key)
813            return gpg_error (GPG_ERR_INV_OBJ);
814        type = GPG_EDITKEY_MINIMIZE;
815        return gpg_editkey (this->ctx, this->key, this);
816    }
817    
818    
819    /* Remove unusable parts from a key. */
820    gpgme_error_t
821    GpgKeyEdit::cleanKey (void)
822    {
823        if (!this->key)
824            return gpg_error (GPG_ERR_INV_OBJ);
825        type = GPG_EDITKEY_CLEAN;
826        return gpg_editkey (this->ctx, this->key, this);
827    }
828    
829    
830  /* Update the user-ID preferences of the user-ID with the  /* Update the user-ID preferences of the user-ID with the
831     index @uid_index to the prefs given in @new_prefs.     index @uid_index to the prefs given in @new_prefs.
832     Return value: 0 on success. */     Return value: 0 on success. */
833  gpgme_error_t  gpgme_error_t
834  GpgKeyEdit::setUseridPreferences (int _uid_index, const char *new_prefs)  GpgKeyEdit::setUseridPreferences (int _uid_index, const char *_new_prefs)
835  {  {
836      if (!this->key || !this->pass)      if (!this->key)
837          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
838      return 0;      if (key_has_passwd && !this->pass)
839            return gpg_error (GPG_ERR_INV_PASSPHRASE);
840        type = GPG_EDITKEY_SETPREF;
841        this->uid_index = _uid_index;
842        this->new_prefs = _new_prefs;
843        return gpg_editkey (this->ctx, this->key, this);
844  }  }
845    
846    
# Line 728  GpgKeyEdit::delUseridSignature (int _uid Line 859  GpgKeyEdit::delUseridSignature (int _uid
859  }  }
860    
861  /* Set the preferred keyserver for the given key to @url.  /* Set the preferred keyserver for the given key to @url.
862       If @_uid_index is -1, set the keyserver for all user-ids.
863     Return value: 0 on success. */     Return value: 0 on success. */
864  gpgme_error_t  gpgme_error_t
865  GpgKeyEdit::setPreferredKeyserver (int _uid_index, const char *_url)  GpgKeyEdit::setPreferredKeyserver (int _uid_index, const char *_url)
866  {  {
867      if (!this->key || !this->pass)      if (!this->key)
868          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
869      if (!url)      if (key_has_passwd && !this->pass)
870            return gpg_error (GPG_ERR_INV_PASSPHRASE);
871        if (!_url)
872          return gpg_error (GPG_ERR_INV_ARG);          return gpg_error (GPG_ERR_INV_ARG);
873    
874      type = GPG_EDITKEY_KEYSERV;      type = GPG_EDITKEY_KEYSERV;
875      this->url = _url;      this->url = _url;
876      this->uid_index = _uid_index;      this->uid_index = _uid_index;
877      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
878  }  }
879    
880    
881    /* Return the saved user-id index. */
882    int
883    GpgKeyEdit::getUseridIndex (void)
884    {
885        return uid_index;
886    }
887    
888    
889    /* Return the saved key index. */  
890    int
891    GpgKeyEdit::getKeyIndex (void)
892    {
893        return key_index;
894    }
895    
896    
897    /* Return the saved sig index. */
898    int
899    GpgKeyEdit::getSigIndex (void)
900    {
901        return sig_index;
902    }

Legend:
Removed from v.77  
changed lines
  Added in v.234

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26