Skip to content

Commit 84ea658

Browse files
committed
master rsa ok
1 parent 5ba9d90 commit 84ea658

10 files changed

Lines changed: 345 additions & 38 deletions

File tree

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

.idea/workspace.xml

Lines changed: 137 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class HashDemo {
4141
String sha512 = getDigest(input, "SHA-512");
4242
System.out.println("sha512:"+sha512);
4343
44-
String fileSha1 = getDigestFile("jdk-8u191-windows-x64.exe", "SHA-1");
44+
String fileSha1 = getDigestFile("a.txt", "SHA-1");
4545
System.out.println("fileSha1:"+fileSha1);
4646
4747
}
@@ -103,8 +103,8 @@ public class HashDemo {
103103
```
104104

105105

106-
## 消息认证码
107-
### 消息认证
106+
# 消息认证
107+
### 消息认证码
108108

109109
> **消息认证码(message authentication code)是一种确认完整性并进行认证的技术,取三个单词的首字母,简称为MAC。**
110110
@@ -215,4 +215,34 @@ public class MacDemo {
215215
return sb.toString();
216216
}
217217
}
218-
```
218+
```
219+
# 数字签名
220+
221+
### 签名的生成和验证
222+
223+
> 1. 签名
224+
> - 有原始数据对其进行哈希运算 -> 散列值
225+
> - 使用非对称加密的<font color="red">私钥</font>对散列值加密 -> 签名
226+
> - 将原始数据和签名一并发送给对方
227+
> 2. 验证
228+
> - 接收数据
229+
> - 原始数据
230+
> - 数字签名
231+
> - 数字签名, 需要使用<font color="red">公钥</font>解密, 得到散列值
232+
> - 对原始数据进行哈希运算得到新的散列值
233+
234+
### 非对称加密和数字签名
235+
236+
> 总结:
237+
>
238+
> 1. 数据通信
239+
>
240+
> ```
241+
> - 公钥加密, 私钥解密
242+
> 2. 数字签名:
243+
> - 私钥加密, 公钥解密
244+
> ```
245+
246+
### 数字签名的方法
247+
248+
![Logo](imgs/3.png)

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ repositories {
1313

1414
dependencies {
1515
testCompile group: 'junit', name: 'junit', version: '4.12'
16+
// https://mvnrepository.com/artifact/commons-io/commons-io
17+
compile group: 'commons-io', name: 'commons-io', version: '2.6'
1618
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Fri Nov 30 14:31:30 CST 2018
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip

0 commit comments

Comments
 (0)