From 11e36951c52390e493fcaaa30b6eb64add8df065 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sat, 5 Nov 2022 20:05:23 +0700 Subject: Cleanup RevokedStatus --- crypto/src/ocsp/RevokedStatus.cs | 45 ++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 27 deletions(-) (limited to 'crypto/src') diff --git a/crypto/src/ocsp/RevokedStatus.cs b/crypto/src/ocsp/RevokedStatus.cs index 659dc99d7..a37bdade9 100644 --- a/crypto/src/ocsp/RevokedStatus.cs +++ b/crypto/src/ocsp/RevokedStatus.cs @@ -6,58 +6,49 @@ using Org.BouncyCastle.Asn1.X509; namespace Org.BouncyCastle.Ocsp { - /** - * wrapper for the RevokedInfo object - */ - public class RevokedStatus + /// Wrapper for the RevokedInfo object + public class RevokedStatus : CertificateStatus { - internal readonly RevokedInfo info; + private readonly RevokedInfo m_revokedInfo; - public RevokedStatus( - RevokedInfo info) + public RevokedStatus(RevokedInfo revokedInfo) { - this.info = info; + m_revokedInfo = revokedInfo; } - public RevokedStatus( - DateTime revocationDate, - int reason) + public RevokedStatus(DateTime revocationDate) { - this.info = new RevokedInfo(new Asn1GeneralizedTime(revocationDate), new CrlReason(reason)); + m_revokedInfo = new RevokedInfo(new Asn1GeneralizedTime(revocationDate)); } - public RevokedStatus( - DateTime revocationDate) + public RevokedStatus(DateTime revocationDate, int reason) { - this.info = new RevokedInfo(new DerGeneralizedTime(revocationDate)); + m_revokedInfo = new RevokedInfo(new Asn1GeneralizedTime(revocationDate), new CrlReason(reason)); } public DateTime RevocationTime { - get { return info.RevocationTime.ToDateTime(); } + get { return m_revokedInfo.RevocationTime.ToDateTime(); } } public bool HasRevocationReason { - get { return (info.RevocationReason != null); } + get { return m_revokedInfo.RevocationReason != null; } } - /** - * return the revocation reason. Note: this field is optional, test for it - * with hasRevocationReason() first. - * @exception InvalidOperationException if a reason is asked for and none is avaliable - */ - public int RevocationReason + /// Return the revocation reason, if there is one. + /// This field is optional; test for it with first. + /// The revocation reason, if available. + /// If no revocation reason is available. + public int RevocationReason { get { - if (info.RevocationReason == null) - { + if (m_revokedInfo.RevocationReason == null) throw new InvalidOperationException("attempt to get a reason where none is available"); - } - return info.RevocationReason.IntValueExact; + return m_revokedInfo.RevocationReason.IntValueExact; } } } -- cgit 1.4.1