linux下安装openssl和调用openssl接口
下面以ubuntu为例:
第一步:安装openssl软件,sudo apt-get install openssl(其他linux操作系统,有相应的软件安装命令)
第二步:安装openssl库,sudo apt-get install libssl-dev
完成这两步就可以在控制台使用openssl命令和在程序里调用openssl提供的接口了
如:openssl aes-128-cbc -in hello.txt -out hello.out -e -K 26896cd652fef3f547b46f6664e4cc29 -iv 00000000000000000000000000000000
调用openssl接口的例子为:
#include <openssl/evp.h>
#include<stdio.h>
#include<string.h>
int do_encrypt(unsigned char *iv, unsigned char *key, unsigned char*inBuffer, int inLen