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

Diff of /trunk/Src/wptKeyCache.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 260 by twoaday, Wed Aug 16 10:01:30 2006 UTC
# Line 762  gpg_keycache_delete_key (gpg_keycache_t Line 762  gpg_keycache_delete_key (gpg_keycache_t
762          return rc;          return rc;
763            
764      c = ctx->item;      c = ctx->item;
765      if (c->next == NULL) {      if (!c) /* empty */
766            return 0;
767        else if (c->next == NULL) {
768          if (itm->key)          if (itm->key)
769              gpgme_key_release (itm->key);              gpgme_key_release (itm->key);
770          itm->key = NULL;          itm->key = NULL;
771          free_if_alloc (itm);          free_if_alloc (itm);
772            /* the cache has no other items, so we set the context to NULL
773               to indicate that the entire cache is empty. */
774            ctx->item = NULL;
775      }      }
776      else {      else {
777          for (; c != NULL; c = c->next) {          for (; c != NULL; c = c->next) {
# Line 830  static int Line 835  static int
835  key_divert_to_card (gpgme_key_t key)  key_divert_to_card (gpgme_key_t key)
836  {  {
837      gpgme_subkey_t k;      gpgme_subkey_t k;
838      int n=0, n_alg=0;      int n=0;
839      int can_auth = 0, can_encr = 0;      int can_auth = 0, can_encr = 0;
840    
841      for (k = key->subkeys; k; k = k->next) {      for (k = key->subkeys; k; k = k->next) {
842          n++;          n++;
843          if (k->pubkey_algo == GPGME_PK_RSA && k->length == 1024)          if (k->pubkey_algo != GPGME_PK_RSA || k->length != 1024) {
844              n_alg++;              return 0;
845                break;
846            }
847          if (k->can_authenticate)          if (k->can_authenticate)
848              can_auth++;              can_auth++;
849          if (k->can_encrypt)          if (k->can_encrypt)
850              can_encr++;              can_encr++;
851      }      }
852      if (n == 3 && n_alg == 3 && can_auth == 1 && can_encr == 1)      if (n >= 3 && can_auth >= 1 && can_encr >= 1)
853          return 1;          return 1;
854      return 0;      return 0;
855  }  }

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26