summary refs log tree commit diff
path: root/crypto/src/asn1/cms
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2024-06-12 18:09:06 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2024-06-12 18:09:06 +0700
commitdaec40507f75c8bbe80f54e25338d31a2b411e39 (patch)
treef336873fdf0be8476dc45de28a30dda37976bd43 /crypto/src/asn1/cms
parentDilithium SampleInBall change and KATs updated (diff)
downloadBouncyCastle.NET-ed25519-daec40507f75c8bbe80f54e25338d31a2b411e39.tar.xz
DerInteger constants for small values
Diffstat (limited to 'crypto/src/asn1/cms')
-rw-r--r--crypto/src/asn1/cms/AuthEnvelopedData.cs2
-rw-r--r--crypto/src/asn1/cms/CompressedData.cs2
-rw-r--r--crypto/src/asn1/cms/KEKRecipientInfo.cs2
-rw-r--r--crypto/src/asn1/cms/KemRecipientInfo.cs2
-rw-r--r--crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs2
-rw-r--r--crypto/src/asn1/cms/KeyTransRecipientInfo.cs4
-rw-r--r--crypto/src/asn1/cms/PasswordRecipientInfo.cs4
-rw-r--r--crypto/src/asn1/cms/RecipientInfo.cs2
-rw-r--r--crypto/src/asn1/cms/SignedData.cs8
-rw-r--r--crypto/src/asn1/cms/TimeStampedData.cs2
10 files changed, 15 insertions, 15 deletions
diff --git a/crypto/src/asn1/cms/AuthEnvelopedData.cs b/crypto/src/asn1/cms/AuthEnvelopedData.cs
index bbcde8180..ae0380b64 100644
--- a/crypto/src/asn1/cms/AuthEnvelopedData.cs
+++ b/crypto/src/asn1/cms/AuthEnvelopedData.cs
@@ -36,7 +36,7 @@ namespace Org.BouncyCastle.Asn1.Cms
 			Asn1Set					unauthAttrs)
 		{
 			// "It MUST be set to 0."
-			this.version = new DerInteger(0);
+			this.version = DerInteger.Zero;
 
 			this.originatorInfo = originatorInfo;
 
diff --git a/crypto/src/asn1/cms/CompressedData.cs b/crypto/src/asn1/cms/CompressedData.cs
index 4b326247e..5ae71708d 100644
--- a/crypto/src/asn1/cms/CompressedData.cs
+++ b/crypto/src/asn1/cms/CompressedData.cs
@@ -43,7 +43,7 @@ namespace Org.BouncyCastle.Asn1.Cms
             AlgorithmIdentifier	compressionAlgorithm,
             ContentInfo			encapContentInfo)
         {
-            this.version = new DerInteger(0);
+            this.version = DerInteger.Zero;
             this.compressionAlgorithm = compressionAlgorithm;
             this.encapContentInfo = encapContentInfo;
         }
diff --git a/crypto/src/asn1/cms/KEKRecipientInfo.cs b/crypto/src/asn1/cms/KEKRecipientInfo.cs
index 76ce9c643..b1b85953e 100644
--- a/crypto/src/asn1/cms/KEKRecipientInfo.cs
+++ b/crypto/src/asn1/cms/KEKRecipientInfo.cs
@@ -35,7 +35,7 @@ namespace Org.BouncyCastle.Asn1.Cms
             AlgorithmIdentifier keyEncryptionAlgorithm,
             Asn1OctetString     encryptedKey)
         {
-            this.version = new DerInteger(4);
+            this.version = DerInteger.Four;
             this.kekID = kekID;
             this.keyEncryptionAlgorithm = keyEncryptionAlgorithm;
             this.encryptedKey = encryptedKey;
diff --git a/crypto/src/asn1/cms/KemRecipientInfo.cs b/crypto/src/asn1/cms/KemRecipientInfo.cs
index c7251fbb1..4f771784a 100644
--- a/crypto/src/asn1/cms/KemRecipientInfo.cs
+++ b/crypto/src/asn1/cms/KemRecipientInfo.cs
@@ -33,7 +33,7 @@ namespace Org.BouncyCastle.Asn1.Cms
             return new KemRecipientInfo(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
         }
 
-        private static readonly DerInteger V1 = new DerInteger(0);
+        private static readonly DerInteger V1 = DerInteger.Zero;
 
         private readonly DerInteger m_cmsVersion;
         private readonly RecipientIdentifier m_rid;
diff --git a/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs b/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs
index 63eebcea3..345a45029 100644
--- a/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs
+++ b/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs
@@ -37,7 +37,7 @@ namespace Org.BouncyCastle.Asn1.Cms
             AlgorithmIdentifier         keyEncryptionAlgorithm,
             Asn1Sequence                recipientEncryptedKeys)
         {
-            this.version = new DerInteger(3);
+            this.version = DerInteger.Three;
             this.originator = originator;
             this.ukm = ukm;
             this.keyEncryptionAlgorithm = keyEncryptionAlgorithm;
diff --git a/crypto/src/asn1/cms/KeyTransRecipientInfo.cs b/crypto/src/asn1/cms/KeyTransRecipientInfo.cs
index 6981e87f9..1d9825b02 100644
--- a/crypto/src/asn1/cms/KeyTransRecipientInfo.cs
+++ b/crypto/src/asn1/cms/KeyTransRecipientInfo.cs
@@ -38,11 +38,11 @@ namespace Org.BouncyCastle.Asn1.Cms
         {
             if (rid.ToAsn1Object() is Asn1TaggedObject)
             {
-                this.version = new DerInteger(2);
+                this.version = DerInteger.Two;
             }
             else
             {
-                this.version = new DerInteger(0);
+                this.version = DerInteger.Zero;
             }
 
 			this.rid = rid;
diff --git a/crypto/src/asn1/cms/PasswordRecipientInfo.cs b/crypto/src/asn1/cms/PasswordRecipientInfo.cs
index 67ff01cf8..5fac434ca 100644
--- a/crypto/src/asn1/cms/PasswordRecipientInfo.cs
+++ b/crypto/src/asn1/cms/PasswordRecipientInfo.cs
@@ -34,7 +34,7 @@ namespace Org.BouncyCastle.Asn1.Cms
             AlgorithmIdentifier	keyEncryptionAlgorithm,
             Asn1OctetString		encryptedKey)
         {
-            this.version = new DerInteger(0);
+            this.version = DerInteger.Zero;
             this.keyEncryptionAlgorithm = keyEncryptionAlgorithm;
             this.encryptedKey = encryptedKey;
         }
@@ -44,7 +44,7 @@ namespace Org.BouncyCastle.Asn1.Cms
 			AlgorithmIdentifier	keyEncryptionAlgorithm,
 			Asn1OctetString		encryptedKey)
 		{
-			this.version = new DerInteger(0);
+			this.version = DerInteger.Zero;
 			this.keyDerivationAlgorithm = keyDerivationAlgorithm;
 			this.keyEncryptionAlgorithm = keyEncryptionAlgorithm;
 			this.encryptedKey = encryptedKey;
diff --git a/crypto/src/asn1/cms/RecipientInfo.cs b/crypto/src/asn1/cms/RecipientInfo.cs
index ff93258b6..85bd7e585 100644
--- a/crypto/src/asn1/cms/RecipientInfo.cs
+++ b/crypto/src/asn1/cms/RecipientInfo.cs
@@ -82,7 +82,7 @@ namespace Org.BouncyCastle.Asn1.Cms
 					case 3:
 						return PasswordRecipientInfo.GetInstance(o, false).Version;
 					case 4:
-						return new DerInteger(0);    // no syntax version for OtherRecipientInfo
+						return DerInteger.Zero;    // no syntax version for OtherRecipientInfo
 					default:
 						throw new InvalidOperationException("unknown tag");
 					}
diff --git a/crypto/src/asn1/cms/SignedData.cs b/crypto/src/asn1/cms/SignedData.cs
index 858715ad6..380305c32 100644
--- a/crypto/src/asn1/cms/SignedData.cs
+++ b/crypto/src/asn1/cms/SignedData.cs
@@ -22,10 +22,10 @@ namespace Org.BouncyCastle.Asn1.Cms
             return new SignedData(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
         }
 
-        private static readonly DerInteger Version1 = new DerInteger(1);
-        private static readonly DerInteger Version3 = new DerInteger(3);
-        private static readonly DerInteger Version4 = new DerInteger(4);
-        private static readonly DerInteger Version5 = new DerInteger(5);
+        private static readonly DerInteger Version1 = DerInteger.One;
+        private static readonly DerInteger Version3 = DerInteger.Three;
+        private static readonly DerInteger Version4 = DerInteger.Four;
+        private static readonly DerInteger Version5 = DerInteger.Five;
 
         private readonly DerInteger		version;
         private readonly Asn1Set		digestAlgorithms;
diff --git a/crypto/src/asn1/cms/TimeStampedData.cs b/crypto/src/asn1/cms/TimeStampedData.cs
index 4d9136ea0..cae290609 100644
--- a/crypto/src/asn1/cms/TimeStampedData.cs
+++ b/crypto/src/asn1/cms/TimeStampedData.cs
@@ -28,7 +28,7 @@ namespace Org.BouncyCastle.Asn1.Cms
 		public TimeStampedData(DerIA5String dataUri, MetaData metaData, Asn1OctetString content,
 			Evidence temporalEvidence)
 		{
-			this.version = new DerInteger(1);
+			this.version = DerInteger.One;
 			this.dataUri = dataUri;
 			this.metaData = metaData;
 			this.content = content;