summary refs log tree commit diff
path: root/crypto/src/asn1/DerUTCTime.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-11-07 20:04:44 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-11-07 20:09:45 +0700
commitcf2633e7cd4f2d29f4e3e56a3d3b81b11e254a41 (patch)
treeeb551d7ad27a4f5651bcca69fdc2caf85da13b6d /crypto/src/asn1/DerUTCTime.cs
parentfixed use of property (diff)
downloadBouncyCastle.NET-ed25519-cf2633e7cd4f2d29f4e3e56a3d3b81b11e254a41.tar.xz
Overhaul UTCTime classes
Diffstat (limited to 'crypto/src/asn1/DerUTCTime.cs')
-rw-r--r--crypto/src/asn1/DerUTCTime.cs27
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));
+        }
     }
 }