当前位置:网站首页>RSA a little bit of thought
RSA a little bit of thought
2022-06-10 14:49:00 【MyFreeIT】
作者
1976年,美国计算机学家W.Diffie 和 M.Hellman提出“在不传递密钥的前提下交换密钥”1。
1977年,三位麻省理工的数学家实现了这种算法,RSA is short for author’s lastname,Ron Rivest、Adi Shamir,Leonard Adleman.
时间
It’s invented in 1977.
场景
数字签名的三个作用,防伪造,防篡改,访抵赖。
任何人都可以通过小明的公钥对这个签名进行验证,如果验证通过,可以肯定,该消息是小明发出的。
数字签名算法在电子商务、在线支付这些领域有非常重要的作用:
首先,签名不可伪造,因为私钥只有签名人自己知道,所以其他人无法伪造签名。
其次,消息不可篡改,如果原始消息被人篡改了,那么对签名进行验证将失败。
最后,签名不可抵赖。如果对签名进行验证通过了,那么,该消息肯定是由签名人自己发出的,他不能抵赖自己曾经发过这
逻辑
基于“由已知加密密钥推导出解密密钥在计算上是不可行的”密码体制。公钥PublicKey,私钥PrivateKey或者Secret Key,其中公钥加密,私钥解密;私钥加密,公钥解密。
RSA通过离散对数,欧拉函数、欧拉定理、模反元素,以及交换密钥规则的知识背景下被研发问世。
SK:Secret Key/Private Key — (保密)
PK: Public Key — (公开)
方案
离散对数
m^k mod n = 1~ n-1. m是n的原根。
欧拉函数
φ(m)= {与m互质数}的集合中元素的个数。
当m本身是质数时φ(m) = m-1; 如 φ(5)= 5-1=4。
当m可以被分解成两个互质的整数之积,如m = A*B,AB互质,
那么 **φ(n)=φ(A*B) = φ(A)*φ(B)=(A-1)*(B-1)**
例如
φ(35) = φ(57) = φ(5)φ(7)=(5-1)(7-1) = 46=24.
1---2---3---4---6---8---9---11 8
12--13--16--17--18--19--22--23 8
24--26--27--29--31--32--33--34 8
\--------------------------------------------------------------/
**24**
φ(56)=φ(7*8)=φ(7)*φ(8)=(7-1)φ(8)= 64=24.
φ(8)= {1—3—5—7} = 4.
1---3---5---9---11---13---15---17 8
19--23--25--27--29---31---33---37 8
39--41--43--45--47---51---53---55 8
\--------------------------------------------------------------/
**24**
*因为24=(5-1)*(7-1)=(7-1)φ(8) =φ(56)=φ(35) ,所以,通过反推24的因子是不能成立的。
欧拉定理
如果正整数m,n 互质, m ^φ(n) mod n = 1.
根据欧拉函数,当n 为质数时,m^(n-1) mod n = 1.
m ^φ(n) mod n = 1
[m ^φ(n) mod n]^k = 1^k
m ^k*φ(n) mod n = 1
[m ^k*φ(n) mod n]*m = 1*m
m ^k*φ(n)+1 mod n = m
模反元素
如果正整数m,n 互质,那么 m*d mod n = 1 , d就是m 对n的模反元素。
例如:
m = 3,n=5;
3*d mon 5 = 1,那么d = 12.
假设k是mon过程的商,那么 kn+1 = md.
例如5k +1 = 3d
当k =1, d=2
k=4, d=7
k=10, d=17
…
RSA
m^e mod n = c 加密
c^d mod n = m 解密
公鑰: n和e 私鑰: n和d 明文: m 密文: c
還記得條件嗎?m < n;d 是 e 相對於φ(n) 的模反元素。
說明:
1、n會非常大,長度一般為1024個二進制位。(目前人類已經分解的最大整數,232個十進制位,768個二進制位);
2、由於需要求出φ(n),所以根據歐函數特點,最簡單的方式n 由兩個質數相乘得到: 質數:p1、p2,Φ(n) = (p1 -1) * (p2 - 1);
3、最終由φ(n)得到e 和 d 。
總共生成6個數字:p1、p2、n、φ(n)、e、d。
關於RSA的安全:
除了公鑰用到了n和e 其餘的4個數字是不公開的。
目前破解RSA得到d的方式如下:
1、要想求出私鑰 d 。由於e*d = φ(n)*k + 1。要知道e和φ(n);
2、e是知道的,但是要得到 φ(n),必須知道p1 和 p2。
3、由於 n=p1*p2。只有將n因數分解才能算出
一个具有注脚的文本。1
边栏推荐
- 【离散数学期复习系列】一、命题逻辑
- 洞察的力量
- 数仓的基本概念
- QT transfers the received JSON data (including Chinese) Unicode to utf8
- [logodetection dataset processing] (4) extract the logo area of each picture
- Flyter page Jump to transfer parameters, tabbar learning summary 5
- [Chongqing University] information sharing of preliminary and second examinations (with postgraduate entrance examination group)
- Wechat applet returns to the previous page and transfers parameters
- [discrete mathematics review series] IV. figure
- As a programmer, is it really that important for the underlying principles?
猜你喜欢
![[original] poi 5 X xssf and HSSF use custom font colors](/img/fc/0d983205784f3c3118bf4d2a73f842.png)
[original] poi 5 X xssf and HSSF use custom font colors
![[solution] each time the trained model is loaded, the generated vector will be different](/img/30/92ddcda69832df2bd5e335fc3b4fdd.png)
[solution] each time the trained model is loaded, the generated vector will be different

WordPress的管理员用户名是如何泄露的

As a programmer, is it really that important for the underlying principles?

This awesome low code generator is now open source!

【原创】POI 5.x XSSF和HSSF使用自定义字体颜色

共创地市价值空间,2022年华为商业分销地市百城行·宁波站成功举办

Flutter Icon Stack LIsttitle... Learning summary 3

orgin框架 笔记

CRM对企业以及销售员有哪些帮助?
随机推荐
How the WordPress administrator user name was leaked
洞见科技入选「爱分析· 隐私计算厂商全景报告」,获评金融解决方案代表厂商
LeetCode_21(合并两个有序链表)
CVPR 2022 oral | SCI: fast, flexible and robust low light image enhancement
OpenTelemetry Metrics发布候选版本
欧几里得算法求最大公因数 Go语言实现
微信小程序 滑动到顶部
2022 the 15th Nanjing International Digital Industry Expo
This awesome low code generator is now open source!
New exploration of meta company | reduce Presto latency by using alluxio data cache
Euclidean algorithm for finding the greatest common factor
How to implement the association between interfaces in JMeter?
what‘t the meaning of “de facto“
【离散数学期复习系列】二、一阶逻辑(谓词逻辑)
2022第十五届南京国际工业自动化展览会
Anaconda installs opencv (CV2) and uses it in the jupyter notebook
Mutual transformation among lists, arrays and tensors
Generate a dataset of training vectors for doc2vec
华为云SRE确定性运维介绍
Notes on the second test of C language