/[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 234 by twoaday, Tue Jun 27 10:16:41 2006 UTC revision 304 by twoaday, Wed Mar 21 10:59:31 2007 UTC
# Line 282  GpgKeyEdit::getDesignatedRevoker (gpg_de Line 282  GpgKeyEdit::getDesignatedRevoker (gpg_de
282          goto leave;          goto leave;
283            
284      gpgme_data_rewind (out);      gpgme_data_rewind (out);
285      while (gpg_data_readline (out, buf, sizeof (buf)-1) > 0)      while (gpg_data_readline (out, buf, DIM (buf)-1) > 0)
286          rev_key_colon_handler (&rev, buf);          rev_key_colon_handler (&rev, buf);
287      *r_rev = rev;      *r_rev = rev;
288    
# Line 320  GpgKeyEdit::getUseridInfo (gpg_uid_info_ Line 320  GpgKeyEdit::getUseridInfo (gpg_uid_info_
320          goto leave;          goto leave;
321            
322      gpgme_data_rewind (out);      gpgme_data_rewind (out);
323      while (gpg_data_readline (out, buf, sizeof (buf) -1) > 0)      while (gpg_data_readline (out, buf, DIM (buf) -1) > 0)
324          uid_inf_colon_handler (&inf, buf);          uid_inf_colon_handler (&inf, buf);
325    
326      *r_uinf = inf;      *r_uinf = inf;
# Line 353  GpgKeyEdit::clear (void) Line 353  GpgKeyEdit::clear (void)
353  }  }
354    
355    
356    GpgKeyEdit::GpgKeyEdit (void)
357    {
358        clear ();
359        key = NULL;
360        gpgme_new (&ctx); /*FIXME */
361    }
362    
363    
364  /* Construct an object with the given key in @key. */  /* Construct an object with the given key in @key. */
365  GpgKeyEdit::GpgKeyEdit (gpgme_key_t _key)  GpgKeyEdit::GpgKeyEdit (gpgme_key_t _key)
366  {  {
# Line 437  GpgKeyEdit::setPassphrase (const char *_ Line 445  GpgKeyEdit::setPassphrase (const char *_
445      this->pass = _pass;      this->pass = _pass;
446  }  }
447    
448    
449    /* Kludge to allow to handle admin and user PINs. */
450    void
451    GpgKeyEdit::setPassphrase2 (const char *_pass2)
452    {
453        this->new_pass = _pass2;
454    }
455    
456  /* Set the current key to @key. */  /* Set the current key to @key. */
457  void  void
458  GpgKeyEdit::setKey (gpgme_key_t _key)  GpgKeyEdit::setKey (gpgme_key_t _key)
# Line 613  GpgKeyEdit::delKey (int _key_index) Line 629  GpgKeyEdit::delKey (int _key_index)
629      return gpg_editkey (this->ctx, this->key, this);      return gpg_editkey (this->ctx, this->key, this);
630  }  }
631    
632    
633    /* Add a new key on a smart card.
634       The type is given in @type. */
635    gpgme_error_t
636    GpgKeyEdit::addCardKey (int _type)
637    {
638        if (!this->key)
639            return gpg_error (GPG_ERR_INV_OBJ);
640        if (!this->pass)
641            return gpg_error (GPG_ERR_INV_PASSPHRASE);
642        if (_type < 1 || _type > 3)
643            return gpg_error (GPG_ERR_INV_VALUE);
644    
645        type = GPG_EDITKEY_ADDCARDKEY;
646        this->key_index = _type;
647        return gpg_editkey (this->ctx, this->key, this);
648    }
649    
650    
651  /* Add a new subkey to the given key.  /* Add a new subkey to the given key.
652     The new key will have @pubkey_algo as the algorithm     The new key will have @pubkey_algo as the algorithm
653     and a size of @pubkey_size bits. If valid > 0, the     and a size of @pubkey_size bits. If valid > 0, the

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26