Download presentation
Presentation is loading. Please wait.
Published byAdelia Snow Modified over 9 years ago
1
JCA, Cryptography for Java Programmer Shawn Shuang Zhang CS 627
2
Cryptography Users Application Integration Cryptographer End User Programmer Development PGP, SSL ? 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 ProviderFree?U.S. only? SunJCE 1.2.1YesNo SunJCE 1.2Yes CryptixYesNo IAIKNoNO
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- javahttp://www.systemics.com/software/cryptix- java http://wwwjce.iaik.tu-graz.ac.at/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.