Article View: borland.public.jbuilder.java.language
Article #18856security class
From: Carlos Javier Castro Pe�a
Date: Wed, 08 Apr 1998 00:00
Date: Wed, 08 Apr 1998 00:00
33 lines
1633 bytes
1633 bytes
I need to sign digital a text file, I use the following piece of code
that I borrowed from a java tutorial:
------------------------------------------------------------------------
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA");
keyGen.initialize(1024, new SecureRandom());
KeyPair pair = keyGen.generateKeyPair();
/*2- Sign the file*/
Signature dsa = Signature.getInstance("SHA/DSA");
PrivateKey priv = pair.getPrivate();
dsa.initSign(priv);
byte b;
FileInputStream fis = new FileInputStream (config_file);
while (fis.available() != 0) {
b = (byte) fis.read();
dsa.update(b);
}; //while
fis.close();
byte[] sig = dsa.sign();
------------------------------------------------------------------------
How can I write the digital signature to a text file to retrieve later
for authentication?
How can I store the generated Key ?
--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Carlos Javier Castro Pe�a
email: jcaspen@iname.com
web: http://www.latin-cancer.com/jcaspen
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Technical Details
Message-ID:
<352C0239.83216FD4@iname.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f74b3,34bbbe97e8829417,start X-Google-Attributes: gidf74b3,public From: "Carlos Javier Castro Pe�a" <jcaspen@iname.com> Subject: security class Date: 1998/04/08 Message-ID: <352C0239.83216FD4@iname.com> X-Deja-AN: 342228687 Content-Transfer-Encoding: 8bit Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Organization: Univerity of Kansas Newsgroups: borland.public.jbuilder.java.language