summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2015-11-13 22:12:38 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2015-11-13 22:12:38 +0700
commit6476a8461d0f71c3961621697904a7cb2f292e62 (patch)
tree700290bc59db506870ed3c3a265fcb4de4b2b789 /crypto
parentUse portable methods for ASCII conversion (diff)
downloadBouncyCastle.NET-ed25519-6476a8461d0f71c3961621697904a7cb2f292e62.tar.xz
Obsolete sequence constructor and refactor
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/asn1/cms/OriginatorPublicKey.cs23
1 files changed, 12 insertions, 11 deletions
diff --git a/crypto/src/asn1/cms/OriginatorPublicKey.cs b/crypto/src/asn1/cms/OriginatorPublicKey.cs
index aabaf4386..988841aa5 100644
--- a/crypto/src/asn1/cms/OriginatorPublicKey.cs
+++ b/crypto/src/asn1/cms/OriginatorPublicKey.cs
@@ -8,22 +8,23 @@ namespace Org.BouncyCastle.Asn1.Cms
     public class OriginatorPublicKey
         : Asn1Encodable
     {
-        private AlgorithmIdentifier algorithm;
-        private DerBitString        publicKey;
+        private readonly AlgorithmIdentifier mAlgorithm;
+        private readonly DerBitString        mPublicKey;
 
-		public OriginatorPublicKey(
+        public OriginatorPublicKey(
             AlgorithmIdentifier algorithm,
             byte[]              publicKey)
         {
-            this.algorithm = algorithm;
-            this.publicKey = new DerBitString(publicKey);
+            this.mAlgorithm = algorithm;
+            this.mPublicKey = new DerBitString(publicKey);
         }
 
+        [Obsolete("Use 'GetInstance' instead")]
 		public OriginatorPublicKey(
             Asn1Sequence seq)
         {
-            algorithm = AlgorithmIdentifier.GetInstance(seq[0]);
-            publicKey = (DerBitString) seq[1];
+            this.mAlgorithm = AlgorithmIdentifier.GetInstance(seq[0]);
+            this.mPublicKey = DerBitString.GetInstance(seq[1]);
         }
 
 		/**
@@ -55,19 +56,19 @@ namespace Org.BouncyCastle.Asn1.Cms
                 return (OriginatorPublicKey)obj;
 
 			if (obj is Asn1Sequence)
-                return new OriginatorPublicKey((Asn1Sequence) obj);
+                return new OriginatorPublicKey(Asn1Sequence.GetInstance(obj));
 
 			throw new ArgumentException("Invalid OriginatorPublicKey: " + obj.GetType().Name);
         }
 
 		public AlgorithmIdentifier Algorithm
 		{
-			get { return algorithm; }
+			get { return mAlgorithm; }
 		}
 
 		public DerBitString PublicKey
 		{
-			get { return publicKey; }
+			get { return mPublicKey; }
 		}
 
 		/**
@@ -81,7 +82,7 @@ namespace Org.BouncyCastle.Asn1.Cms
          */
         public override Asn1Object ToAsn1Object()
         {
-			return new DerSequence(algorithm, publicKey);
+			return new DerSequence(mAlgorithm, mPublicKey);
         }
     }
 }