Java Glossary : BouncyCastle

CMP home Java glossary home Menu no menu Last updated 2004-06-28 by Roedy Green ©1996-2004 Canadian Mind Products

Java definitions: 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

You are here : home : Java Glossary : B words : BouncyCastle.

BouncyCastle
Legion of the Bouncy Castle is a JCE (Java Cryptographic Extension)-compatible library that also handles PGP. It is well regarded. The source is not well formatted or commented. The JavaDoc in version 1.22 was sparce and inaccurate. Version 1.24 is reputedly better. I don't know how they do it, but everything is free.

BouncyCastle has the big advantage of being Australian, and hence immune to the silly American laws about exporting strong encryption. If Americans use BouncyCastle they need not worry about that law, since the code in not American.

You will want to download the BouncyCastle jars for:

Put the jars in your ext directories: C:\Program Files\Java\j2re1.4.2_04\lib\ext and J:\j2sdk1.4.2_04\jre\lib\ext.

Generating Keys

Generate a binary private/public key with:

java org.bouncycastle.openpgp.examples.RSAKeyPairGenerator charlie "open sesame"

The public and private keys will appear as pub.bpg, and secret.bpg. You can generate ascii *.asc ascii armoured file instead by using the -a option like this:

java org.bouncycastle.openpgp.examples.RSAKeyPairGenerator -a charlie "open sesame"

To generate variants look at the source code in bcpg-jdk14-122/src/org/bouncycastleopenpgp/examples/RSAKeyPairGenerator.java

Signing A Binary File

java org.bouncycastle.openpgp.examples.SignedFileProcessor -s anyfile.dat secret.bpg "open sesame"

Resulting signed file will appear in anyfile.dat.bpg signed, but not encrypted.

Verifying a Signed Binary File

java org.bouncycastle.openpgp.examples.SignedFileProcessor -v anyfile.dat.bpg pub.bpg


CMP logo
CMP_home
home
Canadian Mind Products CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[24.87.56.253]
Your IP:[80.134.30.163]
You are visitor number 481.
Please send errors, omissions and suggestions
to improve this page to Roedy Green.
You can get a fresh copy of this page from: or possibly from your local J: drive mirror:
http://mindprod.com/jgloss/bouncycastle.html J:\mindprod\jgloss\bouncycastle.html