Re: JDK1.2/JCE1.2

Jan Luehe (luehe@laguna.eng.sun.com)
Thu, 3 Dec 1998 18:20:36 -0800 (PST)

Samir:

> Hi everybody, I downloaded JDK1.2, JCE1.2, JavaMail1.1 and Jaf1.0
> recently to develop a servlet that sends encrypted E-mail. Very soon, I
> got frustrated. I tried to conpile the following program:

Your program compiled and ran fine without any problems.

> I got the following compiler error:
>
> Encrypt.java:6: Class java.security.GeneralSecurityException not found
> in class Encrypt. Then, I unarchived the source codes and realised that
> java.security package is there, so I compiled it and put a reference to
> the classes in the CLASSPATH. I recompiled the program. This time, it
> compiled fine without an error.

You should not have to do this. Please follow the install
instructions for JCE 1.2 in

http://developer.java.sun.com/developer/earlyAccess/jdk12/jce12_install.html

> When I went to run the program, I got the following error:
>
> Exception in thread "main" java.lang.InternalError: internal error:
> SHA-1 not available.
> at sun.security.provider.SecureRandom.init(SecureRandom.java:93)
> at sun.security.provider.SecureRandom.(init)(SecureRandom.java:72)
> at java.security.SecureRandom.(init)(SecureRandom.java:132)
> at com.sun.crypto.provider.DESKeyGenerator.engineGeneratorKey(Compiled
> Code)
> at javax.crypto.KeyGenerator.generateKey(KeyGenerator.java:278)
> at Encrypt.main(Encrypt.java:11)
>
> Please help me resolve this problem. I would really appreciate that!

This looks like you removed the standard "SUN" provider that
comes with JDK 1.2.

The JCE 1.2 documentation says that the "SunJCE" provider (the
default provider that comes with JCE 1.2) relies on some of the
functionality provided by the "SUN" provider. For example, if
you do not specify your own SecureRandom implementation when
generating a DES key, the "SunJCE" provider uses the SecureRandom
implementation from the "SUN" provider, which is based on the
SHA1 digest algorithm.
Please make sure that your security properties file
(jre/lib/security/java.security) contains this line:

security.provider.1=sun.security.provider.Sun


Jan