1 / 15

JCA, Cryptography for Java Programmer

JCA, Cryptography for Java Programmer. Shawn Shuang Zhang CS 627. Cryptography Users. Application. End User. PGP, SSL. Integration. Programmer. ?. Development. Cryptographer. Math, SPI. JCA. Figure 1-1. [1] Page 30 Figure 3-1. JCE. Java Cryptography Extension. Providers.

tyrell
Download Presentation

JCA, Cryptography for Java Programmer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JCA, Cryptography for Java Programmer Shawn Shuang Zhang CS 627

  2. Cryptography Users Application End User PGP, SSL Integration Programmer ? Development Cryptographer Math, SPI

  3. JCA Figure 1-1. [1] Page 30 Figure 3-1

  4. JCE • Java Cryptography Extension

  5. Providers • Cipher API • Cipher SPI

  6. Restrictions

  7. SunJCE • RSA • DES • Triple DES • MD5 • SHA-1 • Hmac with MD5 • Hamc with SHA-1

  8. Cryptix • LIKI91 • Triple DES • DES2X • DESX • IDEA • RC2 • RC4 • Blowfish • CAST5 • SPEED • SQUARE

  9. IAIK-ICE • RSA • Triple DES • IDEA • RC2 • RC4 • MD2 • MD5 • SHA-1 • Hmac with MD5 • Hmac with SHA-1 • CAST5 • GOST

  10. Example • Get a Cipher • Public static Cipher getInstance(String algorithm, String provider) throws NoSuchAlgorithmException • Cipher cipher=Cipher.getInstance(“DEC”)

  11. Initialize a Cipher • ENCRYPT_MODE • DECRYPT_MODE • Public final void init(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException • Cipher.init(Cipher.ENCRYPT_MODE, Key);

  12. Feed the data • Public final byte[] update(byte[] input) throws IllegalStateException • Byte[] ciphertext=cipher.update(plaintext)

  13. doFinal • Public final byte[] doFinal() IllegalStateException, IllegalBlockSizeException, BadpaddingExceptioin • Byte[] ciphertext=cipher.doFinal();

  14. Example Cipher cipher=Cipher.getInstance(“DES/CBC/PKCS5Padding”); cipher.init(Cipher.ENCRYPT_MODE, key); Byte[] palintext=“plain”.getBytes(); Byte[] step=cipher.update(plaintext); Byte[] ciphertext=cipher.doFinal(plaintext);

  15. References • Java Cryptography by Jonathan Knudsen • Internet Cryptography by Richard E. Smith • http://java.sun.com/products/jsk/1.4/jce • http://www.systemics.com/software/cryptix-java • http://wwwjce.iaik.tu-graz.ac.at/

More Related