Diff

Differences From Artifact [c06e51ee9b]:

To Artifact [e6fa629162]:


  2872   2872   				CACKEY_DEBUG_PRINTF("Security status not satisified (respcode = 0x%04x).  Returning NEEDLOGIN", (int) respcode);
  2873   2873   
  2874   2874   				cackey_mark_slot_reset(slot);
  2875   2875   				slot->token_flags = CKF_LOGIN_REQUIRED;
  2876   2876   
  2877   2877   				return(CACKEY_PCSC_E_NEEDLOGIN);
  2878   2878   			}
         2879  +
         2880  +			if (respcode == 0x6E00) {
         2881  +				CACKEY_DEBUG_PRINTF("Got \"WRONG CLASS\", this means we are talking to the wrong object (likely because the card went away) -- resetting");
         2882  +
         2883  +				cackey_mark_slot_reset(slot);
         2884  +				slot->token_flags = CKF_LOGIN_REQUIRED;
         2885  +
         2886  +				return(CACKEY_PCSC_E_NEEDLOGIN);
         2887  +			}
  2879   2888   
  2880   2889   			if (send_ret == CACKEY_PCSC_E_TOKENABSENT) {
  2881   2890   				CACKEY_DEBUG_PRINTF("Token absent.  Returning TOKENABSENT");
  2882   2891   
  2883   2892   				cackey_mark_slot_reset(slot);
  2884   2893   
  2885   2894   				return(CACKEY_PCSC_E_TOKENABSENT);
................................................................................
  3069   3078   	}
  3070   3079   
  3071   3080   	/* PIV authentication uses a "key_reference" of 0x80 */
  3072   3081   	pcsc_identities = cackey_read_certs(slot, NULL, &num_certs);
  3073   3082   	if (num_certs > 0 && pcsc_identities != NULL) {
  3074   3083   		switch (pcsc_identities[0].id_type) {
  3075   3084   			case CACKEY_ID_TYPE_PIV:
  3076         -				CACKEY_DEBUG_PRINTF("We recently had a PIV card, so we will attempt to authenticate using the PIV Application key reference");
         3085  +				CACKEY_DEBUG_PRINTF("We have PIV card, so we will attempt to authenticate using the PIV Application key reference");
  3077   3086   
  3078   3087   				key_reference = 0x80;
  3079   3088   				break;
  3080   3089   			default:
  3081   3090   				break;
  3082   3091   		}
  3083   3092