Posts Tagged AES
How to encrypt/decrypt files in Java with AES in CBC mode using Bouncy Castle API and NetBeans or Eclipse
The Bouncy Castle Crypto API for Java provides a lightweight cryptography API that is an alternative to the standard Sun Java Cryptographic Architecture (JCA) and Java Cryptographic Extension (JCE) bundled in the JDK. The API can be used in J2ME MIDlet applications or in other Java applications up to the 1.7 platform.
The Bouncy Castle lightweight cryptographic API can be used as a:
- Cryptographic Service Provider (CSP) for the JCA;
- external library.
In this post we will see how to use the the Bouncy Castle lightweight cryptographic API in both situations, as the syntax differs from one approach to the other. To highlight the differences, the advantages and the disadvantages of the two solutions, the Bouncy Castle API is used in a console Java application to encrypt/decrypt files with the AES (Advanced Encryption Standard) or Rijndael algorithm in Cipher Block Chaining (CBC) mode.
In this post we will see how to use the AES (Advanced Encryption Standard) or Rijndael algorithm implementation from the Bouncy Castle API for J2ME platform. The example will use the AES lightweight engine to encrypt and decrypt a file managed by a J2ME (Midlet) application.
The Bouncy Castle Crypto API for Java provides a lightweight cryptographic API that works with everything from the J2ME to the JDK 1.6 platform.
The API is different for J2ME platform than the one for JDK platform. For example, the lightweight API has different implementations for the two platforms: