当前位置:主页 > 论文百科 > 期刊论文 >

nagle算法_RSA 数据加密,数字签名算法

发布时间:2016-10-03 13:29

  本文关键词:数字签名算法,由笔耕文化传播整理发布。


RSA 数据加密,数字签名算法

java.math.BigInteger;
java.security.KeyFactory;
java.security.KeyPairGenerator;
java.security.PublicKey;
java.security.interfaces.RSAPrivateKey;
java.security.spec.PKCS8EncodedKeySpec;
java.util.HashMap;
javax.crypto.Cipher;

RSACryptUtil {
String KEY_ALGORITHM = "RSA";
String SIGNATURE_ALGORITHM = "MD5withRSA";
String PUBLIC_KEY = "RSAPublicKey";
String PRIVATE_KEY = "RSAPrivateKey";

String sign([] keyBytes = CryptUtil.decryptBASE64(privateKey);
PKCS8EncodedKeySpec pkcs8KeySpec = KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
PrivateKey priKey = keyFactory.generatePrivate(pkcs8KeySpec);
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);

verify([] keyBytes = CryptUtil.decryptBASE64(publicKey);
X509EncodedKeySpec keySpec = KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
PublicKey pubKey = keyFactory.generatePublic(keySpec);
signature.verify(CryptUtil.decryptBASE64(sign));

[] decryptByPrivateKey([] keyBytes = CryptUtil.decryptBASE64(key);
PKCS8EncodedKeySpec pkcs8KeySpec = Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());

[] decryptByPublicKey([] keyBytes = CryptUtil.decryptBASE64(key);
X509EncodedKeySpec x509KeySpec = Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());

[] encryptByPublicKey([] keyBytes = CryptUtil.decryptBASE64(key);
X509EncodedKeySpec x509KeySpec = Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());

[] encryptByPrivateKey([] keyBytes = CryptUtil.decryptBASE64(key);
PKCS8EncodedKeySpec pkcs8KeySpec = Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());

String getPrivateKey(Map

  本文关键词:数字签名算法,,由笔耕文化传播整理发布。



本文编号:129871

资料下载
论文发表

本文链接:https://www.wllwen.com/wenshubaike/xingzhengshiwu/129871.html


Copyright(c)文论论文网All Rights Reserved | 网站地图 |

版权申明:资料由用户6d4d7***提供,本站仅收录摘要或目录,作者需要删除请E-mail邮箱bigeng88@qq.com