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
RSA algorithm library for Java
提问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.crypto和java.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
回答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 一起工作

