diff options
author | Oren Novotny <oren@novotny.org> | 2015-10-24 10:56:16 -0400 |
---|---|---|
committer | Oren Novotny <oren@novotny.org> | 2015-10-24 10:56:16 -0400 |
commit | 20cab17d399d70129e4aaf95fdc20004545677da (patch) | |
tree | e4a18e8399df3bbfe60adafcaed22b03dc2eddbe | |
parent | remove gitink hack (diff) | |
parent | Merge branch 'master' into master-vs12 (diff) | |
download | BouncyCastle.NET-ed25519-20cab17d399d70129e4aaf95fdc20004545677da.tar.xz |
Merge branch 'master-vs12' into pcl
-rw-r--r-- | crypto/src/asn1/cmp/RevDetails.cs | 25 | ||||
-rw-r--r-- | crypto/src/cms/CMSSignedDataGenerator.cs | 2 | ||||
-rw-r--r-- | crypto/src/crypto/IBlockResult.cs | 4 | ||||
-rw-r--r-- | crypto/src/crypto/generators/ECKeyPairGenerator.cs | 6 | ||||
-rw-r--r-- | crypto/src/crypto/generators/GOST3410KeyPairGenerator.cs | 6 | ||||
-rw-r--r-- | crypto/src/crypto/operators/Asn1Signature.cs | 6 | ||||
-rw-r--r-- | crypto/src/ocsp/BasicOCSPRespGenerator.cs | 2 | ||||
-rw-r--r-- | crypto/src/pkcs/Pkcs10CertificationRequest.cs | 2 | ||||
-rw-r--r-- | crypto/src/x509/X509V1CertificateGenerator.cs | 2 | ||||
-rw-r--r-- | crypto/src/x509/X509V2AttributeCertificateGenerator.cs | 2 | ||||
-rw-r--r-- | crypto/src/x509/X509V2CRLGenerator.cs | 2 | ||||
-rw-r--r-- | crypto/src/x509/X509V3CertificateGenerator.cs | 2 |
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 2e4aeaf2a..4beab4c43 100644 --- a/crypto/src/cms/CMSSignedDataGenerator.cs +++ b/crypto/src/cms/CMSSignedDataGenerator.cs @@ -174,7 +174,7 @@ namespace Org.BouncyCastle.Cms } sigStr.Dispose(); - 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 611c4c8ab..1500f1cb2 100644 --- a/crypto/src/crypto/operators/Asn1Signature.cs +++ b/crypto/src/crypto/operators/Asn1Signature.cs @@ -423,14 +423,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 95c590666..42c5f2836 100644 --- a/crypto/src/ocsp/BasicOCSPRespGenerator.cs +++ b/crypto/src/ocsp/BasicOCSPRespGenerator.cs @@ -219,7 +219,7 @@ namespace Org.BouncyCastle.Ocsp streamCalculator.Stream.Dispose(); - 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 e32510aaa..ab4f0fde3 100644 --- a/crypto/src/pkcs/Pkcs10CertificationRequest.cs +++ b/crypto/src/pkcs/Pkcs10CertificationRequest.cs @@ -282,7 +282,7 @@ namespace Org.BouncyCastle.Pkcs streamCalculator.Stream.Dispose(); // 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 354b91b8d..3b10c46a9 100644 --- a/crypto/src/x509/X509V1CertificateGenerator.cs +++ b/crypto/src/x509/X509V1CertificateGenerator.cs @@ -186,7 +186,7 @@ namespace Org.BouncyCastle.X509 streamCalculator.Stream.Dispose(); - 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 507d00de8..44d22bb7a 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 1f22e88b3..7dcd80e1a 100644 --- a/crypto/src/x509/X509V2CRLGenerator.cs +++ b/crypto/src/x509/X509V2CRLGenerator.cs @@ -243,7 +243,7 @@ namespace Org.BouncyCastle.X509 streamCalculator.Stream.Dispose(); - 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 5af5dca3b..fb59d65fa 100644 --- a/crypto/src/x509/X509V3CertificateGenerator.cs +++ b/crypto/src/x509/X509V3CertificateGenerator.cs @@ -322,7 +322,7 @@ namespace Org.BouncyCastle.X509 streamCalculator.Stream.Dispose (); - return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).DoFinal()); + return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).Collect()); } private X509Certificate GenerateJcaObject( |