nagle算法_RSA 数据加密,数字签名算法
本文关键词:数字签名算法,由笔耕文化传播整理发布。
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