Sending a byte array of greater length than the APDU data buffer

Hello again, I am now trying to send a byte array of length 480 from the smart card. I've tried setting the outgoing length to 480 first but as i had expected, this threw an exception. Then i tried setting it to 240 and then copying from the array into the apdu buffer in two halves and calling sendBytes() twice, but this only worked the first time - it send the first 240 bytes and then threw an error. Is it possible to do what i am trying to accomplish? If so, what am I missing?

the applet:
H:\java_card_kit-2_2_1-win-dom\java_card_kit-2_2_1\samples\src\com\sun\javacard\samples\photocard
the client:
H:\java_card_kit-2_2_1-win-dom\java_card_kit-2_2_1\samples\src_client\com\sun\javacard\clientsamples\photocardclient
here is the code i have used to store large data on card. maybe it will help you.
i send a series of apdu, where each contains 128 bytes of data (all apdu must have the same length - except the last).
public void writeAPDU(APDU apdu)
     byte[] buffer = apdu.getBuffer();
     short lc = (short)(buffer[ISO7816.OFFSET_LC]&0xFF);          
     short p1 = (short)(buffer[ISO7816.OFFSET_P1]&0xFF); // counter
     short p2 = (short)(buffer[ISO7816.OFFSET_P2]&0xFF); // length of send data
     short offset = (short)(p1 * p2); // calculate the offset
     apdu.setIncomingAndReceive();
     // check for first apdu (contains the total size of data)
     if(p1 == 0 && p2 == 0)
          short l = Util.getShort(buffer,ISO7816.OFFSET_CDATA);
          data = new byte[l];
     else
          // store bytes in array
          Util.arrayCopy(buffer, ISO7816.OFFSET_CDATA, data, offset, lc);
}

Similar Messages

  • InsufficientMemoryException while sending large byte array in WCF Service callback

    Hi
    I have a datacontract with a large byte array that is passed by the WCF Service back to the client using a callback contract.
    Until the byte array size remains below 25-30 MB, it is passed OK, but as soon as it exceeds that, an InsufficientMemoryException is thrown on the service side. I have set the max message sizes at 100 MB and using MTOM Encoder.
    I am using WSDualHTTPBinding with sessions and message security - hence streaming is not an option. I know chunking channels are an option, but I want to try to tune the service and client to maximize the byte array size which can be sent over a normal channel.
    Kindly advise how to tune settings to get to around 100 MB byte array size.
    Binding section of web.config is given below. Same settings for sizes are used on client.
    Thanks
    Abhishek
     <wsDualHttpBinding>
            <binding name="WSHttpBinding_IService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
    transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="100000000" maxReceivedMessageSize="100000000" messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true">
              <readerQuotas maxArrayLength="100000000"  />
              <security mode="Message">
                <message clientCredentialType="Certificate" algorithmSuite="Default"  />
              </security>
            </binding>
          </wsDualHttpBinding>

    Hi abhisinghal21,
    >>InsufficientMemoryException while sending large byte array in WCF Service callback
    First please try to increase the timeout value in the both client and service side to see if it works:
    closeTimeout="00:10:00" openTimeout="00:10:00"
    receiveTimeout="00:10:00" sendTimeout="00:10:00"
    Then since you do not want to the use the Chunking option to help you, maybe you try to change the wsDualHttpBinding to use the binding which supports the streaming mode and supports callback.
    In streaming transfer mode, the receiver can begin to process the message before it is completely delivered. And the streaming mode is useful when the information that is passed is lengthy and can be processed serially. Streaming mode is also useful when the
    message is too large to be entirely buffered. So it will be better for you to use the streamed mode.
    For more information, please try to check:
    #How to: Enable Streaming:
    http://msdn.microsoft.com/en-us/library/ms789010(v=vs.110).aspx .
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Sending a Byte array through a socket

    Can someone please tell me how i can send a Byte array from a client to a sever using sockets?
    Thanks
    Mark

    This tutorial should do the trick:
    http://java.sun.com/docs/books/tutorial/networking/sockets/index.html

  • Why is the INVOICE date different than the ORDER date?

    Something odd is happening... I'm receiving workflow notifications from Business Catalyst for Invoices, but sometimes the date of the order is the day before I receive the invoice. This is causing havoc on the shipping side because when I print out the invoice packing slips and export the order files, they don't match up and sometimes customers get missed.
    Any idea why the invoice date would be different than the order date and how do I fix it to make them the same?
    Thanks in advance!

    Hey there,
    An invoice is not an order. That is an important thing to know.
    An order is generated through a few means but mainly as soon as one product is added to a cart - that order exists and the date marked. An invoice is a purchase and comes from an order.
    Create an order in the admin yourself and save it but add no invoice number. You can see you just made an order and you will see the button to generate invoice.
    API can make an order and no invoice, a person can add items to cart and finish it the next day if they have their session open that long... Lots of reasons why these dates may differ.

  • Why do my recurring tasks have a due date earlier than the reminder date?

    When I create a recurring task in the reminders app, it stores it as a due date 1 day sooner than the reminder date.  Thus, if I set a weekly task for Saturday, it shows up in my date view as being on Friday.  When I look at the details of the task, it shows that the due date was Friday and the reminder date was Saturday.  I know I set it up correctly (for being on Saturdays only) but it's being stored wrong.
    This is happening only for the recurring tasks.  My single-use tasks are working fine.  Has this happened to anyone else?

    Caetano,
    Thanks for the response! The only code it looks like I am getting is Exception Code 30 "Plan process according to schedule.
    When you said that Forward Scheduling did not look like it had been executed which is what I thought. It got me thinking some more.
    I ended up going to Tcode OPPR and checking Start in Past and there the system is set up to be "Control at plant leve"
    Then I went to Tcode OMIT and the Start in Past check box was not marked.
    So I would say we don't have Forward Scheduling set up at my location.
    I am going to work on getting that changed and then rerun MRP to see if our release dates get brought in.
    Thanks again for your help.
    Ken

  • How can I know the length of the image data section of a PSD file

    I'm a C++ programmer developing a project to parse PSD files, and it's necessary to know whether there is a length field indicating the length of the image data in image data section of a PSD file, if not, how can I know the length?
    Thank you.

    Sorry I can't help, maybe there is some information in the SDK?
    http://www.adobe.com/devnet/photoshop/sdk.html
    Or someone might be able to help in this forum?
    http://forums.adobe.com/community/photoshop/photoshop_sdk

  • GR date lesser than the PO date, the system should show an error message.

    Dear Gurus,
                         if anybody puts GR date lesser than the PO date, system should display error this happens because the system allows back dated posting of 101 MVT in MIGO.Similarly the IR date should not be less than the GR date. This happens because the system allows back dated posting of MIRO also.
    Regards
    ASHOK K

    Hi,
    Use the badi MB_DOCUMENT_BADI  and compare dates of EKKO-BEDAT and MKPF-BLDAT for MIGO.
    USe the badi IF_EX_MRM_INVOICE_UPDATE PROCESS_AT_ and compare the dates of MKPF-BLDAT and RBKP-BLDAT while saving the invoice for checking the back dated entries and throw an error message.
    Regards,
    Bharat

  • Length of the User Data attributes

    Hello All,
    anyone knows where can i get the max length of the user data, that can be saved in UME (for both standard and customized data)?
    Cause in some cases a i get the message that some attributes cannot be longer that 20 characters and i would like to change it
    Thanks for help!

    Hi Karol,
    > the lenght of the attributes is hardcoded
    Right: This is done within the method <i>getFieldMaxLength</i> within class <i>com.sap.security.core.admin.UserBean</i> within C:\usr\sap\J2E\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.portal.usermanagement.admin\lib\umeuseradminbase.jar:
    /*1155*/        if (fieldName.equals("firstname"))
    /*1156*/            return 30;
    /*1157*/        if (fieldName.equals("lastname"))
    /*1158*/            return 50;
    /*1159*/        if (fieldName.equals("salutation"))
    /*1160*/            return 30;
    /*1161*/        if (fieldName.equals("title"))
    /*1162*/            return 30;
    /*1163*/        if (fieldName.equals("preferredlanguage"))
    /*1164*/            return 30;
    /*1165*/        if (fieldName.equals("timezone"))
    /*1166*/            return 30;
    /*1167*/        if (fieldName.equals("currency"))
    /*1168*/            return 20;
    /*1169*/        if (fieldName.equals("email"))
    /*1170*/            return 70;
    /*1171*/        if (fieldName.equals("telephone"))
    /*1172*/            return 40;
    /*1173*/        if (fieldName.equals("fax"))
    /*1174*/            return 40;
    /*1175*/        if (fieldName.equals("mobile"))
    /*1176*/            return 40;
    /*1177*/        if (fieldName.equals("zip"))
    /*1178*/            return 15;
    /*1179*/        if (fieldName.equals("city"))
    /*1180*/            return 30;
    /*1181*/        if (fieldName.equals("state"))
    /*1182*/            return 20;
    /*1183*/        if (fieldName.equals("country"))
    /*1184*/            return 30;
    /*1185*/        if (fieldName.equals("streetaddress"))
    /*1186*/            return 60;
    /*1187*/        if (fieldName.equals("jobtitle"))
    /*1188*/            return 20;
    /*1189*/        return !fieldName.equals("department") ? -1 : 50;
    So you could modify the implementation.
    Hope it helps
    Detlev

  • The activity procedure date must be larger than the system date in VA42

    Please Help me...... I am trying to update the Contract End Date in VA42 but it is not updating and through an error message
    ''The activity procedure date must be larger than the system date''
    please help me to solve the issue....
    Thanks & Regards
    Shakeel

    Shakeel Ahmed Mohammed
    Please update how you solved so that it will be helpful to others who face similar issue.
    G. Lakshmipathi

  • The determined activity date 03/24/2009 must be later than the system date

    Hello everyone!
    I am creating a contract but this error message appears when I put a validity date: "The determined activity date 03/24/2009 must be later than the system date". Where in IMG can I adjust this? Thank you.

    no one responded.

  • Update Date is older than the Creation Date

    Hi Team,
    In the Oracle Application 11i forms we are seeing the Update Date is older than the Creation Date?
    But the creation date should be older then the updated date.
    Thanks,

    What 11i release are you on?
    Can you please elaborate more on the Creation/Update dates mentioned above? Are you referring to forms or tables or specific rows? Is this happening to all data/forms? Please provide an example for us to understand your issue.
    Thanks,
    Hussein

  • IPhoto library takes more space than the actual data that is in it.

    Why is iPhoto Library taking almost 10 GB more than the real data i have in it ?

    I have the original photos in a folder and it takes 10.7 GB of space in my hard drive, but when I get info from the iPhoto library its taking 17.9 GB of space
    Do you have two copies of the photos on the HD? Why?
    I have read that every single move I do in iPhoto it makes a copy of the file for backup no matter how big the photo is, even if you just rotate the picture,
    When you edit a pic - including Rotation - iPhoto makes a copy of the Original and carries out the edit on that copy and saves it. However, if you then make another edit it does not make a second copy, it simply destroys the first copy and applies the total edits to a new copy. So there is never more than your Original and a single Modified version of your pics.
    that’s just taking so much space I need is there any way to make iPhoto stop doing that?
    No. If you don't want that, simply don't use iPhoto. IPhoto is a Digital Asset Manager and it coheres to the best practices of DAM by treating your original file like a film photographer protects his negative.
    Also when look in the finder and search for every file I have used during the day, if I had just open iPhoto once it will apper a lot of this files called like Album.999001.ipmeta that are from iphot. If I haven used it just opened it why is it showing that ?
    This is just the way that iPhoto works. These ipmeta files are tiny 4kb files. They take up the smallest amount of disk space possible.
    Regards
    TD

  • NetBeans MobilityPack 5 BUG?? how can I send a byte array?

    I�ve created a WebApp and a Simple servlet with one public method.
    public byte[] getStr(byte[] b) {       
    String s = "A string";
    return s.getBytes();
    Then I've used "Mobile To Web App" wizard to generate stubs to that getStr method. And when I�ve tried to call that getStr method:
    byte[] aByte = "st".getBytes();
    byte[] b = client.getStr(aByte);
    I've got an error at Server in Utility.java in generated ReadArray method.
    * Reads an array from the given data source and returns it.
    *@param source The source from which the data is extracted.
    *@return The array from the data source
    *@exception IOException If an error occured while reading the data.
    public static Object readArray(DataInput in) throws IOException {
    short type = in.readShort();
    int length = in.readInt();
    if (length == -1) {
    return null;
    } else {
    switch (type) {
    case BYTE_TYPE: {
    byte[] data = new byte[length];
    in.readFully(data);
    return data;
    default: {
    throw new IllegalArgumentException("Unsupported return type (" + type + ")");
    At this line "in.readFully(data);" I�ve got an EOFException.
    The the aByte = "st".getBytes(); was 2bytes long and at the server "int length = in.readInt();" it was 363273. Why?
    All code was generated by NetBeans Mobility pack 5 it's not mine so its a bug?
    How can I fix this?

    I found that bug. I've described it here
    http://www.netbeans.org/issues/show_bug.cgi?id=74109
    There's a solution how to fix the generated code.

  • LOB segment size is 2 times bigger than the real data

    here's an interesting test:
    1. I created a tablespace called "smallblock" with 2K blocksize
    2. I created a table with a CLOB type field and specified the smallblock tablespace as a storage for the LOB segment:
    SCOTT@andrkydb> create table t1 (i int, b clob) lob (b) store as
    t1_lob (chunk 2K disable storage in row tablespace smallblock);
    3. I insert data into the table, using a bit less than 2K of data for the clob type column:
    SCOTT@andrkydb> begin
    2 for i in 1..1000 loop
    3 insert into t1 values (mod(i,5), rpad('*',2000,'*'));
    4 end loop;
    5 end;
    6 /
    4. Now I can see that I have an average of 2000 bytes for each lob item:
    SCOTT@andrkydb> select avg(dbms_lob.getlength(b)) from t1;
    AVG(DBMS_LOB.GETLENGTH(B))
    2000
    and that all together they take up:
    SCOTT@andrkydb> select sum(dbms_lob.getlength(b)) from t1;
    SUM(DBMS_LOB.GETLENGTH(B))
    2000000
    But when I take a look at how much is the LOB segment actually taking, I get a result, which is being a total mystery to me:
    SCOTT@andrkydb> select bytes from dba_segments where segment_name = 'T1_LOB';
    BYTES
    5242880
    What am I missing? Why is LOB segment is being ~2 times bigger than it is required by the data?
    I am on 10.2.0.3 EE, Solaris 5.10 sparc 64bit.
    Message was edited by:
    Andrei Kübar

    thanks for the link, it is good to know such thing is possible. Although I don't really see how can it help me..
    But you know, you were right regarding the smaller data amounts. I have tested with 1800 bytes of data and in this case it does fit just right.
    But this means that there is 248 bytes wasted (from my, as developer, point of view) per block! But if there is such an overhead, then I must be able to estimate it when designing the data structures. And I don't see anywhere in the docs a single word about such thing.
    Moreover, if you use NCLOB type, then only 990 bytes fits into a single 2K chunk. So the overhead might become really huge when you go over to gigabyte amounts...
    I have a LOB segment for a nclob type field in a production database, which is 5GB large and it contains only 2,2GB of real data. There is no "deleted" rows in it, I know because I have rebuilt it. So this looks like a total waste of disk space... I must say, I'm quite disappointed with this.
    - Andrei

  • Data Encryption : Length of the result data in RAW

    Hello,
    I am pretty new in data encryption, and in 10g, I use package DBMS_CRYPTO.
    I have no problem with that.
    I want to save to encrypted data in a table.
    I think about using RAW columns.
    The origine strings are saved into VARCHAR2(4000).
    How can I roughly compute and figure out the number of RAWs resulting of the encryption? Is there a kind of formula ?
    Is this connected with the length of the encryption key?
    Thanks a lot,
    Olivier

    Hi Murali,
    Thanks for your reply.
    Yes that's why I found it was weird.
    I always have a nice pop up window when click "Data Mart Status of The Request"...
    usually.
    It also didn't happen to all ODS/Cube,
    some of it still shows a nice pop up window,
    for loading using InfoPackage or DTP.
    So it's not a system problem... there's still pop up window.
    However in particular ODS/Cube,
    the symbol is correct - that data has been loaded,
    but there's no Pop Up window.

Maybe you are looking for

  • Stream 8 tablet location does not work on T-mobile broadband

    On my HP Stream 8 tablet, location works fine with GPS only (GNSS on; Mobile Broadband, Wi-Fi, and Bluetooth off). However, if I turn on Mobile Broadband and connect to T-Mobile and turn off GNSS (or GNSS on inside where there is no GPS signal) and k

  • Asp code in Dreamweaver

    How do I make this code work in Dreamweaver? I need help badly. <% ' Declare variables Dim strURL ' The URL of this page Dim cnnSearch ' ADO connection Dim rstSearch ' ADO recordset Dim strSQL ' The SQL Query we build on the fly Dim strSearch ' The t

  • PDFMaker Server could not be loaded

    When I try to create an Acrobat Pro 8 file from within Word, I get an "Acrobat PDFMaker" dialog saying "The Acrobat PDFMaker Server could not be loaded. Do you want to run the installer in repair mode?" Cannot find this error in the KB. I have alread

  • Music randomly stops/starts and Siri activates itself?

    I have an iPhone 5, with an updated iOS and everything. Lately I'll be listening to a song with my iphone sitting on a flat surface and the song will suddenly stop itself or start skipping. Also, sometimes in the middle of the song it will stop and S

  • Transport update rules or ODS

    Hi, Do i need to transport update rules or ODS object first Thanks