📦 OpenSSL
setup
linux
Bash | |
---|---|
1 |
|
-
下载
wget
/ 解压tar -zxvf
/ 提权chmod +x
-
配置安装选项
./config shared --prefix=/opt/OpenSSL-x.y.z --openssldir=/opt/OpenSSL-x.y.z
-
安装
make && sudo make install
-
编写测试代码
C 1 2 3 4 5 6 7 8 9 10
#include <stdio.h> #include <openssl/opensslv.h> #include <openssl/crypto.h> int main() { // 输出 OpenSSL 版本信息 printf("OpenSSL version: %s\n", OpenSSL_version(OPENSSL_VERSION)); printf("OpenSSL version number: %lx\n", OpenSSL_version_num()); return 0; }
-
编译
Bash 1
gcc a.c -I/.../openssl-x.y.z/include -L/.../openssl-x.y.z/lib64 -Wl,-rpath=/opt/openssl-x.y.z/lib64 -lssl -lcrypto
windows
use
生成密钥对
Bash | |
---|---|
1 2 |
|