summary refs log tree commit diff
path: root/crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2024-06-18 16:12:06 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2024-06-18 16:12:06 +0700
commit740c25a020c7539c99e82dd4531492c5b6bbd787 (patch)
tree998874b3c9d7b80636919b44de639218c9622f29 /crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs
parentDerInteger constants for small values (diff)
downloadBouncyCastle.NET-ed25519-740c25a020c7539c99e82dd4531492c5b6bbd787.tar.xz
Refactoring in Asn1.Cms
Diffstat (limited to 'crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs')
-rw-r--r--crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs40
1 files changed, 15 insertions, 25 deletions
diff --git a/crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs b/crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs
index 9e6e3bd5a..fb393b9ba 100644
--- a/crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs
+++ b/crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs
@@ -35,30 +35,22 @@ namespace Org.BouncyCastle.Asn1.Cms
             return Asn1Utilities.GetInstanceFromChoice(obj, isExplicit, GetInstance);
 		}
 
-		private readonly IssuerAndSerialNumber issuerSerial;
-		private readonly RecipientKeyIdentifier rKeyID;
+		private readonly IssuerAndSerialNumber m_issuerSerial;
+		private readonly RecipientKeyIdentifier m_rKeyID;
 
-		public KeyAgreeRecipientIdentifier(
-			IssuerAndSerialNumber issuerSerial)
-		{
-			this.issuerSerial = issuerSerial;
-		}
+        public KeyAgreeRecipientIdentifier(IssuerAndSerialNumber issuerSerial)
+        {
+            m_issuerSerial = issuerSerial ?? throw new ArgumentNullException(nameof(issuerSerial));
+        }
 
-		public KeyAgreeRecipientIdentifier(
-			RecipientKeyIdentifier rKeyID)
-		{
-			this.rKeyID = rKeyID;
-		}
+        public KeyAgreeRecipientIdentifier(RecipientKeyIdentifier rKeyID)
+        {
+            m_rKeyID = rKeyID ?? throw new ArgumentNullException(nameof(rKeyID));
+        }
 
-		public IssuerAndSerialNumber IssuerAndSerialNumber
-		{
-			get { return issuerSerial; }
-		}
+		public IssuerAndSerialNumber IssuerAndSerialNumber => m_issuerSerial;
 
-		public RecipientKeyIdentifier RKeyID
-		{
-			get { return rKeyID; }
-		}
+		public RecipientKeyIdentifier RKeyID => m_rKeyID;
 
 		/** 
 		 * Produce an object suitable for an Asn1OutputStream.
@@ -71,12 +63,10 @@ namespace Org.BouncyCastle.Asn1.Cms
 		 */
 		public override Asn1Object ToAsn1Object()
 		{
-			if (issuerSerial != null)
-			{
-				return issuerSerial.ToAsn1Object();
-			}
+			if (m_issuerSerial != null)
+				return m_issuerSerial.ToAsn1Object();
 
-			return new DerTaggedObject(false, 0, rKeyID);
+			return new DerTaggedObject(false, 0, m_rKeyID);
 		}
 	}
 }