当前位置:网站首页>关于RSA加密解密原理
关于RSA加密解密原理
2022-06-13 08:38:00 【Array_new】
前言:
随着我们的学习的不断深入,信息的安全也愈加重要,我们发布的代码中可能含有我们的私密信息,比如对接支付宝沙箱api,下载一些专业软件时就需要我们输入公钥和私钥以此来验证我们的身份信息,就相当于用钥匙去开锁一样,公钥代表着锁,私钥代表着开锁的钥匙,而公钥与私钥也是可以互换的,理解完这点,下面就详细说一下他们的原理。
RSA密钥的分发:
首先取俩个质数(p,q),N=pq
然后求他们的欧拉函数 T = (p-1)(q-1)
取出公钥E 它的规则是1.是一个质数。
2.1<公钥<T ;
3.不是T的因子
选出完公钥E后计算出私钥D (D*E)%T=1
这样关于公钥和私钥的分发就完成了
例如p=3,q=11 N=pq=33
T=(3-1)(11-1)=20
随机选出一个公钥E=3那么密钥可取D=7
公钥E(3,33)私钥D(7,33)
根据下边的加密公式对对1 2 3加密成
1,29,9
根据下边的解密公式可以解出原来的数字为
1,2,3
密钥加密:(明文^E)%N=密文
密钥解密:(密文^E)%N=明文
RSA公开密钥密码体制的原理是:根据数论,寻求两个大素数比较简单,而将它们的乘积进行因式分解却极其困难,因此可以将乘积公开作为加密密钥

结果:

边栏推荐
- Data accuracy problems caused by inconsistent data types during sum in MySQL
- JS to download files in batches
- Microservice Project Construction II: database design
- redis.exceptions.ConnectionError: Error 111 connecting to 172.16.8.128:6379. Connection refused.
- Maternal and infant supplies wholesale industry uses management software to improve efficiency and realize cost reduction and efficiency increase
- Review one flex knowledge point every day
- Mongodb test case
- 3、 JS notes
- 7、 JS data type
- Disk management and disk partition operation
猜你喜欢

Several precise order receiving methods suitable for fresh food wholesale industry
![[notes] like the solution to the problem of slow query (index + explicitly specifying query fields)](/img/95/2109ddf1a0ff0223109eb9b5a02f00.jpg)
[notes] like the solution to the problem of slow query (index + explicitly specifying query fields)

About redis encapsulation tool class using distributed locks
![【Pycharm踩坑记录】配置远程运行后提示,[Errno 2] No such file or directory](/img/71/92c06496a9d982294cac61595e0392.png)
【Pycharm踩坑记录】配置远程运行后提示,[Errno 2] No such file or directory

Buuctf web (VII)

When submitting the laravel admin form and using the required verification, an error is reported when the value is 0

DNS domain name resolution service

4、 Js-es5-i / O

File upload question type

Methods of importing and exporting settings in Altium Designer
随机推荐
Determine whether a string is rotated from another string
从零开始-实现JpetStore网站-1-建立项目框架以及项目介绍
3、 JS notes
Dest0g3 520 orientation
Reverse order and comparison of strings
Svg text stroke effect
7、 JS data type
JS to download files in batches
MySQL sorts according to the specified order of the specified fields
JD commodity detail interface, JD detail page interface, baby detail page interface, commodity attribute interface, commodity information query, commodity detail interface, H5 details, JD app details,
JS - set countdown for Date object case
Deploy Yum warehouse and NFS shared services
关于redis使用分布式锁的封装工具类
MySQL installation and configuration under Windows
[virt manager] remote management the problem of the floating mouse when starting the virtual machine
0. Quelques doutes au sujet de SolidWorks
Tmall product details interface, tmall product coupon interface, tmall API interface, tmall price monitoring interface, tmall price comparison interface, brand rights protection interface, tmall sales
DIY无人机(匿名拓控者P2+F330机架)
2020-12-28
SQL injection experiment