Discuss this help topic in SecureBlackbox Forum
Add certificate to CRL
To add new certificate to a CRL, use TElCertificateRevocationListEx class (SBCRLEx namespace; PKI package).
TElX509Certificate cert = new TElX509Certificate();
cert.LoadFromFileAuto("cert.cer", "");
int index = crl.Add(cert);
You can set the revocation details of the new entry by getting the corresponding TElRevocationItem object and tuning it up:
TElRevocationItem item = crl.get_Items(index);
item.RevocationDate = DateTime.UtcNow;
item.Extensions.Included = SBCRL.Unit.crlReasonCode;
item.Extensions.ReasonCode.Reason = SBX509Ext.TSBCRLReasonFlag.rfKeyCompromise;
Note, you can add multiple certificates on this stage.
TElX509Certificate caCert = new TElX509Certificate();
caCert.LoadFromFileAuto("cacert.pfx", "password");
FileStream f = new FileStream("cacert.crl", FileMode.Create);
try
{
crl.SaveToStream(f, cacert);
}
finally
{
f.Close();
}
The standard doesn't require that the certificates included in the CRL are issued with the same CA certificate. Hence you can include the certificates from differenct CAs into the same CRL. In this case you need to provide the name of the certificate issuer via the TElRevocationItem.Extensions.IssuerName property. If the issuer name isn't specified, and two certificates have the same serial numbers, a conflict will arise.
For more information on CRLs see RFC 3280.