views:

424

answers:

5

I want to provide my application with simple licensing mechanism based on RSA algorithm.

Are there any free RSA libraries?

+5  A: 

Yes, check out BouncyCastle.

Noon Silk
Why would you use BouncyCastle instead of the cryptography functionality in the standard API?
jarnbjo
jarnbjo: Not sure, but I was just answering the question. However, I did upvote kdgregory, because I do think that's probably the best way to do it. Though IIRC (and I probably don't) there *was* a time when crypto wasn't built-in to the regular Java download.
Noon Silk
@silky - iirc it came in around 1.4; I just started using it recently ... btw, you upvoted me too soon (but thanks): I had copied one of my learning examples, and included my own method in it :-)
kdgregory
silky: JCE (Java Cryptography Extension) is available as a separate download for Java 1.2 and 1.3 and has been part of the standard API since 1.4, so it has been around for some 10 years. BouncyCastle can very well be used as an additional JCE provider for algorithms not supported by the default VM security providers, but there's no need to add a dependency on a 3rd party lib for common algorithms like RSA.
jarnbjo
A: 

I hate people who answer with a google link, but I think in this case it's appropriate: http://www.google.com/search?hl=en&site=&q=java%20rsa

You can find several RSA examples and libraries in the first page of results; most of them have liberal licenses.

Andreas Bonini
I meant "are there some well-known library which is almost a standard?"
Roman
A: 

I recently used the open source framework Jasypt http://www.jasypt.org/index.html. This framework also work very well together with Spring and Hibernate

bertolami
+7  A: 

Is there a particular reason not to use javax.crypto?

    KeyPair keys = KeyPairGenerator.getInstance("RSA").generateKeyPair();
    Cipher cipher = Cipher.getInstance("RSA");
    cipher.init(Cipher.ENCRYPT_MODE, keys.getPublic());
    byte[] encrypted = cipher.doFinal(rawData);
kdgregory
Don't need to be that arrogant.
Tom Brito
A: 

If for some reason you don't want to use what is build into the platform, then Keyczar is generally the most suggested / best solution for any other sort of cryptographic needs.

matt b
IMO Bouncycastle is much better known, far more complete and mature, and more frequently recommended.
GregS