本文转载自该博客,请大家多多支持原作。
老师布置了一项任务,openssl中的密码算法的使用
然后我找到了我的虚拟机中的ubuntu16,发现里面有openssl,很好!
那我如何写一个C++程序来用到openssl呢?肯定得include,然后我写了一发测试:
#include
#include<openssl/ssl.h>
using namespace std;
int main(){
cout<<“hello world”<<endl;
}
然后gcc编译启动,没有iostream?哦哦!我应该用g++
但是提示缺少没有openssl/ssl.h,然后我找到了这篇博客,很有用,非常感谢!
https://blog.csdn.net/shakeme/article/details/80911441
然后sudo apt install libssl-dev就好了!
我在网上找到了一个关于C++使用des进行加密的代码:
https://blog.csdn.net/u012234115/article/details/72762045 非常感谢!
然后我测试了一下,使用g++时候,显示:
后来遇到了这篇博客,就好了!
https://blog.csdn.net/qq_39436605/article/details/81325975
修改g++命令为g++ opensslTest.c -lssl -lcrypto -o opensslTest就好了,缺少链接库的原因!
剩下的继续更新