【发布时间】:2020-10-25 12:38:35
【问题描述】:
我使用这个创建一个证书请求:
CertificateRequest req = new CertificateRequest(
"cn=test",
Key,
HashAlgorithmName.SHA256,
RSASignaturePadding.Pkcs1);
key 是从 CSP 设置的:
ProviderName:“Utimaco CryptoServer CSP”
KeyContainerName: "默认容器"
但在调试时我发现req.PublicKey.Key.CspKeyContainerInfo 指的是不同的提供者:
ProviderName:“Microsoft 增强的 RSA 和 AES 加密提供程序”
KeyContainerName:空
当我尝试获取Exportable 值时:
var isExportable = ((RSACryptoServiceProvider)req.PublicKey.Key).CspKeyContainerInfo.Exportable;
它抛出一个CryptographicException:密钥不存在
我不明白为什么私钥和公钥分别存储在不同的提供者中?! 还是这意味着别的什么?
【问题讨论】:
标签: c# cryptography cryptoapi rsacryptoserviceprovider