summary refs log tree commit diff
path: root/crypto/src/asn1/crmf/OptionalValidity.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/crmf/OptionalValidity.cs')
-rw-r--r--crypto/src/asn1/crmf/OptionalValidity.cs15
1 files changed, 11 insertions, 4 deletions
diff --git a/crypto/src/asn1/crmf/OptionalValidity.cs b/crypto/src/asn1/crmf/OptionalValidity.cs
index c0037999a..d1a0f7ffb 100644
--- a/crypto/src/asn1/crmf/OptionalValidity.cs
+++ b/crypto/src/asn1/crmf/OptionalValidity.cs
@@ -27,13 +27,20 @@ namespace Org.BouncyCastle.Asn1.Crmf
 
         public static OptionalValidity GetInstance(object obj)
         {
-            if (obj is OptionalValidity)
+            if (obj == null || obj is OptionalValidity)
                 return (OptionalValidity)obj;
 
-            if (obj is Asn1Sequence)
-                return new OptionalValidity((Asn1Sequence)obj);
+            return new OptionalValidity(Asn1Sequence.GetInstance(obj));
+        }
 
-            throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj");
+        public virtual Time NotBefore
+        {
+            get { return notBefore; }
+        }
+
+        public virtual Time NotAfter
+        {
+            get { return notAfter; }
         }
 
         /**