AXISHK
asked on
Error in Java program
An error in my Java code with the message "package org.bouncycastle.jce.provi der does not exist". Any idea how to fix it ? I'm using Java 8.
Thx
Thx
Sounds like your classpath is wrong and the Bouncy Castle jars are not in it
It seems package org.bouncycastle.jce.provi der is missing ,please look for package in your project structure naming
org.bouncycastle.jce.provi der.proper jars should be in the place (in the build path if required dependency)
org.bouncycastle.jce.provi
Put in classpath these two libraries:
bcprov.jar
bcpkix.jar
bcprov.jar
bcpkix.jar
ASKER
Can't find these jar files, where can I download them ? Thx
ASKER
I have downloaded the JAR File : http://www.java2s.com/Code/Jar/b/Downloadbouncycastlejcejdk13112jar.htm and put it under the library of my NetBean project. However, another message prompt up.
No such algorithm: DES/CRT/Nopadding. Any idea ?
private void jButton9ActionPerformed(ja va.awt.eve nt.ActionE vent evt) {
try {
Security.addProvider(new org.bouncycastle.jce.provi der.Bouncy CastleProv ider());
input = Simple_txt.getText().getBy tes();
SecretKeySpec key = new SecretKeySpec(keyBytes, "DES");
IvParameterSpec ivSpec = new IvParameterSpec(ivBytes);
cipher = Cipher.getInstance("DES/CR T/NoPaddin g", "BC");
cipher.init(Cipher.ENCRYPT _MODE, key,ivSpec);
cipherText = new byte[cipher.getOutputSize( input.leng th)];
ctLength = cipher.update(input, 0, input.length, cipherText, 0);
ctLength += cipher.doFinal(cipherText, ctLength);
Encrypt_txt.setText(new String(cipherText));
System.out.println("cipher : " + new String(cipherText));
} catch (Exception ex) {
JOptionPane.showMessageDia log(null, ex);
}
}
No such algorithm: DES/CRT/Nopadding. Any idea ?
private void jButton9ActionPerformed(ja
try {
Security.addProvider(new org.bouncycastle.jce.provi
input = Simple_txt.getText().getBy
SecretKeySpec key = new SecretKeySpec(keyBytes, "DES");
IvParameterSpec ivSpec = new IvParameterSpec(ivBytes);
cipher = Cipher.getInstance("DES/CR
cipher.init(Cipher.ENCRYPT
cipherText = new byte[cipher.getOutputSize(
ctLength = cipher.update(input, 0, input.length, cipherText, 0);
ctLength += cipher.doFinal(cipherText,
Encrypt_txt.setText(new String(cipherText));
System.out.println("cipher
} catch (Exception ex) {
JOptionPane.showMessageDia
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Cipher.getInstance("DES/CRT/NoPadding", "BC");
What code have you got that leads you to believe that algo is possible from that provider and where did you get it?
Thanks AXIHSK,it's nice to see its worked for you.you are most welcome.