May 2001
Intermediate to advanced
1088 pages
30h 13m
English
Decrypting the data is just as easy (or hard) as encrypting it. You've already seen the steps you must take, because you still create a key and initialize a Cipher object. The major difference is that the cipher mode must be Cipher.DECRYPT_MODE instead of Cipher.ENCRYPT_MODE. Other than that, you still use update and doFinal to process the data, or use CipherInputStream to read encrypted data from a stream and decrypt it.
Listing 33.4 shows a program that decrypts the data encrypted by the program in Listing 33.2.
package usingj2ee.security; import java.io.*; import javax.crypto.*; import javax.crypto.spec.*; import java.security.*; public class DecryptData { public static void ... |
Read now
Unlock full access