# Great problem, please help me.

Dario Sgorbini (sgorbini@cli.di.unipi.it)
Tue, 23 Mar 1999 13:48:10 +0100 (MET)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Dylan Williams: "Is is legal to download your software."
- Previous message: PRAVIN MUKHEDKAR: "Regarding JDBC connectivity problem"

    Date: Tue, 23 Mar 1999 13:48:10 +0100 (MET)

    From: Dario Sgorbini <sgorbini@cli.di.unipi.it>

    To: javasecurity <java-security@java.sun.com>

    Subject: Great problem, please help me.

I have to write an applet in jdk1.1 version and i use Explorer 4.0 and
Netscape 4.5.
It is important to underline that i can`t use jdk12 and plug-in to run
the applet, but I must use some of the classes of the security package of
JDK12 to digitally sign a file when the user clicks on a `submit` button
in the applet.

I created a public key in the x509 format and a private key in the pkcs8
format using a separated application written in jdk12 and then i stored
them in two separate files, let`s say privateKeyFile and publicKeyFile.

The applet must read the privateKeyFile and get the
corresponding PrivateKey object to sign the file, but I haven`t the
PKCS8EncodedKeySpec class, because i don`t use the JVM of Sun.
Similarly I assume there`s no Provider to instantiate any of the
KeyFactory or Signature class.

How can I solve this problem??

in the src.jar file of jdk12 there are the source codes for all the
classes of the security package of jdk12. I could try to recompile them
with jdk117 and put them with the other classes of my applet.
But how can I get the SUN provider??

this is the relevant code I need to use:
FileInputStream in= new FileInputStream(...privateKeyFile..);
byte[] encKey = new byte[in.available()];
in.read(encKey);
in.close;

PKCS8EncodedKeySpec keyspec = new PKCS8EncodedKeySpec(encKey);
KeyFactory kf= KeyFactory.getInstance("DSA","SUN");
PrivateKey privateKey= kf.generatePrivate();

............
Signature dsa= Signature.getInstance("Sha1withDSA","SUN");
.............

I need the SUN provider and theese classes out of the JVM of the SUN.

Could you give me some advices please??

P.S: I am italian and I can`t use the JCE. If other libraries exist could
you tell me how to find them and how to actually use them inside my
applet?? that is how the applet can execute the code of the library while
running on a remote host!

Thank you for your attention and goodbye.

Sgorbini@cli.di.unipi.it

- Next message: Dylan Williams: "Is is legal to download your software."
- Previous message: PRAVIN MUKHEDKAR: "Regarding JDBC connectivity problem"