Sending the command apdu with an array of bytes as CDATA

Hello
I learn the java card as part of my final year project. So far I think I can do the most basic things, but I stuck a special moment.

I know that there are different manufacturers to create an apdu command object and a number of these manufacturers take an array of bytes as CDATA values.

My problem is, how do I access this data table in the side of the card because apdu.getBuffer () returns an array of integers (bytes)? And what is actually on apdu.getBuffer () [ISO7816. (Instead of OFFSET_CDATA)] when you send the apdu command object using such constuctor?

concerning

Published by: 992194 on 6 March 2013 06:12

992194 wrote:
(..) I should have mentioned earlier that my card use jc 2.2.1 version, and from different places, I've read that this version does not support ExtendedLength facilities.

Indeed.

I also understand the semantics of apdu.getBuffer () [ISO7816. OFFSET_CDATA] is the first byte of the data command. My question is, these command data was initially provided as an array of bytes. Something like this:

+ new CommandAPDU(CLA, INS, P1, P2, DATA_ARRAY, Le) +.

For example, when you call:

ubyte [] buffer = apdu.getBuffer)

So it means that the values of bytes inside the tableau_donnees argument automatically occupy locations + buffer [ISO7816. OFFSET_CDATA] + inside the buffer?

Yes. The length would be (abstract) (buffer [ISO7816. (OFFSET_LC] & 0xFF) . Notice the & 0xFF is a must greater than 127 bytes.

Or there is a mechanism to extract the table tableau_donnees itself?

Laughing out loud

In fact, in the interest of performance and portability in environments with low memory, usual coding style must pass buffer , an offset that and length; rather than take an object, which would require a copy. Welcome to the real world of Java Card.

Tags: Java

Similar Questions

  • Using Firefox 4 and Windows 7. Whenever I have to start Firefox from a shortcut to a Web site, what happens with the following error "there was a problem sending the command to the program". The requested site is loaded after that. without any problem.

    Using Firefox 4 and Windows 7. Whenever I have to start Firefox from a shortcut to a Web site, what happens with the following error "there was a problem sending the command to the program". The requested site is loaded after that. without any problem.

    If a shortcut is used while Firefox is already open the error will not occur.

    For me, the problem was the FoxClock extension. Once I disabled it, the problem was gone.

    Hope this helps.

    Olivier

  • Send the command to laser sensor via a serial port RS232

    Hello

    I have a sensor of moving Laser of OPTEX FA Co., LTD. with a Communication Manual.pdf file attached. I modified the sample base series write and Read.vi of LV to send the command to the probe in order to receive a response. However, LV always returns an error on my VISA Write.

    In short, the structure of command for the sensor must have a form like this

    STX-command command-space-1 2 - ETX

    (more can be see the manual on page 3 or 18 of the .pdf file)

    where

    -STX: code showing the head of transmit data (02 H)

    -Command 1, 2: could be refers to table 1, 2 and 3 of the manual.

    -ETX: code illustrating the completion of data transmission (03H)

    For example, if I want to ask the sensor to send the data from A sensor head, the command must be

    STX-ABLE () A - ETX

    (20H) space is shown as ().

    I tried to send a string HEX (02 - 4 d 454153555245-20-41-03) for this command to the entry VISA, but all I get is ERROR.

    I enclose with this thread my vi and a printscreen of the ERROR.

    A lot a lot of appreciation for any help from any of you.

    I have my LV code can run successfully. He can read the COMMAND and return measurement data. The last time does not playback VISA because I used a cable RS232 to opportunity, and someone operated two pins (2 and 3) for another application.

  • Problem: Acrobat DC: Windows Explorer: right-click right/convert to...: "..." problem sending the command... »

    Is anyone having problems using Windows Explorer to 2015 of TCS in the process of a PDF file?

    I use TC 2015 on a box of Win 7 64 bit with 32 GB of RAM.

    My workflow includes the use of shortcuts in Windows Explorer to create the FM files from PDF files / or "Convert to Adobe PDF" or "convert to Adobe PDF and send".

    Use either of these commands in Windows Explorer results in the error "There was a problem sends the command to the program", "program" being apparently two FrameMaker 2015 and/or DC Acrobat (or Adobe PDF/Adobe Acrobat Distiller DC).

    FrameMaker begins as it should, and the file is loaded as it should, but apparently when FM called Acrobat, it cannot start as it should.

    I am a week off for a critical period of an internal workflow document discussing this exact feature.

    If anyone knows the answer, it would be of GREAT interest to me...

    Thank you!

    (Related screenshot below...)

    ~Image0.png

    I have confirmed (by test test facilities) that this feature is broken. I will record a bug this morning.

  • Using Autodesk Architecture 3.3 and opening a working file, I get the error message error "there was a problem sending the command to the program".

    When using Autodesk Architecture 3.3 and opening a working file, I get the error error message "there was a problem sending the command to the program". What does that mean? At the same time (or nearly the same time) trying to create a pdf from a drawing file is suspended the program autodesk. These two worked before.

    Hello

    The question you posted would be better suited to the Forums from Autodesk. I suggest you post here for better support.

    Here is a link:

    http://forums.Autodesk.com/

  • Error message Windows Live Mail to write links - "there was a problem sending the command to the program".

    I get an error message when I click on a link in Windows Live Mail.  A pop up, said "there was a problem sending the command to the program".

    Post Windows Live questions in the appropriate forum found here:
    http://windowslivehelp.com/

  • Click on the command "open with...". "and now all programs open in this program.

    The command "open with...". ' pop up and I clicked on a random program. Now, all my programs on my computer open in this program. Any suggestions? Thank you!

    The command "open with...". ' pop up and I clicked on a random program. Now, all my programs on my computer open in this program. Any suggestions? Thank you!

    Try if this will help you:
    http://www.Winhelponline.com/articles/165/1/restore-the-exe-file-association-in-Windows-Vista-after-incorrectly-associating-it-with-another-application.html

    If you wish, here is the link to restore the file Association of Type:
    http://www.Vistax64.com/tutorials/233243-default-file-type-associations-restore.html

    t-4-2

  • There was a problem sending the command to the program - excel windows 7 that no shortcut will open - open, if I click Open in the file menu

    There was a problem sending the command to the program - excel windows 7 no shortcut will open - will be opened only if I click Open in the file menu

    See if the answer of "CardSolve" helps.

    There was a problem sending the command to the program by double clicking on a file. :
    http://social.answers.Microsoft.com/forums/en-us/w7programs/thread/8c870808-A108-47cf-8464-9f84427b624a

    Ramesh Srinivasan . The Winhelponline Blog
    Microsoft MVP, Windows desktop experience

  • Is it possible to run the command script with user account administrator rights?

    Is it possible to run the command script with administrator user account rights means please tell me how to...

    I need to run it in windows 7 professional service pack 1.

    There are a few myths that won't go away, for example

    • You can perform administrative tasks when you are working from a command prompt.
    • A script (batch file, VBScript, PowerShell) gives you administrative rights.

    There is no substance to a myth. Your account has administrator privileges, or it does not. There is no backdoor.

  • Cannot send the UDP datagram with device 8320 (V4.2.2.180)

    There is a post says "Cannot send the datagram UDP with JDE 4.5" to

    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&thread.ID=14528&view=by_date...

    In the emulator of JDE4.2 it really works, but he meets the same problem in the blackberry8320 (V4.2.2.180) device, get the same java.io.IOException (detailMessage = null) to the send() operation;

    I looked in the (accessible via wifi) PC with a tool named Sockettool (it can create the client and Server TCP/UDP), it can be connected to the emulator and receive datagrams sent to the emulator, but can not be connected to device.

    Is this a problem related version too?

    Appreciate if you can share your experience with datagram connection to the device.

    Here is my code:

    Emulator: host = "udp://iport1; port2.

    Feature: host = "udp://iport1; port2 /; = wifi interface.

                    try {
                        udp_client = (DatagramConnection) Connector.open(host);
                        byte[] data = {65,66,67,68};
                        int len = data.length;
                        dg_out = udp_client.newDatagram(data, data.length);
                        udp_client.send(dg_out);
                        udp_client.close();
                }catch (Exception e) {
                        System.out.println("UDP Exception:"+e.getMessage());
                    }
    

    If the application is able to send and receive UDP traffic in the BlackBerry Simulator, but not on a BlackBerry real pocket computer the first thing to check is to check that your carrier supports.  Several carriers do not support UDP traffic or restrict to specific ports or data types.  This can cause exceptions or make it appear that the application will silently fail (carrier is just dropping packets).

  • I can't do the command 'Open with' right click - in windows 7

    I can't do the command 'Open with' right click - in windows 7.

    It applies to all files, whenever I want to 'open with' a program there is a line that stood saying
    "This file doesn't have a program associated with it for performing this action. "Please install a program or... -" and so on
    This applies to all of the files from my laptop every time I tried a file "open with." Is it possible to fix it? I really want to look at the issue, because these things make me really frustrated.
    Please help me, thanks.

    The REG fix available in this article should solve the problem.,.

    'Open with' or the option "choose program...". ', hence the error:
    http://WindowsXP.MVPs.org/openas.htm
    [For PC Windows 7, download and run openas_win7.reg and run it.]
  • PS_Exec (P): Error of the command batch with reason: no such file or directory (2)

    We have symantec pgp installed in our system and trying to decrypt a file through the app engine.

    our process procedure.

    1 FTP the source files.

    2. search files

    3. use pgp to decrypt the file by file

    trying to decipher runs aground and always gives following error

    PS_Exec (P): Error of the command batch with reason: no such file or directory (2)

    When I run the same command using the command line it goes thru very well.

    running order: decrypt pgp - q - passphrase "xxxxxxxxxxxxxxxxxxxx exit»--/data/staging/bank_statements/Reconciliation_files/BAI2_20150618155803.bai.asc--/data/staging/bank_statements/Reconciliation_files/BAI2_20150618155803.bai.

    any help is really appreciated

    Hi all

    I finally understood what happened. The installation of PGP directory is located in/usr/local /. So we moved the installation from this location PS_HOME location and he started to work very well.

    so our installation location current symantec pgp is pgp/PS_HOME /.

    Another point to note was if we are trying to encrypt or decrypt using PeopleSoft PSExec() and these files are under/usr directory structure order Symantec PGP fails to do. the same command works fine through command line, but not through PSExec(). Indeed, the user has full access, but even he couldn't do anything. . But if we use our own custom directories the file gets encrypted and decrypted as you wish.

    Hope these little things help.

  • Send the POST request with BLOB content

    Hello

    I usually use the following structure to send the POST request with content of varchar2 and numbers

          content := '{"Original File Name":"'||V_HOMEBANNER_1_EN_NAME(indx)||'"}';
         url := 'https://api.appery.io/rest/1/db/Names'; 
          req     := utl_http.begin_request(url, 'POST',' HTTP/1.1');
          UTL_HTTP.set_header(req, 'X-Appery-Database-Id', '5f2dac54b02cc6402dbe');
          utl_http.set_header(req, 'content-type', 'application/json');
          UTL_HTTP.set_header(req, 'X-Appery-Session-Token', sessionToken);
          utl_http.set_header(req, 'Content-Length', LENGTH(content));
          utl_http.write_text(req, content);
          res := utl_http.get_response(req);
    
    
    BEGIN
      LOOP
        utl_http.read_line(res, buffer);
      END LOOP;
      utl_http.end_response(res);
    EXCEPTION
    WHEN utl_http.end_of_body THEN
      utl_http.end_response(res);
    END;
    

    And it works very well. However, now I want to send/download (jpg image) files a blob in a MongoDB collection called "Files" (so url: = ttps://api.appery.io/rest/1/db/files). The guide of the collection is the next loop as a general advice:

    curl -X POST \
      -H "X-Appery-Database-Id: 5f2dac54b02cc6402dbe" \
      -H "X-Appery-Session-Token: <session_token>" \
      -H "Content-Type: <content_type>" \
      --data-binary '<file_content>' \
      https://api.appery.io/rest/1/db/files/<file_name>
    

    But I couldn't translate this curvature in PL/SQL query. Specifically, the part (-given binary '< file_content >")

    I have these BLOB files in an Oracle table, and they are stored with their names as follows:

    File_name File_content
    PIC_1.jpgBLOB OBJECT
    PIC_2.jpgBLOB OBJECT
    PIC_3.jpgBLOB OBJECT

    My question, how to download these images in the target URL?

    After a few hours I spent on it, I got it working. My solutions is inspired by this http://blog.optiosys.com/?p=246

    Since you must send you no the (same) CLOB and BLOB files, you need just need to replace .write_text by .write_raw.

    Here is my part of work for your reference:

    content: = V_HOMEBANNER_1_EN (indx);    -blob

    file_name: = 'test.jpg ';

    URL: = "https://api.appery.io/rest/1/db/files/": file_name;

    Req: = utl_http.begin_request (url, 'POST', ' HTTP/1.1');

    Utl_http.set_header (req, 'X-Appery-database - Id', '53fae4b02cc4021dbe');

    Utl_http.set_header (req, 'X-Appery-Session-token', sessionToken);

    Utl_http.set_header (req, "content-type', ' image/jpeg");

    req_length: = DBMS_LOB.getlength (CONTENT);

    DBMS_OUTPUT. Put_line (req_length);

    -IF YOU LIMIT THE DATA UNDER 32KB MSG:

    IF req_length<=>

    THEN

    Start

    Utl_http.set_header (req, "Content-Length", req_length);

    Utl_http.write_raw (req, content);

    exception

    while others then

    DBMS_OUTPUT. Put_line (SQLERRM);

    end;

    -IF MSG DATA MORE THAN 32 KB

    ELSIF req_length > 32767

    THEN

    BEGIN

    DBMS_OUTPUT. Put_line (req_length);

    Utl_http.set_header (req, "Transfer-Encoding", "Chunked");

    While (offset<>

    LOOP

    DBMS_LOB. Read (content, amount, offset, buffer);

    Utl_http.write_raw (req, buffer);

    offset: = offset + amount;

    END LOOP;

    exception

    while others then

    DBMS_OUTPUT. Put_line (SQLERRM);

    end;

    END IF;

    l_http_response: = UTL_HTTP.get_response (req);

    Utl_http.READ_TEXT (l_http_response, response_body, 32767);

    Utl_http.end_response (l_http_response);

    I hope this helps. Good luck

  • PMC-GPIB with NOR-488 DDK very slow when sending the commands-GPIB

    Hello

    I use a PMC-GPIB Board and the NOR-488DDK allows to develop a GPIB Interface with VxWorks. Already, it works correctly, but sending a GPIB command takes about 100 ms, which is very slow.

    Are there opportunities to speed up data transfer?

    Hello again,

    I found a solution to my problem! I realized that the command execution is related to the vxWorks system clock! Of course, this is done in the DDK (driver development kit).

    The system clock is easily adjustable upper and then orders are shipped quickly.

    Thanks for your time

    Good day

    Cassidian

  • Problem: Using the command 'msg' with 'system Exec.vi.

    I try to write to the LabView code that takes advantage of the 'Exec.vi System '. For the moment, I have tried to use it to ping machines, return the command ipconfig and run through the code example that provides NEITHER.

    I would use the "msg" command used on Windows operating systems to send a message to several machines on our network at a time. Warning that we're about to update a program and that they should disconnect, things like that.

    I tried to use the command 'msg' LabView maintains return errors. I also wrote a quick command as follows file:

    @echo we
    CD c:\Windows\System32\
    Msg.exe /server:localhost * test

    When I run the batch of windows, it runs. When I launch from LabView (using the Exec.vi system), it fails.

    Potential quirks:

    I discovered in a different place under a machine to receive these messages they need to have a registry entry:

    "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" and have a DWord value called "AllowRemoteRPC' = 1.

    Note that "/ Server: localhost" might be "/ server: anycomputer" and the "*" is used as a wildcard character that sends a message to anyone who is connected to this computer. Also note that the 'test' is the message to send.

    Any ideas why I'm having a problem?

    TL; Dr.: "System Exec.vi" does not have the command "msg". Why is this?


Maybe you are looking for