summary refs log tree commit diff
path: root/crypto/src/asn1/x509/Time.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/x509/Time.cs')
-rw-r--r--crypto/src/asn1/x509/Time.cs76
1 files changed, 38 insertions, 38 deletions
diff --git a/crypto/src/asn1/x509/Time.cs b/crypto/src/asn1/x509/Time.cs
index ca4e99ac7..0f2511e6d 100644
--- a/crypto/src/asn1/x509/Time.cs
+++ b/crypto/src/asn1/x509/Time.cs
@@ -7,28 +7,28 @@ namespace Org.BouncyCastle.Asn1.X509
     {
         internal Asn1Object time;
 
-		public static Time GetInstance(
+        public static Time GetInstance(
             Asn1TaggedObject	obj,
             bool				explicitly)
         {
             return GetInstance(obj.GetObject());
         }
 
-		public Time(
+        public Time(
             Asn1Object time)
         {
-			if (time == null)
-				throw new ArgumentNullException("time");
+            if (time == null)
+                throw new ArgumentNullException("time");
 
-			if (!(time is DerUtcTime) && !(time is DerGeneralizedTime))
+            if (!(time is DerUtcTime) && !(time is DerGeneralizedTime))
             {
                 throw new ArgumentException("unknown object passed to Time");
             }
 
-			this.time = time;
+            this.time = time;
         }
 
-		/**
+        /**
          * creates a time object from a given date - if the date is between 1950
          * and 2049 a UTCTime object is Generated, otherwise a GeneralizedTime
          * is used.
@@ -38,9 +38,9 @@ namespace Org.BouncyCastle.Asn1.X509
         {
             string d = date.ToString("yyyyMMddHHmmss") + "Z";
 
-			int year = Int32.Parse(d.Substring(0, 4));
+            int year = Int32.Parse(d.Substring(0, 4));
 
-			if (year < 1950 || year > 2049)
+            if (year < 1950 || year > 2049)
             {
                 time = new DerGeneralizedTime(d);
             }
@@ -50,56 +50,56 @@ namespace Org.BouncyCastle.Asn1.X509
             }
         }
 
-		public static Time GetInstance(
+        public static Time GetInstance(
             object obj)
         {
             if (obj == null || obj is Time)
                 return (Time) obj;
 
-			if (obj is DerUtcTime)
+            if (obj is DerUtcTime)
                 return new Time((DerUtcTime) obj);
 
-			if (obj is DerGeneralizedTime)
+            if (obj is DerGeneralizedTime)
                 return new Time((DerGeneralizedTime) obj);
 
-			throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj");
+            throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj");
         }
 
-		public string GetTime()
+        public string GetTime()
         {
             if (time is DerUtcTime)
             {
                 return ((DerUtcTime) time).AdjustedTimeString;
             }
 
-			return ((DerGeneralizedTime) time).GetTime();
+            return ((DerGeneralizedTime) time).GetTime();
         }
 
-		/// <summary>
+        /// <summary>
         /// Return our time as DateTime.
         /// </summary>
         /// <returns>A date time.</returns>
         public DateTime ToDateTime()
         {
-			try
-			{
-				if (time is DerUtcTime)
-				{
-					return ((DerUtcTime)time).ToAdjustedDateTime();
-				}
-				else
-				{
-					return ((DerGeneralizedTime)time).ToDateTime();
-				}
-			}
-			catch (FormatException e)
-			{
-				// this should never happen
-				throw new InvalidOperationException("invalid date string: " + e.Message);
-			}
+            try
+            {
+                if (time is DerUtcTime)
+                {
+                    return ((DerUtcTime)time).ToAdjustedDateTime();
+                }
+                else
+                {
+                    return ((DerGeneralizedTime)time).ToDateTime();
+                }
+            }
+            catch (FormatException e)
+            {
+                // this should never happen
+                throw new InvalidOperationException("invalid date string: " + e.Message);
+            }
         }
 
-		/**
+        /**
          * Produce an object suitable for an Asn1OutputStream.
          * <pre>
          * Time ::= CHOICE {
@@ -112,9 +112,9 @@ namespace Org.BouncyCastle.Asn1.X509
             return time;
         }
 
-		public override string ToString()
-		{
-			return GetTime();
-		}
-	}
+        public override string ToString()
+        {
+            return GetTime();
+        }
+    }
 }