> how can i use bouncy castle api's in java?
> can u just give me instruction!!!!
> thnx
> watin for yur reply!!
You don't really expect me to write a 100 page document on using Bouncy Castle when there is already documentation and examples - http://www.bouncycastle.org/documentation.html
> can u plz tel me wer 2 extract the java n org
> folders...
> also, is the compilation normal?
I don't really understand. Please use English as I don't speak SMS.
Again, there is already documentation and examples - http://www.bouncycastle.org/documentation.html
I find it best to download the 'grab the lot at one hit' i.e. crypto-135.tar.gz or crypto-135.tar.zip from http://www.bouncycastle.org/latest_releases . Just unzip and you will find the jars you need for the JDK you are using. You will need to add the appropriate jar to your class path.
From there, follow the documentation and examples.
There must be some tutorial information on their website. I know they have an examples on http://www.bouncycastle.org/documentation.html. Basically, you can use it in two ways. One way is exclusively through the JCE. You use the same Java classes like Cipher, MessageDigest, Signature, etc, but you explicitly specify the provider in the getInstance method. Here is small code fragment example
import java.io.*;
import java.security.*;
import javax.crypto.*;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
public class BCastle1
{
public static void main(String[] args) throws Exception
{
Security.addProvider(new BouncyCastleProvider());
// "BC" is the name of the BouncyCastle provider
KeyGenerator keyGen = KeyGenerator.getInstance("DES", "BC");
keyGen.init(new SecureRandom());
Key key = keyGen.generateKey();
Cipher encrypt = Cipher.getInstance("DES/CBC/PKCS5Padding", "BC");
encrypt.init(Cipher.ENCRYPT_MODE, key);
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
CipherOutputStream cOut = new CipherOutputStream(bOut, encrypt);
// ... other stuff omitted ....
}
}
Another way is to use the lightweight API directly. You use the classes whose Javadocs are at http://www.bouncycastle.org/docs/docs1.5/index.html just like any other Java classes.