java Java的RSA算法库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2027596/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 19:00:20  来源:igfitidea点击:

RSA algorithm library for Java

javaopen-sourcersa

提问by Roman

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

我想为我的应用程序提供基于 RSA 算法的简单许可机制。

Are there any free RSA libraries?

有没有免费的 RSA 库?

回答by kdgregory

Just use the javax.cryptoand java.securitypackages. It's in the Java standard platform.

只需使用javax.cryptojava.security包。它位于 Java 标准平台中。

KeyPair keys = KeyPairGenerator.getInstance("RSA").generateKeyPair();
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, keys.getPublic());
byte[] encrypted = cipher.doFinal(rawData);

Links for the official documentation:

官方文档链接:

回答by Noon Silk

Yes, check out BouncyCastle.

是的,请查看BouncyCastle

回答by matt b

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

如果由于某种原因您不想使用平台内置的内容,那么Keyczar通常是最适合任何其他类型加密需求的建议/最佳解决方案。

回答by bertolami

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

我最近使用了开源框架 Jasypt http://www.jasypt.org/index.html。这个框架也能很好地与 Spring 和 Hibernate 一起工作