c - 如何使用 mbedTLS 库或 openssl 检查证书是 CA 还是用户证书

标签 c openssl client-certificates ca mbedtls

我有一份从客户那里收到的证书。在我的服务器应用程序中,我需要检查收到的证书是 CA 还是用户证书。我目前正在使用 mbedTLS 库来实现安全性。有一个 example已经在 J​​AVA 中检查了这种情况。同样,我想知道如何使用 mbedTLS 库或 OpenSSL 命令进行检查。

最佳答案

看看 int mbedtls_x509_crt::ca_istrue field 。即:

Optional Basic Constraint extension value: 1 if this certificate belongs to a CA, 0 otherwise.

https://tls.mbed.org/api/structmbedtls__x509__crt.html#a196b3a43dae5a1c0058f46075f832890

编辑:根据您的 example你需要检查 if MBEDTLS_X509_KU_KEY_CERT_SIGN key_usage 的 ( link ) ( link ) 设置在 mbedtls_x509_crt 中结构。

关于c - 如何使用 mbedTLS 库或 openssl 检查证书是 CA 还是用户证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55567299/

相关文章:

android - PolarSSl bignum.c 在 Android 5.0 及以上版本使用 JNI 时会导致崩溃

node.js - 自签名证书 NodeJS rejectUnauthorized

spring boot ssl 客户端证书因 PKIX 路径构建失败错误而失败

asp.net - 使用 https 时 IIS 7 错误 "A specified logon session does not exist. It may already have been terminated."

ssl - 如何在 IOS 中使用安全的 Ejabberd 服务器连接 XMPP 客户端?

c - 在#define 方面需要一些帮助

C - fscanf 进入动态数组崩溃

c - scanf 的异常行为

ruby - Heroku 上的 OpenSSL 1.0.1

c - C 中的点对点 linux 身份验证