[crypto]-53-openssl命令行的使用(aes/rsa签名校验/rsa加密解密/hmac)
常用技巧
如何編寫一個二進制規律性的文件, 比如你可以編寫一個"0123456789abcdef"的文本文件,記得刪除換行符然后用ultraedit打開,ctrl+H就可以看到二進制文件,對應的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
產生公私密鑰對
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
私鑰簽名、公鑰驗簽
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、或使用網頁:https://the-x.cn/base64
私鑰中提取N和E
1、openssl rsa -in test_priv.pem -text -out 1.txt
2、或使用網頁:https://the-x.cn/base64
HMAC
1、openssl dgst -hmac hmackey -sha256 -out out.hash in.data
2、或者在線計算: https://1024tools.com/hmac
相關推薦:
?????????[crypto]-01-對稱加解密AES原理概念詳解
?????????[crypto]-02-非對稱加解密RSA原理概念詳解
?????????[crypto]-03-數字摘要HASH原理概念詳解
?????????[crypto]-04-國產密碼算法(國密算法sm2/sm3/sm4)介紹
?????????[crypto]-05-轉載: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中的應用
?????????[crypto]-31-crypto engion的學習和總結
?????????[crypto]-50-base64_encode和base64_decode的C語言實現
?????????[crypto]-51-RSA私鑰pem轉換成der, 在將der解析出n e d p q dp dq qp
?????????[crypto]-52-python3中rsa(簽名驗簽加密解密)aes(ecb cbc ctr)hmac的使用,以及unittest測試用
?????????[crypto]-53-openssl命令行的使用(aes/rsa簽名校驗/rsa加密解密/hmac)
?????????[crypto]-90-crypto的一些術語和思考
總結
以上是生活随笔為你收集整理的[crypto]-53-openssl命令行的使用(aes/rsa签名校验/rsa加密解密/hmac)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [crypto]-51.2-从rsa公钥
- 下一篇: [crypto]-51.1-python