Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8165479

javax.smartcardio.CardChannel Transmit can't receive more than 8K of data

XMLWordPrintable

      FULL PRODUCT VERSION :


      ADDITIONAL OS VERSION INFORMATION :
      WIndows

      A DESCRIPTION OF THE PROBLEM :
      The JAVA smart card libraries give an error on this APDU: 00 cb 3f ff 00 00 05 5c 03 5f c1 08 00 00

       javax.smartcardio.CardException: sun.security.smartcardio.PCSCException: Unknown error 0x7a
       it turns out that Windows defines an error 122L == 0x7A of
        MessageId: ERROR_INSUFFICIENT_BUFFER
        MessageText: The data area passed to a system call is too small.

      So we just can't use ExtendedData for the facial image which is a shame
      because that is the object that most needs the speedup.

      The bug is in http://searchcode.com/codesearch/view/17992359 and the buffer is 8192.



      A Facial image of 6554 bytes works with extendedData.
      A Facial image of 9407 bytes fails with Java extendedData, but works just fine with C++ access to PC/SC.
       

      You can see the problem in the code that SUN did:
       
      #define MAX_STACK_BUFFER_SIZE 8192
       
      JNIEXPORT jbyteArray JNICALL Java_sun_security_smartcardio_PCSC_SCardControl
          (JNIEnv *env, jclass thisClass, jlong jCard, jint jControlCode, jbyteArray jSendBuffer)
      {
          SCARDHANDLE card = (SCARDHANDLE)jCard;
          LONG rv;
          jbyte* sendBuffer = (*env)->GetByteArrayElements(env, jSendBuffer, NULL);
          jint sendBufferLength = (*env)->GetArrayLength(env, jSendBuffer);
          jbyte receiveBuffer[MAX_STACK_BUFFER_SIZE];
          jint receiveBufferLength = MAX_STACK_BUFFER_SIZE;
       



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Try a SP800-73-4 GET Data command with extended length when there is more than 8K of data available

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      All data should be read

      REPRODUCIBILITY :
      This bug can be reproduced always.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: