HELP on DSA signature

David HANNAPPE (dhe@orlando.fr)
Tue, 10 Mar 1998 10:20:36 +0100

Date: Tue, 10 Mar 1998 10:20:36 +0100
From: "David HANNAPPE" <dhe@orlando.fr>
To: java-security@web2.javasoft.com
Subject: HELP on DSA signature

hello,
I want to Implement two applications:
the first, which can sign a String for instance and write the public key

and the Signature to a file.
the second which take the public key and signature from the file and
verify a string.
How can I write these applications ?
I try the following code ?

First application look like ...

String s=name;

keyGen=KeyPairGenerator.getInstance("DSA");
keyGen.initialize(256,new SecureRandom());

pair=keyGen.generateKeyPair();
dsa=Signature.getInstance("DSA");
privatekey=pair.getPrivate();
publickey=pair.getPublic();
dsa.initSign(privatekey);
dsa.update(s.getBytes());
byte[] b=dsa.sign();

... Don't know how to right the right information to a file?

Second,
... Don't know how to retreive information on public key and
signature from file,
and how to initialize the object Signature with a given public
key ?

Thank you for helping me andanswering me as soon as possible.

--
David HANNAPPE

ORLANDO 179-181, Avenue Charles de Gaulle 92200 Neuilly sur seine France

Tel: 33 1 (0)1 41 43 84 70 Fax: 33 1 (0)1 41 43 84 80 E-mail: dhe@orlando.fr

http://www.orlando.fr