diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-07 20:04:44 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-07 20:09:45 +0700 |
commit | cf2633e7cd4f2d29f4e3e56a3d3b81b11e254a41 (patch) | |
tree | eb551d7ad27a4f5651bcca69fdc2caf85da13b6d /crypto/src/asn1/DerUTCTime.cs | |
parent | fixed use of property (diff) | |
download | BouncyCastle.NET-ed25519-cf2633e7cd4f2d29f4e3e56a3d3b81b11e254a41.tar.xz |
Overhaul UTCTime classes
Diffstat (limited to 'crypto/src/asn1/DerUTCTime.cs')
-rw-r--r-- | crypto/src/asn1/DerUTCTime.cs | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/crypto/src/asn1/DerUTCTime.cs b/crypto/src/asn1/DerUTCTime.cs index 089285367..33e502c67 100644 --- a/crypto/src/asn1/DerUTCTime.cs +++ b/crypto/src/asn1/DerUTCTime.cs @@ -5,21 +5,36 @@ namespace Org.BouncyCastle.Asn1 public class DerUtcTime : Asn1UtcTime { - public DerUtcTime(string time) - : base(time) + public DerUtcTime(string timeString) + : base(timeString) { } - public DerUtcTime(DateTime time) - : base(time) + [Obsolete("Use `DerUtcTime(DateTime, int)' instead")] + public DerUtcTime(DateTime dateTime) + : base(dateTime) { } - internal DerUtcTime(byte[] contents) + public DerUtcTime(DateTime dateTime, int twoDigitYearMax) + : base(dateTime, twoDigitYearMax) + { + } + + internal DerUtcTime(byte[] contents) : base(contents) { } - // TODO: create proper DER encoding. + internal override IAsn1Encoding GetEncoding(int encoding) + { + return new PrimitiveEncoding(Asn1Tags.Universal, Asn1Tags.UtcTime, + GetContents(Asn1OutputStream.EncodingDer)); + } + + internal override IAsn1Encoding GetEncodingImplicit(int encoding, int tagClass, int tagNo) + { + return new PrimitiveEncoding(tagClass, tagNo, GetContents(Asn1OutputStream.EncodingDer)); + } } } |