openssl
加班猿
记录一下生活的点滴,工作上遇到的问题以及学习上的各类笔记
展开
-
C语言openssl aes-128-ecb加解密
openssl aes-128-ecb方式对密码进行md5后的加解密 openssl版本:1.0.2g 其他的自行验证 编译:gcc aes_128_ecb.c -o aes_128_ecb -lssl -lcrypto 执行结果: ./aes_128_ecb passwd: 12345 strMd516: A46B755EA8F1B4DD strBase64Encrypt: cFeeVowosk4cR5gIg7i6ZQ== aes_128_ecb_decrypt OK strAESDecrypt pass原创 2021-10-16 10:15:16 · 1560 阅读 · 0 评论 -
C++11 ECDSA-withSHA256验签
这里不做签名,只验签 使用方法: openssl版本:1.0.2g 其他的自行验证 编译:g++ test.cpp -o test -lssl -lcrypto -std=c++11 执行:./test 签名过程:随机数进行SHA256哈希后再使用私钥对其签名 验签过程:用随机数的SHA256和公钥来验证签名 以下代码是验证签名 #include <iostream> #include <memory> #include <string> #include <sst原创 2021-10-16 09:22:05 · 810 阅读 · 0 评论 -
C++版本ECDSA-with-SHA256签名验证
由于项目需要验证签名,这里不做签名,只验签 直接上代码: 使用方法: openssl版本:1.0.2g 其他的自行验证 编译:g++ x509.cpp -o x509 -lssl -lcrypto 执行:./x509 #include <openssl/pem.h> #include <openssl/x509.h> #include <openssl/x509v3.h> #include <cstring> #include <iostream>原创 2021-10-15 18:00:47 · 1284 阅读 · 0 评论 -
C语言openssl库的ECDSA-with-sha256签名和验签
1.直接上源码: #include <stdio.h> #include <string.h> #include <openssl/ecdsa.h> #include <openssl/pem.h> #include <openssl/err.h> // base64 编码 char *base64_encode(const char *buffer, int length) { BIO *bmem = NULL; BIO *b6原创 2021-10-14 16:54:58 · 1775 阅读 · 0 评论