security - 公共(public)证书的指纹是唯一的吗?

标签 security x509certificate public-key-encryption

我想将公共(public)证书存储在数据库中,但我需要公共(public)证书的属性来索引数据库中的公共(public)证书。我想让它成为一个独特的领域。

公共(public)证书的指纹是唯一的吗?

最佳答案

指纹是唯一的(对于所有实际意图);两个不同的证书永远不应共享相同的哈希。例如,根据 Windows X509certificate2.thumbprint documentation :

the thumbprint is a unique value for the certificate, it is commonly used to find a particular certificate in a certificate store.



根据 OpenSSL documentation :

Because of the nature of message digests the fingerprint of a certificate is unique to that certificate and two certificates with the same fingerprint can be considered to be the same.



请注意,指纹不是证书的一部分。相反,它是通过获取整个证书(包括签名)的加密哈希来计算的。 不同的加密实现可能使用不同的哈希算法来计算指纹,从而为同一个证书提供不同的指纹。 (例如,Windows Crypto API 计算证书的 SHA-1 哈希来计算指纹,而 OpenSSL 可以生成 SHA-256 或 SHA-1 哈希。)因此,您需要确保使用数据库指纹的客户端是使用相同的 API 或一致的哈希算法。

理论上,由多个证书共享的重复指纹将需要哈希冲突。这种偶然事件发生的概率是天文数字。有意生成这样的证书对需要对底层哈希函数进行成功的原像攻击,这种攻击在 SHA-1 上是不可行的(见 Preimage Attack)。

关于security - 公共(public)证书的指纹是唯一的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23986171/

相关文章:

apache - 阻止 .htaccess 中的 IP 地址有多安全?

tomcat - Grails 中基于 RESTful 证书的 (X509) 登录身份验证

java - Openssl 公钥\私钥跨操作系统平台支持

azure - 将证书添加到 Azure 应用服务以调用外部 API

两个 WebApp 之间的 SSL 握手

swift - 如何在 Swift 4 中复制 hash_hmac ('sha256' , $key, $secret_key) 函数?

SSL - 公钥固定困惑

security - 如何为除一个以外的所有 URL 应用 tomcat 安全角色?

javascript - XSS 预防。处理 <script 就足够了吗?

android - 在 Android (flutter) 应用程序中安全地保存 API key