diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-05 20:05:23 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-05 20:05:23 +0700 |
commit | 11e36951c52390e493fcaaa30b6eb64add8df065 (patch) | |
tree | 1428007e27ad57f761f3cd8a69132689a565fd9c /crypto | |
parent | Merge branch 'master' of github.com:harrison314/bc-csharp (diff) | |
download | BouncyCastle.NET-ed25519-11e36951c52390e493fcaaa30b6eb64add8df065.tar.xz |
Cleanup RevokedStatus
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/src/ocsp/RevokedStatus.cs | 45 |
1 files changed, 18 insertions, 27 deletions
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 + /// <summary>Wrapper for the RevokedInfo object</summary> + 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 + /// <summary>Return the revocation reason, if there is one.</summary> + /// <remarks>This field is optional; test for it with <see cref="HasRevocationReason"/> first.</remarks> + /// <returns>The revocation reason, if available.</returns> + /// <exception cref="InvalidOperationException">If no revocation reason is available.</exception> + 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; } } } |