diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-08 13:18:17 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-08 13:18:17 +0700 |
commit | 879bb29bb0058a0723326de6edebb201e4cbc0b8 (patch) | |
tree | 089e7769c2342a99dfa7549c57290522f72c451b /crypto/src/asn1/cms | |
parent | removed unused SecureRandom (diff) | |
download | BouncyCastle.NET-ed25519-879bb29bb0058a0723326de6edebb201e4cbc0b8.tar.xz |
Overhaul GeneralizedTime classes
Diffstat (limited to 'crypto/src/asn1/cms')
-rw-r--r-- | crypto/src/asn1/cms/Time.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/src/asn1/cms/Time.cs b/crypto/src/asn1/cms/Time.cs index f054e3809..7b6b49c30 100644 --- a/crypto/src/asn1/cms/Time.cs +++ b/crypto/src/asn1/cms/Time.cs @@ -101,7 +101,10 @@ namespace Org.BouncyCastle.Asn1.Cms if (m_timeObject is Asn1UtcTime utcTime) return utcTime.ToDateTime(2049).ToString(@"yyyyMMddHHmmssK", DateTimeFormatInfo.InvariantInfo); - return ((Asn1GeneralizedTime)m_timeObject).GetTime(); + if (m_timeObject is Asn1GeneralizedTime generalizedTime) + return generalizedTime.ToDateTime().ToString(@"yyyyMMddHHmmss.FFFFFFFK", DateTimeFormatInfo.InvariantInfo); + + throw new InvalidOperationException(); } } } |