G++ compilation erro for openssl API
G++ compilation erro for openssl API
>我在编译openssl函数以使用G ++编译器从公共证书获取到期日期时遇到问题。
错误是,
error: expected unqualified-id before ‘not’ token
error: expected primary-expression before ‘)’ token
编译程序,
g++ main.c -o test -I /usr/include/openssl/ -lcrypto -lssl
包括所有头文件。
下面我编译的代码,
main ()
{
X509 *x;
int n=0;
unsigned char *not; //expected unqualified-id before ‘not’ token ,expected initializer before ‘not’ token
BIO *out;
FILE *fp=fopen("/home/public.cer", "r");
x = X509_new();
x = PEM_read_X509(fp,NULL,NULL,NULL);
fclose(fp);
out = BIO_new(BIO_s_mem());
ASN1_TIME_print(out, X509_get_notAfter(x));//expected primary-expression before ‘)’ token
n = BIO_get_mem_data(out, ¬);
expiryStr = (char *) malloc (n+1);
expiryStr[n] = ' ';
memcpy(expiryStr, not, n);//expected primary-expression before ‘)’ token
printf("Expiry Date====================%sn",expiryStr);
BIO_free(out);
X509_free(x);
}
请帮助我解决此错误。
"not" 是 C++: http://en.cppreference.com/w/cpp/keyword 中的关键字。您必须重命名变量。
相关文章:
- 用于访问容器<T>数据成员的正确 API
- Openssl 1.1.1d无效使用不完整的类型"struct dsa_st"
- 如何在openssl-ecc中获取十六进制格式的私钥
- 如何使用Luacneneneba API正确读取字符串和表参数
- C++MySQL C api用户输入行
- LINK 尝试使用 OpenSSL evp aes 256 c++ 时出错
- 如何使用 AWS Transcribe C++ API 中的'StartTranscriptionJobRequest'?
- 将std::string传递给WriteConsole API
- EvtExportLogneneneba API正在将远程计算机的事件日志保存到远程PC本身.如何将其保存到主机
- 比较两个公钥与OpenSSL API
- OpenSSL C API:如何在程序exec()之后恢复TLS连接?
- OpenSSL API,使用GCM(伽罗瓦计数器模式)进行AES加密
- openssl 中已弃用的 AES_ige_encrypt() API 的替代方法
- 如何使用 openssl API 解析 CSR 对象
- OpenSSL Stack API - 推送到堆栈后释放对象
- 如何使用OpenSSL API从其PEM格式字符串中读取RSA公钥
- G++ compilation erro for openssl API
- 在Windows上使用OpenSSL访问带有身份验证的REST API
- OpenSSL API 在使用 SSL_get_certificate() 时崩溃
- 可视化我们如何在C++和Windows API中验证openssl数字签名