【发布时间】:2020-11-14 02:34:56
【问题描述】:
给定 C# 中来自 BouncyCastle 的 X509Crl 对象,如何访问 CRL 编号扩展,将其解析为 BigInteger 并递增?
当您想要将 CRL 编号增加 1 以便从旧的 CRL 创建新的更新 CRL 时,这会很有帮助。
【问题讨论】:
标签: c# .net-core x509certificate bouncycastle
给定 C# 中来自 BouncyCastle 的 X509Crl 对象,如何访问 CRL 编号扩展,将其解析为 BigInteger 并递增?
当您想要将 CRL 编号增加 1 以便从旧的 CRL 创建新的更新 CRL 时,这会很有帮助。
【问题讨论】:
标签: c# .net-core x509certificate bouncycastle
如果您在 BouncyCastle C# 中有一个 X509Crl 对象,并且您想访问 CrlNumber 对象以增加它并创建一个新的 CRL,这就是如何做到的。 (有关在this 问题中创建 CRL 的更多详细信息)。
X509Crl prevCrl = ... // read it from somewhere or pass it as a function parameter
...
Asn1OctetString prevCrlNum = prevCrl.GetExtensionValue(X509Extensions.CrlNumber);
Asn1Object obj = X509ExtensionUtilities.FromExtensionValue(prevCrlNum);
BigInteger prevCrlNumVal = DerInteger.GetInstance(obj).PositiveValue;
CrlNumber nextCrlNum = new CrlNumber(prevCrlNum.Add(BigInteger.One));
【讨论】: