[crypto]-53-openssl命令行的使用(aes/rsa签名校验/rsa加密解密/hmac)
常用技巧
如何編寫一個(gè)二進(jìn)制規(guī)律性的文件, 比如你可以編寫一個(gè)"0123456789abcdef"的文本文件,記得刪除換行符然后用ultraedit打開(kāi),ctrl+H就可以看到二進(jìn)制文件,對(duì)應(yīng)的0x30 0x31 0x32…或者使用xxd -i 1.txt查看
AES
openssl enc -aes-128-cbc -in mingwen.data -K 000102030405060708090A0B0C0D0E0F -iv a0a1a2a3a4a5a6a7a8a9aAaBaCaDaEaF -out miwen.data
openssl aes-128-cbc -d -in miwen.data -K 000102030405060708090A0B0C0D0E0F -iv a0a1a2a3a4a5a6a7a8a9aAaBaCaDaEaF -out mingwen.data
RSA
產(chǎn)生公私密鑰對(duì)
openssl genrsa -out test_priv.pem 2048
openssl rsa -pubout -in test_priv.pem -out test_pub.pem
公鑰加密、私鑰解密
openssl rsautl -encrypt -in hello -inkey test_pub.key -pubin -out hello.en
openssl rsautl -decrypt -in hello.en -inkey test_priv.key -out hello.de
私鑰簽名、公鑰驗(yàn)簽
openssl dgst -sign test_priv.pem -sha256 -out sign.txt file.txt
openssl dgst -verify test_pub.pem -sha256 -signature sign.txt file.txt
公鑰中提取N和E
1、openssl rsa -inform PEM -in Key0_pub.pem -pubin -text -out Key1_pub.txt
2、或使用網(wǎng)頁(yè):https://the-x.cn/base64
私鑰中提取N和E
1、openssl rsa -in test_priv.pem -text -out 1.txt
2、或使用網(wǎng)頁(yè):https://the-x.cn/base64
HMAC
1、openssl dgst -hmac hmackey -sha256 -out out.hash in.data
2、或者在線計(jì)算: https://1024tools.com/hmac
相關(guān)推薦:
?????????[crypto]-01-對(duì)稱加解密AES原理概念詳解
?????????[crypto]-02-非對(duì)稱加解密RSA原理概念詳解
?????????[crypto]-03-數(shù)字摘要HASH原理概念詳解
?????????[crypto]-04-國(guó)產(chǎn)密碼算法(國(guó)密算法sm2/sm3/sm4)介紹
?????????[crypto]-05-轉(zhuǎn)載:PKCS #1 RSA Encryption Version 1.5介紹
?????????[crypto]-05.1-PKCS PKCS#1 PKCS#7 PKCS#11的介紹
?????????[crypto]-06-CA證書介紹和使用方法
?????????[crypto]-30-The Armv8 Cryptographic Extension在linux中的應(yīng)用
?????????[crypto]-31-crypto engion的學(xué)習(xí)和總結(jié)
?????????[crypto]-50-base64_encode和base64_decode的C語(yǔ)言實(shí)現(xiàn)
?????????[crypto]-51-RSA私鑰pem轉(zhuǎn)換成der, 在將der解析出n e d p q dp dq qp
?????????[crypto]-52-python3中rsa(簽名驗(yàn)簽加密解密)aes(ecb cbc ctr)hmac的使用,以及unittest測(cè)試用
?????????[crypto]-53-openssl命令行的使用(aes/rsa簽名校驗(yàn)/rsa加密解密/hmac)
?????????[crypto]-90-crypto的一些術(shù)語(yǔ)和思考
總結(jié)
以上是生活随笔為你收集整理的[crypto]-53-openssl命令行的使用(aes/rsa签名校验/rsa加密解密/hmac)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: [crypto]-51.2-从rsa公钥
- 下一篇: [crypto]-51.1-python