Java Reference
In-Depth Information
and a lightweight cryptography API that fits well with Java ME. This API implements
many popular ciphers, including DES, AES, Blowfish, International Data Encryption
Algorithm (IDEA), and others, as well as a slew of message-digest algorithms, including
MD5 and SHA. The API also provides a large number of utilities, including support for
Abstract Syntax Notation One (ASN.1) encoding and decoding, X.509 cryptographic
certificates and public-key exchange files, and codecs for Secure/MIME (S/MIME) and
OpenPGP.
You can get a copy of the API from http://www.bouncycastle.org/java.html ; as I write
this, the current version is 1.39. You'll want to download the release, unpack it, and drop
the ZIP files in the zips directory in the lib directory of your project.
The Bouncy Castle API consists of a number of packages; the following are the ones
you're most likely to use:
org.bouncycastle.crypto : Includes base classes that represent cryptographic
engines, digests, and other basic constructs
org.bouncycastle.crypto.digests : Includes classes that implement message-digest
algorithms
org.bouncycastle.crypto.engines : Includes classes that implement cipher
algorithms
org.bouncycastle.crypto.generators : Includes classes that implement key
generators
org.bouncycastle.crypto.params : Includes classes that implement representations
to options for specific cipher algorithms
It's worth noting that the full implementation of Bouncy Castle for Java ME is large :
nearly one and a half megabytes! Of course, almost no application needs all of the func-
tionality provided by the API. To manage the size of applications depending on the API,
you need to use an obfuscator—something I discuss in Chapter 3 in the section titled
“Building CLDC/MIDP Applications.” NetBeans includes the ProGuard ( http://
proguard.sourceforge.net ) obfuscator, which does a fine job at managing the output
application size. Figure 15-2 shows appropriate settings for use with the Bouncy Castle
API; choose Obfuscating under the Build property.
 
Search WWH ::




Custom Search