简体   繁体   English

如何将 Bouncy Castle X509Crl C# 中的 CRL 编号解析为 BigInteger

[英]How to parse CRL Number in Bouncy Castle X509Crl C# as BigInteger

Given a X509Crl object from BouncyCastle in C#, how can you access the CRL Number extension, parse it as BigInteger and increment it?给定一个来自 C# 中 BouncyCastle 的 X509Crl 对象,如何访问 CRL Number 扩展名,将其解析为 BigInteger 并递增它?

This can be helpful for when you want to increment the CRL Number by one in order to create a new updated CRL from an old one.当您希望将 CRL 编号增加 1 以便从旧 CRL 创建新的更新 CRL 时,这会很有帮助。

If you have a X509Crl object in BouncyCastle C# and you would like to access the CrlNumber object in order to increment it and create a new CRL, this is how to do it.如果您在 BouncyCastle C# 中有一个 X509Crl 对象,并且您想访问 CrlNumber 对象以增加它并创建一个新的 CRL,这是如何做到的。 (More details on creating CRLs in this questions). (有关在问题中创建 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));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Bouncy Castle c#创建CRL文件 - Create CRL file with Bouncy Castle c# 如何在C#中使用Bouncy Castle将X.509 v.3谷歌证书添加到项目中 - How to add X.509 v.3 google certificate to project with Bouncy Castle in c# 通过 C# 中 BouncyCastle 库中的 x509Crl.IsRevoked() 方法检查证书? - Checking certificate by x509Crl.IsRevoked() method in BouncyCastle library in C#? C# X509 证书验证,带在线 CRL 检查,无需将根证书导入受信任的根 CA 证书存储 - C# X509 certificate validation, with Online CRL check, without importing root certificate to trusted root CA certificate store c#验证CRL列表中的证书 - c# verify certificate in CRL list 如何读取 Pem 证书和私钥文件并创建 Bouncy Castle X509Certificate 和 Bouncy Castle AsymmetricKeyParameter dotnet 核心? - How to Read a Pem Cert and Private Key Files and create Bouncy Castle X509Certificate and Bouncy Castle AsymmetricKeyParameter dotnet core? C# 充气城堡 FipsDRBG - C# Bouncy Castle FipsDRBG 使用 C# 从 CRL 文件中提取属性 - Extract properties from a CRL file using C# 如何从Bouncy Castle创建X509证书以与AuthenticateAsServer一起使用? - How to create a X509 certificate from Bouncy Castle for use with AuthenticateAsServer? 充气城堡的CMS签名X509证书 - CMS Signature X509 Certificate with Bouncy Castle
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM