Two Laptop Bag*
The moose likes Other JSE/JEE APIs and the fly likes JSSE sample code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JSSE sample code" Watch "JSSE sample code" New topic
Author

JSSE sample code

Matthew X. Brown
Ranch Hand

Joined: Nov 08, 2000
Posts: 165
I was hoping that someone(possibly our the esteemed guests/authors-Jess and Daniel)- has sample code for generating a certificate. Tomcat 3.2.x has a certificate store and command line utilities for loading into the store-but I need to generate a certificate first. I've got an online shopping cart that I need to secure. I'm opting on this solution over using OpenSSL to generate certificates. I believe that the certificate would be generated using the java.security.cert.CertificateFactory class- but it would be nice to have a piece of code to chew on. Thanks
Matt
Jess Garms
Author
Greenhorn

Joined: Jul 16, 2001
Posts: 17
The command-line program keytool (shipped with JDK 1.2 and 1.3) will let you generate certificates. It's probably easier to use than to try to create them programmatically, unless you're looking to create a large number of certificates.
CertificateFactory is actually for tranforming an encoded cert from a file or a stream into a Java object. The public Java APIs don't provide the ability to create a certificate from scratch.
Originally posted by Matthew Brown:
I was hoping that someone(possibly our the esteemed guests/authors-Jess and Daniel)- has sample code for generating a certificate. Tomcat 3.2.x has a certificate store and command line utilities for loading into the store-but I need to generate a certificate first. I've got an online shopping cart that I need to secure. I'm opting on this solution over using OpenSSL to generate certificates. I believe that the certificate would be generated using the java.security.cert.CertificateFactory class- but it would be nice to have a piece of code to chew on. Thanks
Matt


------------------

Jess Garms<br />Author of "<a href="http://www.amazon.com/exec/obidos/ASIN/1861004257/electricporkchop" target="_blank" rel="nofollow">Professional Java Security</a>"
Matthew X. Brown
Ranch Hand

Joined: Nov 08, 2000
Posts: 165
Boy that shows you how much I know- I should really brush up on my Java Security. Could you recommend a book to help me ?
Jess Garms
Author
Greenhorn

Joined: Jul 16, 2001
Posts: 17
Originally posted by Matthew Brown:
Boy that shows you how much I know- I should really brush up on my Java Security. Could you recommend a book to help me ?

Heh. Well, I'd certainly recommend Professional Java Security, since I'm one of the authors. Seriously though, it contains plenty of information on how to set up your keystores to use the JSSE, including a number of examples.

------------------
Jess Garms
Author of "Professional Java Security"
James Nuzzi
Ranch Hand

Joined: Aug 02, 2001
Posts: 35
Hi,
Does your book have any information on accessing directory servers using LDAP over SSL?

------------------

James Nuzzi
SCJP, SCJD, SCWCD


James Nuzzi<br /> <br />SCJP 1.2, 1.4, 5.0, 6<br />SCJD<br />SCWCD<br />MCSE NT 4.0<br />MCAD C# .NET
Jess Garms
Author
Greenhorn

Joined: Jul 16, 2001
Posts: 17
Originally posted by James Nuzzi:
Hi,
Does your book have any information on accessing directory servers using LDAP over SSL?


Afraid not, sorry. There's general information on using SSL as both client and server, but nothing specific to LDAP.

------------------
Jess Garms
Author of "Professional Java Security"
Sean Bruton
Greenhorn

Joined: Jan 18, 2002
Posts: 3
Does anyone have any sample code for generating certificates completly w/ java... I do have the need to generate lots of certificates and I would much prefer to do it w/o calling outside applications.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSSE sample code
 
Similar Threads
Applets, SSL Sockets, and Certificates
Help with generating self-signed certs in BC
SATSA jsr 177
applet access file on his server?
Using Bouncy Castle - Generate a Certificate and Sign that by CA Root Certificate