summary refs log tree commit diff
path: root/crypto/src/asn1/pkcs/CertBag.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/pkcs/CertBag.cs')
-rw-r--r--crypto/src/asn1/pkcs/CertBag.cs16
1 files changed, 12 insertions, 4 deletions
diff --git a/crypto/src/asn1/pkcs/CertBag.cs b/crypto/src/asn1/pkcs/CertBag.cs
index e561fb890..61165c087 100644
--- a/crypto/src/asn1/pkcs/CertBag.cs
+++ b/crypto/src/asn1/pkcs/CertBag.cs
@@ -5,17 +5,25 @@ namespace Org.BouncyCastle.Asn1.Pkcs
     public class CertBag
         : Asn1Encodable
     {
-//		private readonly Asn1Sequence seq;
+        public static CertBag GetInstance(object obj)
+        {
+            if (obj is CertBag)
+                return (CertBag)obj;
+            if (obj == null)
+                return null;
+            return new CertBag(Asn1Sequence.GetInstance(obj));
+        }
+
         private readonly DerObjectIdentifier certID;
         private readonly Asn1Object certValue;
 
+        [Obsolete("Use 'GetInstance' instead")]
 		public CertBag(
             Asn1Sequence seq)
         {
 			if (seq.Count != 2)
 				throw new ArgumentException("Wrong number of elements in sequence", "seq");
 
-//			this.seq = seq;
             this.certID = DerObjectIdentifier.GetInstance(seq[0]);
             this.certValue = Asn1TaggedObject.GetInstance(seq[1]).GetObject();
         }
@@ -28,12 +36,12 @@ namespace Org.BouncyCastle.Asn1.Pkcs
             this.certValue = certValue;
         }
 
-		public DerObjectIdentifier CertID
+		public virtual DerObjectIdentifier CertID
 		{
 			get { return certID; }
 		}
 
-		public Asn1Object CertValue
+		public virtual Asn1Object CertValue
 		{
 			get { return certValue; }
 		}