/*对file.txt文件使用sha1算法进行hash运算*/
linuxidc@linuxidc:~/test$ openssl dgst -sha1 file.txt
SHA1(file.txt)= c994aec2a9007221a9b9113b8ab60a60144740c9
/*指定–non-fips-allow参数,与fips标准有关,尚待研究*/
linuxidc@linuxidc:~/test$ openssl dgst –
sha1 –non-fips-allow file.txt
SHA1(file.txt)=
c994aec2a9007221a9b9113b8ab60a60144740c9
/*指定-d参数,打印调试消息*/
linuxidc@linuxidc:~/test$ openssl dgst -sha1 -
d file.txt
BIO[02469910]:ctrl(
6) -
FILE pointer
BIO[02469910]:ctrl
return 0
BIO[02469910]:ctrl(
108) -
FILE pointer
BIO[02469910]:ctrl
return 1
BIO[02469910]:read(
0,
8192) -
FILE pointer
BIO[02469910]:read
return 37
BIO[02469910]:read(
0,
8192) -
FILE pointer
BIO[02469910]:read
return 0
SHA1(file.txt)=
c994aec2a9007221a9b9113b8ab60a60144740c9
BIO[02469910]:ctrl(
1) -
FILE pointer
BIO[02469910]:ctrl
return 0
BIO[02469910]:Free -
FILE pointer
/*指定-c -hex参数,以16进制打印结果*/
linuxidc@linuxidc:~/test$ openssl dgst -sha1 -c -
hex file.txt
SHA1(file.txt)= c9:
94:ae:c2:a9:
00:
72:
21:a9:b9:
11:3b:8a:b6:0a:
60:
14:
47:
40:c9
/*指定-r参数,输出结果如下所示,然并卵……*/
linuxidc@linuxidc:~/test$ openssl dgst -sha1 -
r file.txt
c994aec2a9007221a9b9113b8ab60a60144740c9 *
file.txt
/*指定-binary参数,输入结果为二进制*/
linuxidc@linuxidc:~/test$ openssl dgst -sha1 -
binary file.txt
ɔ�©r!
��;��
`G@linuxidc@linuxidc:~/test$
2、使用RSA密钥进行签名验证操作