本文介绍了用于Java的RSA算法库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为我的应用程序提供基于RSA算法的简单许可机制.
I want to provide my application with simple licensing mechanism based on RSA algorithm.
有免费的RSA库吗?
推荐答案
只需使用javax.crypto
和java.security
软件包.它在Java标准平台中.
Just use the javax.crypto
and java.security
packages. It's in the Java standard platform.
KeyPair keys = KeyPairGenerator.getInstance("RSA").generateKeyPair();
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, keys.getPublic());
byte[] encrypted = cipher.doFinal(rawData);
官方文档链接:
这篇关于用于Java的RSA算法库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!