aspose file tools
The moose likes Security and the fly likes Jdk14 Cipher Providers Exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Security
Reply Bookmark "Jdk14 Cipher Providers Exceptions" Watch "Jdk14 Cipher Providers Exceptions" New topic
Author

Jdk14 Cipher Providers Exceptions

H.C. Satish
Greenhorn

Joined: Feb 08, 2004
Posts: 4
Hi All
When Execute the below code exception in jdk14CipherWithModeWithPadding()"java.security.NoSuchAlgorithmException" @ the commented lines (2, 3, 6, 7, 8, 10, 11, 14, 15, 16, 17, 18, 19, 22, 23)
but in jdk14CipherProviders() there is no exception,
Kindly suggest issues related these exceptions

import javax.crypto.Cipher;
import java.security.NoSuchAlgorithmException;
import java.security.Provider;
import javax.crypto.NoSuchPaddingException;

public class CipherProviderInJdk14 {
public static void main (String ar[]) {
CipherProviderInJdk14 cipherProviderInJdk14 = new CipherProviderInJdk14();
cipherProviderInJdk14.jdk14CipherWithModeWithPadding ( );
cipherProviderInJdk14.jdk14CipherProviders( );
}
public void jdk14CipherWithModeWithPadding ( ) {
String alg [] = { "Blowfish/ECB/PKCS5Padding",// 0
"Blowfish/CBC/PKCS5Padding",// 2
"Blowfish/CFB/PKCS5Padding",// 3
"Blowfish/OFB/PKCS5Padding",// 4
"DESEDE/ECB/PKCS5Padding",// 5
"DESEDE/CBC/PKCS5Padding",// 6
"DESEDE/CFB/PKCS5Padding",// 7
"DESEDE/OFB/PKCS5Padding",// 8
"PBEWITHMD5ANDTRIPLEDES/ECB/PKCS5Padding",// 9
"PBEWITHMD5ANDTRIPLEDES/CBC/PKCS5Padding",// 10
"PBEWITHMD5ANDTRIPLEDES/CFB/PKCS5Padding",// 11
"PBEWITHMD5ANDTRIPLEDES/OFB/PKCS5Padding",// 12
"DES/ECB/PKCS5Padding",// 13
"DES/CBC/PKCS5Padding",// 14
"DES/CFB/PKCS5Padding",// 15
"DES/OFB/PKCS5Padding",// 16
"PBEWITHMD5ANDDES/ECB/PKCS5Padding",// 17
"PBEWITHMD5ANDDES/CBC/PKCS5Padding",// 18
"PBEWITHMD5ANDDES/CFB/PKCS5Padd2ing",// 19
"PBEWITHMD5ANDDES/OFB/PKCS5Padding",// 20
"TRIPLEDES/ECB/PKCS5Padding",// 21
"TRIPLEDES/CBC/PKCS5Padding",// 22
"TRIPLEDES/CFB/PKCS5Padding",// 23
"TRIPLEDES/OFB/PKCS5Padding" };// 24
for (int i = 0; i < alg.length; i++) {
try {
Cipher skf = Cipher.getInstance(alg[i]);
Provider pr = skf.getProvider();
System.out.println(i + "\t" +alg[i] + "\tCipher\t" + pr.getName());
} catch (NoSuchAlgorithmException nsae) {
System.out.println(i + "\t" + alg[i] + "\tCipher\t\t" +nsae);
} catch (NoSuchPaddingException nspe) {
System.out.println(i + "\t" + alg[i] + "\tCipher\t\t" +nspe);
}
}
}
public void jdk14CipherProviders( ) {
String prov [] = { "Blowfish", "DESEDE", "PBEWITHMD5ANDTRIPLEDES", "DES", "PBEWITHMD5ANDDES", "tripledes" };
for (int i = 0; i < prov.length; i++) {
try {
Cipher skf = Cipher.getInstance(prov[i]);
Provider pr = skf.getProvider();
System.out.println(i + "\t" + prov[i] + "\tCipher Provider\t" + pr.getName());
} catch (NoSuchAlgorithmException nsae) {
System.out.println(i + "\t" + prov[i] + "\tCipher Provider\t" +nsae);
} catch (NoSuchPaddingException nspe) {
System.out.println(i + "\t" + prov[i] + "\tCipher\t\t" +nspe);
}
}
}
}
 
 
subject: Jdk14 Cipher Providers Exceptions
 
Threads others viewed
Digital Signature in PKCS 7 format with base 64 encoding
crytography
Length of Encrypted String Longer than Original String... Help
Algorithm DES not available
error coming while decrypting...
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com