javacard - Test RSA Keys For EMV card -
as per emv standard require 2 rsa keys.
1) issuer rsa keys ( use 1408 bit)
2) icc rsa keys ( use 1152 bit)
here issuer rsa private keys use calculate icc public key certificate. emv card contain various tag 8f
, 90
(issuer public key certificate) 9f46
(icc public key certificate) etc use in sda/dda.
actually want personalize emv card using java language , want handle calculation own. require rsa keys ( sda/dda need rsa stuff)
also emv have dgi8201-8205
that contain icc rsa private key in crt format.
i know complex way understand emv technology in deep. body tell me how can rsa keys can solve purpose , can use in emv calculation. in advance.
how can rsa keys
you can generate own rsa crt keys testing purpose. wrote following code snippet generate rsa crt 1408 bit. note, interfaces , classes used found in java.security.*
public static string bytetohex(byte[] data){ string r = ""; for(int i=0;i<data.length;i++){ r+=integer.tostring( (data[i] & 0xff) + 0x100,16).substring(1); } return r; } public static void main(string[] args) throws nosuchalgorithmexception { keypairgenerator keygen = keypairgenerator.getinstance("rsa"); keygen.initialize(1408); keypair keypair = keygen.generatekeypair(); rsapublickey publickey = (rsapublickey ) keypair.getpublic(); rsaprivatecrtkey privatekey = (rsaprivatecrtkey) keypair.getprivate(); system.out.println("public modulus: "+ bytetohex(publickey.getmodulus().tobytearray())); system.out.println("public exponent: "+bytetohex(publickey.getpublicexponent().tobytearray())); system.out.println("private modulus: "+bytetohex(privatekey.getmodulus().tobytearray())); system.out.println("private private exponent: "+bytetohex(privatekey.getprivateexponent().tobytearray())); system.out.println("private prime exponent dp : "+bytetohex(privatekey.getprimeexponentp().tobytearray())); // d mod (p-1) system.out.println("private prime exponent dq: "+bytetohex(privatekey.getprimeexponentq().tobytearray())); // d mod (q-1) system.out.println("private prime p: "+bytetohex(privatekey.getprimep().tobytearray())); // p system.out.println("private prime q: "+bytetohex(privatekey.getprimeq().tobytearray())); // q system.out.println("private coefficient pq : "+bytetohex(privatekey.getcrtcoefficient().tobytearray())); // pq }
and generated key components like:
public modulus: 0095c606a1ca4c5e97afa469c29d0bba478ed9d44f736877ab370a003409a1f04598de1638a394d56e296cd8e52ca37883fd43faa6af299c63180068070ee2f5dbb898d65cc76d0f07a5f2ae6c2b703b069ae5edd4b8c07f2cf642f7f687b5da40a0e877bc5e34c6e0a7fcfbd5f0be1504c03eb0e9b6b3893b4f502e495a56d2e5bce8f28bc2d520aac69af021c1646e285ce226a138e8775164f870856b3f327efaeecf77fa67e520fe37aa053e3a7145 public exponent: 010001 private modulus: 0095c606a1ca4c5e97afa469c29d0bba478ed9d44f736877ab370a003409a1f04598de1638a394d56e296cd8e52ca37883fd43faa6af299c63180068070ee2f5dbb898d65cc76d0f07a5f2ae6c2b703b069ae5edd4b8c07f2cf642f7f687b5da40a0e877bc5e34c6e0a7fcfbd5f0be1504c03eb0e9b6b3893b4f502e495a56d2e5bce8f28bc2d520aac69af021c1646e285ce226a138e8775164f870856b3f327efaeecf77fa67e520fe37aa053e3a7145 private private exponent: 455cab4f9c4f97f329bdbbd90c401529f4a73ee2f8b0a5d31e2f3c7edd0329322224a027e4e215a1e9ff65c764cfe40d446a8a174dc1b8924fd848551478d9a1c330ccfdb4c1f616f5ac9948b1294dbcb659cbb61b45d2df363499320ce43c04c038b3988f062fcc1d6d3dfcc7a6ff6ad160ace5c8f14662c9f8cc69f790463d65e20cfffea2a3ecd0626b207acad31b25d46688d3facd157285847e08511e8127dc4bdea9ffc1c3b57f1e8be04f9275 private prime exponent dp : 00d634ed8f011db920750a594d23b6066a2181ae8378d5f90b4e701b634f9378c1215015c875b7e852118ed92433772b01f6d315813d45de63edd9f8acee4d819f320e7b50c819160621450a673ea7b61678d1b50a2a13059f private prime exponent dq: 1e6bf49a032f5168cfb5817f51f6dac5613bd769c56b96008ca3b1f2e62824efcefd1cfc827c08efd42190db0de54d12b2296b67f71dfc24e9d58927ad61ff3b5492225a84d35188a38f32a9aea0287fe597af3d76540e49 private prime p: 00f88b11b520fc307cdddc8f0526172b7d0d25bffb3f46005bfc686101ebea8df24b657abe2118c74968e3106f39ef1b080d9eb134efcaf85a603ae9e8b0a9d5dc8bee0ee3d1de88a57b432080afd99657cdf6bc3a35962fcb private prime q: 009a445bb5fe1ff143eca24abb8852a76c3b4a40ec5dead5602948f1f2b0e8365a3e885bc886dd48e4219f46d898c465936fb8536144a7674c1a31f9c3c11f63623e8b1c60ce4746d53c737c55479555f7e16871e135aba12f private coefficient pq : 00b21001cee21e109dfd63dc39c7315bbf45faa835c22c9d0cd1d109c9843fc00285adc7f6bc0cf66e855c2e7155d104858845b9ab5c5ce8db95c65dd566e41ef938d5c594de5af8fda13a32e82162d4b730a453625c2d7783
edit: can create own key generation spec, example:
rsakeygenparameterspec keygenparameterspec = new rsakeygenparameterspec(1408, rsakeygenparameterspec.f0); keypairgenerator keygen = keypairgenerator.getinstance("rsa"); keygen.initialize(keygenparameterspec); //.... rest of code same posted above
and time get:
public exponent: 03
Comments
Post a Comment