Atitit.rsa密钥生成器的attilax总结
Atitit.rsa密钥生成器的attilax总结
1.2.1.
设置或重置 SecureRandom
对象的随机数种子 2
1.1. 密钥生成器
public static Map<String,
Object> initKey2(String md5_deta)
throws Exception{
/** RSA算法要求有一个可信任的随机数源 */
SecureRandom
secureRandom= SecureRandom.getInstance("12345678");
//实例化密钥对生成器
KeyPairGenerator keyPairGen=KeyPairGenerator.getInstance(KEY_ALGORITHM);
// 初始化密钥对生成器
//keyPairGen.initialize(KEY_SIZE);
// 初始化的时候固定随机源的值
keyPairGen.initialize(KEY_SIZE,
secureRandom);
// 生成密钥对
KeyPair keyPair=keyPairGen.generateKeyPair();
//公钥
RSAPublicKey publicKey=(RSAPublicKey)keyPair.getPublic();
//私钥
RSAPrivateKey privateKey=(RSAPrivateKey)
keyPair.getPrivate();
// 得到公钥字符串
// String publicKeyString = Base64.encode(publicKey.getEncoded());
// 得到私钥字符串
// String privateKeyString = Base64.encode(privateKey.getEncoded());
// 封装密钥
Map<String, Object> keyMap=new HashMap<String,Object>(2);
keyMap.put(PUBLIC_KEY,
publicKey);
keyMap.put(PRIVATE_KEY,
privateKey);
return keyMap;
}
1.2. 生成固定的密钥
1.2.1. 设置或重置
SecureRandom 对象的随机数种子
除非调用程序在调用 getInstance 方法后接着调用 setSeed 方法,否则
SecureRandom 实现方法将会完全使发生器的内部状态随机化:
SecureRandom
secureRandom= new SecureRandom("fixx".getBytes("gbk"));
// 初始化的时候固定随机源的值
keyPairGen.initialize(KEY_SIZE,
secureRandom);
方法
SecureRandom
secureRandom=new SecureRandom();
secureRandom.setSeed(1235);
1.3. 密钥结构
pubkey_md5:A603B693B6BB434FA3004B7618F3B9BB
{
"RSAPublicKey":{
"algorithm":"RSA",
"algorithmId":{
"name":"RSA",
"oID":{}
},
"encoded":"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIQqS1ReGEE/ySM+PyZxS41HzDBul0xIkscNkqd+qZejQ3r2LmUw4BYoTC7CHsFjwk6V/a0Imwz3KsvtsOffii8CAwEAAQ==",
"encodedInternal":"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIQqS1ReGEE/ySM+PyZxS41HzDBul0xIkscNkqd+qZejQ3r2LmUw4BYoTC7CHsFjwk6V/a0Imwz3KsvtsOffii8CAwEAAQ==",
"format":"X.509",
"modulus":6922053815168845700711519855384250277549407002769104068590208637227720690525493166882866757882836951436668086793282219943697989363887338835452201051064879,
"publicExponent":65537
},
"RSAPrivateKey":{
"algorithm":"RSA",
"algorithmId":{"$ref":"$.RSAPublicKey.algorithmId"},
"crtCoefficient":12637801240537467651180025414810617094531052210139246616910795005297730540027,
"destroyed":false,
"encoded":"MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEAhCpLVF4YQT/JIz4/JnFLjUfMMG6XTEiSxw2Sp36pl6NDevYuZTDgFihMLsIewWPCTpX9rQibDPcqy+2w59+KLwIDAQABAkBNu1Zcw46+aZaR/N1FbeMCsBSe85xWyGRTYF891dhHD21HERkZyfm4BooN0VjKohPbatUmRazWfuGKc9hap7Y5AiEAwfjL1el1zq+YOlTqKsJ5oF8/b+55SLD4dasZpAvC+S0CIQCubcsND+yJrFMFDNyQoY+w2GZuEegDQ3gs37R6N4TySwIgSJZfSTylbmQ9tk6Clt/R/hbGuY9nabF4OSh/Xulb3D0CIB2VO2nUuI5E7rOdkc7px7/7g6vJV6suBzS9IBPWVLLvAiAb8L307PiDD9i/IvEbM8uz7RC+YRUr4DNRx66jEkBR+w==",
"format":"PKCS#8",
"modulus":6922053815168845700711519855384250277549407002769104068590208637227720690525493166882866757882836951436668086793282219943697989363887338835452201051064879,
"primeExponentP":32832209798077781373384495608799993732908171300012237207496150976697489677373,
"primeExponentQ":13380742877797692883283997671823302246667615946650995680559515864045072986863,
"primeP":87735964670198717955861353260506633609525089601993964928345575802643155188013,
"primeQ":78896423390213891002409658607133041775965411272664534765346737848126131204683,
"privateExponent":4071143999659477204234638949384102521448065869993059131846279077802500786064340926073856151160133264216762031129885857399234406337799168487767767633081913,
"publicExponent":65537
}
}
取模运算符“%”的作 modulus
作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 )
汉字名:艾提拉(艾龙), EMAIL:1466519819@qq.com
转载请注明来源: http://blog.csdn.net/attilax
Atiend
Atitit.rsa密钥生成器的attilax总结的更多相关文章
- Atitit RSA非对称加密原理与解决方案
Atitit RSA非对称加密原理与解决方案 1.1. 一.一点历史 1 1.2. 八.加密和解密 2 1.3. 二.基于RSA的消息传递机制 3 1.4. 基于rsa的授权验证机器码 4 1.5. ...
- Java与.NET兼容的RSA密钥持久化方法
默认情况下,.NET生成的RSA密钥对可以用XML或字节流来保存,而JAVA中生成的RSA密钥对只能用字节流来保存.而它们的字节流格式不同,就导致Java中生成的RSA密钥对不能在.NET中使用,而. ...
- atitit.词法分析的实现token attilax总结
atitit.词法分析的实现token attilax总结 1. 词法分析(英语:lexical analysis)跟token 1 1.1. 扫描器 2 2. 单词流必须识别为保留字,标识符(变量) ...
- Atitit 管理原理与实践attilax总结
Atitit 管理原理与实践attilax总结 1. 管理学分类1 2. 我要学的管理学科2 3. 管理学原理2 4. 管理心理学2 5. 现代管理理论与方法2 6. <领导科学与艺术4 7. ...
- Atitit 图像处理的摩西五经attilax总结
Atitit 图像处理的摩西五经attilax总结 1. 数字图像处理(第三版)1 2. 图像处理基础(第2版)(世界著名计算机教材精选)1 3. 计算机视觉特征提取与图像处理(第三版)2 4. Op ...
- Atitit opencv版本新特性attilax总结
Atitit opencv版本新特性attilax总结 1.1. :OpenCV 3.0 发布,史上功能最全,速度最快的版1 1.2. 应用领域2 1.3. OPENCV2.4.3改进 2.4.2就有 ...
- Atitit MATLAB 图像处理 经典书籍attilax总结
Atitit MATLAB 图像处理 经典书籍attilax总结 1.1. MATLAB数字图像处理1 1.2. <MATLAB实用教程(第二版)>((美)穆尔 著)[简介_书评_在线阅读 ...
- Atitit 图像处理类库大总结attilax qc20
Atitit 图像处理类库大总结attilax qc20 1.1. 选择与组合不同的图像处理类库1 1.2. Halcon 貌似商业工具,功能强大.1 1.3. Openvc Openvc功能也是比 ...
- Atitit osi tcp ip 对应attilax总结
Atitit osi tcp ip 对应attilax总结 Atitit 网络摄像机又叫IP CAMERA(简称IPC)常见的协议组合 网络摄像机又叫IP CAMERA(简称IPC)由网络编码模块和模 ...
随机推荐
- list对象属性排序
Collections.sort(list, new Comparator<ScRel>() { @Override public int compare(Object o1, Objec ...
- Spring 学习笔记 3. 尚硅谷_佟刚_Spring_配置 Bean
1,bean 的配置 <bean id="helloWorld" class="com.yfy.HelloWorld"> <property ...
- 通过.net反射技术实现DataReader转换成Model实体类列表
public static T ReaderToModel<T>(IDataReader dr) { try { using (dr) { if (dr.Read()) { Typ ...
- [UCSD白板题] Maximize the Value of an Arithmetic Expression
Problem Introduction In the problem, your goal is to add parentheses to a given arithmetic expressio ...
- Mini projects #3 ---- Stopwatch: The Game
课程全名:An Introduction to Interactive Programming in Python,来自 Rice University 授课教授:Joe Warren, Scott ...
- [SystemC] Setting Up the Environment
My operating system is Ubuntu 12.04. 0. Checking Your Compilers First thing first, you will need the ...
- HDU 1284 钱币兑换问题
动态转移方程:dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3] 即要想兑够 i,有三种方法: 1.从 i - 1 再增加一个1分的: 2.从 i - 2 再增加一个2 ...
- XAF Spreadsheet property Editor
https://www.devexpress.com/Support/Center/Question/Details/T371232
- Handler机制来处理子线程去更新UI线程控件
public class HandlerTestActivity extends Activity { private TextView tv; private static final int UP ...
- wampserver 2.5 首页链接问题,wampserver Your Projects
在wampserver 2.5之后,在首页的Your projects里面,链接的地址为http://直接加你的系统名称,会导致无法访问, 正常的应该为http://localhost+你的系统名称, ...