Try to get a sample of authentication applet works.

package GenSignVerify;

Javacard.framework import. *;

Javacard.security import. *;

/**

*/

SerializableAttribute public class GenSignVerify extends Applet {}

/**

* Only installation method of this class should create the object of the cmdlet.

*/

public GenSignVerify() {}

Register();

}

/**

* Install this applet.

*

@param Baker

* the table that contains the installation settings

@param bOffset

* starting in Baker offset

@param bLength

lengthwise in bytes of the data parameter Baker

*/

{} Public Shared Sub install (byte [] Baker, short bOffset, bLength bytes)

GP-compatible recording of JavaCard applet

new GenSignVerify();

}

/**

* Treats an incoming APDU.

*

* @see APDU

@param apdu

Incoming APDU

* @exception ISOException

* with the bytes of response according to ISO 7816-4

*/

{} public void process (APDU apdu)

Byte [] buf = apdu.getBuffer ();

Byte [] testSig = new byte [256];

Byte [] test = new byte [] {0x01, 0x02, 0x03, 0x04};

Key of the key pair = null;

SIG Signature;

/*

check the command SELECT UDPA

If ((buf [ISO7816. OFFSET_CLA] == 0) & &

(buf [ISO7816. OFFSET_INS] = (byte) (0xA4))) {}

return;

}*/

If (selectingApplet ())

{

return;

}

apdu.setIncomingAndReceive ();

switch (buf [ISO7816. {} OFFSET_INS])

case (byte) 0 x 01:

if(Keys == null)

{

keys = new pair of keys (KeyPair.ALG_RSA_CRT, KeyBuilder.LENGTH_AES_256);

keys.genKeyPair ();

}

INITIALIZE THE SIGNATURE AND SIGN

GIS = Signature.getInstance (Signature.ALG_RSA_SHA_PKCS1, false);

SIG.init (Keys.getPrivate (), Signature.MODE_SIGN);

short Len = sig.sign (test, (short) 0, (short) test.length, testSig, 0 (short));

VERIFY THE SIGNATURE

SIG.init (Keys.getPublic (), signature. MODE_VERIFY);

GIS. Verify (testing, (short) 0, (short) test.length, testSig, (byte) 0, len);

apdu.setOutgoing ();

apdu.setOutgoingLength (len);

apdu.sendBytesLong (testSig, (short) 0, len);

break;

0xCA, case (byte):

break;

by default:

good practice: If you don't know the statement, say:

ISOException.throwIt (ISO7816.SW_INS_NOT_SUPPORTED);

}

}

}

and this is the .scr file

Test script for the Applet "GenSignVerify".

power-up;

Select GenSignVerify //aid/19550633C5/99

0 x 00 0xa4 0x04 0x00 X 06 X 19 0 0 0 X 0 X 06 55 0 X 33 0XC5 0X9A 0x7F;

Send the APDU with chain J C 3

0 x 80 0xCA 0x00 0x00 0 x 03 0x4A 0x43 0 x 33 0x7F;

Must return SW1:6 D, SW2:00-> statement not supported since INS = D2

0 x 80 0xD2 0x00 0x00 0 x 03 0x4B 0x4D 0 x 33 0x7F;

To enter the key of the case and gen, sign and verify data

0x00 0x01 0x00 0x00 0 x 00 0x7F;

powerdown;

When I build and run this is my output:

Received ATR = 0x3b 0xf0 0x11 0 x 00-0xff 0x00

CLA: 00, INS: a4, P1: 04, P2: Lc, 00:06, 19, 55, 06, 33, c5, 9A, the: 00, SW1: 90, SW2: 00

CLA: 80, INS: ca, P1: 00, P2: Lc, 00:03, 4, 43, 33, the: 00, SW1: 90, SW2: 00

CLA: 80, INS: d2, P1: 00, P2: Lc, 00:03, 4B, 4 d, the 33,: 00, SW1: 6 d, SW2: 00

CLA: 80, INS: P1 01: 00, P2: LK, 00:01:45, the: 00, SW1: 6f, SW2: 00

run:

BUILD successful (total time: 6 seconds)

The last line is where is my mistake. 6F00 indicates that there is no specific diagnosis. I don't know where I went wrong in my code. Any help or advice would be appreciated. Thank you!

According to this - https://forums.oracle.com/message/10589893 , you should use KeyBuilder.LENGTH_RSA_512 when you use a Java Card sim card. So now the correct code is:

package GenSignVerify;

Javacard.framework import. *;

Javacard.security import. *;

/**

*

Raja * @author

*/

SerializableAttribute public class GenSignVerify extends Applet {}

private key pair key = null;

SIG Signature private;

Byte [] testSig = new byte [256];

Byte [] test = {0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};

Check Byte [] = {0x00};

public GenSignVerify() {}

CREATE THE SIGNATURE OBJECT

GIS = Signature.getInstance (Signature.ALG_RSA_SHA_PKCS1, false);

}

{} Public Shared Sub install (byte [] Baker, short bOffset, bLength bytes)

GP-compatible recording of JavaCard applet

new GenSignVerify () .register (Baker, (short) (bOffset + 1), Baker [bOffset]);

}

{} public void process (APDU apdu)

value Boolean = false;

GOOD PRACTICE: BACK 9000 ON SELECT

If (selectingApplet()) {}

return;

}

Byte [] buf = apdu.getBuffer ();

switch (buf [ISO7816. {} OFFSET_INS])

case (byte) 0 x 01:

If (key == null) {}

try {}

CREATE THE RSA KEY PAIR

keys = new pair of keys (KeyPair.ALG_RSA, KeyBuilder.LENGTH_RSA_512);

}

{} catch (EC CryptoException)

short-reason = ce.getReason ();

}

START THE PROCESS OF GENERATION OF CARD KEYS

keys.genKeyPair ();

}

INITIALIZE WITH THE PRIVATE KEY

SIG.init (Keys.getPrivate (), Signature.MODE_SIGN);

BUFFER INCOMING SIGN

short Len = sig.sign (test, (short) 0, (short) test.length, testSig, 0 (short));

INIT WITH PUBLIC KEY

SIG.init (Keys.getPublic (), Signature.MODE_VERIFY);

VERIFY THE SIGNATURE

value = sig.verify (test, (short) 0, (short) test.length, testSig, (byte) 0, len);

IF AUDITED CORRECTLY, RETURNS 1, OTHERWISE RETURN 0

If {(value)

Check [0] = (byte) 0 x 01;

}

apdu.setOutgoing ();

apdu.setOutgoingLength ((short) verify.length);

apdu.sendBytesLong (check, (short) 0, (short) verify.length);

break;

0xCA, case (byte):

break;

by default:

good practice: If you don't know the statement, say:

ISOException.throwIt (ISO7816.SW_INS_NOT_SUPPORTED);

}

}

}

With the same script APDU, I get the following result:

Received ATR = 0x3b 0xf0 0x11 0 x 00-0xff 0x00

CLA: 00, INS: a4, P1: 04, P2: Lc, 00:06, 19, 55, 06, 33, c5, d0, the: 00, SW1: 90, SW2: 00

CLA: 80, INS: ca, P1: 00, P2: Lc, 00:03, 4, 43, 33, the: 00, SW1: 90, SW2: 00

CLA: 80, INS: d2, P1: 00, P2: Lc, 00:03, 4B, 4 d, the 33,: 00, SW1: 6 d, SW2: 00

CLA: 00, INS: P1 01: 00, P2: Lc, 00:00, the: 01, 01, SW1: 90, SW2: 00

Hope that helps someone who is stuck...

Tags: Java

Similar Questions

  • Try to get a USB capture card to work

    I just bought a certain T610 more units. I try to get a Hauppauge USB Live-2 capture card to work. I get a driver has not loaded or corrupt the question. I tried this USB on a PC and it works fine. The system is 6.1.7601.286 English. I had a problem earlier with adding users after joining a domain, but found the question. I think it's a problem of permission in system32, but can't seem to find it.  Any help would be great.

    Lou

    Without worrying if PCI or USB, the OS for TV Tuner compatible components is not present in the image.

    Custom images are available after sales and pre-sales.

  • Try to get the Photoshop 8.0 disc working in another PC, after the failure of the motherboard...

    I need help - my motherboard failed in PCno1 and I removed the hard drive and inserted in another PC and have it running with the old drive as a second drive - and it is this second disc which contains the Photoshop.

    I can't find the disks to reinstall photoshop so need to know how to get this working.

    When I try to open photoshop, I see the boot logo, but the I get an error message saying "cannot take place because of missing or incomplete data" which I guess is linked to the license?

    If anyone can help?

    My wife has this urgent need for a presentation of the competition!

    Thank you very much

    Murray

    I found the answer myself finally that CS2 is the equivalent of PS8.0 and is now available for free download on the adobe site.

    I lost a day whole, but grateful to have found the solution...

  • Try to get the HD-DVD player to work on the Satellite P100-463

    Hello world.
    I bought this baby the weekend and since I am struggeling trying to get HD-DVDs to work on it. I added the HD_DVD xbox 360 drive, but Power DVD Software Advisor continues to say that the graphic card 9Geforce Go 7900) drivers must be updated to read HD-DVD content. Now, there is no available such as newer driver installed (84.0?)

    Can someone please advise if the card supports protection hdcp anyway? Maybe my problem is another source.
    Thanks for the tips.

    Wait do you use player designed for the Xbox in the Satellite P100?
    Hmm, I m surprised that this device is compatible with the Toshiba laptop.
    Anyway, as far as I know you need a special DVD player to play and watch HD-DVD on the laptop.
    A simple WinDVD does not support the new HD-DVD.

    By the way: I know a Toshiba model that shipped with the HD_DVD drive.
    It was a Qosmio G30 DVD HD model.
    I found a new Nvidia GeForce Go7600 8.3.2.7 Version graphics card driver update in the download section of driver on the Toshiba site
    But I put t know if it s compatible with your card...

  • Try to get a new graphics card to work...

    I have a GeForce GT of 640 that I try to install in my office p7-1414.  Problem is it seems to have some sort of conflict with the integrated graphics card, as when it is installed in the slot of PCIx16, NONE of the screens will be exploited.

    It doesn't seem to be a way to disable the onboard graphics via the BIOS (AMI Bios 8.04), and I know that the card works as it still works with the office, that I recently tried to replace.

    Any help on this would be greatly appreciated.

    Here are the specifications of your desktop HP Pavilion p7-1414. According to specifications, your system comes from the factory with a 300 Watt power supply. Review the specifications for graphics cards of TG 640 indicates they generally recommend a minimum of 350 watts system power supply. Although this is not the only problem, it's a start. There is no option in the BIOS to disable the onboard graphics on board, as this is done automatically when a PCIe x 16 card into the PCIe x 16 slot.

  • try to get the HP SCANJET 5100C to WORK WITH WINDOWS 7. _ No. DRIVER UPDATE OF HEWLERD PACKARD

    I HAVE WINDOWS 7 AND AM LOOKING FOR A DRIVER, OR WORK AROUND FOR HP SCANJET 5100C SCANNER.

    NO DRIVER TO DATE OF H.P.

    The HP page says that XP drivers. Then you can try to use XP Mode, if you use Windows 7 teacher or company or buy a Windows 7 compatible scanner. "A programmer is just a tool that converts the caffeine in code" Deputy CLIP - http://www.winvistaside.de/

  • Try to get a wireless remote control to work with Flash presentation... Help!

    I know almost nothing about Flash or Powerpoint.  They gave me a Flash presentation that I need I want to show at meetings using my wireless remote control, but I can't seem to move forward and backward between slides (works very well using the arrow keys on the keyboard to laptop - Windows XP Pro).  The remote works fine with Powerpoint presentations, so I don't know the remote is ok.  Is there some setting/order I have to run my Flash presentation with my remote, or do I need a special remote control?  I have already spoken to the remote support (Keyspan/TrippLite) and they were totally unknown wirh Flash and said simply that their device works with Powerpoint, as announced, which was true, but they could not help me with Flash presentations.  There, can someone help me?  Thank you very much!

    Thanks a lot for all the help.  I see a lot of situations where I can use the functions available through the use of SharpKeys2 key mapping, as well as a few other programs I 'discovered' during my travels recent (KeyTweak + AutoHotKey).  Even better for my situation here, I just got a more advanced model Keyspan remote (PR-Pro3) what Flash handles submissions very well - I have no idea why - and nor their tech support, apparently.  Anyway, the PR - EZ1 will come back to Newegg and I'm fortunately wireless practice of my script for my Flash presentation - working remote in hand!  Take care.

  • When I try to buy a book, it seems it download but does not work. If I am able to get a sample and try to buy the sample goes far & no new book. There are funds in my account iTunes Help!

    When I try to buy a book, it seems it download but does not work. If I am able to get a sample & try to buy the sample goes far & no new book. There are funds in my account iTunes Help!

    Mine just did the same thing. I've even went and was sold again in case I did something wrong the first time. Still no book! I had to happen a few weeks ago, but when I closed iBooks and reopened, the book was there. This time that didn't happen.  I prefer to read on the iBook, but I'm not if my books download

  • I downloaded the free app Adobe Content Viewer, but when I try to connect, I get an error message "authentication failure". What should I do to fix?

    I downloaded the free app Adobe Content Viewer, but when I try to connect, I get an error message "authentication failure". What should I do to fix this?

    Did you go digitalpublishing.acrobat.com, connect with the Adobe ID and accept the terms of use? If this is not the case, do using a computer. You can't do this from a mobile device. This is not an automatic process, you must do it manually.

  • I get the message "Could not authenticate you" when I try to get the portfolio management

    Original title: portfolio in MSN Money management.

    I get the message "Could not authenticate you" when I try to get the portfolio management and when I try again, the same message is repeated.  What type of authentication is necessary?

    Hello

    I recommend you contact the support team of MSN Money for assistance on this issue.

    http://social.Microsoft.com/forums/en-HK/money/threads

    See also Solution Center-silver

  • During the installation of adobe in Win 7 products I get this error: "certificate authentication failed.

    Windows 7 Edition using Home Premium.  Had Adobe Reader and Flash work and then had problems to update.  Uninstalled all Adobe products and now cannot re - install.  I get the error "certificate authentication failed.  Other proposed help sites enter gpedit.msc but it is not installed on my machine (not available with Win 7 Home Premium, I understand, $220 upgrade to Ultimate... :-(

    Hello

    Step 1: Run the fixit to solve the problems of the uninstalling and reinstalling:

    Solve problems with programs that cannot be installed or uninstalled

    http://support.Microsoft.com/mats/Program_Install_and_Uninstall

    Step 2: I suggest to try a clean boot and install.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

    Note: After installing windows update, follow step 7 in the link provided to return the computer to a Normal startup mode

    To further support contact Adobe support to improve assistance to this topic:

    http://forums.Adobe.com/community/webplayers/flash_player

    http://www.Adobe.com/support/Flash/

    The video problems with Internet Explorer

    http://support.Microsoft.com/kb/2532294

    It will be useful.

  • YouTube said that there is a message titled "authorization" when I try to get onto the site with Firefox. Can I fix?

    When I try to get on YouTube, the site is completely white with the words "Authorization error" in the upper left corner. For a while, all I had to do was charge YouTube and it was fine. Now it won't work at all. I have Internet Explorer on my computer as well and YouTube works fine there. When this error occurs, the icon in the bar of Exchange address back to the old icon of YouTube.

    I tried:
    -Updated Firefox
    -Restart the computer
    -Closing and reopening of Firefox
    -Type https rather than http before the address
    -Google search and clicking the Google link on the site (Yes, a feeble attempt, I know)

    Anyone know what I can do to put YouTube on my favorite browser? I would like to stop having to run in Internet Explorer using this site.

    Thank you!

    I found what was wrong. Internet security blocked it without letting me know. Thanks for the help =)

  • Try to get Inkscape and said I need xQuartz. I have OS El Capitan. It is already on my computer or I have to download it and is it safe to do?

    Try to get Inkscape and said I need xQuartz. I have OS El Capitan. It is already on my computer or I have to download it and is it safe to do?

    Hello Alice,.

    Here is the link for XQuartz: http://www.xquartz.org/

  • I try to get built-in microphone working on Satellite C850

    Dear Forum

    I try to get the built-in microphone works on my C850.

    Nothing is saved if I use the sound recorder utility.

    In the recording tab listed only one microphone is a Realtek High definition Audio which is defined as the device by default, is enabled and mute is off.

    If it were a microphone internal?

    Any suggestions will be greatly appreciated.

    The internal mic belongs to the internal webcam.
    Have you tried to record short videos including sound using the internal webcam and webcam software?

  • I can't access firefox, everytime I try I get that windows does not find the file, I tried it redownloading but he still gave me the same message?

    I can't access firefox, everytime I try I get that windows does not find the file, I tried to download again, but he still gave me the same message. the problem has nothing to do with my internet because it freaks on the internet explore and everythign is fine, just my computer can not access firefox for some reason any. I tried uninstallign it and then install again, but that did not work, I tried to install a different version and it still doesn't work.

    yesterday

    User Agent

    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; MSDigitalLocker; FunWebProducts; GTB6; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 1.1.4322; OfficeLiveConnector.1.3; OfficeLivePatch.0.0 .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

    I'm sorry, but you have not answered my questions.

    (1) on the last stage Setup lets you start Firefox, if you keep all of the checkbox "Launch Firefox now", turns on Firefox when you click on "Finish"?

    (2) how did you launch Firefox when you receive the error message? How do you 'by clicking on the freshly installed target Firefox.exe?

    (3) what is the exact error message? (Post a screenshot if you cannot re-type precisely). Text you have posted it lacks an ending quotation mark and does not resemble any message I know.

Maybe you are looking for