树莓派或者是乌班图系统中使用C++编译时找不到openssl的头文件是因为缺少了开发库:
sudo apt-get install libssl-dev
安装即可
PEM_read_RSA_PUBKEY和PEM_read_RSAPublicKey函数的区别在于
0down voteaccepted
You might try PEM_read_RSA_PUBKEY() instead of PEM_read_RSAPublicKey().
This is all about formats.
The default public key file format generated by openssl is the PEM format.
PEM_read_RSA_PUBKEY() reads the PEM format. PEM_read_RSAPublicKey() reads the PKCS#1 format.
So if you want to stick to PEM_read_RSAPublicKey() you could generate the public key file using the PKCS#1 format by specifying the -outform DER option when generating the public key.
PEM_read_RSA_PUBKEY读取的PEM格式的秘钥,秘钥的开头是-----BEGIN PUBLIC KEY-----,秘钥本身长度比较短
而PEM_read_RSAPublicKey读取的是PEM_PKCS#1格式的秘钥,开头是-----BEGIN RSA PUBLIC KEY----- 秘钥本身要比第一种要长,因为添加了padding 的缘故