Hello all. I've recently started doing a java encryption/decryption project using the crypto and security packages. I have very little experience with java although I do have a lot of experience in C and C++ so I am no stranger to OO programming. Anyway, I have this one line of code which is causing me a problem.
import java.util.*; import DataLog.*; import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; public class JCipher { private static Cipher jc; public static void main(String[] args) { /* Apparently this method does not exist, how should I use the Cipher class? */ jc = Cipher.getInstance("DES/CBC/PKCS5Padding"); } }
Obviously I have more code than that, but it shows the principle.
Here is the compiler message:
JCipher.java:79: unreported exception java.security.NoSuchAlgorithmException; must be caught or declared to be thrown jc = Cipher.getInstance("DES/CBC/PKCS5Padding"); ^ 1 error
I am using JDK 6.27, did they change the interface for accessing the classes, all the info I can find says that I should get an instance rather than doing something like: jc = new Cipher(...);
The only other idea I have is that my imports are wrong but all the examples I've looked at have the same imports.