[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] JCE Applet Edition reporting iaik.java.security.NoSuchAlgorithmException: Algorithm DSA not implemenated.



I am trying to encrypt a String with an existing DSA private key, but the following code:
 
public static void main(String args[])
{
 try
 {
  String password = "This is a test password numbered 0123456789";
  iaik.security.dsa.DSAPrivateKey iicl = new iaik.security.dsa.DSAPrivateKey(new java.io.FileInputStream(new java.io.File("O:\\Technical\\javakey\\iicl_priv")));
  javax.crypto.Cipher privateCipher = javax.crypto.Cipher.getInstance("DSA");
  javax.crypto.CipherInputStream privateCipherInputStream = new javax.crypto.CipherInputStream(new java.io.ByteArrayInputStream(password.getBytes()), privateCipher);
  java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
  byte[] bytes = new byte[256];
  int status = privateCipherInputStream.read(bytes);
  while (status != -1)
  {
   baos.write(bytes, 0, status);
   status = privateCipherInputStream.read(bytes);
  }
  privateCipherInputStream.close();
  String encryptedPassword = baos.toString();
  baos.close();
  System.out.println(encryptedPassword);
 }
 catch (Exception e)
 {
  System.out.println("StringEncrypt.main(): failed with " + e.getMessage());
  e.printStackTrace();
  System.exit(0);
 }
}
 
gives the following error:
 
StringEncrypt.main(): failed with Algorithm DSA not implemenated.
iaik.java.security.NoSuchAlgorithmException: Algorithm DSA not implemenated.
 java.lang.Throwable(java.lang.String)
 java.lang.Exception(java.lang.String)
 iaik.java.security.NoSuchAlgorithmException(java.lang.String)
 java.lang.String javax.crypto.IaikSecurity.a()
 java.lang.Object javax.crypto.IaikSecurity.getImplementation()
 javax.crypto.Cipher javax.crypto.Cipher.getInstance(java.lang.String, java.lang.String)
 javax.crypto.Cipher javax.crypto.Cipher.getInstance(java.lang.String)
 void uk.co.streeter.dave.cryptography.test.StringEncrypt.main(java.lang.String [])
 
Please help.....
 

Regards

Dave Streeter