summary refs log tree commit diff
diff options
context:
space:
mode:
authorJeffrey Stedfast <jeff@xamarin.com>2015-10-23 09:11:33 -0400
committerJeffrey Stedfast <jeff@xamarin.com>2015-10-23 09:11:33 -0400
commitdb4a3f72ab5fe851abdbcd5571710e95475f38f7 (patch)
tree69b8096992b264cbd194db59145a0c355136cf3e
parentMerge branch 'master' into vs2010 (diff)
parentMerge branch 'master' of bcgit@git.bouncycastle.org:bc-csharp.git (diff)
downloadBouncyCastle.NET-ed25519-db4a3f72ab5fe851abdbcd5571710e95475f38f7.tar.xz
Merge branch 'master' into vs2010
-rw-r--r--crypto/src/asn1/cmp/RevDetails.cs25
-rw-r--r--crypto/src/cms/CMSSignedDataGenerator.cs2
-rw-r--r--crypto/src/crypto/IBlockResult.cs4
-rw-r--r--crypto/src/crypto/generators/ECKeyPairGenerator.cs6
-rw-r--r--crypto/src/crypto/generators/GOST3410KeyPairGenerator.cs6
-rw-r--r--crypto/src/crypto/operators/Asn1Signature.cs6
-rw-r--r--crypto/src/ocsp/BasicOCSPRespGenerator.cs2
-rw-r--r--crypto/src/pkcs/Pkcs10CertificationRequest.cs2
-rw-r--r--crypto/src/x509/X509V1CertificateGenerator.cs2
-rw-r--r--crypto/src/x509/X509V2AttributeCertificateGenerator.cs2
-rw-r--r--crypto/src/x509/X509V2CRLGenerator.cs2
-rw-r--r--crypto/src/x509/X509V3CertificateGenerator.cs2
12 files changed, 24 insertions, 37 deletions
diff --git a/crypto/src/asn1/cmp/RevDetails.cs b/crypto/src/asn1/cmp/RevDetails.cs
index 1bd95f1db..6bdf5b2e9 100644
--- a/crypto/src/asn1/cmp/RevDetails.cs
+++ b/crypto/src/asn1/cmp/RevDetails.cs
@@ -11,17 +11,15 @@ namespace Org.BouncyCastle.Asn1.Cmp
 		private readonly CertTemplate certDetails;
 		private readonly X509Extensions crlEntryDetails;
 
-		private RevDetails(Asn1Sequence seq)
+        private RevDetails(Asn1Sequence seq)
 		{
 			certDetails = CertTemplate.GetInstance(seq[0]);
-
-			if  (seq.Count > 1)
-			{
-				crlEntryDetails = X509Extensions.GetInstance(seq[1]);
-			}
+            crlEntryDetails = seq.Count <= 1
+                ?   null
+                :   X509Extensions.GetInstance(seq[1]);
 		}
 
-		public static RevDetails GetInstance(object obj)
+        public static RevDetails GetInstance(object obj)
 		{
 			if (obj is RevDetails)
 				return (RevDetails)obj;
@@ -33,21 +31,22 @@ namespace Org.BouncyCastle.Asn1.Cmp
 		}
 
 		public RevDetails(CertTemplate certDetails)
+            :   this(certDetails, null)
 		{
-			this.certDetails = certDetails;
 		}
-		
-		public RevDetails(CertTemplate certDetails, X509Extensions crlEntryDetails)
+
+        public RevDetails(CertTemplate certDetails, X509Extensions crlEntryDetails)
 		{
-			this.crlEntryDetails = crlEntryDetails;
+            this.certDetails = certDetails;
+            this.crlEntryDetails = crlEntryDetails;
 		}
 
-		public virtual CertTemplate CertDetails
+        public virtual CertTemplate CertDetails
 		{
 			get { return certDetails; }
 		}
 
-		public virtual X509Extensions CrlEntryDetails
+        public virtual X509Extensions CrlEntryDetails
 		{
 			get { return crlEntryDetails; }
 		}
diff --git a/crypto/src/cms/CMSSignedDataGenerator.cs b/crypto/src/cms/CMSSignedDataGenerator.cs
index e0caca9ff..f4720597d 100644
--- a/crypto/src/cms/CMSSignedDataGenerator.cs
+++ b/crypto/src/cms/CMSSignedDataGenerator.cs
@@ -174,7 +174,7 @@ namespace Org.BouncyCastle.Cms
                 }
 
 				sigStr.Close();
-                byte[] sigBytes = ((IBlockResult)calculator.GetResult()).DoFinal();
+                byte[] sigBytes = ((IBlockResult)calculator.GetResult()).Collect();
 
 				Asn1Set unsignedAttr = null;
 				if (unsAttr != null)
diff --git a/crypto/src/crypto/IBlockResult.cs b/crypto/src/crypto/IBlockResult.cs
index c12bdaa1d..0f054fedc 100644
--- a/crypto/src/crypto/IBlockResult.cs
+++ b/crypto/src/crypto/IBlockResult.cs
@@ -11,7 +11,7 @@ namespace Org.BouncyCastle.Crypto
         /// Return the final result of the operation.
         /// </summary>
         /// <returns>A block of bytes, representing the result of an operation.</returns>
-        byte[] DoFinal();
+        byte[] Collect();
 
         /// <summary>
         /// Store the final result of the operation by copying it into the destination array.
@@ -19,6 +19,6 @@ namespace Org.BouncyCastle.Crypto
         /// <returns>The number of bytes copied into destination.</returns>
         /// <param name="destination">The byte array to copy the result into.</param>
         /// <param name="offset">The offset into destination to start copying the result at.</param>
-        int DoFinal(byte[] destination, int offset);
+        int Collect(byte[] destination, int offset);
     }
 }
diff --git a/crypto/src/crypto/generators/ECKeyPairGenerator.cs b/crypto/src/crypto/generators/ECKeyPairGenerator.cs
index d4afff750..26bc06e14 100644
--- a/crypto/src/crypto/generators/ECKeyPairGenerator.cs
+++ b/crypto/src/crypto/generators/ECKeyPairGenerator.cs
@@ -108,12 +108,6 @@ namespace Org.BouncyCastle.Crypto.Generators
                 if (d.CompareTo(BigInteger.Two) < 0 || d.CompareTo(n) >= 0)
                     continue;
 
-                /*
-                 * Require a minimum weight of the NAF representation, since low-weight primes may be
-                 * weak against a version of the number-field-sieve for the discrete-logarithm-problem.
-                 * 
-                 * See "The number field sieve for integers of low weight", Oliver Schirokauer.
-                 */
                 if (WNafUtilities.GetNafWeight(d) < minWeight)
                     continue;
 
diff --git a/crypto/src/crypto/generators/GOST3410KeyPairGenerator.cs b/crypto/src/crypto/generators/GOST3410KeyPairGenerator.cs
index 013b81810..520820bfa 100644
--- a/crypto/src/crypto/generators/GOST3410KeyPairGenerator.cs
+++ b/crypto/src/crypto/generators/GOST3410KeyPairGenerator.cs
@@ -55,12 +55,6 @@ namespace Org.BouncyCastle.Crypto.Generators
                 if (x.SignValue < 1 || x.CompareTo(q) >= 0)
                     continue;
 
-                /*
-                 * Require a minimum weight of the NAF representation, since low-weight primes may be
-                 * weak against a version of the number-field-sieve for the discrete-logarithm-problem.
-                 * 
-                 * See "The number field sieve for integers of low weight", Oliver Schirokauer.
-                 */
                 if (WNafUtilities.GetNafWeight(x) < minWeight)
                     continue;
 
diff --git a/crypto/src/crypto/operators/Asn1Signature.cs b/crypto/src/crypto/operators/Asn1Signature.cs
index ba070f4fc..9e66b6f0c 100644
--- a/crypto/src/crypto/operators/Asn1Signature.cs
+++ b/crypto/src/crypto/operators/Asn1Signature.cs
@@ -422,14 +422,14 @@ namespace Org.BouncyCastle.Crypto.Operators
             this.sig = sig;
         }
 
-        public byte[] DoFinal()
+        public byte[] Collect()
         {
             return sig.GenerateSignature();
         }
 
-        public int DoFinal(byte[] destination, int offset)
+        public int Collect(byte[] destination, int offset)
         {
-            byte[] signature = DoFinal();
+            byte[] signature = Collect();
 
             Array.Copy(signature, 0, destination, offset, signature.Length);
 
diff --git a/crypto/src/ocsp/BasicOCSPRespGenerator.cs b/crypto/src/ocsp/BasicOCSPRespGenerator.cs
index a7d5f3da5..9735ba177 100644
--- a/crypto/src/ocsp/BasicOCSPRespGenerator.cs
+++ b/crypto/src/ocsp/BasicOCSPRespGenerator.cs
@@ -219,7 +219,7 @@ namespace Org.BouncyCastle.Ocsp
 
                 streamCalculator.Stream.Close();
 
-                bitSig = new DerBitString(((IBlockResult)streamCalculator.GetResult()).DoFinal());
+                bitSig = new DerBitString(((IBlockResult)streamCalculator.GetResult()).Collect());
 			}
 			catch (Exception e)
 			{
diff --git a/crypto/src/pkcs/Pkcs10CertificationRequest.cs b/crypto/src/pkcs/Pkcs10CertificationRequest.cs
index b68979cad..6c6b4c87d 100644
--- a/crypto/src/pkcs/Pkcs10CertificationRequest.cs
+++ b/crypto/src/pkcs/Pkcs10CertificationRequest.cs
@@ -282,7 +282,7 @@ namespace Org.BouncyCastle.Pkcs
             streamCalculator.Stream.Close();
 
             // Generate Signature.
-            sigBits = new DerBitString(((IBlockResult)streamCalculator.GetResult()).DoFinal());
+            sigBits = new DerBitString(((IBlockResult)streamCalculator.GetResult()).Collect());
         }
 
         //        internal Pkcs10CertificationRequest(
diff --git a/crypto/src/x509/X509V1CertificateGenerator.cs b/crypto/src/x509/X509V1CertificateGenerator.cs
index a452df440..2279767e3 100644
--- a/crypto/src/x509/X509V1CertificateGenerator.cs
+++ b/crypto/src/x509/X509V1CertificateGenerator.cs
@@ -186,7 +186,7 @@ namespace Org.BouncyCastle.X509
 
             streamCalculator.Stream.Close();
 
-            return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).DoFinal());
+            return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).Collect());
 		}
 
 		private X509Certificate GenerateJcaObject(
diff --git a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs
index 138f2ec6f..b6ab45c64 100644
--- a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs
+++ b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs
@@ -180,7 +180,7 @@ namespace Org.BouncyCastle.X509
 
 			try
 			{
-				v.Add(new DerBitString(((IBlockResult)streamCalculator.GetResult()).DoFinal()));
+				v.Add(new DerBitString(((IBlockResult)streamCalculator.GetResult()).Collect()));
 
 				return new X509V2AttributeCertificate(AttributeCertificate.GetInstance(new DerSequence(v)));
 			}
diff --git a/crypto/src/x509/X509V2CRLGenerator.cs b/crypto/src/x509/X509V2CRLGenerator.cs
index c1cc8e824..869722219 100644
--- a/crypto/src/x509/X509V2CRLGenerator.cs
+++ b/crypto/src/x509/X509V2CRLGenerator.cs
@@ -243,7 +243,7 @@ namespace Org.BouncyCastle.X509
 
             streamCalculator.Stream.Close();
 
-            return GenerateJcaObject(tbsCertList, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).DoFinal());
+            return GenerateJcaObject(tbsCertList, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).Collect());
         }
 
         private TbsCertificateList GenerateCertList()
diff --git a/crypto/src/x509/X509V3CertificateGenerator.cs b/crypto/src/x509/X509V3CertificateGenerator.cs
index a22cd9943..d8cdc7521 100644
--- a/crypto/src/x509/X509V3CertificateGenerator.cs
+++ b/crypto/src/x509/X509V3CertificateGenerator.cs
@@ -322,7 +322,7 @@ namespace Org.BouncyCastle.X509
 
             streamCalculator.Stream.Close ();
 
-			return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).DoFinal());
+			return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).Collect());
 		}
 
 		private X509Certificate GenerateJcaObject(