Announce two new product: SmartCard Reader Rockey200 and USB2.0 Extension Cable

ROCKEY 200 is a handy and portable USB Smart Card reader that can perform read/write operations on any ISO 7816-1/2/3/4 smart cards which are compatible with protocol T=0 and T=1.

USB2.0 Extension Cable With high speed USB 2.0 devices such as USB token ,USB Card Reader and so on.

Come to try it now!

Some APDU commands in OpenPGPApplet

This project implement the OpenPGP card functionality

Moderator: Ellisun

User avatar
Ellisun
Posts: 45
Joined: Wed May 20, 2015 3:47 am
Points: 396
Contact:

Some APDU commands in OpenPGPApplet

Postby Ellisun » Sat Nov 28, 2015 6:06 am

The following APDU commands is the result of my learning applet, it's contains:
1. All the types of RSA signature data length, it can be any length.
2. Generate three types of Key Pair
3. Encrpt and Decrypt commands

Code: Select all

//select
00A4040010D276000124010200000600000001000000;


//verify pw3
00200083083132333435363738;
//Generate sig_key Key Pair
0047800001b6;
//Get remain data
//00C000000F;

//verify pw1
0020008106313233343536;
//Compute Signature
002a9e9a051122334455;
00C0000001;

//verify pw1
0020008106313233343536;
//Compute Signature
002a9e9a10000102030405060708090A0B0C0D0E0F;
00C0000001;

//verify pw1
0020008106313233343536;
//Compute Signature
002a9e9aF50102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5;
00C0000001;

//verify pw1
0020008106313233343536;
//Compute Signature
002a9e9a0101;
00C0000001;

//verify pw1
0020008106313233343536;
//Compute Signature
002a9e9aF50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001;
00C0000001;

//verify pw1
0020008206313233343536;
//GENERATE auth_key Key Pair
0047800001a4;
00C000000F;

//encrpt
8088000006112233445566;
00C00001;

//Generate dec_key Key Pair
0047800001b8;
00C000000F;

//decrypt
102A8186 + lc + encrypted data part1;
102A8086 + lc + encrypted data part2;
802A808600;

//Put Data 80DATag+Lc+data
80DA7F2106010203040506;

//Get data. 80CA + Tag +00
80CA7F2100;


whitexiao
Posts: 16
Joined: Wed Sep 09, 2015 8:45 am
Points: 80
Contact:

Re: Some APDU commands in OpenPGPApplet

Postby whitexiao » Wed Dec 02, 2015 8:57 am

I used this commands in my script, when I sent the "102A8186..." to decrypt data, it always returned 0x6F00. Why this happened?

User avatar
UNKNwYSHSA
Posts: 628
Joined: Thu May 21, 2015 4:05 am
Points: 2979
Contact:

Re: Some APDU commands in OpenPGPApplet

Postby UNKNwYSHSA » Wed Dec 02, 2015 11:39 pm

Where's the data of command DECRYPT DATA from?
You should understand the process flow:
1 The OpenPGP Applet generate dec_key pair, output the public key, save the private key in the card;
2 The client application encrypt data with the public key.
3 The he card decrypt the encrypted data using the private key.
sense and simplicity

whitexiao
Posts: 16
Joined: Wed Sep 09, 2015 8:45 am
Points: 80
Contact:

Re: Some APDU commands in OpenPGPApplet

Postby whitexiao » Fri Dec 04, 2015 5:48 am

UNKNwYSHSA wrote:Where's the data of command DECRYPT DATA from?
You should understand the process flow:
1 The OpenPGP Applet generate dec_key pair, output the public key, save the private key in the card;
2 The client application encrypt data with the public key.
3 The he card decrypt the encrypted data using the private key.


That is say, I will generate dec_key pair, and get the public key, then I encrypt a data outside card and decrypt this data inside card?

User avatar
UNKNwYSHSA
Posts: 628
Joined: Thu May 21, 2015 4:05 am
Points: 2979
Contact:

Re: Some APDU commands in OpenPGPApplet

Postby UNKNwYSHSA » Fri Dec 04, 2015 11:06 pm

Yes.

If i send one mail to you, i encrypt the mail using the public key. you can decrypt the mail with the card (contains private key).
sense and simplicity

whitexiao
Posts: 16
Joined: Wed Sep 09, 2015 8:45 am
Points: 80
Contact:

Re: Some APDU commands in OpenPGPApplet

Postby whitexiao » Fri Dec 04, 2015 11:19 pm

UNKNwYSHSA wrote:Yes.

If i send one mail to you, i encrypt the mail using the public key. you can decrypt the mail with the card (contains private key).


I know, but where I can find a tool to encrypt datas. Can you please give me a tool? :D

Regist
Posts: 9
Joined: Wed Aug 12, 2015 6:22 am
Points: 14
Contact:

Re: Some APDU commands in OpenPGPApplet

Postby Regist » Sat Dec 05, 2015 1:56 am

I also need such a tool, can you give me an algorithm tool too?

User avatar
UNKNwYSHSA
Posts: 628
Joined: Thu May 21, 2015 4:05 am
Points: 2979
Contact:

Re: Some APDU commands in OpenPGPApplet

Postby UNKNwYSHSA » Tue Dec 08, 2015 5:59 am

Here is a opensource application PortablePGP, maybe fit your needs: http://sourceforge.net/projects/ppgp/
The following is the main frame of this application:
PortablePGP1.png

PortablePGP2.png

PortablePGP3.png
You do not have the required permissions to view the files attached to this post. Please login first.
sense and simplicity


Return to “OpenPGPApplet”

Who is online

Users browsing this forum: No registered users and 2 guests

JavaCard OS : Disclaimer