/[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 68 by werner, Mon Oct 31 21:14:11 2005 UTC revision 69 by twoaday, Sat Nov 5 12:28:12 2005 UTC
# Line 339  GpgKeyEdit::GpgKeyEdit (gpgme_key_t key) Line 339  GpgKeyEdit::GpgKeyEdit (gpgme_key_t key)
339  }  }
340    
341  /* Construct an object and fetch the key with the keyid @keyid. */  /* Construct an object and fetch the key with the keyid @keyid. */
342  GpgKeyEdit::GpgKeyEdit (const char *keyid)  GpgKeyEdit::GpgKeyEdit (const char *_keyid)
343  {  {
344      get_pubkey (keyid, &this->key);      get_pubkey (_keyid, &this->key);
345      pass = NULL;      pass = NULL;
346      type = 0;      type = 0;
347      name = NULL;      name = NULL;
# Line 396  GpgKeyEdit::setCallback (gpgme_progress_ Line 396  GpgKeyEdit::setCallback (gpgme_progress_
396    
397  /* Set the passphrase to @pass. */  /* Set the passphrase to @pass. */
398  void  void
399  GpgKeyEdit::setPassphrase (const char *pass)  GpgKeyEdit::setPassphrase (const char *_pass)
400  {  {
401      this->pass = pass;      this->pass = _pass;
402  }  }
403    
404  /* Set the current key to @key. */  /* Set the current key to @key. */
405  void  void
406  GpgKeyEdit::setKey (gpgme_key_t key)  GpgKeyEdit::setKey (gpgme_key_t _key)
407  {  {
408      this->key = key;      this->key = _key;
409  }  }
410    
411  /* Set the keyid of the destination key to @keyid. */  /* Set the keyid of the destination key to @keyid. */
412  void  void
413  GpgKeyEdit::setKeyID (const char *keyid)  GpgKeyEdit::setKeyID (const char *_keyid)
414  {  {
415      if (!keyid)      if (!_keyid)
416          return;          return;
417      get_pubkey (keyid, &this->key);      get_pubkey (_keyid, &this->key);
418  }  }
419    
420    
# Line 452  GpgKeyEdit::getType (void) Line 452  GpgKeyEdit::getType (void)
452     signing mode @mode and the signature class @sig_class.     signing mode @mode and the signature class @sig_class.
453     Return value: 0 on success. */     Return value: 0 on success. */
454  gpgme_error_t  gpgme_error_t
455  GpgKeyEdit::signKey (int mode, int sig_class, const char *exp_date)  GpgKeyEdit::signKey (int mode, int _sig_class, const char *_exp_date)
456  {  {
457      if (!this->key || !this->pass)      if (!this->key || !this->pass)
458          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
459    
460      type = mode;      type = mode;
461      this->exp_date = exp_date;      this->exp_date = _exp_date;
462      this->sig_class = sig_class;      this->sig_class = _sig_class;
463      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
464  }  }
465    
466    
467  /* Set the ownertrust of the key stored in the object  /* Set the ownertrust of the key stored in the object
468     to the trust value @trust.     to the trust value @trust.
469     Return value: 0 on success. */     Return value: 0 on success. */
# Line 503  GpgKeyEdit::addUserid (const char *name, Line 504  GpgKeyEdit::addUserid (const char *name,
504  /* Delete the user-ID with the index @uid_index of the given key.  /* Delete the user-ID with the index @uid_index of the given key.
505     Return value: 0 on success. */     Return value: 0 on success. */
506  gpgme_error_t  gpgme_error_t
507  GpgKeyEdit::delUserid (int uid_index)  GpgKeyEdit::delUserid (int _uid_index)
508  {  {
509      if (!this->key)      if (!this->key)
510          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
511    
512      type = GPG_EDITKEY_DELUID;      type = GPG_EDITKEY_DELUID;
513      this->uid_index = uid_index;      this->uid_index = _uid_index;
514      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
515  }  }
516    
517  /* Delete the subkey with the index @key_index.  /* Delete the subkey with the index @key_index.
518     Return value: 0 on success. */     Return value: 0 on success. */
519  gpgme_error_t  gpgme_error_t
520  GpgKeyEdit::delKey (int key_index)  GpgKeyEdit::delKey (int _key_index)
521  {  {
522      if (!this->key)      if (!this->key)
523          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
524    
525      type = GPG_EDITKEY_DELKEY;      type = GPG_EDITKEY_DELKEY;
526      this->key_index = key_index;      this->key_index = _key_index;
527      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
528  }  }
529    
# Line 549  GpgKeyEdit::addSubkey (gpgme_pubkey_algo Line 550  GpgKeyEdit::addSubkey (gpgme_pubkey_algo
550     If allow_empty != 0, it is allowed to provide an empty passphrase.     If allow_empty != 0, it is allowed to provide an empty passphrase.
551     Return value: 0 on success. */     Return value: 0 on success. */
552  gpgme_error_t  gpgme_error_t
553  GpgKeyEdit::changePassphrase (const char *new_pass, int allow_empty)  GpgKeyEdit::changePassphrase (const char *_new_pass, int allow_empty)
554  {  {
555      if (!this->key || !this->pass)      if (!this->key || !this->pass)
556          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
557            
558      type = GPG_EDITKEY_PASSWD;      type = GPG_EDITKEY_PASSWD;
559      this->new_pass = new_pass;      this->new_pass = _new_pass;
560      this->flags = allow_empty? 1 : 0;      this->flags = allow_empty? 1 : 0;
561      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
562  }  }
# Line 564  GpgKeyEdit::changePassphrase (const char Line 565  GpgKeyEdit::changePassphrase (const char
565     the index @uid_index.     the index @uid_index.
566     Return value: 0 on success. */     Return value: 0 on success. */
567  gpgme_error_t  gpgme_error_t
568  GpgKeyEdit::setPrimaryUserid (int uid_index)  GpgKeyEdit::setPrimaryUserid (int _uid_index)
569  {  {
570      if (!this->key || !this->pass)      if (!this->key || !this->pass)
571          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
572    
573      type = GPG_EDITKEY_PRIMARY;      type = GPG_EDITKEY_PRIMARY;
574      this->uid_index = uid_index;      this->uid_index = _uid_index;
575      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
576  }  }
577    
# Line 579  GpgKeyEdit::setPrimaryUserid (int uid_in Line 580  GpgKeyEdit::setPrimaryUserid (int uid_in
580     if @exp_days is true, exp_timestamp is already converted to days.     if @exp_days is true, exp_timestamp is already converted to days.
581     Return value: 0 on success. */     Return value: 0 on success. */
582  gpgme_error_t  gpgme_error_t
583  GpgKeyEdit::setKeyExpireDate (int key_index, long exp_timestamp, bool exp_days)  GpgKeyEdit::setKeyExpireDate (int _key_index,
584                                  long exp_timestamp, bool exp_days)
585  {  {
586      if (!this->key || !this->pass)      if (!this->key || !this->pass)
587          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
# Line 593  GpgKeyEdit::setKeyExpireDate (int key_in Line 595  GpgKeyEdit::setKeyExpireDate (int key_in
595      }      }
596      else      else
597          valid = exp_timestamp;          valid = exp_timestamp;
598      this->key_index = key_index;      this->key_index = _key_index;
599      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
600  }  }
601    
602  /* Revoke the userid given by the index @uid_index.  /* Revoke the userid given by the index @uid_index.
603     Return value: 0 on success. */     Return value: 0 on success. */
604  gpgme_error_t  gpgme_error_t
605  GpgKeyEdit::revokeUserid (int uid_index)  GpgKeyEdit::revokeUserid (int _uid_index)
606  {  {
607      if (!this->key || !this->pass)      if (!this->key || !this->pass)
608          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
609    
610      type = GPG_EDITKEY_REVUID;      type = GPG_EDITKEY_REVUID;
611      this->uid_index = uid_index;      this->uid_index = _uid_index;
612      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
613  }  }
614    
# Line 615  GpgKeyEdit::revokeUserid (int uid_index) Line 617  GpgKeyEdit::revokeUserid (int uid_index)
617     and the signature index @sig_index.     and the signature index @sig_index.
618     Return value: 0 on success. */     Return value: 0 on success. */
619  gpgme_error_t  gpgme_error_t
620  GpgKeyEdit::revokeSignature (int uid_index, int sig_index)  GpgKeyEdit::revokeSignature (int _uid_index, int _sig_index)
621  {  {
622      if (!this->key || !this->pass)      if (!this->key || !this->pass)
623          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
624    
625      type = GPG_EDITKEY_REVSIG;      type = GPG_EDITKEY_REVSIG;
626      this->uid_index = uid_index;      this->uid_index = _uid_index;
627      this->sig_index = sig_index;      this->sig_index = _sig_index;
628      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
629  }  }
630    
# Line 632  GpgKeyEdit::revokeSignature (int uid_ind Line 634  GpgKeyEdit::revokeSignature (int uid_ind
634     more details in @cmt.     more details in @cmt.
635     Return value: 0 on success. */     Return value: 0 on success. */
636  gpgme_error_t  gpgme_error_t
637  GpgKeyEdit::revokeSubkey (int key_index, int reason, const char *cmt)  GpgKeyEdit::revokeSubkey (int _key_index, int _reason, const char *_cmt)
638  {  {
639      if (!this->key || !this->pass)      if (!this->key || !this->pass)
640          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
641    
642      type = GPG_EDITKEY_REVKEY;      type = GPG_EDITKEY_REVKEY;
643      this->key_index = key_index;      this->key_index = _key_index;
644      this->reason = reason;      this->reason = _reason;
645      free_if_alloc (this->cmt);      free_if_alloc (this->cmt);
646      this->cmt = NULL;      this->cmt = NULL;
647      if (cmt)      if (_cmt)
648          this->cmt = m_strdup (cmt);          this->cmt = m_strdup (_cmt);
649      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
650  }  }
651    
# Line 703  GpgKeyEdit::disable (void) Line 705  GpgKeyEdit::disable (void)
705     index @uid_index to the prefs given in @new_prefs.     index @uid_index to the prefs given in @new_prefs.
706     Return value: 0 on success. */     Return value: 0 on success. */
707  gpgme_error_t  gpgme_error_t
708  GpgKeyEdit::setUseridPreferences (int uid_index, const char *new_prefs)  GpgKeyEdit::setUseridPreferences (int _uid_index, const char *new_prefs)
709  {  {
710      if (!this->key || !this->pass)      if (!this->key || !this->pass)
711          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
# Line 715  GpgKeyEdit::setUseridPreferences (int ui Line 717  GpgKeyEdit::setUseridPreferences (int ui
717     The index of the signature is given in @sig_index.     The index of the signature is given in @sig_index.
718     Return value: 0 on success. */     Return value: 0 on success. */
719  gpgme_error_t  gpgme_error_t
720  GpgKeyEdit::delUseridSignature (int uid_index, int sig_index)  GpgKeyEdit::delUseridSignature (int _uid_index, int _sig_index)
721  {  {
722      if (!this->key)      if (!this->key)
723          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
724      type = GPG_EDITKEY_DELSIG;      type = GPG_EDITKEY_DELSIG;
725      this->uid_index = uid_index;      this->uid_index = _uid_index;
726      this->sig_index = sig_index;      this->sig_index = _sig_index;
727      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
728  }  }
729    
730  /* Set the preferred keyserver for the given key to @url.  /* Set the preferred keyserver for the given key to @url.
731     Return value: 0 on success. */     Return value: 0 on success. */
732  gpgme_error_t  gpgme_error_t
733  GpgKeyEdit::setPreferredKeyserver (int uid_index, const char *url)  GpgKeyEdit::setPreferredKeyserver (int _uid_index, const char *_url)
734  {  {
735      if (!this->key || !this->pass)      if (!this->key || !this->pass)
736          return gpg_error (GPG_ERR_INV_OBJ);          return gpg_error (GPG_ERR_INV_OBJ);
737      if (!url)      if (!url)
738          return gpg_error (GPG_ERR_INV_ARG);          return gpg_error (GPG_ERR_INV_ARG);
739      type = GPG_EDITKEY_KEYSERV;      type = GPG_EDITKEY_KEYSERV;
740      this->url = url;      this->url = _url;
741      this->uid_index = uid_index;      this->uid_index = _uid_index;
742      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
743  }  }

Legend:
Removed from v.68  
changed lines
  Added in v.69

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26