├── OpenPGP ├── delete_pgp_cap.bat ├── _capfiles │ └── openpgp.cap ├── install_cap.bat ├── build.xml ├── Readme.md └── src │ └── PGPKey.java ├── AEAD ├── _capfiles │ ├── cloc.cap │ ├── acorn.cap │ ├── aegis.cap │ ├── ascon.cap │ └── morus.cap ├── install_acorn.bat ├── install_aegis.bat ├── install_ascon.bat ├── install_cloc.bat ├── install_morus.bat ├── Readme.md ├── CLOC │ ├── Readme.md │ └── src │ │ └── ClocApplet.java ├── AEGIS │ ├── Readme.md │ └── src │ │ └── AegisApplet.java ├── ASCON │ ├── Readme.md │ └── src │ │ └── AsconApplet.java ├── MORUS │ ├── Readme.md │ └── src │ │ └── MorusApplet.java ├── ACORN │ ├── Readme.md │ └── src │ │ └── AcornApplet.java └── build.xml ├── Sha3 ├── capfiles │ └── sha3.cap ├── install_cap.bat ├── src │ ├── Hash test vectors.txt │ └── Sha3Applet.java ├── build.xml └── Readme.md ├── _ext ├── ant-javacard.jar ├── java_card_kit-2_2_1 │ ├── bin │ │ ├── cref │ │ ├── capgen │ │ ├── jcwde │ │ ├── apdutool │ │ ├── capdump │ │ ├── converter │ │ ├── exp2text │ │ ├── scriptgen │ │ ├── verifycap │ │ ├── verifyexp │ │ └── verifyrev │ └── api_export_files │ │ ├── java │ │ ├── io │ │ │ └── javacard │ │ │ │ └── io.exp │ │ ├── rmi │ │ │ └── javacard │ │ │ │ └── rmi.exp │ │ └── lang │ │ │ └── javacard │ │ │ └── lang.exp │ │ ├── javacardx │ │ └── crypto │ │ │ └── javacard │ │ │ └── crypto.exp │ │ └── javacard │ │ ├── framework │ │ ├── javacard │ │ │ └── framework.exp │ │ └── service │ │ │ └── javacard │ │ │ └── service.exp │ │ └── security │ │ └── javacard │ │ └── security.exp ├── java_card_kit-2_2_2 │ ├── bin │ │ ├── cref │ │ ├── libjpcsclite.so │ │ ├── jcwde │ │ ├── apdutool │ │ ├── capdump │ │ ├── capgen │ │ ├── scriptgen │ │ ├── converter │ │ ├── exp2text │ │ ├── verifycap │ │ ├── verifyexp │ │ └── verifyrev │ ├── lib │ │ ├── api.jar │ │ ├── jcwde.jar │ │ ├── apduio.jar │ │ ├── api_16.jar │ │ ├── capdump.jar │ │ ├── apdutool.jar │ │ ├── converter.jar │ │ ├── installer.jar │ │ ├── jcwde_16.jar │ │ ├── scriptgen.jar │ │ ├── jcclientsamples.jar │ │ ├── offcardverifier.jar │ │ ├── javacardframework.jar │ │ └── jcrmiclientframework.jar │ └── api_export_files │ │ ├── java │ │ ├── io │ │ │ └── javacard │ │ │ │ └── io.exp │ │ ├── rmi │ │ │ └── javacard │ │ │ │ └── rmi.exp │ │ └── lang │ │ │ └── javacard │ │ │ └── lang.exp │ │ ├── javacardx │ │ ├── apdu │ │ │ └── javacard │ │ │ │ └── apdu.exp │ │ ├── crypto │ │ │ └── javacard │ │ │ │ └── crypto.exp │ │ ├── biometry │ │ │ └── javacard │ │ │ │ └── biometry.exp │ │ ├── external │ │ │ └── javacard │ │ │ │ └── external.exp │ │ └── framework │ │ │ ├── tlv │ │ │ └── javacard │ │ │ │ └── tlv.exp │ │ │ ├── math │ │ │ └── javacard │ │ │ │ └── math.exp │ │ │ └── util │ │ │ ├── javacard │ │ │ └── util.exp │ │ │ └── intx │ │ │ └── javacard │ │ │ └── intx.exp │ │ └── javacard │ │ ├── framework │ │ ├── javacard │ │ │ └── framework.exp │ │ └── service │ │ │ └── javacard │ │ │ └── service.exp │ │ └── security │ │ └── javacard │ │ └── security.exp ├── java_card_kit-2_1_2 │ ├── README.txt │ ├── COPYRIGHT.txt │ ├── bin │ │ ├── cref.exe │ │ ├── jcwde.bat │ │ ├── capdump.bat │ │ ├── capgen.bat │ │ ├── maskgen.bat │ │ ├── apdutool.bat │ │ ├── converter.bat │ │ ├── exp2text.bat │ │ ├── scriptgen.bat │ │ ├── verifycap.bat │ │ ├── verifyexp.bat │ │ └── verifyrev.bat │ ├── lib │ │ ├── api21.jar │ │ ├── jcwde.jar │ │ ├── apduio.jar │ │ ├── capdump.jar │ │ ├── apdutool.jar │ │ ├── converter.jar │ │ ├── scriptgen.jar │ │ └── offcardverifier.jar │ ├── RELEASENOTES.txt │ ├── samples │ │ ├── build_samples.bat │ │ ├── src │ │ │ ├── demo │ │ │ │ ├── Footer.scr │ │ │ │ ├── Header.scr │ │ │ │ ├── demo1.scr │ │ │ │ ├── demo3.scr │ │ │ │ ├── jcwde.app │ │ │ │ ├── AppletTest.scr │ │ │ │ └── demo3.scr.expected.out │ │ │ └── com │ │ │ │ └── sun │ │ │ │ └── javacard │ │ │ │ └── samples │ │ │ │ ├── SampleLibrary │ │ │ │ ├── SampleLibrary.opt │ │ │ │ └── JavaLoyaltyInterface.java │ │ │ │ ├── wallet │ │ │ │ ├── Wallet.java │ │ │ │ └── Wallet.opt │ │ │ │ ├── JavaPurse │ │ │ │ ├── Record.java │ │ │ │ ├── CyclicFile.java │ │ │ │ ├── JavaPurse.java │ │ │ │ ├── ParametersFile.java │ │ │ │ └── JavaPurse.opt │ │ │ │ ├── NullApp │ │ │ │ ├── NullApp.java │ │ │ │ └── NullApp.opt │ │ │ │ ├── HelloWorld │ │ │ │ ├── HelloWorld.java │ │ │ │ └── HelloWorld.opt │ │ │ │ ├── JavaLoyalty │ │ │ │ ├── JavaLoyalty.java │ │ │ │ └── JavaLoyalty.opt │ │ │ │ └── installer.opt │ │ └── classes │ │ │ └── com │ │ │ └── sun │ │ │ └── javacard │ │ │ └── samples │ │ │ ├── SampleLibrary │ │ │ ├── SampleLibrary.opt │ │ │ ├── JavaLoyaltyInterface.class │ │ │ └── javacard │ │ │ │ ├── SampleLibrary.cap │ │ │ │ ├── SampleLibrary.exp │ │ │ │ └── SampleLibrary.jca │ │ │ ├── wallet │ │ │ ├── Wallet.class │ │ │ ├── javacard │ │ │ │ ├── wallet.cap │ │ │ │ └── wallet.exp │ │ │ └── Wallet.opt │ │ │ ├── JavaPurse │ │ │ ├── Record.class │ │ │ ├── CyclicFile.class │ │ │ ├── JavaPurse.class │ │ │ ├── ParametersFile.class │ │ │ ├── javacard │ │ │ │ ├── JavaPurse.cap │ │ │ │ └── JavaPurse.exp │ │ │ └── JavaPurse.opt │ │ │ ├── NullApp │ │ │ ├── NullApp.class │ │ │ ├── javacard │ │ │ │ ├── NullApp.cap │ │ │ │ ├── NullApp.exp │ │ │ │ └── NullApp.jca │ │ │ └── NullApp.opt │ │ │ ├── HelloWorld │ │ │ ├── HelloWorld.class │ │ │ ├── javacard │ │ │ │ ├── HelloWorld.cap │ │ │ │ ├── HelloWorld.exp │ │ │ │ └── HelloWorld.jca │ │ │ └── HelloWorld.opt │ │ │ └── JavaLoyalty │ │ │ ├── JavaLoyalty.class │ │ │ ├── javacard │ │ │ ├── JavaLoyalty.cap │ │ │ ├── JavaLoyalty.exp │ │ │ └── JavaLoyalty.jca │ │ │ └── JavaLoyalty.opt │ ├── doc │ │ └── en │ │ │ └── guides │ │ │ ├── OffCardVerifier.pdf │ │ │ └── JCDevKit_User_Guide.pdf │ └── api_export_files │ │ ├── java │ │ └── lang │ │ │ └── javacard │ │ │ └── lang.exp │ │ ├── javacardx │ │ └── crypto │ │ │ └── javacard │ │ │ └── crypto.exp │ │ └── javacard │ │ ├── framework │ │ └── javacard │ │ │ └── framework.exp │ │ └── security │ │ └── javacard │ │ └── security.exp ├── java_card_kit-3_0_3 │ ├── shared │ │ ├── oracle.gif │ │ ├── topicon.gif │ │ ├── downicon.gif │ │ ├── Java_clr_hori.gif │ │ ├── smallOracleLogo.gif │ │ ├── Java_clr_hori_small.gif │ │ └── Java_clr_hori_interval.gif │ ├── api_export_files │ │ ├── java │ │ │ ├── io │ │ │ │ └── javacard │ │ │ │ │ └── io.exp │ │ │ ├── rmi │ │ │ │ └── javacard │ │ │ │ │ └── rmi.exp │ │ │ └── lang │ │ │ │ └── javacard │ │ │ │ └── lang.exp │ │ ├── javacardx │ │ │ ├── apdu │ │ │ │ └── javacard │ │ │ │ │ └── apdu.exp │ │ │ ├── crypto │ │ │ │ └── javacard │ │ │ │ │ └── crypto.exp │ │ │ ├── biometry │ │ │ │ └── javacard │ │ │ │ │ └── biometry.exp │ │ │ ├── external │ │ │ │ └── javacard │ │ │ │ │ └── external.exp │ │ │ └── framework │ │ │ │ ├── tlv │ │ │ │ └── javacard │ │ │ │ │ └── tlv.exp │ │ │ │ ├── math │ │ │ │ └── javacard │ │ │ │ │ └── math.exp │ │ │ │ └── util │ │ │ │ ├── javacard │ │ │ │ └── util.exp │ │ │ │ └── intx │ │ │ │ └── javacard │ │ │ │ └── intx.exp │ │ └── javacard │ │ │ ├── framework │ │ │ ├── javacard │ │ │ │ └── framework.exp │ │ │ └── service │ │ │ │ └── javacard │ │ │ │ └── service.exp │ │ │ └── security │ │ │ └── javacard │ │ │ └── security.exp │ ├── legal │ │ └── Distribution_ReadME.txt │ ├── lib │ │ └── logging.properties │ └── COPYRIGHT.html ├── visa_openplatform-2_0 │ └── visa │ │ └── openplatform │ │ └── javacard │ │ └── openplatform.exp └── globalplatform-2_1_1 │ └── org │ └── globalplatform │ └── javacard │ └── globalplatform.exp ├── Twine ├── capfiles │ └── twine.cap ├── install_cap.bat ├── build.xml ├── src │ └── TwineApplet.java └── Readme.md ├── Zorro ├── capfiles │ └── zorro.cap ├── install_cap.bat ├── build.xml ├── src │ └── ZorroApplet.java └── Readme.md ├── Pbkdf2 ├── capfiles │ └── pbkdf2.cap ├── install_cap.bat ├── build.xml ├── Readme.md └── src │ ├── Pbkdf2Applet.java │ └── PBKDF2.java ├── LICENSE └── README.md /OpenPGP/delete_pgp_cap.bat: -------------------------------------------------------------------------------- 1 | gp -delete D27600012401 2 | echo DONE 3 | pause -------------------------------------------------------------------------------- /AEAD/_capfiles/cloc.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/AEAD/_capfiles/cloc.cap -------------------------------------------------------------------------------- /Sha3/capfiles/sha3.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/Sha3/capfiles/sha3.cap -------------------------------------------------------------------------------- /_ext/ant-javacard.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/ant-javacard.jar -------------------------------------------------------------------------------- /AEAD/_capfiles/acorn.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/AEAD/_capfiles/acorn.cap -------------------------------------------------------------------------------- /AEAD/_capfiles/aegis.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/AEAD/_capfiles/aegis.cap -------------------------------------------------------------------------------- /AEAD/_capfiles/ascon.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/AEAD/_capfiles/ascon.cap -------------------------------------------------------------------------------- /AEAD/_capfiles/morus.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/AEAD/_capfiles/morus.cap -------------------------------------------------------------------------------- /Twine/capfiles/twine.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/Twine/capfiles/twine.cap -------------------------------------------------------------------------------- /Zorro/capfiles/zorro.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/Zorro/capfiles/zorro.cap -------------------------------------------------------------------------------- /Pbkdf2/capfiles/pbkdf2.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/Pbkdf2/capfiles/pbkdf2.cap -------------------------------------------------------------------------------- /OpenPGP/_capfiles/openpgp.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/OpenPGP/_capfiles/openpgp.cap -------------------------------------------------------------------------------- /Sha3/install_cap.bat: -------------------------------------------------------------------------------- 1 | gp -delete 556E697454657374 2 | call ant sha3 3 | gp -install _capfiles/sha3.cap 4 | echo DONE 5 | pause -------------------------------------------------------------------------------- /Twine/install_cap.bat: -------------------------------------------------------------------------------- 1 | gp -delete 556E697454657374 2 | call ant twine 3 | gp -install _capfiles/twine.cap 4 | echo DONE 5 | pause -------------------------------------------------------------------------------- /Zorro/install_cap.bat: -------------------------------------------------------------------------------- 1 | gp -delete 556E697454657374 2 | call ant zorro 3 | gp -install _capfiles/zorro.cap 4 | echo DONE 5 | pause -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/bin/cref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/bin/cref -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/bin/cref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/bin/cref -------------------------------------------------------------------------------- /AEAD/install_acorn.bat: -------------------------------------------------------------------------------- 1 | gp -delete 556E697454657374 2 | call ant acorn 3 | gp -install _capfiles/acorn.cap 4 | echo DONE 5 | pause -------------------------------------------------------------------------------- /AEAD/install_aegis.bat: -------------------------------------------------------------------------------- 1 | gp -delete 556E697454657374 2 | call ant aegis 3 | gp -install _capfiles/aegis.cap 4 | echo DONE 5 | pause -------------------------------------------------------------------------------- /AEAD/install_ascon.bat: -------------------------------------------------------------------------------- 1 | gp -delete 556E697454657374 2 | call ant ascon 3 | gp -install _capfiles/ascon.cap 4 | echo DONE 5 | pause -------------------------------------------------------------------------------- /AEAD/install_cloc.bat: -------------------------------------------------------------------------------- 1 | gp -delete 556E697454657374 2 | call ant cloc 3 | gp -install _capfiles/cloc.cap 4 | echo DONE 5 | pause -------------------------------------------------------------------------------- /AEAD/install_morus.bat: -------------------------------------------------------------------------------- 1 | gp -delete 556E697454657374 2 | call ant morus 3 | gp -install _capfiles/morus.cap 4 | echo DONE 5 | pause -------------------------------------------------------------------------------- /OpenPGP/install_cap.bat: -------------------------------------------------------------------------------- 1 | gp -delete D27600012401 2 | call ant openpgp 3 | gp -install _capfiles/openpgp.cap 4 | echo DONE 5 | pause -------------------------------------------------------------------------------- /Pbkdf2/install_cap.bat: -------------------------------------------------------------------------------- 1 | gp -delete 556E697454657374 2 | call ant pbkdf2 3 | gp -install _capfiles/pbkdf2.cap 4 | echo DONE 5 | pause -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/README.txt -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/bin/capgen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/bin/capgen -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/bin/jcwde: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/bin/jcwde -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/COPYRIGHT.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/COPYRIGHT.txt -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/bin/cref.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/bin/cref.exe -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/bin/jcwde.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/bin/jcwde.bat -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/lib/api21.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/lib/api21.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/lib/jcwde.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/lib/jcwde.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/bin/apdutool: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/bin/apdutool -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/bin/capdump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/bin/capdump -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/bin/converter: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/bin/converter -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/bin/exp2text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/bin/exp2text -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/bin/scriptgen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/bin/scriptgen -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/bin/verifycap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/bin/verifycap -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/bin/verifyexp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/bin/verifyexp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/bin/verifyrev: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/bin/verifyrev -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/api.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/api.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/jcwde.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/jcwde.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/bin/capdump.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/bin/capdump.bat -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/bin/capgen.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/bin/capgen.bat -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/bin/maskgen.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/bin/maskgen.bat -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/lib/apduio.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/lib/apduio.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/lib/capdump.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/lib/capdump.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/apduio.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/apduio.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/api_16.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/api_16.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/capdump.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/capdump.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/RELEASENOTES.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/RELEASENOTES.txt -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/bin/apdutool.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/bin/apdutool.bat -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/bin/converter.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/bin/converter.bat -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/bin/exp2text.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/bin/exp2text.bat -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/bin/scriptgen.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/bin/scriptgen.bat -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/bin/verifycap.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/bin/verifycap.bat -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/bin/verifyexp.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/bin/verifyexp.bat -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/bin/verifyrev.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/bin/verifyrev.bat -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/lib/apdutool.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/lib/apdutool.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/lib/converter.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/lib/converter.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/lib/scriptgen.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/lib/scriptgen.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/apdutool.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/apdutool.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/converter.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/converter.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/installer.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/installer.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/jcwde_16.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/jcwde_16.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/scriptgen.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/scriptgen.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/shared/oracle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/shared/oracle.gif -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/shared/topicon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/shared/topicon.gif -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/bin/libjpcsclite.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/bin/libjpcsclite.so -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/shared/downicon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/shared/downicon.gif -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/lib/offcardverifier.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/lib/offcardverifier.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/jcclientsamples.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/jcclientsamples.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/offcardverifier.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/offcardverifier.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/build_samples.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/build_samples.bat -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/javacardframework.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/javacardframework.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/shared/Java_clr_hori.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/shared/Java_clr_hori.gif -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/demo/Footer.scr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/demo/Footer.scr -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/demo/Header.scr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/demo/Header.scr -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/demo/demo1.scr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/demo/demo1.scr -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/demo/demo3.scr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/demo/demo3.scr -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/demo/jcwde.app: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/demo/jcwde.app -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/lib/jcrmiclientframework.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/lib/jcrmiclientframework.jar -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/shared/smallOracleLogo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/shared/smallOracleLogo.gif -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/shared/Java_clr_hori_small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/shared/Java_clr_hori_small.gif -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/doc/en/guides/OffCardVerifier.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/doc/en/guides/OffCardVerifier.pdf -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/demo/AppletTest.scr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/demo/AppletTest.scr -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/shared/Java_clr_hori_interval.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/shared/Java_clr_hori_interval.gif -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/doc/en/guides/JCDevKit_User_Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/doc/en/guides/JCDevKit_User_Guide.pdf -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/api_export_files/java/io/javacard/io.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/api_export_files/java/io/javacard/io.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/java/io/javacard/io.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/java/io/javacard/io.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/java/io/javacard/io.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/java/io/javacard/io.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/api_export_files/java/rmi/javacard/rmi.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/api_export_files/java/rmi/javacard/rmi.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/java/rmi/javacard/rmi.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/java/rmi/javacard/rmi.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/java/rmi/javacard/rmi.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/java/rmi/javacard/rmi.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/api_export_files/java/lang/javacard/lang.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/api_export_files/java/lang/javacard/lang.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/api_export_files/java/lang/javacard/lang.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/api_export_files/java/lang/javacard/lang.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/java/lang/javacard/lang.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/java/lang/javacard/lang.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/java/lang/javacard/lang.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/java/lang/javacard/lang.exp -------------------------------------------------------------------------------- /_ext/visa_openplatform-2_0/visa/openplatform/javacard/openplatform.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/visa_openplatform-2_0/visa/openplatform/javacard/openplatform.exp -------------------------------------------------------------------------------- /_ext/globalplatform-2_1_1/org/globalplatform/javacard/globalplatform.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/globalplatform-2_1_1/org/globalplatform/javacard/globalplatform.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/javacardx/apdu/javacard/apdu.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/javacardx/apdu/javacard/apdu.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/javacardx/apdu/javacard/apdu.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/javacardx/apdu/javacard/apdu.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/api_export_files/javacardx/crypto/javacard/crypto.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/api_export_files/javacardx/crypto/javacard/crypto.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/api_export_files/javacardx/crypto/javacard/crypto.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/api_export_files/javacardx/crypto/javacard/crypto.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/javacardx/crypto/javacard/crypto.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/javacardx/crypto/javacard/crypto.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/javacardx/crypto/javacard/crypto.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/javacardx/crypto/javacard/crypto.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/SampleLibrary/SampleLibrary.opt: -------------------------------------------------------------------------------- 1 | -out EXP JCA CAP 2 | -exportpath . 3 | com.sun.javacard.samples.SampleLibrary 4 | 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x4 1.0 5 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/wallet/Wallet.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/wallet/Wallet.java -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/api_export_files/javacard/framework/javacard/framework.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/api_export_files/javacard/framework/javacard/framework.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/api_export_files/javacard/security/javacard/security.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/api_export_files/javacard/security/javacard/security.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/SampleLibrary/SampleLibrary.opt: -------------------------------------------------------------------------------- 1 | -out EXP JCA CAP 2 | -exportpath . 3 | com.sun.javacard.samples.SampleLibrary 4 | 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x4 1.0 5 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/JavaPurse/Record.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/JavaPurse/Record.java -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/NullApp/NullApp.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/NullApp/NullApp.java -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/api_export_files/javacard/framework/javacard/framework.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/api_export_files/javacard/framework/javacard/framework.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/api_export_files/javacard/security/javacard/security.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/api_export_files/javacard/security/javacard/security.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/javacard/framework/javacard/framework.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/javacard/framework/javacard/framework.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/javacard/security/javacard/security.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/javacard/security/javacard/security.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/javacardx/biometry/javacard/biometry.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/javacardx/biometry/javacard/biometry.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/javacardx/external/javacard/external.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/javacardx/external/javacard/external.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/tlv/javacard/tlv.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/tlv/javacard/tlv.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/javacard/framework/javacard/framework.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/javacard/framework/javacard/framework.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/javacard/security/javacard/security.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/javacard/security/javacard/security.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/javacardx/biometry/javacard/biometry.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/javacardx/biometry/javacard/biometry.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/javacardx/external/javacard/external.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/javacardx/external/javacard/external.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/tlv/javacard/tlv.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/tlv/javacard/tlv.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/wallet/Wallet.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/wallet/Wallet.class -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/math/javacard/math.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/math/javacard/math.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/util/javacard/util.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/util/javacard/util.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/math/javacard/math.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/math/javacard/math.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/util/javacard/util.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/util/javacard/util.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/Record.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/Record.class -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/NullApp/NullApp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/NullApp/NullApp.class -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/HelloWorld/HelloWorld.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/HelloWorld/HelloWorld.java -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/JavaPurse/CyclicFile.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/JavaPurse/CyclicFile.java -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/JavaPurse/JavaPurse.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/JavaPurse/JavaPurse.java -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.java -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_1/api_export_files/javacard/framework/service/javacard/service.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_1/api_export_files/javacard/framework/service/javacard/service.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/javacard/framework/service/javacard/service.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/javacard/framework/service/javacard/service.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/util/intx/javacard/intx.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_2_2/api_export_files/javacardx/framework/util/intx/javacard/intx.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/javacard/framework/service/javacard/service.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/javacard/framework/service/javacard/service.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/util/intx/javacard/intx.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-3_0_3/api_export_files/javacardx/framework/util/intx/javacard/intx.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/HelloWorld/HelloWorld.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/HelloWorld/HelloWorld.class -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/CyclicFile.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/CyclicFile.class -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/JavaPurse.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/JavaPurse.class -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/wallet/javacard/wallet.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/wallet/javacard/wallet.cap -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/wallet/javacard/wallet.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/wallet/javacard/wallet.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/JavaPurse/ParametersFile.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/JavaPurse/ParametersFile.java -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.class -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/NullApp/javacard/NullApp.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/NullApp/javacard/NullApp.cap -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/NullApp/javacard/NullApp.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/NullApp/javacard/NullApp.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/ParametersFile.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/ParametersFile.class -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/javacard/JavaPurse.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/javacard/JavaPurse.cap -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/javacard/JavaPurse.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/javacard/JavaPurse.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/HelloWorld/javacard/HelloWorld.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/HelloWorld/javacard/HelloWorld.cap -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/HelloWorld/javacard/HelloWorld.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/HelloWorld/javacard/HelloWorld.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaLoyalty/javacard/JavaLoyalty.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaLoyalty/javacard/JavaLoyalty.cap -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaLoyalty/javacard/JavaLoyalty.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaLoyalty/javacard/JavaLoyalty.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/SampleLibrary/JavaLoyaltyInterface.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/SampleLibrary/JavaLoyaltyInterface.java -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/SampleLibrary/JavaLoyaltyInterface.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/SampleLibrary/JavaLoyaltyInterface.class -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/SampleLibrary/javacard/SampleLibrary.cap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/SampleLibrary/javacard/SampleLibrary.cap -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/SampleLibrary/javacard/SampleLibrary.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crocs-muni/OptimizedJCAlgs/HEAD/_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/SampleLibrary/javacard/SampleLibrary.exp -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/wallet/Wallet.opt: -------------------------------------------------------------------------------- 1 | -out EXP JCA CAP 2 | -exportpath . 3 | -applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x6:0x1 com.sun.javacard.samples.wallet.Wallet 4 | com.sun.javacard.samples.wallet 5 | 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x6 1.0 6 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/wallet/Wallet.opt: -------------------------------------------------------------------------------- 1 | -out EXP JCA CAP 2 | -exportpath . 3 | -applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x6:0x1 com.sun.javacard.samples.wallet.Wallet 4 | com.sun.javacard.samples.wallet 5 | 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x6 1.0 6 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/NullApp/NullApp.opt: -------------------------------------------------------------------------------- 1 | -out EXP JCA CAP 2 | -exportpath . 3 | -applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x3:0x1 com.sun.javacard.samples.NullApp.NullApp 4 | com.sun.javacard.samples.NullApp 5 | 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x3 1.0 6 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/NullApp/NullApp.opt: -------------------------------------------------------------------------------- 1 | -out EXP JCA CAP 2 | -exportpath . 3 | -applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x3:0x1 com.sun.javacard.samples.NullApp.NullApp 4 | com.sun.javacard.samples.NullApp 5 | 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x3 1.0 6 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/installer.opt: -------------------------------------------------------------------------------- 1 | -exportpath . 2 | -classdir . 3 | -out JCA 4 | -i 5 | -applet 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x08:0x01 com.sun.javacard.installer.InstallerApplet 6 | com.sun.javacard.installer 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x08 1.0 7 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaPurse/JavaPurse.opt: -------------------------------------------------------------------------------- 1 | -out EXP JCA CAP 2 | -exportpath . 3 | -applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x2:0x1 com.sun.javacard.samples.JavaPurse.JavaPurse 4 | com.sun.javacard.samples.JavaPurse 5 | 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x2 1.0 6 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/JavaPurse/JavaPurse.opt: -------------------------------------------------------------------------------- 1 | -out EXP JCA CAP 2 | -exportpath . 3 | -applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x2:0x1 com.sun.javacard.samples.JavaPurse.JavaPurse 4 | com.sun.javacard.samples.JavaPurse 5 | 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x2 1.0 6 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/HelloWorld/HelloWorld.opt: -------------------------------------------------------------------------------- 1 | -out EXP JCA CAP 2 | -exportpath . 3 | -applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1:0x1 com.sun.javacard.samples.HelloWorld.HelloWorld 4 | com.sun.javacard.samples.HelloWorld 5 | 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1 1.0 6 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/HelloWorld/HelloWorld.opt: -------------------------------------------------------------------------------- 1 | -out EXP JCA CAP 2 | -exportpath . 3 | -applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1:0x1 com.sun.javacard.samples.HelloWorld.HelloWorld 4 | com.sun.javacard.samples.HelloWorld 5 | 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1 1.0 6 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.opt: -------------------------------------------------------------------------------- 1 | -out EXP JCA CAP 2 | -exportpath . 3 | -applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x5:1 com.sun.javacard.samples.JavaLoyalty.JavaLoyalty 4 | com.sun.javacard.samples.JavaLoyalty 5 | 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x5 1.0 6 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.opt: -------------------------------------------------------------------------------- 1 | -out EXP JCA CAP 2 | -exportpath . 3 | -applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x5:1 com.sun.javacard.samples.JavaLoyalty.JavaLoyalty 4 | com.sun.javacard.samples.JavaLoyalty 5 | 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x5 1.0 6 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/bin/jcwde: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4 | # Use is subject to license terms. 5 | # 6 | 7 | JAVA_HOME=${JAVA_HOME:-/usr/j2se} 8 | 9 | bin_home=`dirname $0` 10 | JC_HOME=${JC_HOME:-$bin_home/..} 11 | 12 | JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH 13 | 14 | JFLAGS="-classpath $JC_PATH" 15 | $JAVA_HOME/bin/java $JFLAGS com.sun.javacard.jcwde.Main "$@" 16 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/bin/apdutool: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4 | # Use is subject to license terms. 5 | # 6 | 7 | JAVA_HOME=${JAVA_HOME:-/usr/j2se} 8 | 9 | bin_home=`dirname $0` 10 | JC_HOME=${JC_HOME:-$bin_home/..} 11 | 12 | JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH 13 | 14 | JFLAGS="-classpath $JC_PATH" 15 | $JAVA_HOME/bin/java $JFLAGS com.sun.javacard.apdutool.Main "$@" 16 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/bin/capdump: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4 | # Use is subject to license terms. 5 | # 6 | 7 | JAVA_HOME=${JAVA_HOME:-/usr/j2se} 8 | 9 | bin_home=`dirname $0` 10 | JC_HOME=${JC_HOME:-$bin_home/..} 11 | 12 | JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH 13 | 14 | JFLAGS="-classpath $JC_PATH" 15 | $JAVA_HOME/bin/java $JFLAGS com.sun.javacard.capdump.CapDump "$@" 16 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/bin/capgen: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4 | # Use is subject to license terms. 5 | # 6 | 7 | JAVA_HOME=${JAVA_HOME:-/usr/j2se} 8 | 9 | bin_home=`dirname $0` 10 | JC_HOME=${JC_HOME:-$bin_home/..} 11 | 12 | JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH 13 | 14 | JFLAGS="-classpath $JC_PATH" 15 | $JAVA_HOME/bin/java $JFLAGS com.sun.javacard.jcasm.cap.Main "$@" 16 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/bin/scriptgen: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4 | # Use is subject to license terms. 5 | # 6 | 7 | JAVA_HOME=${JAVA_HOME:-/usr/j2se} 8 | 9 | bin_home=`dirname $0` 10 | JC_HOME=${JC_HOME:-$bin_home/..} 11 | 12 | JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH 13 | 14 | JFLAGS="-classpath $JC_PATH" 15 | $JAVA_HOME/bin/java $JFLAGS com.sun.javacard.scriptgen.Main "$@" 16 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/bin/converter: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4 | # Use is subject to license terms. 5 | # 6 | 7 | JAVA_HOME=${JAVA_HOME:-/usr/j2se} 8 | 9 | bin_home=`dirname $0` 10 | JC_HOME=${JC_HOME:-$bin_home/..} 11 | 12 | JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH 13 | 14 | JFLAGS="-classpath $JC_PATH" 15 | $JAVA_HOME/bin/java $JFLAGS com.sun.javacard.converter.Converter "$@" 16 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/bin/exp2text: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4 | # Use is subject to license terms. 5 | # 6 | 7 | JAVA_HOME=${JAVA_HOME:-/usr/j2se} 8 | 9 | bin_home=`dirname $0` 10 | JC_HOME=${JC_HOME:-$bin_home/..} 11 | 12 | JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH 13 | 14 | JFLAGS="-classpath $JC_PATH" 15 | $JAVA_HOME/bin/java $JFLAGS com.sun.javacard.converter.Exp2Text "$@" 16 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/bin/verifycap: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4 | # Use is subject to license terms. 5 | # 6 | 7 | JAVA_HOME=${JAVA_HOME:-/usr/j2se} 8 | 9 | bin_home=`dirname $0` 10 | JC_HOME=${JC_HOME:-$bin_home/..} 11 | 12 | JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH 13 | 14 | JFLAGS="-classpath $JC_PATH" 15 | $JAVA_HOME/bin/java $JFLAGS com.sun.javacard.offcardverifier.Verifier "$@" 16 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/bin/verifyexp: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4 | # Use is subject to license terms. 5 | # 6 | 7 | JAVA_HOME=${JAVA_HOME:-/usr/j2se} 8 | 9 | bin_home=`dirname $0` 10 | JC_HOME=${JC_HOME:-$bin_home/..} 11 | 12 | JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH 13 | 14 | JFLAGS="-classpath $JC_PATH" 15 | $JAVA_HOME/bin/java $JFLAGS com.sun.javacard.offcardverifier.VerifyExp "$@" 16 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_2_2/bin/verifyrev: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4 | # Use is subject to license terms. 5 | # 6 | 7 | JAVA_HOME=${JAVA_HOME:-/usr/j2se} 8 | 9 | bin_home=`dirname $0` 10 | JC_HOME=${JC_HOME:-$bin_home/..} 11 | 12 | JC_PATH=$JC_HOME/lib/apdutool.jar:$JC_HOME/lib/apduio.jar:$JC_HOME/lib/converter.jar:$JC_HOME/lib/jcwde.jar:$JC_HOME/lib/scriptgen.jar:$JC_HOME/lib/offcardverifier.jar:$JC_HOME/lib/api.jar:$JC_HOME/lib/installer.jar:$JC_HOME/lib/capdump.jar:$JC_HOME/samples/classes:$CLASSPATH 13 | 14 | JFLAGS="-classpath $JC_PATH" 15 | $JAVA_HOME/bin/java $JFLAGS com.sun.javacard.offcardverifier.VerifyRev "$@" 16 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/SampleLibrary/javacard/SampleLibrary.jca: -------------------------------------------------------------------------------- 1 | // converted by version 1.2 2 | // on Mon Apr 09 13:40:42 PDT 2001 3 | 4 | .package com/sun/javacard/samples/SampleLibrary { 5 | .aid 0xA0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x4; 6 | .version 1.0; 7 | 8 | .imports { 9 | 0xA0:0x0:0x0:0x0:0x62:0x0:0x1 1.0; //java/lang 10 | 0xA0:0x0:0x0:0x0:0x62:0x1:0x1 1.0; //javacard/framework 11 | } 12 | 13 | .interface public abstract JavaLoyaltyInterface 0 { 14 | 15 | .shareable; 16 | 17 | .superInterfaces { 18 | 1.2; // javacard/framework/Shareable 19 | } 20 | 21 | .method public abstract grantPoints([B)V 0 { 22 | } 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /AEAD/Readme.md: -------------------------------------------------------------------------------- 1 | # Authenticated Encryption with Associated Data 2 | 3 | This folder contains 5 optimized versions of AEAD algorithms: 4 | * ACORN 5 | * AEGIS 6 | * ASCON 7 | * CLOC 8 | * MORUS 9 | 10 | Profiling data of each one is in their respective folder in Readme. All optimizations run faster, some run much more faster, some just very slightly. But they are also less memory-consuming now. 11 | 12 | For more info about AEAD on javacard, and its usage, visit original project repository:\ 13 | https://github.com/palkrajesh/AEonJC 14 | 15 | Some interfaces have been slightly changed. Init now doesn't take all data as input, rather than only needed initialization parameters. All data for encryption/decryption are now taken by encrypt/decrypt methods, which are, together with init, the only public methods. 16 | ``` 17 | public void init(byte[] nsecret, byte[] npublic, byte[] key) 18 | 19 | public byte encrypt(byte[] cipher, short cipherlen, 20 | byte[] message, short messagelen, 21 | byte[] authdata, short authdatalen) 22 | ``` 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Matej Evin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /AEAD/CLOC/Readme.md: -------------------------------------------------------------------------------- 1 | # CLOC 2 | 3 | ## Optimizations Used: 4 | * removed redundant ram arrays 5 | * removed redundant variables 6 | * removed unused decryptCipher 7 | * inlined some function calls 8 | * removed software AES implementation 9 | * moved functionality to init instead of encrypt/decrypt 10 | 11 | ## Profiling: 12 | 13 | ### Speed: 14 | Optimized version: 15 | ``` 16 | .cap file size: 7,351 bytes 17 | 18 | Until initialization: 8 ms 19 | initialization: 8 ms 20 | process associated data: 38 ms 21 | encrypt plaintext: 30 ms 22 | 23 | Total: 84 ms 24 | ``` 25 | Unoptimized version: 26 | ``` 27 | .cap file size: 7,600 bytes 28 | 29 | Until initialization: 8 ms 30 | initialization: 19 ms 31 | process associated data: 42 ms 32 | encrypt plaintext: 30 ms 33 | 34 | Total: 99 ms 35 | ``` 36 | Since CLOC uses internal AES, it is very fast. Our optimizations managed to slightly improve the speed, also improved the code logic by putting more operations into init. 37 | 38 | ### RAM: 39 | Unoptimized version: 40 | ``` 41 | 380 bytes 42 | ``` 43 | Optimized version: 44 | ``` 45 | 78 bytes 46 | ``` 47 | 380 - 78 = 302 bytes (79% smaller) 48 | -------------------------------------------------------------------------------- /Sha3/src/Hash test vectors.txt: -------------------------------------------------------------------------------- 1 | Verified with: https://emn178.github.io/online-tools 2 | 3 | Input: 0x112233 4 | 5 | Outputs: 6 | (apdu b0000000112233) SHA3 224 26b7fa43c1f2fe568aeeac7e3e3efc9bb8846ec996b66772e0fdc6be 7 | (apdu b0010000112233) SHA3 256 bd55ba18aa483464e273b947614943a6dcb9d1525fea5981a2b1edbed39bd7de 8 | (apdu b0020000112233) SHA3 384 6e376f9b5db6286fe18bcf18c613b1aeadbe126d8b34a1b53a23590fa7a56a5dd6f5bff4807ebc172548028e5384641e 9 | (apdu b0030000112233) SHA3 512 21f5e68ed66f657c4eb0b0a8929edb30fd1163fbd7b87ffe420a610c9bffeceaa65b2a6f12ccc368b92d8ef97d7c50614492ad314dd629add8a9e8573f05e231 10 | (apdu b0040000112233) KECCAK 224 4eb21013c0ce9ebae475037d744e17191f56960725862f47d1f74c13 11 | (apdu b0050000112233) KECCAK 256 50fceab2fe7ed15023d21b343e098d8a822f44ed61ba7e988e708db9c68c2535 12 | (apdu b0060000112233) KECCAK 384 75b8cd37da78fde60c3192e28536f2b38c173106c7af8aeade99b46a490cfaf7fc7f8ff15c2a75d48f486dae2e53a160 13 | (apdu b0070000112233) KECCAK 512 77de6dd297713574725debd79bbaf97ae36ea0ea95a07c24a56d26415062bc7ab5e53fefa05f0994205cf6f1ae01c6614b412c428a4fddc69ce90da8e7f2a121 14 | (apdu b0080000112233) SHAKE 128 8bbd9cf3b72afa04490fe171829bd8ee1abe9a59cb599413c255bc729afe596f 15 | (apdu b0090000112233) SHAKE 256 7cd1466cff59dfc13450bec0c0bbcd900d2d597c75be7561dfd6a0dfda53bf8951e7b774f26dca101238d086c29f3add3123964813e6a0ee9b383209284dca78 -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/legal/Distribution_ReadME.txt: -------------------------------------------------------------------------------- 1 | DistributionREADME 2 | 3 | DISTRIBUTION BY DEVELOPERS. Subject to the terms and conditions of the Software License Agreement and the obligations, restrictions, and exceptions set forth below, You may reproduce and distribute the portions of Software identified below ("Redistributable"), provided that: 4 | 5 | (a) You distribute Redistributable complete and unmodified and only bundled as part of Your Programs, 6 | 7 | (b) Your Programs add significant and primary functionality to the Redistributable, 8 | 9 | (c) You do not distribute additional software intended to replace any 10 | component(s) of the Redistributable, 11 | 12 | (d) You do not remove or alter any proprietary legends or notices contained in or on the Redistributable. 13 | 14 | (e) You only distribute the Redistributable subject to a license agreement that protects Oracle's interests consistent with the terms contained in this 15 | Agreement, and 16 | 17 | (f) You agree to defend and indemnify Oracle and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Redistributable. 18 | 19 | The following files are Redistributables: 20 | 21 | Java Card Development Kit 3.0.3 22 | -------------------------------------------------------------------------------- /Sha3/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /AEAD/AEGIS/Readme.md: -------------------------------------------------------------------------------- 1 | # AEGIS 2 | 3 | ## Optimizations Used: 4 | * removed two ram arrays 5 | * added constants 6 | * Split initialization and encryption/decryption. 7 | 8 | ## Profiling: 9 | 10 | ### Speed: 11 | Optimized version: 12 | ``` 13 | .cap file size: 12,629 bytes 14 | 15 | Until initialization: 8 ms 16 | initialization: 2360 ms 17 | process associated data 1: 63 ms 18 | process associated data 2: 96 ms 19 | process plaintext: 100 ms 20 | generate tag: 542 ms 21 | finalize encryption: 6 ms 22 | 23 | Total: 3175 ms 24 | ``` 25 | Unoptimized version: 26 | ``` 27 | .cap file size: 12,889 bytes 28 | 29 | Until initialization: 8 ms 30 | initialization: 2334 ms 31 | process associated data 1: 96 ms 32 | process associated data 2: 96 ms 33 | process plaintext: 100 ms 34 | generate tag: 543 ms 35 | finalize encryption: 9 ms 36 | 37 | Total: 3186 ms 38 | ``` 39 | 40 | This algorithm was well optimized for speed already, which we can see at basically identical run times. We managed to push a big part of the code to the initialization. Also, we removed some arrays so the RAM consumption is lower. 41 | 42 | ### RAM: 43 | Unoptimized version: 44 | ``` 45 | 208 bytes 46 | ``` 47 | Optimized version: 48 | ``` 49 | 176 bytes 50 | ``` 51 | 208 - 176 = 32 bytes (15,3% smaller) 52 | -------------------------------------------------------------------------------- /Twine/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Pbkdf2/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Zorro/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /OpenPGP/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /AEAD/ASCON/Readme.md: -------------------------------------------------------------------------------- 1 | # ASCON 2 | 3 | ## Optimizations Used: 4 | * Much faster bit rotation 5 | * Removed 8 byte tempbuf 6 | * Changed method visibility 7 | 8 | ## Profiling: 9 | 10 | ### Speed: 11 | Optimized version: 12 | ``` 13 | .cap file size: 6,302 bytes 14 | 15 | Until initialization: 7 ms 16 | initialization: 51 ms 17 | data padding: 4 ms 18 | populating state: 19 ms 19 | initial permutation: 766 ms 20 | adding key: 4 ms 21 | process associated data: 404 ms 22 | process plaintext: 781 ms 23 | generate tag: 790 ms 24 | 25 | Total: 2826 ms 26 | ``` 27 | Unoptimized version: 28 | ``` 29 | .cap file size: 6,294 bytes 30 | 31 | Until initialization: 8 ms 32 | initialization: 52 ms 33 | data padding: 2 ms 34 | populating state: 8 ms 35 | initial permutation: 6354 ms 36 | adding key: 4 ms 37 | process associated data: 3178 ms 38 | process plaintext: 6553 ms 39 | generate tag: 6354 ms 40 | 41 | Total: 22513 ms 42 | ``` 43 | 44 | We went from 22,5 seconds to less than 3 seconds when processing 16 bytes of data. That is almost 8 times faster! Also, some arrays were removed so it takes less RAM space. 45 | 46 | ### RAM: 47 | Unoptimized version: 48 | ``` 49 | 128 bytes 50 | ``` 51 | Optimized version: 52 | ``` 53 | 120 bytes 54 | ``` 55 | 128 - 120 = 8 bytes (6,25% smaller) 56 | -------------------------------------------------------------------------------- /AEAD/MORUS/Readme.md: -------------------------------------------------------------------------------- 1 | # MORUS 2 | 3 | ## Optimizations Used: 4 | * removed redundant variables and temporaries 5 | * reduced method visibility to package only 6 | * inlined many function calls 7 | * improved byte shifting 8 | * moved many parts to init 9 | * unrolled many loops 10 | 11 | ## Profiling: 12 | 13 | ### Speed (16 byte input 0x00 - 0x0f): 14 | Optimized version: 15 | ``` 16 | .cap file size: 10,347 bytes 17 | 18 | Until initialization: 8 ms 19 | initialization: 2286 ms 20 | endianness changes: 263 ms 21 | process associated data: 80 ms 22 | process plaintext: 140 ms 23 | generate tag: 781 ms 24 | 25 | Total: 3558 ms 26 | 27 | (255 bytes are encrypted in 6270 ms) 28 | ``` 29 | Unoptimized version: 30 | ``` 31 | .cap file size: 8,534 bytes 32 | 33 | Until initialization: 8 ms 34 | initialization: 53827 ms 35 | endianness changes: 466 ms 36 | process associated data: 3333 ms 37 | process plaintext: 3341 ms 38 | generate tag: 26768 ms 39 | 40 | Total: 87743 ms 41 | ``` 42 | We cut the computation time from 87,7 seconds to 3,5 seconds. That is more than 24x faster!\ 43 | We also moved most of the code to initialization, so subsequent runs of encrypt() would take only about 1,3 seconds.\ 44 | Improved bitshifts and byte shifts are the main reason of this speedup.\ 45 | The only price for this is cap being bigger by 1500 bytes, which is is completely negligible in this case. 46 | 47 | ### RAM: 48 | ``` 49 | 128 bytes 50 | ``` 51 | ``` 52 | 128 bytes 53 | ``` 54 | No improvement 55 | -------------------------------------------------------------------------------- /AEAD/ACORN/Readme.md: -------------------------------------------------------------------------------- 1 | # ACORN 2 | 3 | ## Optimizations Used: 4 | * simplified byte shifts 5 | * removed redundant arrays 6 | * removed tempbuf 7 | * inlined functions 8 | * unrolled some loops 9 | * removed 1536 bytes of EEPROM 10 | * removed 1536 writes into EEPROM (this is huge) 11 | * changed visibility 12 | 13 | ## Profiling: 14 | 15 | ### Speed: 16 | Optimized version: 17 | ``` 18 | .cap file size: 5,927 bytes 19 | 20 | Until initialization: 7 ms 21 | initialization: 18989 ms 22 | encryption preparation: 35 ms 23 | process associated data 1: 3306 ms 24 | process associated data 2: 12191 ms 25 | process plaintext 1: 3374 ms 26 | process plaintext 2: 12178 ms 27 | generate tag: 12119 ms 28 | finalize encryption: 6 ms 29 | 30 | Total: 62205 ms 31 | ``` 32 | Unoptimized version: 33 | ``` 34 | .cap file size: 6,005 bytes 35 | 36 | Until initialization: 8 ms 37 | initialization: 20688 ms 38 | process associated data 1: 3099 ms 39 | process associated data 2: 12522 ms 40 | process plaintext 1: 3457 ms 41 | process plaintext 2: 12482 ms 42 | generate tag: 12426 ms 43 | finalize encryption: 2 ms 44 | 45 | Total: 64649 ms 46 | ``` 47 | Speed gain is roughly 4%. Memory footprint, however, is much smaller for optimized version. We cut 1536 bytes of EEPROM and several RAM arrays. Capsize is slightly smaller too.\ 48 | Also, much more code was moved to initialization process, so subsequent uses of acorn would take substantially less time (about 40 seconds, instead of 62), which is ~33% speed gain. 49 | 50 | ### RAM: 51 | Unoptimized version: 52 | ``` 53 | 602 bytes 54 | ``` 55 | Optimized version: 56 | ``` 57 | 309 bytes 58 | ``` 59 | 602 - 309 = 293 bytes (48,6% smaller) 60 | -------------------------------------------------------------------------------- /OpenPGP/Readme.md: -------------------------------------------------------------------------------- 1 | # Smart Card OpenPGP 2 | 3 | ## Project Status 4 | - [x] Code is working 5 | - [x] Code is optimized 6 | - [x] Code is beautified 7 | - [x] Usage info is provided 8 | - [x] Example is provided 9 | - [x] Profiling data are collected & interpreted 10 | - [x] Diploma thesis article is written 11 | 12 | ## Briefly about OpenPGP 13 | OpenPGP is an open-source implementation of the PGP protocol. PGP allows users to securely send and receive e-mails. GnuPG offers a possibility to use smart cards to store and use cryptographic keys. Smart Card OpenPGP implements an applet that is compatible with GnuPG. 14 | 15 | ## Usage 16 | The complete usage instructions can be found on GnuPG page: 17 | https://www.gnupg.org/howtos/card-howto/en/ch01.html 18 | 19 | To use this applet with GnuPG, use this PKG and AID when building a .cap file:\ 20 | PKG: D27600012401\ 21 | AID: D2760001240102000000000000010000 22 | 23 | ## Example 24 | ![OpenPGP on card](https://is.muni.cz/www/kewo/GPG_CLI_blur.png?1542469599284) 25 | 26 | ## Optimizations used 27 | * Inlined single-use private methods 28 | * Minimized number of method parameters 29 | * Changed some redundant function calls to constant values 30 | * Simplified conditional logic 31 | * Simplified structure 32 | * Removed all possible getters/setters 33 | * Fixed some incorrect constants 34 | 35 | ## Performance measurement results 36 | 37 | ### Speed: 38 | Unoptimized: 39 | ``` 40 | initial operations: 43 ms 41 | verify pin: 18 ms 42 | change pin: 46 ms 43 | encrypt/decrypt: 451 ms 44 | authenticate: 442 ms 45 | generate key: 34025 ms 46 | ``` 47 | Optimized: 48 | ``` 49 | initial operations: 27 ms 50 | verify pin: 18 ms 51 | change pin: 45 ms 52 | encrypt/decrypt: 410 ms 53 | authenticate: 403 ms 54 | generate key: 33857 ms 55 | ``` 56 | We see that optimizations didn't increase the speed radically, but we see a good improvement in initial setup: 43 milliseconds to 27 milliseconds. Even if this is very subtle improvement, it is faster by around 40 %. 57 | Quicker access to structures such as keys can be seen in all methods. The improvement is around 10 %. 58 | 59 | ### RAM: 60 | Unoptimized: 61 | ``` 62 | 1728 bytes 63 | ``` 64 | Optimized: 65 | ``` 66 | 1728 bytes 67 | ``` 68 | No improvement 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OptimizedJCAlgs 2 | Collection of open-source JavaCard crypto algorithms. Optimized for memory and speed with unified interface (where possible). 3 | See each algorithm's own readme file for more details. 4 | 5 | ### Featured algorithms: 6 | * AEGIS, ACORN, ASCON, CLOC, MORUS - Authenticated Encryption 7 | * TWINE, Zorro - Block Ciphers 8 | * SHA-3 - Message Digest 9 | * PBKDF2 - Key derivation 10 | * OpenPGP - extend your GnuPG with smart card! 11 | 12 | ### List of known JC crypto algs on GitHub: 13 | * Elliptic curves: [JCMathLib](https://github.com/OpenCryptoProject/JCMathLib) 14 | * Sha3 (Keccak): [JCSha3](https://github.com/MiragePV/JCSha3), [OptimizedJCAlgs](https://github.com/MiragePV/OptimizedJCAlgs) (Discontinued on JCSha3, continuing here; SHAKE not done yet) 15 | * [JCSWAlgs](https://github.com/JavaCardSpot-dev/JCSWAlgs) (don't blindly trust the code there) 16 | * Sha3 17 | * Sha512 18 | * AES 19 | * Twine Cipher (incorrect implementation there, correct here) 20 | * Zorro Cipher (correct implementation here, but the alg. design is not secure!) 21 | * [Primitives_SmartCard](https://github.com/albertocarp/Primitives_SmartCard/tree/master/src/sid) 22 | * Sha3 23 | * LBlock Cipher 24 | * Picollo Cipher 25 | * Rectangle Cipher 26 | * Authenticated Encryption: [AEonJC](https://github.com/palkrajesh/AEonJC) (well optimized) 27 | * AEGIS 28 | * ACORN 29 | * ASCON 30 | * CLOC 31 | * MORUS 32 | * [OpenPGP](https://github.com/jderuiter/javacard-openpgpcard) - open source PGP on JC 33 | * [LedgerHQ Wallet](https://github.com/LedgerHQ/ledger-javacard) - implementation of Ledger cryptocurrency wallet on JC 34 | * Password-based key derivation: [OptimizedJCAlgs](https://github.com/MiragePV/OptimizedJCAlgs) 35 | * PBKDF2 (Sha1, Sha256; single-block, 128-bit salt) (pretty slow) 36 | 37 | Profiling and optimization tools: 38 | * [JCProfiler](https://github.com/OpenCryptoProject/JCProfiler) 39 | * [MemoryMeasurement](https://github.com/maxashwin/JavaCard/tree/master/Wkg_MemoryMeasurementScript) 40 | * [JCAlgTest](https://github.com/crocs-muni/JCAlgTest) 41 | 42 | JC miracle people: [Martin Paljak](https://github.com/martinpaljak), [PetrS](https://github.com/petrs) 43 | * [JC-ant](https://github.com/martinpaljak/ant-javacard#syntax) 44 | * [Global Platform Pro](https://github.com/martinpaljak/GlobalPlatformPro) 45 | * [Applet Playground](https://github.com/martinpaljak/AppletPlayground) 46 | -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/lib/logging.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2010, 2010, Oracle and/or its affiliates. All rights reserved. 2 | 3 | # Properties file which configures the operation of the JDK 4 | # logging facility. 5 | 6 | # The system will look for this config file, first using 7 | # a System property specified at startup: 8 | # 9 | # >java -Djava.util.logging.config.file=myLoggingConfigFilePath 10 | # 11 | # If this property is not specified, then the config file is 12 | # retrieved from its default location at: 13 | # 14 | # JDK_HOME/jre/lib/logging.properties 15 | 16 | # Global logging properties. 17 | # ------------------------------------------ 18 | # The set of handlers to be loaded upon startup. 19 | # Comma-separated list of class names. 20 | # java.util.logging.ConsoleHandler 21 | handlers=com.sun.javacard.tools.util.JCConsoleHandler, java.util.logging.FileHandler 22 | 23 | # Default global logging level. 24 | # Loggers and Handlers may override this level 25 | .level=ALL 26 | 27 | # Loggers 28 | # ------------------------------------------ 29 | # Loggers are usually attached to packages. 30 | # Here, the level for each package is specified. 31 | # The global level is used by default, so levels 32 | # specified here simply act as an override. 33 | #com.sun.javacard.offcardinstaller=ALL 34 | 35 | # Handlers 36 | # ----------------------------------------- 37 | 38 | com.sun.javacard.tools.util.JCConsoleHandler.level=ALL 39 | com.sun.javacard.tools.util.JCConsoleHandler.formatter=com.sun.javacard.tools.util.JCToolsFormatter 40 | com.sun.javacard.tools.util.JCConsoleHandler.filter=com.sun.javacard.tools.util.ConsoleFilter 41 | 42 | # --- FileHandler --- 43 | # Override of global logging level 44 | java.util.logging.FileHandler.level=ALL 45 | 46 | # Naming style for the output file: 47 | # (The output file is placed in the directory 48 | # defined by the "user.home" System property.) 49 | java.util.logging.FileHandler.pattern=%h/java%u.log 50 | 51 | # Limiting size of output file in bytes: 52 | java.util.logging.FileHandler.limit=50000 53 | 54 | # Number of output files to cycle through, by appending an 55 | # integer to the base file name: 56 | java.util.logging.FileHandler.count=10 57 | 58 | # Style of output (Simple or XML): 59 | java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter 60 | 61 | java.util.logging.FileHandler.append=true 62 | 63 | #--------------print class method info 64 | printCurrentClassAndMethod = false 65 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/NullApp/javacard/NullApp.jca: -------------------------------------------------------------------------------- 1 | // converted by version 1.2 2 | // on Mon Apr 09 13:40:44 PDT 2001 3 | 4 | .package com/sun/javacard/samples/NullApp { 5 | .aid 0xA0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x3; 6 | .version 1.0; 7 | 8 | .imports { 9 | 0xA0:0x0:0x0:0x0:0x62:0x1:0x1 1.0; //javacard/framework 10 | } 11 | 12 | .applet { 13 | 0xA0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x3:0x1 NullApp; 14 | } 15 | 16 | .constantPool { 17 | // 0 18 | staticMethodRef 0.3.0()V; // javacard/framework/Applet.()V 19 | // 1 20 | virtualMethodRef 0.3.1()V; // javacard/framework/Applet.register()V 21 | // 2 22 | classRef NullApp; 23 | // 3 24 | staticMethodRef NullApp/(Ljavacard/framework/APDU;)V; 25 | .descriptor Ljavacard/framework/APDU; 0.10; 26 | 27 | // 4 28 | virtualMethodRef 0.10.1()[B; // javacard/framework/APDU.getBuffer()[B 29 | // 5 30 | staticMethodRef 0.16.5(BB)S; // javacard/framework/Util.makeShort(BB)S 31 | // 6 32 | staticMethodRef 0.7.1(S)V; // javacard/framework/ISOException.throwIt(S)V 33 | } 34 | 35 | .class public NullApp 0 extends 0.3 { // extends javacard/framework/Applet 36 | 37 | .publicMethodTable 7 { 38 | equals(Ljava/lang/Object;)Z; 39 | register()V; 40 | register([BSB)V; 41 | selectingApplet()Z; 42 | deselect()V; 43 | getShareableInterfaceObject(Ljavacard/framework/AID;B)Ljavacard/framework/Shareable;; 44 | select()Z; 45 | process(Ljavacard/framework/APDU;)V; 46 | } 47 | 48 | .packageMethodTable 0 { 49 | } 50 | 51 | .method protected (Ljavacard/framework/APDU;)V 0 { 52 | .stack 1; 53 | .locals 0; 54 | 55 | .descriptor Ljavacard/framework/APDU; 0.10; 56 | 57 | L0: aload_0; 58 | invokespecial 0; // javacard/framework/Applet.()V 59 | aload_0; 60 | invokevirtual 1; // javacard/framework/Applet.register()V 61 | return; 62 | } 63 | 64 | .method public static install([BSB)V 1 { 65 | .stack 2; 66 | .locals 0; 67 | 68 | L0: new 2; // com/sun/javacard/samples/NullApp/NullApp 69 | aconst_null; 70 | invokespecial 3; // com/sun/javacard/samples/NullApp/NullApp.(Ljavacard/framework/APDU;)V 71 | return; 72 | } 73 | 74 | .method public process(Ljavacard/framework/APDU;)V 7 { 75 | .stack 3; 76 | .locals 1; 77 | 78 | .descriptor Ljavacard/framework/APDU; 0.10; 79 | 80 | L0: aload_1; 81 | invokevirtual 4; // javacard/framework/APDU.getBuffer()[B 82 | astore_2; 83 | bspush 109; 84 | aload_2; 85 | sconst_1; 86 | baload; 87 | invokestatic 5; // javacard/framework/Util.makeShort(BB)S 88 | invokestatic 6; // javacard/framework/ISOException.throwIt(S)V 89 | return; 90 | } 91 | 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/src/demo/demo3.scr.expected.out: -------------------------------------------------------------------------------- 1 | CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 2 | CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 3 | CLA: 80, INS: 20, P1: 01, P2: 00, Lc: 0a, 61, a8, 22, 44, 66, 88, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 00, 00, 00, 07, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 4 | CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1b, 61, 0f, 21, Le: 0a, 61, a8, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 5 | CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 09, c4, 22, 44, 66, 88, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 61, a8, 00, 08, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 6 | CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1b, 61, 0f, 23, Le: 0a, 57, e4, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 7 | CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 8 | CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 9 | CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 08, f7, 33, 55, 77, 99, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 57, e4, 00, 09, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 10 | CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1b, 61, 11, 2d, Le: 0a, 4e, ed, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 11 | CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 01, Le: 11, 6f, 0f, 84, 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 02, 03, a5, 01, 42, SW1: 90, SW2: 00 12 | CLA: 00, INS: 20, P1: 00, P2: 82, Lc: 04, 01, 02, 03, 04, Le: 00, SW1: 90, SW2: 00 13 | CLA: 00, INS: b2, P1: 01, P2: 24, Lc: 00, Le: 06, 4e, ed, 7d, 00, 4e, 20, SW1: 90, SW2: 00 14 | CLA: 00, INS: b2, P1: 01, P2: 1c, Lc: 00, Le: 12, 00, 09, 02, 08, f7, 33, 55, 77, 99, 0a, 1b, 61, 11, 2d, 4e, ed, 90, 00, SW1: 90, SW2: 00 15 | CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 03, da, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4e, ed, 00, 0a, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 16 | CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 0a, 4b, 13, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 17 | CLA: 80, INS: 20, P1: 02, P2: 00, Lc: 0a, 4b, 13, 33, 44, 55, 66, 00, 00, 00, 00, Le: 13, 05, 05, 05, 05, 0c, 1f, 62, 4b, 13, 00, 0b, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 18 | CLA: 80, INS: 22, P1: 00, P2: 00, Lc: 0d, 00, 00, 00, 00, 00, 00, 00, 00, 0a, 1c, 61, 12, 35, Le: 0a, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, SW1: 90, SW2: 00 19 | CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 0a, a0, 00, 00, 00, 62, 03, 01, 0c, 05, 01, Le: 00, SW1: 90, SW2: 00 20 | CLA: 90, INS: 20, P1: 00, P2: 00, Lc: 00, Le: 02, 00, 16, SW1: 90, SW2: 00 21 | CLA: 90, INS: 22, P1: 00, P2: 00, Lc: 00, Le: 00, SW1: 90, SW2: 00 22 | -------------------------------------------------------------------------------- /OpenPGP/src/PGPKey.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Java Card implementation of the OpenPGP card 3 | * Copyright (C) 2011 Joeri de Ruiter 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | */ 19 | package openpgp; 20 | 21 | import javacard.framework.*; 22 | import javacard.security.*; 23 | 24 | /** 25 | * @author Joeri de Ruiter (joeri@cs.ru.nl) 26 | * @review Matej Evin 27 | */ 28 | public class PGPKey implements ISO7816 { 29 | 30 | // Constants 31 | public static final short KEY_SIZE = 2048; 32 | public static final short KEY_SIZE_BYTES = KEY_SIZE / 8; // 256 33 | public static final short EXPONENT_SIZE = 17; 34 | public static final short EXPONENT_SIZE_BYTES = 3; 35 | public static final short FP_SIZE = 20; // Fingerprint size 36 | public static final short TIME_SIZE = 4; // Time size 37 | public static final short ATTR_SIZE = 6; // Attributes array size 38 | 39 | // Macros 40 | public static final short _0 = (short) 0; 41 | 42 | // Key structure 43 | final KeyPair key; 44 | final byte[] fp; 45 | final byte[] time = { 0x00, 0x00, 0x00, 0x00 }; 46 | final byte[] attributes = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x02 }; 47 | 48 | // Constructor 49 | public PGPKey() { 50 | key = new KeyPair(KeyPair.ALG_RSA_CRT, KEY_SIZE); 51 | 52 | fp = new byte[FP_SIZE]; 53 | Util.arrayFillNonAtomic(fp, _0, FP_SIZE, (byte) 0); 54 | 55 | Util.setShort(attributes, (short) 1, KEY_SIZE); 56 | Util.setShort(attributes, (short) 3, EXPONENT_SIZE); 57 | } 58 | 59 | //Set the fingerprint for the public key. 60 | public void setFingerprint(byte[] data, short offset) { 61 | // Check whether there are enough bytes to copy 62 | if ((short) (offset + FP_SIZE) > data.length) 63 | throw new CryptoException(CryptoException.ILLEGAL_VALUE); 64 | 65 | Util.arrayCopy(data, offset, fp, _0, FP_SIZE); 66 | } 67 | 68 | // Set the generation time for the key pair. 69 | public void setTime(byte[] data, short offset) { 70 | // Check whether there are enough bytes to copy 71 | if ((short) (offset + TIME_SIZE) > data.length) 72 | throw new CryptoException(CryptoException.ILLEGAL_VALUE); 73 | 74 | Util.arrayCopy(data, offset, time, _0, TIME_SIZE); 75 | } 76 | 77 | //Get the fingerprint for the public key. 78 | public short getFingerprint(byte[] data, short offset) { 79 | Util.arrayCopyNonAtomic(fp, _0, data, offset, FP_SIZE); 80 | return (short) (offset + FP_SIZE); 81 | } 82 | 83 | //Get the generation time for the key pair. 84 | public short getTime(byte[] data, short offset) { 85 | Util.arrayCopyNonAtomic(time, _0, data, offset, TIME_SIZE); 86 | return (short) (offset + TIME_SIZE); 87 | } 88 | 89 | //Get the algorithm attributes for the key pair. 90 | public short getAttributes(byte[] data, short offset) { 91 | Util.arrayCopyNonAtomic(attributes, _0, data, offset, ATTR_SIZE); 92 | return (short) (offset + ATTR_SIZE); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /Pbkdf2/Readme.md: -------------------------------------------------------------------------------- 1 | # Password-Based Key Derivation Function 2 (PBKDF2) 2 | 3 | ## Project Status 4 | - [x] Code is working 5 | - [x] Code is optimized 6 | - [x] Code is beautified 7 | - [x] Usage info is provided 8 | - [x] Example is provided 9 | - [x] Profiling data are collected & interpreted 10 | - [x] Side-channel vulnerability data are collected 11 | - [x] Diploma thesis article is written 12 | 13 | ## Briefly about PBKDF2 14 | Password-Based Key Derivation Function 2 is exactly how it sounds. You provide a password+salt, and it will spit out a strong cryptographic key. 15 | It iterates as many times as needed (more iterations = more security), computng and xoring HMAC over and over, together with salt. 16 | This implementation offers HMAC_SHA-1 and HMAC_SHA-256, and maximum salt length of 16 bytes. 17 | 18 | ## Usage 19 | PBKDF2 doesn't extend any other class, because it requires specific inputs, but imitates the usage of MessageDigest. 20 | The constructor is protected, therefore the only way to instantiate PBKDF2 is through the getInstance() method. 21 | ### Interface: 22 | Create PBKDF2 instance: 23 | ````java 24 | public static PBKDF2 getInstance(byte algorithm) { 25 | 26 | 27 | algorithm // either ALG_SHA or ALG_SHA256 28 | return // the instance of PBKDF2 29 | throws NO_SUCH_ALGORITHM // if input algorithm is different 30 | ```` 31 | Compute key: 32 | ````java 33 | public short doFinal(byte[] password, short passwordOffset, short passwordLength, 34 | byte[] salt, short saltOffset, short saltLength, 35 | short iterations, 36 | byte[] out, short outOffset) 37 | 38 | password // password to make key from 39 | passwordOffset // password buffer offset 40 | passwordLength // password buffer length 41 | salt // salt input buffer 42 | saltOffset // salt input buffer offset 43 | saltLength // salt input buffer length 44 | iterations // number of iterations of computation 45 | out // output buffer 46 | outOffset // output buffer offset 47 | return // the length of processed data (length of mesageDigest; 20 for SHA-1, 32 for SHA-256) 48 | throws ILLEGAL_USE // if saltLength is longer than 16 bytes 49 | ```` 50 | 51 | ## Example 52 | Simple example how to create, instantiate and use PBKDF2 in the JavaCard applet: 53 | ```` java 54 | // create entities 55 | private PBKDF2 m_pbkdf2 = null; //password digest 56 | 57 | // instantiate the 128-bit cipher and key 58 | m_pbkdf2 = PBKDF2.getInstance(PBKDF2.ALG_SHA); 59 | 60 | 61 | // create key from password "password" and salt "salt": 62 | // m_ramArray1 = {0x70, 0x61, 0x73, 0x73, 0x77, 0x6F, 0x72, 0x64} 63 | // m_ramArray2 = {0x73, 0x61, 0x6C, 0x74} 64 | short ret = m_pbkdf2.doFinal(m_ramArray1, (short) 0, (short) 8, m_ramArray2, (short) 0, (short) 4, (short) 1, m_ramArray3, (short) 0); 65 | ```` 66 | 67 | ## Optimizations used 68 | * Removed redundant arrays (RAM saving) 69 | * Minimized number of method parameters (worse readability but faster) 70 | * Code beautification (better readability) 71 | * Added hardware HMAC possibility, which is much faster, but it may not work on all cards 72 | 73 | ## Performance measurement results 74 | PBKDF2 using HMAC_SHA1 with input data: "password" and "salt", with 512 iterations: 75 | ``` 76 | invoke doFinal: 0 ms 77 | first HMAC invoke: 7 ms 78 | if statement: 1 ms 79 | XOR + arrayCopy: 26 ms 80 | hash: 3 ms 81 | copy array: 5 ms 82 | out of hmac: 7 ms 83 | 84 | 511 hmacs: 23296 ms 85 | 86 | one hmac avg: ~45 ms 87 | ``` 88 | PBKDF2 using HMAC_SHA256 with same input: 89 | ``` 90 | 512 hmacs: 28350 ms 91 | 92 | one hmac avg: ~55 ms 93 | ``` 94 | We see that if we wanted to comply with Kerberos' HMAC_SHA256 with 4096 iterations, it would take at least 3 minutes and 47 seconds. 95 | -------------------------------------------------------------------------------- /AEAD/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /Sha3/Readme.md: -------------------------------------------------------------------------------- 1 | # Sha3 Keccak 2 | 3 | ## Project Status 4 | - [x] Code is working 5 | - [ ] SHAKE is implemented (optional) 6 | - [x] Code is optimized 7 | - [x] Code is beautified 8 | - [x] Usage info is provided 9 | - [x] Example is provided 10 | - [x] Profiling data are collected & interpreted 11 | - [x] Side-channel vulnerability data are collected 12 | - [x] Diploma thesis article is written 13 | 14 | ## Briefly about Sha3 15 | SHA-3 is the new hashing standard approved in 2015. It doesn't serve as a replacement for SHA-2, raher serves as an alternative since it uses quite different computation than SHA-1 and SHA-2 do. It's reasonably fast while providing great security. It also provides Extensible Output Functions that allows users to get output of arbitrary length (not implemented here, yet). 16 | ## Usage 17 | SHA-3 extends the MessageDigest class, therefore you are able to use it the same way you would use any other message digest algorithm. 18 | The constructor is protected, therefore the only way to instantiate Sha3 is through the getInstance() method. 19 | ### Interface: 20 | Create SHA-3 instance: 21 | ````java 22 | public static Sha3 getInstance(byte algorithm) 23 | 24 | algorithm // ALG_SHA3_224 or ALG_SHA3_256 or ALG_SHA3_384 or ALG_SHA3_512 25 | return // the instance of SHA-3 engine 26 | throws NO_SUCH_ALGORITHM // if algorithm is unsupported 27 | ```` 28 | Reset SHA-3 to its initial state: 29 | ```` java 30 | public void reset() 31 | ```` 32 | Sponge absorb data: 33 | ```` java 34 | public void update(byte[] inBuff, short inOffset, short inLength) 35 | 36 | inBuff // input buffer 37 | inOffset // input buffer offset 38 | inLength // input buffer length 39 | ```` 40 | Sponge absorb last piece of data and squeeze: 41 | ````java 42 | public short doFinal(byte[] inBuff, short inOffset, short inLength, byte[] outBuff, short outOffset) throws CryptoException { 43 | 44 | inBuff // input buffer 45 | inOffset // input buffer offset 46 | inLength // input buffer length 47 | outBuff // output buffer 48 | outOffset // output buffer offset 49 | return // the length of processed data 50 | ```` 51 | Get SHA-3 algorithm tag: 52 | ```` java 53 | public byte getAlgorithm() 54 | 55 | return // ALG_SHA3_224 or ALG_SHA3_256 or ALG_SHA3_384 or ALG_SHA3_512 (7/8/9/10) 56 | ```` 57 | 58 | Get SHA-3 message digest length: 59 | ```` java 60 | public byte getLength() 61 | 62 | return // 28 or 32 or 48 or 64 63 | ```` 64 | ## Example 65 | ````java 66 | //create entity 67 | private MessageDigest m_sha3 = null; 68 | 69 | // instantiate 256-bit algorithm 70 | m_sha3 = Sha3.getInstance(Sha3.ALG_SHA3_256); 71 | 72 | // digest 17 bytes of data 73 | short ret1 = m_sha3.doFinal(m_ramArray1, (short) 0, (short) 17, apdubuf, (short) 0); 74 | ```` 75 | ## Optimizations used 76 | * Changed the naive and abnormally slow bitwise operation into a godly superfast one (well, as much as it gets) 77 | * Unrolled several loops 78 | * Got rid of redundant code 79 | * Changed visibility of non-interface methods to package-only or private (safer) 80 | * Minimized number of method parameters (worse readability but faster) 81 | * Beautified code (better readability) 82 | * Created proper MessageDigest interface 83 | 84 | ## Measurement results 85 | 86 | ### Speed 87 | Unrolled for loops: 88 | ``` 89 | init: 17 ms 90 | swap endian: 16 ms 91 | theta (arrayCopy and XOR): 25 ms 92 | theta (copy, XOR, rotlW): 59 ms 93 | rho+pi (24x rotlW): 112 ms 94 | chi (copy and negate): 96 ms 95 | swap endian: 22 ms 96 | Keccakf (24 rounds): 6746 ms 97 | ``` 98 | Classic for loops: 99 | ``` 100 | init: 18 ms 101 | swap endian: 15 ms 102 | theta (arrayCopy and XOR): 27 ms 103 | theta (copy, XOR, rotlW): 58 ms 104 | rho+pi (24x rotlW): 110 ms 105 | chi (copy and negate): 99 ms 106 | swap endian: 19 ms 107 | Keccakf (24 rounds): 6813 ms 108 | ``` 109 | ### RAM 110 | 111 | ``` 112 | 257 bytes 113 | ``` 114 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/HelloWorld/javacard/HelloWorld.jca: -------------------------------------------------------------------------------- 1 | // converted by version 1.2 2 | // on Mon Apr 09 13:40:46 PDT 2001 3 | 4 | .package com/sun/javacard/samples/HelloWorld { 5 | .aid 0xA0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x1; 6 | .version 1.0; 7 | 8 | .imports { 9 | 0xA0:0x0:0x0:0x0:0x62:0x1:0x1 1.0; //javacard/framework 10 | } 11 | 12 | .applet { 13 | 0xA0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x1:0x1 HelloWorld; 14 | } 15 | 16 | .constantPool { 17 | // 0 18 | instanceFieldRef byte[] HelloWorld/echoBytes; 19 | // 1 20 | staticMethodRef 0.3.0()V; // javacard/framework/Applet.()V 21 | // 2 22 | virtualMethodRef 0.3.1()V; // javacard/framework/Applet.register()V 23 | // 3 24 | classRef HelloWorld; 25 | // 4 26 | staticMethodRef HelloWorld/()V; 27 | // 5 28 | virtualMethodRef 0.10.1()[B; // javacard/framework/APDU.getBuffer()[B 29 | // 6 30 | virtualMethodRef 0.10.6()S; // javacard/framework/APDU.setIncomingAndReceive()S 31 | // 7 32 | virtualMethodRef 0.10.7()S; // javacard/framework/APDU.setOutgoing()S 33 | // 8 34 | virtualMethodRef 0.10.9(S)V; // javacard/framework/APDU.setOutgoingLength(S)V 35 | // 9 36 | virtualMethodRef 0.10.4(SS)V; // javacard/framework/APDU.sendBytes(SS)V 37 | // 10 38 | virtualMethodRef 0.10.5([BSS)V; // javacard/framework/APDU.sendBytesLong([BSS)V 39 | // 11 40 | staticMethodRef 0.16.2([BS[BSS)S; // javacard/framework/Util.arrayCopyNonAtomic([BS[BSS)S 41 | // 12 42 | virtualMethodRef 0.10.3(S)S; // javacard/framework/APDU.receiveBytes(S)S 43 | } 44 | 45 | .class public HelloWorld 0 extends 0.3 { // extends javacard/framework/Applet 46 | 47 | .fields { 48 | private byte[] echoBytes 0; // [B 49 | private static final short LENGTH_ECHO_BYTES = 256; // S 50 | } 51 | 52 | .publicMethodTable 7 { 53 | equals(Ljava/lang/Object;)Z; 54 | register()V; 55 | register([BSB)V; 56 | selectingApplet()Z; 57 | deselect()V; 58 | getShareableInterfaceObject(Ljavacard/framework/AID;B)Ljavacard/framework/Shareable;; 59 | select()Z; 60 | process(Ljavacard/framework/APDU;)V; 61 | } 62 | 63 | .packageMethodTable 0 { 64 | } 65 | 66 | .method protected ()V 0 { 67 | .stack 2; 68 | .locals 0; 69 | 70 | L0: aload_0; 71 | invokespecial 1; // javacard/framework/Applet.()V 72 | aload_0; 73 | sspush 256; 74 | newarray 11; 75 | putfield_a 0; // reference com/sun/javacard/samples/HelloWorld/HelloWorld.echoBytes 76 | aload_0; 77 | invokevirtual 2; // javacard/framework/Applet.register()V 78 | return; 79 | } 80 | 81 | .method public static install([BSB)V 1 { 82 | .stack 1; 83 | .locals 0; 84 | 85 | L0: new 3; // com/sun/javacard/samples/HelloWorld/HelloWorld 86 | invokespecial 4; // com/sun/javacard/samples/HelloWorld/HelloWorld.()V 87 | return; 88 | } 89 | 90 | .method public process(Ljavacard/framework/APDU;)V 7 { 91 | .stack 5; 92 | .locals 3; 93 | 94 | .descriptor Ljavacard/framework/APDU; 0.10; 95 | 96 | L0: aload_1; 97 | invokevirtual 5; // javacard/framework/APDU.getBuffer()[B 98 | astore_2; 99 | aload_1; 100 | invokevirtual 6; // javacard/framework/APDU.setIncomingAndReceive()S 101 | sstore_3; 102 | sconst_0; 103 | sstore 4; 104 | goto L2; 105 | L1: aload_2; 106 | sconst_5; 107 | getfield_a_this 0; // reference com/sun/javacard/samples/HelloWorld/HelloWorld.echoBytes 108 | sload 4; 109 | sload_3; 110 | invokestatic 11; // javacard/framework/Util.arrayCopyNonAtomic([BS[BSS)S 111 | pop; 112 | sload 4; 113 | sload_3; 114 | sadd; 115 | sstore 4; 116 | aload_1; 117 | sconst_5; 118 | invokevirtual 12; // javacard/framework/APDU.receiveBytes(S)S 119 | sstore_3; 120 | L2: sload_3; 121 | ifgt L1; 122 | L3: aload_1; 123 | invokevirtual 7; // javacard/framework/APDU.setOutgoing()S 124 | pop; 125 | aload_1; 126 | sload 4; 127 | sconst_5; 128 | sadd; 129 | invokevirtual 8; // javacard/framework/APDU.setOutgoingLength(S)V 130 | aload_1; 131 | sconst_0; 132 | sconst_5; 133 | invokevirtual 9; // javacard/framework/APDU.sendBytes(SS)V 134 | aload_1; 135 | getfield_a_this 0; // reference com/sun/javacard/samples/HelloWorld/HelloWorld.echoBytes 136 | sconst_0; 137 | sload 4; 138 | invokevirtual 10; // javacard/framework/APDU.sendBytesLong([BSS)V 139 | return; 140 | } 141 | 142 | } 143 | 144 | } 145 | -------------------------------------------------------------------------------- /Twine/src/TwineApplet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TODO CHANGE IDs 3 | * PACKAGEID: 41 45 47 49 53 3A // 4 | * APPLETID: 41 45 47 49 53 3A 50 04 47 ./ 5 | */ 6 | package applets; 7 | 8 | import javacard.framework.APDU; 9 | import javacard.framework.ISO7816; 10 | import javacard.framework.ISOException; 11 | import javacard.framework.JCSystem; 12 | import javacard.security.AESKey; 13 | import javacard.security.KeyBuilder; 14 | import javacardx.crypto.Cipher; 15 | 16 | /** 17 | * 18 | * @author Matej Evin 19 | * 6th March 2018 20 | */ 21 | public class TwineApplet extends javacard.framework.Applet 22 | { 23 | // MAIN INSTRUCTION CLASS 24 | final static byte CLA_SIMPLEAPPLET = (byte) 0xB0; 25 | 26 | // INSTRUCTIONS 27 | final static byte INS_TWINE_ENCRYPT = (byte) 0x61; 28 | 29 | //Constants 30 | final static short ARRAY_LENGTH = (short) 0xff; 31 | 32 | //Error codes 33 | final static short SW_OBJECT_NOT_AVAILABLE = (short) 0x6711; 34 | 35 | private Cipher m_twine = null; 36 | private AESKey m_aes = null; 37 | 38 | // TEMPORARRY ARRAY IN RAM 39 | private byte m_ramArray1[] = null; 40 | 41 | private final byte[] TWINE_KEY = { 42 | (byte) 0x00, (byte) 0x11, (byte) 0x22, (byte) 0x33, 43 | (byte) 0x44, (byte) 0x55, (byte) 0x66, (byte) 0x77, 44 | (byte) 0x88, (byte) 0x99, (byte) 0xAA, (byte) 0xBB, 45 | (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF }; 46 | 47 | /** 48 | * AegisApplet constructor 49 | * Only this class's install method should create the applet object. 50 | */ 51 | protected TwineApplet(byte[] buffer, short offset, byte length) 52 | { 53 | 54 | // data offset is used for application specific parameter. 55 | // initialization with default offset (AID offset). 56 | short dataOffset = offset; 57 | boolean isOP2 = false; 58 | 59 | if(length > 9) { 60 | 61 | // shift to privilege offset 62 | dataOffset += (short)( 1 + buffer[offset]); 63 | // finally shift to Application specific offset 64 | dataOffset += (short)( 1 + buffer[dataOffset]); 65 | 66 | // go to proprietary data 67 | dataOffset++; 68 | 69 | // TEMPORARY BUFFER USED FOR FAST OPERATION WITH MEMORY LOCATED IN RAM 70 | m_ramArray1 = JCSystem.makeTransientByteArray((short) 0xff, JCSystem.CLEAR_ON_DESELECT); 71 | 72 | // prepare key 73 | m_aes = (AESKey) KeyBuilder.buildKey(KeyBuilder.TYPE_AES, KeyBuilder.LENGTH_AES_128, false); 74 | m_aes.setKey(TWINE_KEY, (short) 0); 75 | 76 | // prepare cipher engine 77 | m_twine = TwineCipher.getInstance(TwineCipher.TWINE_CIPHER_128); 78 | 79 | // update flag 80 | isOP2 = true; 81 | 82 | } else {} 83 | register(); 84 | } 85 | 86 | public static void install(byte[] bArray, short bOffset, byte bLength) throws ISOException 87 | { 88 | new TwineApplet(bArray, bOffset, bLength); 89 | } 90 | 91 | public boolean select() 92 | { 93 | return true; 94 | } 95 | 96 | public void deselect() { } 97 | 98 | public void process(APDU apdu) throws ISOException 99 | { 100 | // get the APDU buffer 101 | byte[] apduBuffer = apdu.getBuffer(); 102 | 103 | // ignore the applet select command dispatched to the process 104 | if (selectingApplet()) 105 | return; 106 | 107 | // APDU instruction parser 108 | if (apduBuffer[ISO7816.OFFSET_CLA] == CLA_SIMPLEAPPLET) { 109 | switch ( apduBuffer[ISO7816.OFFSET_INS] ) 110 | { 111 | case INS_TWINE_ENCRYPT: 112 | Twine_encrypt(apdu); 113 | break; 114 | 115 | default : 116 | // The INS code is not supported by the dispatcher 117 | ISOException.throwIt( ISO7816.SW_INS_NOT_SUPPORTED ) ; 118 | break ; 119 | 120 | } 121 | } 122 | else ISOException.throwIt( ISO7816.SW_CLA_NOT_SUPPORTED); 123 | } 124 | 125 | 126 | public void Twine_encrypt(APDU apdu){ 127 | byte[] apdubuf = apdu.getBuffer(); 128 | short dataLen = apdu.setIncomingAndReceive(); 129 | 130 | // initiate Twine cipher 131 | m_twine.init(m_aes, Cipher.MODE_ENCRYPT); 132 | 133 | //test vectors: 134 | //3a 8a 2c 2b 2d d5 4e d2 <- 80bit key 135 | //97 9f f9 b3 79 b5 a9 b8 <- 128bit key 136 | 137 | //plaintext 138 | m_ramArray1[0] = (byte) 0x01; 139 | m_ramArray1[1] = (byte) 0x23; 140 | m_ramArray1[2] = (byte) 0x45; 141 | m_ramArray1[3] = (byte) 0x67; 142 | m_ramArray1[4] = (byte) 0x89; 143 | m_ramArray1[5] = (byte) 0xab; 144 | m_ramArray1[6] = (byte) 0xcd; 145 | m_ramArray1[7] = (byte) 0xef; 146 | 147 | 148 | short ret = m_twine.doFinal(m_ramArray1, (short) 0, (short) 8, apdubuf, ISO7816.OFFSET_CDATA); 149 | 150 | // SEND OUTGOING BUFFER 151 | apdu.setOutgoingAndSend(ISO7816.OFFSET_CDATA, ret); 152 | 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /Zorro/src/ZorroApplet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TODO CHANGE IDs 3 | * PACKAGEID: 41 45 47 49 53 3A // 4 | * APPLETID: 41 45 47 49 53 3A 50 04 47 ./ 5 | */ 6 | package applets; 7 | 8 | import javacard.framework.APDU; 9 | import javacard.framework.ISO7816; 10 | import javacard.framework.ISOException; 11 | import javacard.framework.JCSystem; 12 | import javacard.security.AESKey; 13 | import javacard.security.KeyBuilder; 14 | import javacardx.crypto.Cipher; 15 | 16 | /** 17 | * 18 | * @author Matej Evin 19 | * 6th March 2018 20 | */ 21 | public class ZorroApplet extends javacard.framework.Applet 22 | { 23 | // MAIN INSTRUCTION CLASS 24 | final static byte CLA_SIMPLEAPPLET = (byte) 0xB0; 25 | 26 | // INSTRUCTIONS 27 | final static byte INS_ZORRO_ENCRYPT = (byte) 0x61; 28 | 29 | //Constants 30 | final static short ARRAY_LENGTH = (short) 0xff; 31 | 32 | //Error codes 33 | final static short SW_OBJECT_NOT_AVAILABLE = (short) 0x6711; 34 | 35 | private Cipher m_zorro = null; 36 | private AESKey m_aes = null; 37 | 38 | // TEMPORARRY ARRAY IN RAM 39 | private byte m_ramArray1[] = null; 40 | 41 | private final byte[] ZORRO_KEY = { 42 | (byte) 0x00, (byte) 0x11, (byte) 0x22, (byte) 0x33, 43 | (byte) 0x44, (byte) 0x55, (byte) 0x66, (byte) 0x77, 44 | (byte) 0x88, (byte) 0x99, (byte) 0xAA, (byte) 0xBB, 45 | (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF }; 46 | 47 | /** 48 | * AegisApplet constructor 49 | * Only this class's install method should create the applet object. 50 | */ 51 | protected ZorroApplet(byte[] buffer, short offset, byte length) 52 | { 53 | 54 | // data offset is used for application specific parameter. 55 | // initialization with default offset (AID offset). 56 | short dataOffset = offset; 57 | boolean isOP2 = false; 58 | 59 | if(length > 9) { 60 | 61 | // shift to privilege offset 62 | dataOffset += (short)( 1 + buffer[offset]); 63 | // finally shift to Application specific offset 64 | dataOffset += (short)( 1 + buffer[dataOffset]); 65 | 66 | // go to proprietary data 67 | dataOffset++; 68 | 69 | // TEMPORARY BUFFER USED FOR FAST OPERATION WITH MEMORY LOCATED IN RAM 70 | m_ramArray1 = JCSystem.makeTransientByteArray((short) 0xff, JCSystem.CLEAR_ON_DESELECT); 71 | 72 | m_aes = (AESKey) KeyBuilder.buildKey(KeyBuilder.TYPE_AES, KeyBuilder.LENGTH_AES_128, false); 73 | m_aes.setKey(ZORRO_KEY, (short) 0); 74 | 75 | m_zorro = ZorroCipher.getInstance(); 76 | 77 | // update flag 78 | isOP2 = true; 79 | 80 | } else {} 81 | register(); 82 | } 83 | 84 | public static void install(byte[] bArray, short bOffset, byte bLength) throws ISOException 85 | { 86 | new ZorroApplet(bArray, bOffset, bLength); 87 | } 88 | 89 | public boolean select() 90 | { 91 | return true; 92 | } 93 | 94 | public void deselect() { } 95 | 96 | public void process(APDU apdu) throws ISOException 97 | { 98 | // get the APDU buffer 99 | byte[] apduBuffer = apdu.getBuffer(); 100 | 101 | // ignore the applet select command dispatched to the process 102 | if (selectingApplet()) 103 | return; 104 | 105 | // APDU instruction parser 106 | if (apduBuffer[ISO7816.OFFSET_CLA] == CLA_SIMPLEAPPLET) { 107 | switch ( apduBuffer[ISO7816.OFFSET_INS] ) 108 | { 109 | case INS_ZORRO_ENCRYPT: 110 | Zorro_encrypt(apdu); 111 | break; 112 | 113 | default : 114 | // The INS code is not supported by the dispatcher 115 | ISOException.throwIt( ISO7816.SW_INS_NOT_SUPPORTED ) ; 116 | break ; 117 | 118 | } 119 | } 120 | else ISOException.throwIt( ISO7816.SW_CLA_NOT_SUPPORTED); 121 | } 122 | 123 | 124 | public void Zorro_encrypt(APDU apdu){ 125 | byte[] apdubuf = apdu.getBuffer(); 126 | short dataLen = apdu.setIncomingAndReceive(); 127 | 128 | m_zorro.init(m_aes, Cipher.MODE_ENCRYPT); 129 | 130 | //test vector: 131 | // key: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 132 | // pt: 01 23 45 67 89 ab cd ef 01 23 45 67 89 ab cd ef 133 | // ct: 11 52 00 a7 25 d1 4c ad 9b f8 0b dd 79 f6 94 39 (90 00) 134 | 135 | //plaintext 136 | m_ramArray1[0] = (byte) 0x01; 137 | m_ramArray1[1] = (byte) 0x23; 138 | m_ramArray1[2] = (byte) 0x45; 139 | m_ramArray1[3] = (byte) 0x67; 140 | m_ramArray1[4] = (byte) 0x89; 141 | m_ramArray1[5] = (byte) 0xab; 142 | m_ramArray1[6] = (byte) 0xcd; 143 | m_ramArray1[7] = (byte) 0xef; 144 | 145 | m_ramArray1[8] = (byte) 0x01; 146 | m_ramArray1[9] = (byte) 0x23; 147 | m_ramArray1[10] = (byte) 0x45; 148 | m_ramArray1[11] = (byte) 0x67; 149 | m_ramArray1[12] = (byte) 0x89; 150 | m_ramArray1[13] = (byte) 0xab; 151 | m_ramArray1[14] = (byte) 0xcd; 152 | m_ramArray1[15] = (byte) 0xef; 153 | 154 | short ret = m_zorro.doFinal(m_ramArray1, (short) 0, (short) 16, apdubuf, ISO7816.OFFSET_CDATA); 155 | 156 | // SEND OUTGOING BUFFER 157 | apdu.setOutgoingAndSend(ISO7816.OFFSET_CDATA, ret); 158 | 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /Sha3/src/Sha3Applet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TODO CHANGE IDs 3 | * PACKAGEID: 41 45 47 49 53 3A // 4 | * APPLETID: 41 45 47 49 53 3A 50 04 47 ./ 5 | */ 6 | package applets; 7 | 8 | import javacard.framework.*; 9 | import javacard.security.MessageDigest; 10 | 11 | /** 12 | * 13 | * @author Matej Evin 14 | * 6th March 2018 15 | */ 16 | public class Sha3Applet extends javacard.framework.Applet 17 | { 18 | // MAIN INSTRUCTION CLASS 19 | final static byte CLA_SIMPLEAPPLET = (byte) 0xB0; 20 | 21 | // INSTRUCTIONS 22 | final static byte INS_MESSAGE_DIGEST = (byte) 0x61; 23 | 24 | //Constants 25 | final static short ARRAY_LENGTH = (short) 0xff; 26 | 27 | //Error codes 28 | final static short SW_OBJECT_NOT_AVAILABLE = (short) 0x6711; 29 | 30 | private MessageDigest m_keccak = null; //Keccak message digest 31 | //private MessageDigest m_sha2 = null; //sha2 message digest 32 | 33 | // TEMPORARRY ARRAY IN RAM 34 | private byte m_ramArray1[] = null; 35 | 36 | /** 37 | * AegisApplet constructor 38 | * Only this class's install method should create the applet object. 39 | */ 40 | protected Sha3Applet(byte[] buffer, short offset, byte length) 41 | { 42 | 43 | // data offset is used for application specific parameter. 44 | // initialization with default offset (AID offset). 45 | short dataOffset = offset; 46 | boolean isOP2 = false; 47 | 48 | if(length > 9) { 49 | 50 | // shift to privilege offset 51 | dataOffset += (short)( 1 + buffer[offset]); 52 | // finally shift to Application specific offset 53 | dataOffset += (short)( 1 + buffer[dataOffset]); 54 | 55 | // go to proprietary data 56 | dataOffset++; 57 | 58 | // TEMPORARY BUFFER USED FOR FAST OPERATION WITH MEMORY LOCATED IN RAM 59 | m_ramArray1 = JCSystem.makeTransientByteArray((short) 0xff, JCSystem.CLEAR_ON_DESELECT); 60 | 61 | //compare with sha2 62 | //m_sha2 = MessageDigest.getInstance(MessageDigest.ALG_SHA_256, false); 63 | 64 | // update flag 65 | isOP2 = true; 66 | 67 | } else {} 68 | register(); 69 | } 70 | 71 | /** 72 | * Method installing the applet. 73 | * @param bArray the array containing installation parameters 74 | * @param bOffset the starting offset in bArray 75 | * @param bLength the length in bytes of the data parameter in bArray 76 | */ 77 | public static void install(byte[] bArray, short bOffset, byte bLength) throws ISOException 78 | { 79 | // no parameters needed 80 | //new Sha3Applet(); 81 | new Sha3Applet(bArray, bOffset, bLength); 82 | } 83 | 84 | /** 85 | * Select method returns true if applet selection is supported. 86 | * @return boolean status of selection. 87 | */ 88 | public boolean select() 89 | { 90 | // 91 | return true; 92 | } 93 | 94 | /** 95 | * Deselect method called by the system in the deselection process. 96 | */ 97 | public void deselect() 98 | { 99 | // 100 | return; 101 | } 102 | 103 | /** 104 | * Method processing an incoming APDU. 105 | * @see APDU 106 | * @param apdu the incoming APDU 107 | * @exception ISOException with the response bytes defined by ISO 7816-4 108 | */ 109 | public void process(APDU apdu) throws ISOException 110 | { 111 | // get the APDU buffer 112 | byte[] apduBuffer = apdu.getBuffer(); 113 | 114 | // ignore the applet select command dispatched to the process 115 | if (selectingApplet()) 116 | return; 117 | 118 | // APDU instruction parser 119 | if (apduBuffer[ISO7816.OFFSET_CLA] == CLA_SIMPLEAPPLET) { 120 | switch ( apduBuffer[ISO7816.OFFSET_INS] ) 121 | { 122 | case 0x00: computeKeccak(apdu, Keccak.ALG_SHA3_224); break; 123 | case 0x01: computeKeccak(apdu, Keccak.ALG_SHA3_256); break; 124 | case 0x02: computeKeccak(apdu, Keccak.ALG_SHA3_384); break; 125 | case 0x03: computeKeccak(apdu, Keccak.ALG_SHA3_512); break; 126 | case 0x04: computeKeccak(apdu, Keccak.ALG_KECCAK_224); break; 127 | case 0x05: computeKeccak(apdu, Keccak.ALG_KECCAK_256); break; 128 | case 0x06: computeKeccak(apdu, Keccak.ALG_KECCAK_384); break; 129 | case 0x07: computeKeccak(apdu, Keccak.ALG_KECCAK_512); break; 130 | case 0x08: computeKeccak(apdu, Keccak.ALG_SHAKE_128); break; 131 | case 0x09: computeKeccak(apdu, Keccak.ALG_SHAKE_256); break; 132 | default : 133 | // The INS code is not supported by the dispatcher 134 | ISOException.throwIt( ISO7816.SW_INS_NOT_SUPPORTED ) ; 135 | break ; 136 | 137 | } 138 | } 139 | else ISOException.throwIt( ISO7816.SW_CLA_NOT_SUPPORTED); 140 | } 141 | 142 | 143 | public void computeKeccak(APDU apdu, byte algorithm){ 144 | //Create Keccak OBJECT 145 | m_keccak = Keccak.getInstance(algorithm); 146 | m_keccak.reset(); 147 | // ((Keccak)m_keccak).setShakeDigestLength((short)128); //Optional function to set shake return bytes to 128 bytes 148 | 149 | byte[] apdubuf = apdu.getBuffer(); 150 | short dataLen = apdu.setIncomingAndReceive(); 151 | 152 | Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_ramArray1, (short) 0, dataLen); 153 | short ret1 = m_keccak.doFinal(m_ramArray1, (short) 0, dataLen, apdubuf, (short) 0); 154 | //short ret2 = m_sha2.doFinal(m_ramArray1, (short) 0, dataLen, apdubuf, (short) 0); 155 | 156 | // SEND OUTGOING BUFFER 157 | apdu.setOutgoingAndSend((short)0, ret1); 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /Pbkdf2/src/Pbkdf2Applet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TODO CHANGE IDs 3 | * PACKAGEID: 41 45 47 49 53 3A // 4 | * APPLETID: 41 45 47 49 53 3A 50 04 47 ./ 5 | */ 6 | package applets; 7 | 8 | import javacard.framework.*; 9 | 10 | /** 11 | * 12 | * @author Matej Evin 13 | * 6th March 2018 14 | */ 15 | public class Pbkdf2Applet extends javacard.framework.Applet 16 | { 17 | // MAIN INSTRUCTION CLASS 18 | final static byte CLA_SIMPLEAPPLET = (byte) 0xB0; 19 | 20 | // INSTRUCTIONS 21 | final static byte INS_MESSAGE_DIGEST = (byte) 0x61; 22 | 23 | //Constants 24 | final static short ARRAY_LENGTH = (short) 0xff; 25 | 26 | //Error codes 27 | final static short SW_OBJECT_NOT_AVAILABLE = (short) 0x6711; 28 | 29 | private PBKDF2 m_pbkdf2 = null; //message digest 30 | 31 | // TEMPORARRY ARRAY IN RAM 32 | private byte m_ramArray1[] = null; 33 | private byte m_ramArray2[] = null; 34 | private byte m_ramArray3[] = null; 35 | // PERSISTENT ARRAY IN EEPROM 36 | private byte m_dataArray[] = null; 37 | 38 | /** 39 | * AegisApplet constructor 40 | * Only this class's install method should create the applet object. 41 | */ 42 | protected Pbkdf2Applet(byte[] buffer, short offset, byte length) 43 | { 44 | 45 | // data offset is used for application specific parameter. 46 | // initialization with default offset (AID offset). 47 | short dataOffset = offset; 48 | boolean isOP2 = false; 49 | 50 | if(length > 9) { 51 | 52 | // shift to privilege offset 53 | dataOffset += (short)( 1 + buffer[offset]); 54 | // finally shift to Application specific offset 55 | dataOffset += (short)( 1 + buffer[dataOffset]); 56 | 57 | // go to proprietary data 58 | dataOffset++; 59 | 60 | // PERSISTENT BUFFER IN EEPROM 61 | m_dataArray = new byte[ARRAY_LENGTH]; 62 | Util.arrayFillNonAtomic(m_dataArray, (short) 0, ARRAY_LENGTH, (byte) 0); 63 | // TEMPORARY BUFFER USED FOR FAST OPERATION WITH MEMORY LOCATED IN RAM 64 | m_ramArray1 = JCSystem.makeTransientByteArray((short) 0xff, JCSystem.CLEAR_ON_DESELECT); 65 | m_ramArray2 = JCSystem.makeTransientByteArray((short) 0xff, JCSystem.CLEAR_ON_DESELECT); 66 | m_ramArray3 = JCSystem.makeTransientByteArray((short) 0xff, JCSystem.CLEAR_ON_DESELECT); 67 | 68 | m_pbkdf2 = PBKDF2.getInstance(PBKDF2.ALG_SHA); 69 | 70 | // update flag 71 | isOP2 = true; 72 | 73 | } else {} 74 | register(); 75 | } 76 | 77 | /** 78 | * Method installing the applet. 79 | * @param bArray the array containing installation parameters 80 | * @param bOffset the starting offset in bArray 81 | * @param bLength the length in bytes of the data parameter in bArray 82 | */ 83 | public static void install(byte[] bArray, short bOffset, byte bLength) throws ISOException 84 | { 85 | // no parameters needed 86 | //new Sha3Applet(); 87 | new Pbkdf2Applet(bArray, bOffset, bLength); 88 | } 89 | 90 | /** 91 | * Select method returns true if applet selection is supported. 92 | * @return boolean status of selection. 93 | */ 94 | public boolean select() 95 | { 96 | // 97 | return true; 98 | } 99 | 100 | /** 101 | * Deselect method called by the system in the deselection process. 102 | */ 103 | public void deselect() 104 | { 105 | // 106 | return; 107 | } 108 | 109 | /** 110 | * Method processing an incoming APDU. 111 | * @see APDU 112 | * @param apdu the incoming APDU 113 | * @exception ISOException with the response bytes defined by ISO 7816-4 114 | */ 115 | public void process(APDU apdu) throws ISOException 116 | { 117 | // get the APDU buffer 118 | byte[] apduBuffer = apdu.getBuffer(); 119 | 120 | // ignore the applet select command dispatched to the process 121 | if (selectingApplet()) 122 | return; 123 | 124 | // APDU instruction parser 125 | if (apduBuffer[ISO7816.OFFSET_CLA] == CLA_SIMPLEAPPLET) { 126 | switch ( apduBuffer[ISO7816.OFFSET_INS] ) 127 | { 128 | case INS_MESSAGE_DIGEST: 129 | Pbkdf2(apdu); 130 | break; 131 | 132 | default : 133 | // The INS code is not supported by the dispatcher 134 | ISOException.throwIt( ISO7816.SW_INS_NOT_SUPPORTED ) ; 135 | break ; 136 | 137 | } 138 | } 139 | else ISOException.throwIt( ISO7816.SW_CLA_NOT_SUPPORTED); 140 | } 141 | 142 | 143 | public void Pbkdf2(APDU apdu){ 144 | byte[] apdubuf = apdu.getBuffer(); 145 | short dataLen = apdu.setIncomingAndReceive(); 146 | 147 | //"password" 148 | m_ramArray1[0] = 0x70; 149 | m_ramArray1[1] = 0x61; 150 | m_ramArray1[2] = 0x73; 151 | m_ramArray1[3] = 0x73; 152 | m_ramArray1[4] = 0x77; 153 | m_ramArray1[5] = 0x6F; 154 | m_ramArray1[6] = 0x72; 155 | m_ramArray1[7] = 0x64; 156 | 157 | //"salt" 158 | m_ramArray2[0] = 0x73; 159 | m_ramArray2[1] = 0x61; 160 | m_ramArray2[2] = 0x6C; 161 | m_ramArray2[3] = 0x74; 162 | 163 | //Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_ramArray1, (short) 0, dataLen); 164 | short ret = m_pbkdf2.doFinal(m_ramArray1, (short) 0, (short) 8, 165 | m_ramArray2, (short) 0, (short) 4, 166 | (short) 1, 167 | m_ramArray3, (short) 0); 168 | 169 | // SEND OUTGOING BUFFER 170 | Util.arrayCopyNonAtomic(m_ramArray3, (short) 0, apdubuf, ISO7816.OFFSET_CDATA, ret); 171 | apdu.setOutgoingAndSend(ISO7816.OFFSET_CDATA, ret); 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /Twine/Readme.md: -------------------------------------------------------------------------------- 1 | # TWINE Cipher 2 | 3 | ## Project Status 4 | - [x] Code is working 5 | - [x] Code is optimized 6 | - [x] Code is beautified 7 | - [x] Usage info is provided 8 | - [x] Example is provided 9 | - [x] Profiling data are collected & interpreted 10 | - [x] Side-channel vulnerability data are collected 11 | - [x] Diploma thesis article is written 12 | 13 | ## Briefly about Twine 14 | Twine is a lightweight block cipher which utilises a 4x4 substitution box and a 144byte RoundKey (state). Whether you use an 80-bit or 128-bit key, it gets expanded using the substitution box into a RoundKey of the constant 144-byte length. The longer key adds more entropy to the expansion procedure and therefore more entropy to the encryption and decryption itself. 15 | 16 | ## Usage 17 | Twine extends the Cipher class, therefore you are able to use it the same way you would use any other block cipher, such as AES. 18 | The constructor is protected, therefore the only way to instantiate Twine is through the getInstance() method. 19 | ### Interface: 20 | Create TwineCipher instance: 21 | ````java 22 | public static TwineCipher getInstance(byte algorithm) 23 | 24 | algorithm // either TWINE_CIPHER_80 or TWINE_CIPHER_128 25 | return // the instance of Twine cipher 26 | ```` 27 | Initialize TwineCipher with key for encryption/decryption: 28 | ```` java 29 | public void init(Key theKey, byte theMode) 30 | 31 | theKey // initialized 128bit AESKey with either 80 bits or 128 bits of data 32 | theMode // either Cipher.MODE_ENCRYPT or Cipher.MODE_DECRYPT 33 | throws UNINITIALIZED_KEY // if theKey wasn't properly initialized yet 34 | throws ILLEGAL_VALUE // if theKey is not a 128-bit AESKey 35 | ```` 36 | Encrypt/decrypt supported data: 37 | ````java 38 | public short doFinal(byte[] inBuff, short inOffset, short inLength, byte[] outBuff, short outOffset) 39 | 40 | inBuff // input buffer 41 | inOffset // input buffer offset 42 | inLength // input buffer length 43 | outBuff // output buffer 44 | outOffset // output buffer offset 45 | return // the length of processed data (same as inLength if properly executed) 46 | throws UNINITIALIZED_KEY // if cipher wasn't initialized using init() method. 47 | throws ILLEGAL_VALUE // if inLength is not a multiple of 8 (Twine is NOPAD) 48 | ```` 49 | Get TwineCipher algorithm tag: 50 | ```` java 51 | public byte getAlgorithm() 52 | 53 | return ALG_TWINE // 19 54 | ```` 55 | Update (not supported): 56 | ```` java 57 | public short update(byte[] inBuff, short inOffset, short inLength, byte[] outBuff, short outOffset) 58 | 59 | throws ILLEGAL_USE // always throws this 60 | // this method is not supported on lightweight Twine cipher (just use doFinal) 61 | ```` 62 | Initialize with array (not supported) 63 | ```` java 64 | public void init(Key theKey, byte theMode, byte[] bArray, short bOff, short bLen) 65 | 66 | throws ILLEGAL_USE // always throws this 67 | // this method is not supported on lightweight Twine cipher (use supported init) 68 | ```` 69 | 70 | ## Example 71 | Simple example how to create, instantiate and use TwineCipher in the JavaCard applet: 72 | ```` java 73 | // create entities 74 | private Cipher m_twine = null; // cipher 75 | private AESKey m_aes = null; // key 76 | 77 | // instantiate the 128-bit cipher and key 78 | m_twine = TwineCipher.getInstance(TwineCipher.TWINE_CIPHER_128); 79 | m_aes = (AESKey) KeyBuilder.buildKey(KeyBuilder.TYPE_AES, KeyBuilder.LENGTH_AES_128, false); 80 | // (note that instatiating with 80-bit key still requires 128-bit AESKey) 81 | 82 | // set AES key 83 | m_aes.setKey(m_ramArray, (short) 0); 84 | 85 | // init twine Cipher before using 86 | m_twine.init(m_aes, Cipher.MODE_ENCRYPT); 87 | 88 | // encrypt 32 bytes of data 89 | short ret = m_twine.doFinal(m_ramArray1, (short) 0, (short) 32, apdubuf, ISO7816.OFFSET_CDATA); 90 | ```` 91 | 92 | ## Optimizations used 93 | * DESKey changed to AESKey (no impact on performance, but is more true to the nature of Twine) 94 | * Removed redundant arrays (RAM saving) 95 | * Inlined single-use private methods (faster) 96 | * Changed visibility of non-interface methods to package-only (safer) 97 | * temporary variables are now all stored in one array (faster, but not always) 98 | * Minimized number of method parameters (worse readability but faster) 99 | * Code beautification (better readability) (not complete) 100 | 101 | ## Performance measurement results 102 | 103 | Old Twine with 80-bit key schedule (not working properly): 104 | ``` 105 | init: 7 ms 106 | doFinal: 107 | getKey (DES): 3 ms 108 | expand key: 241 ms 109 | arrayCopy: 0 ms 110 | encrypt: 356 ms 111 | null fields: 2 ms 112 | 113 | init total: 7 ms 114 | Encrypt total: ~600 ms 115 | ``` 116 | New Twine with 80-bit key schedule: 117 | ``` 118 | init total: 309 ms (getKey & expand 80-bit key is here) 119 | Encrypt total: 355 ms (only encryption itself) 120 | ``` 121 | New Twine 128-bit key schedule: 122 | ``` 123 | init total: 391 ms (getKey & expand 128-bit key is here) 124 | Encrypt total: 354 ms (only encryption itself) 125 | ``` 126 | The reason why new 80-bit key schedule lasts longer than the onld one is because the original was not working properly - it missed some steps. Adding those steps to fix key schedule means longer computation time. Also, some optimizations to reduce RAM usage might cause a slight increase in computation time. 127 | 128 | The main point is, however, that we moved getKey() and keySchedule() into the init() function. init() is called only once, so we rather have longer init while any subsequent doFinal() call is much quicker. 129 | Old TWINE would encrypt 64 bits in 600 ms every time, our new TWINE makes it in 355 ms on average. That's a 41% speed increase. 130 | Even more, the old Twine only accepted 64 bits of data. This meant sending APDUs over and over when we wanted to encrypt more data, taking 600+ ms every time (discounting apdu management time!). New Twine can encrypt any number of 64-bit blocks all at once, where init takes 300-400ms, and then every 64-bit block takes only 355 ms. 131 | -------------------------------------------------------------------------------- /Zorro/Readme.md: -------------------------------------------------------------------------------- 1 | # Zorro Cipher 2 | 3 | Warning! **__BE CAREFUL WHEN USING ZORRO, IT IS NOT SECURE__** Warning! \ 4 | Read more here: https://eprint.iacr.org/2014/220.pdf 5 | 6 | ## Project Status 7 | - [x] Code is working 8 | - [x] Code is optimized 9 | - [x] Code is beautified 10 | - [x] Usage info is provided 11 | - [x] Example is provided 12 | - [x] Speed profiling data are collected & interpreted 13 | - [x] Memory profiling data are collected & interpreted 14 | - [x] Side-channel vulnerability data are collected 15 | - [x] Diploma thesis article is written 16 | 17 | ## Briefly about Zorro 18 | Zorro is a lightweight 128-bit block cipher whose goal is to provide an AES-like encryption on JavaCards 19 | while being able to be masked against side-channel attacks more efficiently. 20 | 21 | ## Usage 22 | Zorro extends the Cipher class, therefore you are able to use it the same way you would use any other block cipher, such as AES. 23 | The constructor is protected, therefore the only way to instantiate Zorro is through the getInstance() method. 24 | ### Interface: 25 | Create ZorroCipher instance: 26 | ````java 27 | public static ZorroCipher getInstance() 28 | 29 | return // the instance of Zorro cipher 30 | ```` 31 | Initialize ZorroCipher with key for encryption/decryption: 32 | ```` java 33 | public void init(Key theKey, byte theMode) 34 | 35 | theKey // initialized 128-bit AESKey with 128 bits of data 36 | theMode // either Cipher.MODE_ENCRYPT or Cipher.MODE_DECRYPT 37 | throws UNINITIALIZED_KEY // if theKey wasn't properly initialized yet 38 | throws ILLEGAL_VALUE // if theKey is not a 128-bit AESKey 39 | ```` 40 | Encrypt/decrypt supported data: 41 | ````java 42 | public short doFinal(byte[] inBuff, short inOffset, short inLength, byte[] outBuff, short outOffset) 43 | 44 | inBuff // input buffer 45 | inOffset // input buffer offset 46 | inLength // input buffer length 47 | outBuff // output buffer 48 | outOffset // output buffer offset 49 | return // the length of processed data (same as inLength if properly executed) 50 | throws UNINITIALIZED_KEY // if cipher wasn't initialized using the init() method. 51 | throws ILLEGAL_VALUE // if inLength is not a multiple of 16 (because Zorro is NOPAD) 52 | throws INVALID_INIT // if mode is neither MODE_ENCRYPT nor MODE_DECRYPT 53 | ```` 54 | Get ZorroCipher algorithm tag: 55 | ```` java 56 | public byte getAlgorithm() 57 | 58 | return ALG_ZORRO // 18 59 | ```` 60 | Update (not supported): 61 | ```` java 62 | public short update(byte[] inBuff, short inOffset, short inLength, byte[] outBuff, short outOffset) 63 | 64 | throws ILLEGAL_USE // always throws this 65 | // this method is not supported on lightweight Zorro cipher (just use doFinal) 66 | ```` 67 | Initialize with array (not supported) 68 | ```` java 69 | public void init(Key theKey, byte theMode, byte[] bArray, short bOff, short bLen) 70 | throws ILLEGAL_USE // always throws this 71 | // this method is not supported on lightweight Zorro cipher (use supported init) 72 | ```` 73 | 74 | ## Example 75 | Simple example how to create, instantiate and use ZorroCipher in the JavaCard applet: 76 | ```` java 77 | //create entities 78 | private Cipher m_zorro = null; // cipher 79 | private AESKey m_aes = null; // key 80 | 81 | //instantiate the 128-bit cipher and key 82 | m_zorro = ZorroCipher.getInstance(); 83 | m_aes = (AESKey) KeyBuilder.buildKey(KeyBuilder.TYPE_AES, KeyBuilder.LENGTH_AES_128, false); 84 | 85 | //init aes key and Zorro cipher for encrpytion 86 | m_aes.setKey(m_ramArray, (short) 0); 87 | m_zorro.init(m_aes, Cipher.MODE_ENCRYPT); 88 | 89 | //encrypt 32 bytes of data 90 | short ret = m_zorro.doFinal(m_ramArray1, (short) 0, (short) 32, apdubuf, ISO7816.OFFSET_CDATA); 91 | ```` 92 | 93 | ## Optimizations used 94 | * DESKey changed to AESKey (no impact on performance, but is more true to the nature of Zorro) 95 | * Changed visibility of non-interface methods to package-only (safer) 96 | * Temporary variables are now all stored in one array (faster) 97 | * Minimized number of method parameters (worse readability but faster) 98 | * Beautified code (better readability) (not complete) 99 | * Created proper Cipher interface 100 | 101 | ## Performance measurement results 102 | ### Speed 103 | Old Zorro encrypting 16 bytes of data: 104 | ``` 105 | init: 7 ms 106 | 107 | getKey: 2 ms 108 | Encrypt: 109 | xor key: 4 ms 110 | mix1Column: 24 ms 111 | mix4Columns: 89 ms 112 | 1 round: 97 ms 113 | 4 rounds: 389 ms 114 | 24 rounds: 2338 ms 115 | 116 | encrypt: 2361 ms 117 | cleanup: n/a 118 | ``` 119 | New Zorro encrypting 16 bytes of data: 120 | ``` 121 | init: 7 ms 122 | 123 | getKey: 2 ms 124 | Encrypt: 125 | xor key: 4 ms 126 | mix1Column: 22 ms 127 | mix4Columns: 80 ms 128 | 1 round: 93 ms 129 | 4 rounds: 375 ms 130 | 24 rounds: 2232 ms 131 | 132 | encrypt: 2259 ms 133 | cleanup: 4 ms 134 | ``` 135 | The new - optimized Zorro is about 100 ms faster. This is because of loop unrolling and better handling of arrays. We also added cleanup for safety reasons, which takes only 4 ms therefore is negligible time-wise. Alltogether we report a 4.5% speed increase. 136 | 137 | We see that whole encryption takes around 2250 ms. This is split into 6 steps, each containing 4 rounds. Each step lasts 375 ms. Each round lasts 93 ms, split into 4 functions: SubBytes, AddConstant and ShiftRows last together about 13 ms, where MixColumns itself lasts 80 ms. In MixColumns, there are 4 identical steps, each lasting about 20-22 ms. Each step is 16 multiplications over Galois field (mGF). Each multiplication is over 1 ms long. Since we perform ``16 x 4 x 4 x 6 = 1546`` multiplications, the computation can't last less than that many milliseconds. All other computations also take some time (although that's only a small portion), resulting in an average 2250 ms long computation. So mGF is what takes so long and cannot be further optimized. 138 | 139 | ### Memory 140 | 141 | ``` 142 | 40 bytes 143 | ``` 144 | Zorro only needs 40 bytes to save the state. Nothing more. 145 | -------------------------------------------------------------------------------- /AEAD/ASCON/src/AsconApplet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * PACKAGEID: 41 53 43 4F 4E 3A // ASCON: 3 | * APPLETID: 41 53 43 4F 4E 3A 50 04 47 // ASCON:PKG 4 | */ 5 | package ascon; 6 | 7 | //import javacard.framework.*; 8 | import javacard.framework.APDU; 9 | import javacard.framework.ISO7816; 10 | import javacard.framework.ISOException; 11 | import javacard.framework.JCSystem; 12 | import javacard.framework.Util; 13 | 14 | 15 | /** 16 | * 17 | * @author rajesh 18 | * @review matej 19 | */ 20 | public class AsconApplet extends javacard.framework.Applet 21 | { 22 | // MAIN INSTRUCTION CLASS 23 | final static byte CLA_SIMPLEAPPLET = (byte) 0xB0; 24 | 25 | // INSTRUCTIONS 26 | final static byte INS_ASCONENCRYPTION = (byte) 0x61; 27 | final static byte INS_ASCONDECRYPTION = (byte) 0x62; 28 | 29 | final static short ARRAY_LENGTH = (short) 0xff; 30 | final static byte AES_BLOCK_LENGTH = (short) 0x16; 31 | 32 | final static short SW_BAD_TEST_DATA_LEN = (short) 0x6680; 33 | final static short SW_KEY_LENGTH_BAD = (short) 0x6715; 34 | final static short SW_CIPHER_DATA_LENGTH_BAD = (short) 0x6710; 35 | final static short SW_OBJECT_NOT_AVAILABLE = (short) 0x6711; 36 | final static short SW_BAD_PIN = (short) 0x6900; 37 | 38 | private AsconCore myascon = null; //ASCON engine 39 | 40 | //ASCON Parameters 41 | byte[] AD = {(byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00}; 42 | short ADLEN = (short)AD.length; 43 | byte[] NSEC = {(byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01}; 44 | byte[] NPUB = {(byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02}; 45 | byte[] KEY = {(byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06, (byte)0x07, (byte)0x08, (byte)0x09, (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06}; 46 | // TEMPORARRY ARRAY IN RAM 47 | private byte m_ramArray[] = null; 48 | // PERSISTENT ARRAY IN EEPROM 49 | private byte m_dataArray[] = null; 50 | 51 | protected AsconApplet(byte[] buffer, short offset, byte length) 52 | { 53 | // data offset is used for application specific parameter. 54 | // initialization with default offset (AID offset). 55 | short dataOffset = offset; 56 | boolean isOP2 = false; 57 | 58 | if(length > 9) { 59 | 60 | // shift to privilege offset 61 | dataOffset += (short)( 1 + buffer[offset]); 62 | // finally shift to Application specific offset 63 | dataOffset += (short)( 1 + buffer[dataOffset]); 64 | 65 | // go to proprietary data 66 | dataOffset++; 67 | 68 | // PERSISTENT BUFFER IN EEPROM 69 | m_dataArray = new byte[ARRAY_LENGTH]; 70 | Util.arrayFillNonAtomic(m_dataArray, (short) 0, ARRAY_LENGTH, (byte) 0); 71 | // TEMPORARY BUFFER USED FOR FAST OPERATION WITH MEMORY LOCATED IN RAM 72 | m_ramArray = JCSystem.makeTransientByteArray((short) 260, JCSystem.CLEAR_ON_DESELECT); 73 | 74 | //Create ASCON OBJECT 75 | myascon = new AsconCore(); 76 | 77 | // update flag 78 | isOP2 = true; 79 | 80 | } else {} 81 | register(); 82 | } 83 | 84 | /** 85 | * Method installing the applet. 86 | * @param bArray the array containing installation parameters 87 | * @param bOffset the starting offset in bArray 88 | * @param bLength the length in bytes of the data parameter in bArray 89 | */ 90 | public static void install(byte[] bArray, short bOffset, byte bLength) throws ISOException 91 | { 92 | new AsconApplet(bArray, bOffset, bLength); 93 | } 94 | 95 | @Override 96 | public boolean select() 97 | { 98 | return true; 99 | } 100 | 101 | @Override 102 | public void deselect() 103 | {} 104 | 105 | @Override 106 | public void process(APDU apdu) throws ISOException 107 | { 108 | // get the APDU buffer 109 | byte[] apduBuffer = apdu.getBuffer(); 110 | 111 | // ignore the applet select command dispatched to the process 112 | if (selectingApplet()) 113 | return; 114 | 115 | // APDU instruction parser 116 | if (apduBuffer[ISO7816.OFFSET_CLA] == CLA_SIMPLEAPPLET) { 117 | switch ( apduBuffer[ISO7816.OFFSET_INS] ) 118 | { 119 | case INS_ASCONENCRYPTION: ASCONEncryption(apdu); break; 120 | case INS_ASCONDECRYPTION: ASCONDecryption(apdu); break; 121 | default : 122 | // The INS code is not supported by the dispatcher 123 | ISOException.throwIt( ISO7816.SW_INS_NOT_SUPPORTED ) ; 124 | break ; 125 | 126 | } 127 | } 128 | else ISOException.throwIt( ISO7816.SW_CLA_NOT_SUPPORTED); 129 | } 130 | 131 | 132 | public void ASCONEncryption(APDU apdu){ 133 | byte[] apdubuf = apdu.getBuffer(); 134 | short dataLen = apdu.setIncomingAndReceive(); 135 | 136 | // Copy message to m_ramArray for encryption 137 | Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_ramArray, (short)0, dataLen); 138 | 139 | // ASCON Encryption 140 | myascon.encrypt(apdubuf, (short)0, m_ramArray, dataLen, AD, ADLEN, NSEC, NPUB, KEY); 141 | 142 | // SEND OUTGOING BUFFER 143 | apdu.setOutgoingAndSend((short)0, (short)(dataLen+16)); 144 | } 145 | 146 | 147 | public void ASCONDecryption(APDU apdu){ 148 | byte[] apdubuf = apdu.getBuffer(); 149 | short dataLen = apdu.setIncomingAndReceive(); 150 | 151 | // Copy cipher to m_ramArray for decryption 152 | Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_ramArray, (short)0, dataLen); 153 | 154 | // ASCON Decryption 155 | myascon.decrypt(apdubuf, (short)0, NSEC, m_ramArray, dataLen, AD, ADLEN, NPUB, KEY); 156 | 157 | // SEND OUTGOING BUFFER 158 | apdu.setOutgoingAndSend((short)0, (short)(dataLen-16)); 159 | } 160 | 161 | 162 | } 163 | -------------------------------------------------------------------------------- /AEAD/MORUS/src/MorusApplet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * PACKAGEID: 4D 4F 52 55 53 3A // MORUS: 3 | * APPLETID: 4D 4F 52 55 53 3A 50 04 47 // MORUS:PKG 4 | */ 5 | package morus; 6 | 7 | import javacard.framework.APDU; 8 | import javacard.framework.ISO7816; 9 | import javacard.framework.ISOException; 10 | import javacard.framework.JCSystem; 11 | import javacard.framework.Util; 12 | 13 | 14 | /** 15 | * 16 | * @author rajesh 17 | */ 18 | public class MorusApplet extends javacard.framework.Applet 19 | { 20 | // MAIN INSTRUCTION CLASS 21 | final static byte CLA_SIMPLEAPPLET = (byte) 0xB0; 22 | 23 | // INSTRUCTIONS 24 | final static byte INS_MORUSENCRYPTION = (byte) 0x61; 25 | final static byte INS_MORUSDECRYPTION = (byte) 0x62; 26 | 27 | final static short ARRAY_LENGTH = (short) 0xff; 28 | final static byte AES_BLOCK_LENGTH = (short) 0x16; 29 | 30 | final static short SW_BAD_TEST_DATA_LEN = (short) 0x6680; 31 | final static short SW_KEY_LENGTH_BAD = (short) 0x6715; 32 | final static short SW_CIPHER_DATA_LENGTH_BAD = (short) 0x6710; 33 | final static short SW_OBJECT_NOT_AVAILABLE = (short) 0x6711; 34 | final static short SW_BAD_PIN = (short) 0x6900; 35 | 36 | private MorusCore m_morus = null; 37 | 38 | //ASCON Parameters-- Encryption 39 | public byte[] AD = {(byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02}; 40 | public short ADLEN = (short)AD.length; 41 | public byte[] NSEC = {(byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01}; 42 | public byte[] NPUB = {(byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02}; 43 | public byte[] KEY = {(byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06, (byte)0x07, (byte)0x08, (byte)0x09, (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06}; 44 | 45 | //ASCON Parameters-- Decryption 46 | public byte[] AD1 = {(byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02}; 47 | public short ADLEN1 = (short)AD1.length; 48 | public byte[] NSEC1 = {(byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01}; 49 | public byte[] NPUB1 = {(byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02}; 50 | public byte[] KEY1 = {(byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06, (byte)0x07, (byte)0x08, (byte)0x09, (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06}; 51 | 52 | 53 | // TEMPORARRY ARRAY IN RAM 54 | private byte m_ramArray[] = null; 55 | 56 | /** 57 | * AezApplet constructor 58 | * Only this class's install method should create the applet object. 59 | */ 60 | protected MorusApplet(byte[] buffer, short offset, byte length) 61 | { 62 | // data offset is used for application specific parameter. 63 | // initialization with default offset (AID offset). 64 | short dataOffset = offset; 65 | boolean isOP2 = false; 66 | 67 | if(length > 9) { 68 | 69 | // shift to privilege offset 70 | dataOffset += (short)( 1 + buffer[offset]); 71 | // finally shift to Application specific offset 72 | dataOffset += (short)( 1 + buffer[dataOffset]); 73 | 74 | // go to proprietary data 75 | dataOffset++; 76 | 77 | // TEMPORARY BUFFER USED FOR FAST OPERATION WITH MEMORY LOCATED IN RAM 78 | m_ramArray = JCSystem.makeTransientByteArray((short) 260, JCSystem.CLEAR_ON_DESELECT); 79 | 80 | //Create ASCON OBJECT 81 | m_morus = new MorusCore(); 82 | 83 | // update flag 84 | isOP2 = true; 85 | 86 | } else {} 87 | register(); 88 | } 89 | 90 | public static void install(byte[] bArray, short bOffset, byte bLength) throws ISOException 91 | { 92 | new MorusApplet (bArray, bOffset, bLength); 93 | } 94 | 95 | public boolean select() 96 | { 97 | return true; 98 | } 99 | 100 | public void deselect() {} 101 | 102 | public void process(APDU apdu) throws ISOException 103 | { 104 | // get the APDU buffer 105 | byte[] apduBuffer = apdu.getBuffer(); 106 | 107 | // ignore the applet select command dispatched to the process 108 | if (selectingApplet()) 109 | return; 110 | 111 | // APDU instruction parser 112 | if (apduBuffer[ISO7816.OFFSET_CLA] == CLA_SIMPLEAPPLET) { 113 | switch ( apduBuffer[ISO7816.OFFSET_INS] ) 114 | { 115 | case INS_MORUSENCRYPTION: MORUSEncryption(apdu); break; 116 | case INS_MORUSDECRYPTION: MORUSDecryption(apdu); break; 117 | default : 118 | // The INS code is not supported by the dispatcher 119 | ISOException.throwIt( ISO7816.SW_INS_NOT_SUPPORTED ) ; 120 | break ; 121 | 122 | } 123 | } 124 | else ISOException.throwIt( ISO7816.SW_CLA_NOT_SUPPORTED); 125 | } 126 | 127 | 128 | public void MORUSEncryption(APDU apdu){ 129 | byte[] apdubuf = apdu.getBuffer(); 130 | short dataLen = apdu.setIncomingAndReceive(); 131 | 132 | // Copy message to m_ramArray for encryption 133 | Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_ramArray, (short)0, dataLen); 134 | 135 | m_morus.init(NSEC, NPUB, KEY); 136 | 137 | // MORUS Encryption 138 | m_morus.encrypt(m_ramArray, (short)0, m_ramArray, dataLen, AD, ADLEN); 139 | Util.arrayCopyNonAtomic(m_ramArray, (short)0, apdubuf, (short)0, (short)(dataLen+16)); 140 | 141 | // SEND OUTGOING BUFFER 142 | apdu.setOutgoingAndSend((short)0, (short)(dataLen+16)); 143 | } 144 | 145 | 146 | public void MORUSDecryption(APDU apdu){ 147 | byte[] apdubuf = apdu.getBuffer(); 148 | short dataLen = apdu.setIncomingAndReceive(); 149 | 150 | // Copy cipher to m_ramArray for decryption 151 | Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_ramArray, (short)0, dataLen); 152 | 153 | m_morus.init(NSEC1, NPUB1, KEY1); 154 | // MORUS Decryption 155 | m_morus.decrypt(m_ramArray, dataLen, m_ramArray, (short)0, AD1, ADLEN1); 156 | Util.arrayCopyNonAtomic(m_ramArray, (short)0, apdubuf, (short)0, (short)(dataLen-16)); 157 | 158 | // SEND OUTGOING BUFFER 159 | apdu.setOutgoingAndSend((short)0, (short)(dataLen-16)); 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /AEAD/AEGIS/src/AegisApplet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * PACKAGEID: 41 45 47 49 53 3A // AEGIS: 3 | * APPLETID: 41 45 47 49 53 3A 50 04 47 // AEGIS:PKG 4 | */ 5 | package aegis; 6 | 7 | //import javacard.framework.*; 8 | import javacard.framework.APDU; 9 | import javacard.framework.ISO7816; 10 | import javacard.framework.ISOException; 11 | import javacard.framework.JCSystem; 12 | import javacard.framework.Util; 13 | 14 | 15 | /** 16 | * 17 | * @author rajesh 18 | * @review matej 19 | */ 20 | public class AegisApplet extends javacard.framework.Applet 21 | { 22 | // MAIN INSTRUCTION CLASS 23 | final static byte CLA_SIMPLEAPPLET = (byte) 0xB0; 24 | 25 | // INSTRUCTIONS 26 | final static byte INS_AEGISENCRYPTION = (byte) 0x61; 27 | final static byte INS_AEGISDECRYPTION = (byte) 0x62; 28 | 29 | final static short ARRAY_LENGTH = (short) 0xff; 30 | final static byte AES_BLOCK_LENGTH = (short) 0x16; 31 | 32 | final static short SW_BAD_TEST_DATA_LEN = (short) 0x6680; 33 | final static short SW_KEY_LENGTH_BAD = (short) 0x6715; 34 | final static short SW_CIPHER_DATA_LENGTH_BAD = (short) 0x6710; 35 | final static short SW_OBJECT_NOT_AVAILABLE = (short) 0x6711; 36 | 37 | private AegisCore myaegis = null; //AEGIS engine 38 | 39 | //AEGIS Parameters-- Encryption 40 | byte[] AD = {(byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02}; 41 | short ADLEN = (short)AD.length; 42 | byte[] NSEC = {(byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01}; 43 | byte[] NPUB = {(byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02}; 44 | byte[] KEY = {(byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06, (byte)0x07, (byte)0x08, (byte)0x09, (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06}; 45 | short KEYLEN = (short)KEY.length; 46 | 47 | /*AEGIS Parameters-- Decryption 48 | byte[] AD1 = {(byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02}; 49 | short ADLEN1 = (short)AD1.length; 50 | byte[] NSEC1 = {(byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01}; 51 | byte[] NPUB1 = {(byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02}; 52 | byte[] KEY1 = {(byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06, (byte)0x07, (byte)0x08, (byte)0x09, (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06}; 53 | short KEYLEN1 = (short)KEY1.length;*/ 54 | 55 | // TEMPORARRY ARRAY IN RAM 56 | private byte m_ramArrayPt[] = null; //plaintext array 57 | private byte m_ramArrayCt[] = null; //ciphertext array 58 | 59 | //constructor 60 | protected AegisApplet(byte[] buffer, short offset, byte length) 61 | { 62 | 63 | short dataOffset = offset; 64 | boolean isOP2 = false; 65 | 66 | if(length > 9) { 67 | 68 | // shift to privilege offset 69 | dataOffset += (short)( 1 + buffer[offset]); 70 | // finally shift to Application specific offset 71 | dataOffset += (short)( 1 + buffer[dataOffset]); 72 | 73 | // go to proprietary data 74 | dataOffset++; 75 | 76 | // TEMPORARY BUFFER USED FOR FAST OPERATION WITH MEMORY LOCATED IN RAM 77 | m_ramArrayPt = JCSystem.makeTransientByteArray((short) 260, JCSystem.CLEAR_ON_DESELECT); 78 | m_ramArrayCt = JCSystem.makeTransientByteArray((short) 260, JCSystem.CLEAR_ON_DESELECT); 79 | 80 | //Create AEGIS OBJECT 81 | myaegis = new AegisCore(); 82 | 83 | // update flag 84 | isOP2 = true; 85 | 86 | } else {} 87 | register(); 88 | } 89 | 90 | public static void install(byte[] bArray, short bOffset, byte bLength) throws ISOException 91 | { 92 | new AegisApplet(bArray, bOffset, bLength); 93 | } 94 | 95 | public boolean select() 96 | { 97 | return true; 98 | } 99 | 100 | public void deselect() 101 | { 102 | return; 103 | } 104 | 105 | public void process(APDU apdu) throws ISOException 106 | { 107 | // get the APDU buffer 108 | byte[] apduBuffer = apdu.getBuffer(); 109 | 110 | // ignore the applet select command dispatched to the process 111 | if (selectingApplet()) 112 | return; 113 | 114 | // APDU instruction parser 115 | if (apduBuffer[ISO7816.OFFSET_CLA] == CLA_SIMPLEAPPLET) { 116 | switch ( apduBuffer[ISO7816.OFFSET_INS] ) 117 | { 118 | case INS_AEGISENCRYPTION: AEGISEncryption(apdu); break; 119 | case INS_AEGISDECRYPTION: AEGISDecryption(apdu); break; 120 | default : 121 | ISOException.throwIt( ISO7816.SW_INS_NOT_SUPPORTED); 122 | break ; 123 | 124 | } 125 | } 126 | else ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED); 127 | } 128 | 129 | 130 | public void AEGISEncryption(APDU apdu){ 131 | byte[] apdubuf = apdu.getBuffer(); 132 | short dataLen = apdu.setIncomingAndReceive(); 133 | 134 | // Copy message to m_ramArrayPt for encryption 135 | Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_ramArrayPt, (short)0, dataLen); 136 | 137 | myaegis.init(NSEC, NPUB, KEY, KEYLEN); 138 | 139 | // AEGIS Encryption 140 | myaegis.encrypt(m_ramArrayCt, (short)0, m_ramArrayPt, dataLen, AD, ADLEN); 141 | 142 | // Copy ciphertext 143 | Util.arrayCopyNonAtomic(m_ramArrayCt, (short)0, apdubuf, (short)0, (short)(dataLen+16)); 144 | 145 | // SEND OUTGOING BUFFER 146 | apdu.setOutgoingAndSend((short)0, (short)(dataLen+16)); 147 | } 148 | 149 | 150 | public void AEGISDecryption(APDU apdu){ 151 | byte[] apdubuf = apdu.getBuffer(); 152 | short dataLen = apdu.setIncomingAndReceive(); 153 | 154 | // Copy cipher to m_ramArrayCt for decryption 155 | Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_ramArrayCt, (short)0, dataLen); 156 | 157 | myaegis.init(NSEC, NPUB, KEY, KEYLEN); 158 | // AEGIS Decryption 159 | myaegis.decrypt(m_ramArrayCt, dataLen, m_ramArrayPt, (short)0, AD, ADLEN); 160 | 161 | // Copy retrieved message (plaintext) 162 | Util.arrayCopyNonAtomic(m_ramArrayPt, (short)0, apdubuf, (short)0, (short)(dataLen-16)); 163 | 164 | // SEND OUTGOING BUFFER 165 | apdu.setOutgoingAndSend((short)0, (short)(dataLen-16)); 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /AEAD/ACORN/src/AcornApplet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * PACKAGEID: 43 4C 4F 43 4B 3A // ACORN: 3 | * APPLETID: 43 4C 4F 43 4B 3A 50 04 47 // ACORN:PKG 4 | */ 5 | package acorn; 6 | 7 | import javacard.framework.APDU; 8 | import javacard.framework.ISO7816; 9 | import javacard.framework.ISOException; 10 | import javacard.framework.JCSystem; 11 | import javacard.framework.Util; 12 | 13 | 14 | /** 15 | * 16 | * @author rajesh 17 | * @review matej 18 | */ 19 | public class AcornApplet extends javacard.framework.Applet 20 | { 21 | // MAIN INSTRUCTION CLASS 22 | final static byte CLA_SIMPLEAPPLET = (byte) 0xB0; 23 | 24 | // INSTRUCTIONS 25 | final static byte INS_ACORNENCRYPTION = (byte) 0x61; 26 | final static byte INS_ACORNDECRYPTION = (byte) 0x62; 27 | 28 | final static short ARRAY_LENGTH = (short) 0xff; 29 | final static byte AES_BLOCK_LENGTH = (short) 0x16; 30 | 31 | final static short SW_BAD_TEST_DATA_LEN = (short) 0x6680; 32 | final static short SW_KEY_LENGTH_BAD = (short) 0x6715; 33 | final static short SW_CIPHER_DATA_LENGTH_BAD = (short) 0x6710; 34 | final static short SW_OBJECT_NOT_AVAILABLE = (short) 0x6711; 35 | 36 | private AcornCore m_acorn = null; //ACORN engine 37 | 38 | //ACORN Parameters-- Encryption 39 | byte[] AD = {(byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02}; 40 | short ADLEN = (short)AD.length; 41 | byte[] NSEC = {(byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01}; 42 | byte[] NPUB = {(byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02}; 43 | byte[] KEY = {(byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06, (byte)0x07, (byte)0x08, (byte)0x09, (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06}; 44 | short KEYLEN = (short)KEY.length; 45 | 46 | //ACORN Parameters-- Decryption 47 | byte[] AD1 = {(byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02}; 48 | short ADLEN1 = (short)AD1.length; 49 | byte[] NSEC1 = {(byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01}; 50 | byte[] NPUB1 = {(byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02}; 51 | byte[] KEY1 = {(byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06, (byte)0x07, (byte)0x08, (byte)0x09, (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06}; 52 | short KEYLEN1 = (short)KEY1.length; 53 | 54 | // TEMPORARRY ARRAY IN RAM 55 | private byte m_ramArrayPt[] = null; 56 | private byte m_ramArrayCt[] = null; 57 | // PERSISTENT ARRAY IN EEPROM 58 | 59 | /** 60 | * AcornApplet constructor 61 | * Only this class's install method should create the applet object. 62 | */ 63 | protected AcornApplet(byte[] buffer, short offset, byte length) 64 | { 65 | // data offset is used for application specific parameter. 66 | // initialization with default offset (AID offset). 67 | short dataOffset = offset; 68 | boolean isOP2 = false; 69 | 70 | if(length > 9) { 71 | 72 | // shift to privilege offset 73 | dataOffset += (short)( 1 + buffer[offset]); 74 | // finally shift to Application specific offset 75 | dataOffset += (short)( 1 + buffer[dataOffset]); 76 | 77 | // go to proprietary data 78 | dataOffset++; 79 | 80 | // TEMPORARY BUFFER USED FOR FAST OPERATION WITH MEMORY LOCATED IN RAM 81 | m_ramArrayPt = JCSystem.makeTransientByteArray((short) 260, JCSystem.CLEAR_ON_DESELECT); 82 | m_ramArrayCt = JCSystem.makeTransientByteArray((short) 260, JCSystem.CLEAR_ON_DESELECT); 83 | 84 | //Create ASCON OBJECT 85 | m_acorn = new AcornCore(); 86 | 87 | // update flag 88 | isOP2 = true; 89 | 90 | } else {} 91 | register(); 92 | } 93 | 94 | public static void install(byte[] bArray, short bOffset, byte bLength) throws ISOException 95 | { 96 | new AcornApplet (bArray, bOffset, bLength); 97 | } 98 | 99 | public boolean select() 100 | { 101 | return true; 102 | } 103 | 104 | public void deselect() 105 | { 106 | return; 107 | } 108 | 109 | public void process(APDU apdu) throws ISOException 110 | { 111 | // get the APDU buffer 112 | byte[] apduBuffer = apdu.getBuffer(); 113 | 114 | // ignore the applet select command dispatched to the process 115 | if (selectingApplet()) 116 | return; 117 | 118 | // APDU instruction parser 119 | if (apduBuffer[ISO7816.OFFSET_CLA] == CLA_SIMPLEAPPLET) { 120 | switch ( apduBuffer[ISO7816.OFFSET_INS] ) 121 | { 122 | case INS_ACORNENCRYPTION: ACORNEncryption(apdu); break; 123 | case INS_ACORNDECRYPTION: ACORNDecryption(apdu); break; 124 | default : 125 | // The INS code is not supported by the dispatcher 126 | ISOException.throwIt( ISO7816.SW_INS_NOT_SUPPORTED ) ; 127 | break ; 128 | 129 | } 130 | } 131 | else ISOException.throwIt( ISO7816.SW_CLA_NOT_SUPPORTED); 132 | } 133 | 134 | 135 | public void ACORNEncryption(APDU apdu){ 136 | byte[] apdubuf = apdu.getBuffer(); 137 | short dataLen = apdu.setIncomingAndReceive(); 138 | 139 | // Copy message to m_ramArrayPt for encryption 140 | Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_ramArrayPt, (short)0, dataLen); 141 | 142 | m_acorn.init(NSEC, NPUB, KEY, KEYLEN); 143 | // ACORN Encryption 144 | m_acorn.encrypt(m_ramArrayCt, (short)0, m_ramArrayPt, dataLen, AD, ADLEN); 145 | 146 | // Copy ciphertext 147 | Util.arrayCopyNonAtomic(m_ramArrayCt, (short)0, apdubuf, (short)0, (short)(dataLen+16)); 148 | 149 | // SEND OUTGOING BUFFER 150 | apdu.setOutgoingAndSend((short)0, (short)(dataLen+16)); 151 | } 152 | 153 | 154 | public void ACORNDecryption(APDU apdu){ 155 | byte[] apdubuf = apdu.getBuffer(); 156 | short dataLen = apdu.setIncomingAndReceive(); 157 | 158 | // Copy cipher to m_ramArrayCt for decryption 159 | Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_ramArrayCt, (short)0, dataLen); 160 | 161 | m_acorn.init(NSEC1, NPUB1, KEY1, KEYLEN1); 162 | // ACORN Decryption 163 | m_acorn.decrypt(m_ramArrayCt, dataLen, m_ramArrayPt, (short)0, AD1, ADLEN1); 164 | 165 | // Copy retrieved message (plaintext) 166 | Util.arrayCopyNonAtomic(m_ramArrayPt, (short)0, apdubuf, (short)0, (short)(dataLen-16)); 167 | 168 | // SEND OUTGOING BUFFER 169 | apdu.setOutgoingAndSend((short)0, (short)(dataLen-16)); 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /AEAD/CLOC/src/ClocApplet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * PACKAGEID: 43 4C 4F 43 4B 3A // CLOC: 3 | * APPLETID: 43 4C 4F 43 4B 3A 50 04 47 // CLOC:PKG 4 | */ 5 | package cloc; 6 | 7 | import javacard.framework.*; 8 | 9 | /** 10 | * 11 | * @author rajesh 12 | */ 13 | public class ClocApplet extends javacard.framework.Applet 14 | { 15 | // MAIN INSTRUCTION CLASS 16 | final static byte CLA_SIMPLEAPPLET = (byte) 0xB0; 17 | 18 | // INSTRUCTIONS 19 | final static byte INS_CLOCENCRYPTION = (byte) 0x61; 20 | final static byte INS_CLOCDECRYPTION = (byte) 0x62; 21 | 22 | final static short ARRAY_LENGTH = (short) 0xff; 23 | final static byte AES_BLOCK_LENGTH = (short) 0x16; 24 | 25 | final static short SW_BAD_TEST_DATA_LEN = (short) 0x6680; 26 | final static short SW_KEY_LENGTH_BAD = (short) 0x6715; 27 | final static short SW_CIPHER_DATA_LENGTH_BAD = (short) 0x6710; 28 | final static short SW_OBJECT_NOT_AVAILABLE = (short) 0x6711; 29 | final static short SW_BAD_PIN = (short) 0x6900; 30 | 31 | private ClocCore mycloc = null; //CLOC engine 32 | 33 | //CLOC Parameters-- Encryption 34 | byte[] AD = {(byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x09, (byte)0x00, (byte)0x02}; 35 | short ADLEN = (short)AD.length; 36 | byte[] NSEC = {(byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01}; 37 | byte[] NPUB = {(byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02}; 38 | byte[] KEY = {(byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06, (byte)0x07, (byte)0x08, (byte)0x09, (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06}; 39 | short KEYLEN = (short)KEY.length; 40 | 41 | //CLOC Parameters-- Decryption 42 | byte[] AD1 = {(byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x05, (byte)0x09, (byte)0x09, (byte)0x00, (byte)0x02, (byte)0x09, (byte)0x00, (byte)0x02}; 43 | short ADLEN1 = (short)AD1.length; 44 | byte[] NSEC1 = {(byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01}; 45 | byte[] NPUB1 = {(byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02}; 46 | byte[] KEY1 = {(byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06, (byte)0x07, (byte)0x08, (byte)0x09, (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06}; 47 | short KEYLEN1 = (short)KEY1.length; 48 | 49 | // TEMPORARRY ARRAY IN RAM 50 | private byte m_ramArrayPt[] = null; 51 | private byte m_ramArrayCt[] = null; 52 | // PERSISTENT ARRAY IN EEPROM 53 | private byte m_dataArray[] = null; 54 | 55 | /** 56 | * ClocApplet constructor 57 | * Only this class's install method should create the applet object. 58 | */ 59 | protected ClocApplet(byte[] buffer, short offset, byte length) 60 | { 61 | short dataOffset = offset; 62 | boolean isOP2 = false; 63 | 64 | if(length > 9) { 65 | 66 | // shift to privilege offset 67 | dataOffset += (short)( 1 + buffer[offset]); 68 | // finally shift to Application specific offset 69 | dataOffset += (short)( 1 + buffer[dataOffset]); 70 | 71 | // go to proprietary data 72 | dataOffset++; 73 | 74 | // PERSISTENT BUFFER IN EEPROM 75 | m_dataArray = new byte[ARRAY_LENGTH]; 76 | Util.arrayFillNonAtomic(m_dataArray, (short) 0, ARRAY_LENGTH, (byte) 0); 77 | // TEMPORARY BUFFER USED FOR FAST OPERATION WITH MEMORY LOCATED IN RAM 78 | m_ramArrayPt = JCSystem.makeTransientByteArray((short) 260, JCSystem.CLEAR_ON_DESELECT); 79 | m_ramArrayCt = JCSystem.makeTransientByteArray((short) 260, JCSystem.CLEAR_ON_DESELECT); 80 | 81 | //Create ASCON OBJECT 82 | mycloc = new ClocCore(); 83 | 84 | // update flag 85 | isOP2 = true; 86 | 87 | } else {} 88 | register(); 89 | } 90 | 91 | public static void install(byte[] bArray, short bOffset, byte bLength) throws ISOException 92 | { 93 | new ClocApplet (bArray, bOffset, bLength); 94 | } 95 | 96 | public boolean select() 97 | { 98 | return true; 99 | } 100 | 101 | public void deselect() 102 | { 103 | return; 104 | } 105 | 106 | public void process(APDU apdu) throws ISOException 107 | { 108 | // get the APDU buffer 109 | byte[] apduBuffer = apdu.getBuffer(); 110 | 111 | // ignore the applet select command dispatched to the process 112 | if (selectingApplet()) 113 | return; 114 | 115 | // APDU instruction parser 116 | if (apduBuffer[ISO7816.OFFSET_CLA] == CLA_SIMPLEAPPLET) { 117 | switch ( apduBuffer[ISO7816.OFFSET_INS] ) 118 | { 119 | case INS_CLOCENCRYPTION: CLOCEncryption(apdu); break; 120 | case INS_CLOCDECRYPTION: CLOCDecryption(apdu); break; 121 | default : 122 | // The INS code is not supported by the dispatcher 123 | ISOException.throwIt( ISO7816.SW_INS_NOT_SUPPORTED ) ; 124 | break ; 125 | 126 | } 127 | } 128 | else ISOException.throwIt( ISO7816.SW_CLA_NOT_SUPPORTED); 129 | } 130 | 131 | 132 | public void CLOCEncryption(APDU apdu){ 133 | byte[] apdubuf = apdu.getBuffer(); 134 | short dataLen = apdu.setIncomingAndReceive(); 135 | 136 | // Copy message to m_ramArrayPt for encryption 137 | Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_ramArrayPt, (short)0, dataLen); 138 | 139 | mycloc.init(NSEC, NPUB, KEY, KEYLEN); 140 | // CLOC Encryption 141 | mycloc.encrypt(m_ramArrayPt, dataLen, m_ramArrayCt, AD, ADLEN); 142 | 143 | // Copy ciphertext 144 | Util.arrayCopyNonAtomic(m_ramArrayCt, (short)0, apdubuf, (short)0, (short)(dataLen+8)); 145 | 146 | // SEND OUTGOING BUFFER 147 | apdu.setOutgoingAndSend((short)0, (short)(dataLen+8)); 148 | } 149 | 150 | 151 | public void CLOCDecryption(APDU apdu){ 152 | byte[] apdubuf = apdu.getBuffer(); 153 | short dataLen = apdu.setIncomingAndReceive(); 154 | 155 | // Copy cipher to m_ramArrayCt for decryption 156 | Util.arrayCopyNonAtomic(apdubuf, ISO7816.OFFSET_CDATA, m_ramArrayCt, (short)0, dataLen); 157 | 158 | mycloc.init(NSEC1, NPUB1, KEY1, KEYLEN1); 159 | // CLOC Decryption 160 | mycloc.decrypt(m_ramArrayCt, dataLen, m_ramArrayPt, AD1, ADLEN1); 161 | 162 | // Copy retrieved message (plaintext) 163 | Util.arrayCopyNonAtomic(m_ramArrayPt, (short)0, apdubuf, (short)0, (short)(dataLen-8)); 164 | 165 | // SEND OUTGOING BUFFER 166 | apdu.setOutgoingAndSend((short)0, (short)(dataLen-8)); 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /_ext/java_card_kit-2_1_2/samples/classes/com/sun/javacard/samples/JavaLoyalty/javacard/JavaLoyalty.jca: -------------------------------------------------------------------------------- 1 | // converted by version 1.2 2 | // on Mon Apr 09 13:40:50 PDT 2001 3 | 4 | .package com/sun/javacard/samples/JavaLoyalty { 5 | .aid 0xA0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x5; 6 | .version 1.0; 7 | 8 | .imports { 9 | 0xA0:0x0:0x0:0x0:0x62:0x1:0x1 1.0; //javacard/framework 10 | 0xA0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x4 1.0; //com/sun/javacard/samples/SampleLibrary 11 | } 12 | 13 | .applet { 14 | 0xA0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x5:0x1 JavaLoyalty; 15 | } 16 | 17 | .constantPool { 18 | // 0 19 | instanceFieldRef short JavaLoyalty/balance; 20 | // 1 21 | staticMethodRef 0.3.0()V; // javacard/framework/Applet.()V 22 | // 2 23 | virtualMethodRef 0.3.1()V; // javacard/framework/Applet.register()V 24 | // 3 25 | virtualMethodRef 0.3.2([BSB)V; // javacard/framework/Applet.register([BSB)V 26 | // 4 27 | staticMethodRef 0.16.4([BS)S; // javacard/framework/Util.getShort([BS)S 28 | // 5 29 | classRef JavaLoyalty; 30 | // 6 31 | staticMethodRef JavaLoyalty/([BSB)V; 32 | // 7 33 | virtualMethodRef 0.10.1()[B; // javacard/framework/APDU.getBuffer()[B 34 | // 8 35 | virtualMethodRef JavaLoyalty/processReadBalance(Ljavacard/framework/APDU;)V; 36 | .descriptor Ljavacard/framework/APDU; 0.10; 37 | 38 | // 9 39 | virtualMethodRef JavaLoyalty/processResetBalance()V; 40 | // 10 41 | staticMethodRef 0.7.1(S)V; // javacard/framework/ISOException.throwIt(S)V 42 | // 11 43 | virtualMethodRef 0.3.3()Z; // javacard/framework/Applet.selectingApplet()Z 44 | // 12 45 | staticMethodRef 0.16.6([BSS)S; // javacard/framework/Util.setShort([BSS)S 46 | // 13 47 | virtualMethodRef 0.10.8(SS)V; // javacard/framework/APDU.setOutgoingAndSend(SS)V 48 | } 49 | 50 | .class public JavaLoyalty 0 extends 0.3 { // extends javacard/framework/Applet 51 | 52 | .shareable; 53 | 54 | .fields { 55 | short balance 0; // S 56 | static final byte LOYALTY_CLA = -112; // B 57 | static final byte READ_BALANCE = 32; // B 58 | static final byte RESET_BALANCE = 34; // B 59 | static final byte CREDIT = 1; // B 60 | static final byte DEBIT = 2; // B 61 | static final short TRANSACTION_TYPE_OFFSET = 2; // S 62 | static final short TRANSACTION_AMOUNT_OFFSET = 3; // S 63 | static final short SCALE = 100; // S 64 | static final short BALANCE_MAX = 30000; // S 65 | } 66 | 67 | .publicMethodTable 5 { 68 | equals(Ljava/lang/Object;)Z; 69 | register()V; 70 | register([BSB)V; 71 | selectingApplet()Z; 72 | deselect()V; 73 | getShareableInterfaceObject(Ljavacard/framework/AID;B)Ljavacard/framework/Shareable;; 74 | select()Z; 75 | process(Ljavacard/framework/APDU;)V; 76 | grantPoints([B)V; 77 | } 78 | 79 | .packageMethodTable 0 { 80 | processReadBalance(Ljavacard/framework/APDU;)V; 81 | processResetBalance()V; 82 | } 83 | 84 | .implementedInterfaceInfoTable { 85 | .interface 0.2 { // javacard/framework/Shareable 86 | } 87 | 88 | .interface 1.0 { // com/sun/javacard/samples/SampleLibrary/JavaLoyaltyInterface 89 | 8; // grantPoints([B)V 90 | } 91 | 92 | } 93 | 94 | .method protected ([BSB)V 0 { 95 | .stack 4; 96 | .locals 0; 97 | 98 | L0: aload_0; 99 | invokespecial 1; // javacard/framework/Applet.()V 100 | aload_0; 101 | sconst_0; 102 | putfield_s 0; // short com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.balance 103 | aload_1; 104 | ifnull L2; 105 | L1: sload_3; 106 | ifgt L3; 107 | L2: aload_0; 108 | invokevirtual 2; // javacard/framework/Applet.register()V 109 | goto L4; 110 | L3: aload_0; 111 | aload_1; 112 | sload_2; 113 | sload_3; 114 | invokevirtual 3; // javacard/framework/Applet.register([BSB)V 115 | L4: return; 116 | } 117 | 118 | .method public getShareableInterfaceObject(Ljavacard/framework/AID;B)Ljavacard/framework/Shareable; 5 { 119 | .stack 1; 120 | .locals 0; 121 | 122 | .descriptor Ljavacard/framework/AID; 0.6; 123 | .descriptor Ljavacard/framework/Shareable; 0.2; 124 | 125 | L0: sload_2; 126 | ifne L2; 127 | L1: aload_0; 128 | areturn; 129 | L2: aconst_null; 130 | areturn; 131 | } 132 | 133 | .method public grantPoints([B)V 8 { 134 | .stack 3; 135 | .locals 1; 136 | 137 | L0: aload_1; 138 | sconst_3; 139 | invokestatic 4; // javacard/framework/Util.getShort([BS)S 140 | sstore_2; 141 | sload_2; 142 | bspush 100; 143 | sdiv; 144 | sstore_2; 145 | aload_1; 146 | sconst_2; 147 | baload; 148 | stableswitch L3 1 2 L2 L1; 149 | L1: aload_0; 150 | getfield_s_this 0; // short com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.balance 151 | sload_2; 152 | sadd; 153 | putfield_s 0; // short com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.balance 154 | goto L3; 155 | L2: aload_0; 156 | getfield_s_this 0; // short com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.balance 157 | sload_2; 158 | ssub; 159 | putfield_s 0; // short com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.balance 160 | goto L3; 161 | L3: getfield_s_this 0; // short com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.balance 162 | ifge L5; 163 | L4: aload_0; 164 | sconst_0; 165 | putfield_s 0; // short com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.balance 166 | L5: getfield_s_this 0; // short com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.balance 167 | sspush 30000; 168 | if_scmple L7; 169 | L6: aload_0; 170 | sspush 30000; 171 | putfield_s 0; // short com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.balance 172 | L7: return; 173 | } 174 | 175 | .method public static install([BSB)V 1 { 176 | .stack 4; 177 | .locals 0; 178 | 179 | L0: new 5; // com/sun/javacard/samples/JavaLoyalty/JavaLoyalty 180 | aload_0; 181 | sload_1; 182 | sload_2; 183 | invokespecial 6; // com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.([BSB)V 184 | return; 185 | } 186 | 187 | .method public process(Ljavacard/framework/APDU;)V 7 { 188 | .stack 2; 189 | .locals 1; 190 | 191 | .descriptor Ljavacard/framework/APDU; 0.10; 192 | 193 | L0: aload_1; 194 | invokevirtual 7; // javacard/framework/APDU.getBuffer()[B 195 | astore_2; 196 | aload_2; 197 | sconst_0; 198 | baload; 199 | bspush -112; 200 | if_scmpne L5; 201 | L1: aload_2; 202 | sconst_1; 203 | baload; 204 | stableswitch L4 32 34 L2 L4 L3; 205 | L2: aload_0; 206 | aload_1; 207 | invokevirtual 8; // com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.processReadBalance(Ljavacard/framework/APDU;)V 208 | goto L8; 209 | L3: aload_0; 210 | invokevirtual 9; // com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.processResetBalance()V 211 | goto L8; 212 | L4: sspush 27904; 213 | invokestatic 10; // javacard/framework/ISOException.throwIt(S)V 214 | goto L8; 215 | L5: aload_0; 216 | invokevirtual 11; // javacard/framework/Applet.selectingApplet()Z 217 | ifeq L7; 218 | L6: return; 219 | L7: sspush 28160; 220 | invokestatic 10; // javacard/framework/ISOException.throwIt(S)V 221 | L8: return; 222 | } 223 | 224 | .method processReadBalance(Ljavacard/framework/APDU;)V 128 { 225 | .stack 3; 226 | .locals 1; 227 | 228 | .descriptor Ljavacard/framework/APDU; 0.10; 229 | 230 | L0: aload_1; 231 | invokevirtual 7; // javacard/framework/APDU.getBuffer()[B 232 | astore_2; 233 | aload_2; 234 | sconst_0; 235 | getfield_s_this 0; // short com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.balance 236 | invokestatic 12; // javacard/framework/Util.setShort([BSS)S 237 | pop; 238 | aload_1; 239 | sconst_0; 240 | sconst_2; 241 | invokevirtual 13; // javacard/framework/APDU.setOutgoingAndSend(SS)V 242 | return; 243 | } 244 | 245 | .method processResetBalance()V 129 { 246 | .stack 2; 247 | .locals 0; 248 | 249 | L0: aload_0; 250 | sconst_0; 251 | putfield_s 0; // short com/sun/javacard/samples/JavaLoyalty/JavaLoyalty.balance 252 | return; 253 | } 254 | 255 | } 256 | 257 | } 258 | -------------------------------------------------------------------------------- /Pbkdf2/src/PBKDF2.java: -------------------------------------------------------------------------------- 1 | package applets; 2 | 3 | import javacard.framework.JCSystem; 4 | import javacard.framework.Util; 5 | import javacard.security.MessageDigest; 6 | import javacard.security.CryptoException; 7 | import javacard.security.HMACKey; 8 | import javacard.security.KeyBuilder; 9 | import javacard.security.Signature; 10 | 11 | 12 | /** 13 | * 14 | * @author Matej Evin 15 | * 03 August 2018 16 | */ 17 | 18 | // This is the simplified version of PBKDF2 on JavaCard. It does not support any other hash functions than Sha1 and Sha256. 19 | // This is pretty much optimized for speed, but still it is a very lengthy process, because it requires a lot of iterations 20 | // on a slow CPU with very limited memory. 21 | // 22 | // If you know of any speed/memory optimizations, please let me know, I'll surely acknowledge you in my diploma thesis. 23 | // This one uses software implementation of HMAC. There is also hardware (faster) implementation, but it may not work 24 | 25 | ////////////// 26 | // TODO // 27 | ////////////// 28 | 29 | // optimize memory usage - draw a diagram of array access, and figure out if some arrays can't be merged (because now we require a lot of RAM) 30 | 31 | public class PBKDF2 { 32 | 33 | //Public Defines (copied from MessageDigest source code) 34 | public static final byte ALG_SHA = 1; 35 | public static final byte ALG_SHA_256 = 4; 36 | public static final byte LENGTH_SHA = 20; 37 | public static final byte LENGTH_SHA_256 = 32; 38 | public static final short BLOCKSIZE_SHA = 64; 39 | 40 | private final static short SALT_LEN = 16; //maximum usable length of salt (bytes) 41 | 42 | //macros 43 | private final static short SZERO = (short) 0x0; 44 | private final static byte BZERO = (byte) 0x0; 45 | private final static byte BONE = (byte) 0x01; 46 | 47 | //variables 48 | private static short mdlen; //message digest length 49 | 50 | //variable arrays 51 | private byte[] U_i = null; //intermediate values of F function 52 | private byte[] keyprime = null; //place to store K' for creating HMAC 53 | private byte[] innerblock = null; //place to store inner block of HMAC 54 | private byte[] outerblock = null; //place to store outer block of HMAC 55 | 56 | //engines 57 | private MessageDigest m_hash = null; //hash engine 58 | private static PBKDF2 m_instance = null; //instance of pbkdf2 itself 59 | //private HMACKey m_key = null; //HMAC Key structure 60 | //private Signature m_hmac = null; //HMAC Signature engine 61 | 62 | //constructor called during card installation. Nothing really to do here 63 | protected PBKDF2() {} 64 | 65 | //get PBKDF2Core Instance 66 | //what happens if there is already an instance and I try to get a different one? 67 | public static PBKDF2 getInstance(byte algorithm) throws CryptoException { 68 | if (m_instance == null) 69 | { 70 | m_instance = new PBKDF2(); 71 | 72 | switch(algorithm) { 73 | case ALG_SHA: 74 | m_instance.m_hash = MessageDigest.getInstance(ALG_SHA, false); 75 | //m_instance.m_hmac = Signature.getInstance(Signature.ALG_HMAC_SHA1, false); 76 | //m_instance.m_key = (HMACKey) KeyBuilder.buildKey(KeyBuilder.TYPE_HMAC, KeyBuilder.LENGTH_HMAC_SHA_1_BLOCK_64, false); 77 | PBKDF2.mdlen = LENGTH_SHA; 78 | break; 79 | case ALG_SHA_256: 80 | m_instance.m_hash = MessageDigest.getInstance(ALG_SHA_256, false); 81 | //m_instance.m_hmac = Signature.getInstance(Signature.ALG_HMAC_SHA_256, false); 82 | //m_instance.m_key = (HMACKey) KeyBuilder.buildKey(KeyBuilder.TYPE_HMAC, KeyBuilder.LENGTH_HMAC_SHA_256_BLOCK_64, false); 83 | PBKDF2.mdlen = LENGTH_SHA_256; 84 | break; 85 | default: 86 | throw new CryptoException(CryptoException.NO_SUCH_ALGORITHM); 87 | } 88 | 89 | //prepare space for saving hash results 90 | //is it better to create arrays all at the start, or create them on the fly? 91 | //for SHA256 - 288 bytes of transient memory 92 | m_instance.U_i = JCSystem.makeTransientByteArray(mdlen, JCSystem.CLEAR_ON_DESELECT); //32 bytes //resulting hmac 93 | m_instance.keyprime = JCSystem.makeTransientByteArray(BLOCKSIZE_SHA, JCSystem.CLEAR_ON_DESELECT); //64 bytes //padded/hashed key for HMAC 94 | m_instance.innerblock = JCSystem.makeTransientByteArray((short)(BLOCKSIZE_SHA + mdlen), JCSystem.CLEAR_ON_DESELECT); //96 bytes //create enough space for hash 95 | m_instance.outerblock = JCSystem.makeTransientByteArray((short)(BLOCKSIZE_SHA + mdlen), JCSystem.CLEAR_ON_DESELECT); //96 bytes //create enough space for hash 96 | } 97 | return m_instance; 98 | } 99 | 100 | //K - Key, offset, length 101 | //mLength - length of salt (U_i, offset 0) 102 | //output into U_i, return length of output 103 | //out array may overlap K or m arrays. 104 | private short hmac(byte[] K, short KOffset, short KLength, short mLength) { 105 | 106 | //if short key, needs padding with zeros 107 | if (KLength < BLOCKSIZE_SHA) { 108 | Util.arrayFillNonAtomic(keyprime, KLength, (short)(BLOCKSIZE_SHA-KLength), BZERO); // fill rest of array with zeros 109 | Util.arrayCopyNonAtomic(K, KOffset, keyprime, SZERO, KLength); // copy the Key inside 110 | } else 111 | if (KLength > BLOCKSIZE_SHA) { // if long key, needs hashing 112 | m_hash.doFinal(K, KOffset, KLength, keyprime, SZERO); 113 | } else { 114 | Util.arrayCopyNonAtomic(K, KOffset, keyprime, SZERO, KLength); // just copy the Key inside 115 | } 116 | 117 | //xor with ipad/opad 118 | for (short i = 0; i < BLOCKSIZE_SHA; i++) { 119 | innerblock[i] = (byte) (keyprime[i] ^ ((byte) 0x36)); 120 | outerblock[i] = (byte) (keyprime[i] ^ ((byte) 0x5c)); 121 | } 122 | 123 | //concatenate and digest inner part 124 | Util.arrayCopyNonAtomic(U_i, SZERO, innerblock, BLOCKSIZE_SHA, mLength); 125 | m_hash.doFinal(innerblock, SZERO, (short) (BLOCKSIZE_SHA+mLength), innerblock, SZERO); 126 | 127 | //concatenate and digest outer part, save HMAC and return its length 128 | Util.arrayCopyNonAtomic(innerblock, SZERO, outerblock, BLOCKSIZE_SHA, mdlen); 129 | return m_hash.doFinal(outerblock, SZERO, (short) (BLOCKSIZE_SHA+mdlen), U_i, SZERO); 130 | } 131 | 132 | //pw - input password 133 | //salt - input salt 134 | //iterations - # of runs 135 | //out - output array 136 | //return length of output 137 | public short doFinal(byte[] password, short passwordOffset, short passwordLength, 138 | byte[] salt, short saltOffset, short saltLength, 139 | short iterations, 140 | byte[] out, short outOffset) throws CryptoException { 141 | 142 | if (SALT_LEN < saltLength) 143 | throw new CryptoException(CryptoException.ILLEGAL_USE); 144 | 145 | //concatenate with int32BE(1) (salt is max 16, U_i is at least 20, so 4 more bytes can always fit there) 146 | Util.arrayCopyNonAtomic(salt, saltOffset, U_i, SZERO, saltLength); 147 | U_i[ saltLength ] = BZERO; 148 | U_i[(short) (saltLength + 1)] = BZERO; 149 | U_i[(short) (saltLength + 2)] = BZERO; 150 | U_i[(short) (saltLength + 3)] = BONE; 151 | 152 | //generate first HMAC 153 | //hardware HMAC - uncomment these 3 lines and comment the next line to swap HW/SW computation 154 | //m_key.setKey(password, passwordOffset, passwordLength); 155 | //m_hmac.init(m_key, Signature.MODE_SIGN); 156 | //m_hmac.sign(U_i, SZERO, (short) (saltLength + 4), U_i, SZERO); 157 | //software HMAC 158 | hmac(password, passwordOffset, passwordLength, (short) (saltLength + 4)); 159 | //insert U_1 into result array 160 | Util.arrayCopyNonAtomic(U_i, SZERO, out, outOffset, mdlen); 161 | //do the rest of iterations. We already did first iteration above, that's why we start at 1 162 | for (short k = 1; k < iterations; k++) { 163 | //Same with HMAC here 164 | //m_hmac.sign(U_i, SZERO, mdlen, U_i, SZERO); // Hardware hmac 165 | hmac(password, passwordOffset, passwordLength, mdlen); // Software hmac 166 | //xor U_(i-1) with U_i 167 | for (short j = 0; j < mdlen; j++) { 168 | out[(short) (outOffset + j)] ^= U_i[j]; 169 | } 170 | } 171 | 172 | return mdlen; 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /_ext/java_card_kit-3_0_3/COPYRIGHT.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 11 | Copyright 12 | 13 | 14 |
Copyright © 1998, 2010, 15 | Oracle and/or its affiliates. All rights reserved.
17 |
18 |

This software and related documentation are provided under a license 19 | agreement containing restrictions on use and disclosure and are 20 | protected by intellectual property laws. Except as expressly permitted 21 | in your license agreement or allowed by law, you may not use, copy, 22 | reproduce, translate, broadcast, modify, license, transmit, distribute, 23 | exhibit, perform, publish, or display any part, in any form, or by any 24 | means. Reverse engineering, disassembly, or decompilation of this 25 | software, unless required by law for interoperability, is prohibited.

26 |

The information contained herein is subject to change without notice 27 | and is not warranted to be error-free. If you find any errors, please 28 | report them to us in writing.

29 |

If this is software or related software documentation that is 30 | delivered to the U.S. Government or anyone licensing it on behalf of 31 | the U.S. Government, the following notice is applicable:

32 |

U.S. GOVERNMENT RIGHTS Programs, software, databases, and related 33 | documentation and technical data delivered to U.S. Government customers 34 | are "commercial computer software" or "commercial technical data" 35 | pursuant to the applicable Federal Acquisition Regulation and 36 | agency-specific supplemental regulations. As such, the use, 37 | duplication, disclosure, modification, and adaptation shall be subject 38 | to the restrictions and license terms set forth in the applicable 39 | Government contract, and, to the extent applicable by the terms of the 40 | Government contract, the additional rights set forth in FAR 52.227-19, 41 | Commercial Computer Software License (December 2007). Oracle USA, Inc., 42 | 500 Oracle Parkway, Redwood City, CA 94065.

43 |

This software or hardware is developed for general use in a variety 44 | of information management applications. It is not developed or intended 45 | for use in any inherently dangerous applications, including 46 | applications which may create a risk of personal injury. If you use 47 | this software or hardware in dangerous applications, then you shall be 48 | responsible to take all appropriate fail-safe, backup, redundancy, and 49 | other measures to ensure the safe use. Oracle Corporation and its 50 | affiliates disclaim any liability for any damages caused by use of this 51 | software or hardware in dangerous applications.

52 |

Oracle and Java are registered trademarks of Oracle Corporation 53 | and/or its 54 | affiliates. Oracle and Java are registered trademarks of Oracle and/or 55 | its affiliates. Other names may be trademarks of their respective 56 | owners.

57 |

AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks 58 | or registered trademarks of Advanced Micro Devices. Intel and Intel 59 | Xeon are trademarks or registered trademarks of Intel Corporation. All 60 | SPARC trademarks are used under license and are trademarks or 61 | registered trademarks of SPARC International, Inc. UNIX is a registered 62 | trademark licensed through X/Open Company, Ltd.

63 |

This software or hardware and documentation may provide access to or 64 | information on content, products, and services from third parties. 65 | Oracle Corporation and its affiliates are not responsible for and 66 | expressly disclaim all warranties of any kind with respect to 67 | third-party content, products, and services. Oracle Corporation and its 68 | affiliates will not be responsible for any loss, costs, or damages 69 | incurred due to your access to or use of third-party content, products, 70 | or services.
71 |

72 |
73 | Copyright © 1998, 2010, Oracle 74 | et/ou ses affiliés. 75 | Tous droits réservés. 76 | 77 |

Ce logiciel et la documentation qui l’accompagne sont 78 | protégés par les 79 | lois sur la propriété intellectuelle. Ils sont 80 | concédés sous licence et soumis à 81 | des restrictions d’utilisation et de divulgation. Sauf disposition de 82 | votre contrat de licence ou 83 | de la loi, vous ne pouvez pas copier, reproduire, traduire, diffuser, 84 | modifier, breveter, 85 | transmettre, distribuer, exposer, exécuter, publier ou afficher 86 | le logiciel, même partiellement, sous quelque forme 87 | et par quelque procédé que ce soit. Par ailleurs, il est 88 | interdit de 89 | procéder à toute ingénierie inverse du logiciel, 90 | de le désassembler ou de le décompiler, 91 | excepté à des fins d’interopérabilité avec 92 | des logiciels tiers ou tel que prescrit par 93 | la loi.

94 |

Les informations fournies dans ce document sont susceptibles de 95 | modification sans préavis. 96 | Par ailleurs, Oracle Corporation ne garantit pas qu’elles soient 97 | exemptes d’erreurs et vous invite, 98 | le cas échéant, à lui en faire part par 99 | écrit.

100 |

Si ce logiciel, ou 101 | la documentation qui l’accompagne, est concédé sous 102 | licence au Gouvernement des Etats-Unis, ou à 103 | toute entité qui délivre la licence de ce logiciel ou 104 | l’utilise pour le 105 | compte du Gouvernement des Etats-Unis, la notice suivante s’applique:

106 |

U.S. GOVERNMENT RIGHTS. Programs, 107 | software, databases, and related documentation and technical data 108 | delivered to U.S. Government customers are 109 | "commercial computer software" or "commercial technical data" pursuant 110 | to the applicable Federal Acquisition 111 | Regulation and agency-specific supplemental regulations. As such, the 112 | use, duplication, disclosure, modification, and 113 | adaptation shall be subject to the restrictions and license terms set 114 | forth in 115 | the applicable Government contract, and, to the extent applicable by 116 | the terms of the 117 | Government contract, the additional rights set forth in FAR 52.227-19, 118 | Commercial Computer Software 119 | License (December 2007). Oracle America, Inc., 500 Oracle Parkway, 120 | Redwood City, CA 121 | 94065.

122 |

Ce logiciel ou matériel a été 123 | développé pour un usage général dans le 124 | cadre d’applications de gestion des informations. Ce logiciel ou 125 | matériel n’est pas conçu ni 126 | n’est destiné à être utilisé dans des 127 | applications à risque, notamment dans des applications 128 | pouvant causer des dommages corporels. Si vous utilisez ce logiciel ou 129 | matériel dans 130 | le cadre d’applications dangereuses, il est de votre 131 | responsabilité de prendre toutes les mesures 132 | de secours, de sauvegarde, de redondance et autres mesures 133 | nécessaires à son utilisation 134 | dans des conditions optimales de sécurité. Oracle 135 | Corporation et ses affiliés déclinent toute 136 | responsabilité 137 | quant aux dommages causés par l’utilisation de ce logiciel ou 138 | matériel pour ce type 139 | d’applications.

140 |

Oracle et Java sont des marques déposées d’Oracle 141 | Corporation et/ou de ses affiliés.Tout 142 | autre nom mentionné peut correspondre à des marques 143 | appartenant à d’autres propriétaires qu’Oracle.

144 |

AMD, Opteron, 145 | le logo AMD et le logo AMD Opteron sont des marques ou des 146 | marques déposées d’Advanced Micro Devices. Intel et Intel 147 | Xeon sont des marques ou 148 | des marques déposées d’Intel Corporation. Toutes les 149 | marques SPARC sont utilisées sous licence et 150 | sont des marques ou des marques déposées de SPARC 151 | International, Inc. UNIX est une 152 | marque déposée concédée sous licence par 153 | X/Open Company, Ltd.

154 |

Ce logiciel ou matériel et 155 | la documentation qui l’accompagne peuvent fournir des informations ou 156 | des liens donnant accès à 157 | des contenus, des produits et des services émanant de tiers. 158 | Oracle Corporation et 159 | ses affiliés déclinent toute responsabilité ou 160 | garantie expresse quant aux contenus, produits ou services 161 | émanant de tiers. En aucun cas, Oracle Corporation et ses 162 | affiliés ne sauraient 163 | être tenus pour responsables des pertes subies, des coûts 164 | occasionnés ou des dommages causés 165 | par l’accès à des contenus, produits ou services tiers, 166 | ou à leur utilisation.
167 |

168 |

169 |
170 | 171 | 172 | --------------------------------------------------------------------------------