diff options
author | David Hook <dgh@cryptoworkshop.com> | 2021-10-04 19:50:31 +1100 |
---|---|---|
committer | David Hook <dgh@cryptoworkshop.com> | 2021-10-04 19:50:31 +1100 |
commit | 64f8abc147a03de15ff1cbcdea4bfc428f79913f (patch) | |
tree | 677bc0155aa935cfd204b929865d589aed7c3ee6 | |
parent | partial #68 (diff) | |
download | BouncyCastle.NET-ed25519-64f8abc147a03de15ff1cbcdea4bfc428f79913f.tar.xz |
format changes only - relates to github #68
-rw-r--r-- | crypto/src/asn1/DerUTCTime.cs | 2 | ||||
-rw-r--r-- | crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs | 2 | ||||
-rw-r--r-- | crypto/src/cms/CMSSignedDataStreamGenerator.cs | 74 | ||||
-rw-r--r-- | crypto/src/crypto/engines/NaccacheSternEngine.cs | 6 | ||||
-rw-r--r-- | crypto/src/crypto/generators/NaccacheSternKeyPairGenerator.cs | 8 | ||||
-rw-r--r-- | crypto/src/pkcs/Pkcs12Store.cs | 78 | ||||
-rw-r--r-- | crypto/src/util/zlib/ZDeflaterOutputStream.cs | 2 | ||||
-rw-r--r-- | crypto/test/src/asn1/test/AdditionalInformationSyntaxUnitTest.cs | 2 | ||||
-rw-r--r-- | crypto/test/src/asn1/test/AdmissionSyntaxUnitTest.cs | 2 | ||||
-rw-r--r-- | crypto/test/src/asn1/test/EssCertIDv2UnitTest.cs | 2 |
10 files changed, 89 insertions, 89 deletions
diff --git a/crypto/src/asn1/DerUTCTime.cs b/crypto/src/asn1/DerUTCTime.cs index 99af8bf6b..5d058619d 100644 --- a/crypto/src/asn1/DerUTCTime.cs +++ b/crypto/src/asn1/DerUTCTime.cs @@ -93,7 +93,7 @@ namespace Org.BouncyCastle.Asn1 #endif } - internal DerUtcTime( + internal DerUtcTime( byte[] bytes) { // diff --git a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs index 8e6d2729b..e0822aa8b 100644 --- a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs @@ -287,7 +287,7 @@ namespace Org.BouncyCastle.Cms // TODO Parent context(s) should really be closed explicitly - _eiGen.Close(); + _eiGen.Close(); if (_outer.unprotectedAttributeGenerator != null) { diff --git a/crypto/src/cms/CMSSignedDataStreamGenerator.cs b/crypto/src/cms/CMSSignedDataStreamGenerator.cs index f6bdacb06..e32f95d42 100644 --- a/crypto/src/cms/CMSSignedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSSignedDataStreamGenerator.cs @@ -834,7 +834,7 @@ namespace Org.BouncyCastle.Cms _eiGen.Close(); - outer._digests.Clear(); // clear the current preserved digest state + outer._digests.Clear(); // clear the current preserved digest state if (outer._certs.Count > 0) { @@ -842,8 +842,8 @@ namespace Org.BouncyCastle.Cms ? CmsUtilities.CreateDerSetFromList(outer._certs) : CmsUtilities.CreateBerSetFromList(outer._certs); - WriteToGenerator(_sigGen, new BerTaggedObject(false, 0, certs)); - } + WriteToGenerator(_sigGen, new BerTaggedObject(false, 0, certs)); + } if (outer._crls.Count > 0) { @@ -851,48 +851,48 @@ namespace Org.BouncyCastle.Cms ? CmsUtilities.CreateDerSetFromList(outer._crls) : CmsUtilities.CreateBerSetFromList(outer._crls); - WriteToGenerator(_sigGen, new BerTaggedObject(false, 1, crls)); - } + WriteToGenerator(_sigGen, new BerTaggedObject(false, 1, crls)); + } - // - // Calculate the digest hashes - // - foreach (DictionaryEntry de in outer._messageDigests) - { - outer._messageHashes.Add(de.Key, DigestUtilities.DoFinal((IDigest)de.Value)); - } + // + // Calculate the digest hashes + // + foreach (DictionaryEntry de in outer._messageDigests) + { + outer._messageHashes.Add(de.Key, DigestUtilities.DoFinal((IDigest)de.Value)); + } - // TODO If the digest OIDs for precalculated signers weren't mixed in with - // the others, we could fill in outer._digests here, instead of SignerInfoGenerator.Generate + // TODO If the digest OIDs for precalculated signers weren't mixed in with + // the others, we could fill in outer._digests here, instead of SignerInfoGenerator.Generate - // - // collect all the SignerInfo objects - // + // + // collect all the SignerInfo objects + // Asn1EncodableVector signerInfos = new Asn1EncodableVector(); - // + // // add the generated SignerInfo objects // - { - foreach (DigestAndSignerInfoGeneratorHolder holder in outer._signerInfs) - { - AlgorithmIdentifier digestAlgorithm = holder.DigestAlgorithm; + { + foreach (DigestAndSignerInfoGeneratorHolder holder in outer._signerInfs) + { + AlgorithmIdentifier digestAlgorithm = holder.DigestAlgorithm; - byte[] calculatedDigest = (byte[])outer._messageHashes[ - Helper.GetDigestAlgName(holder.digestOID)]; - outer._digests[holder.digestOID] = calculatedDigest.Clone(); + byte[] calculatedDigest = (byte[])outer._messageHashes[ + Helper.GetDigestAlgName(holder.digestOID)]; + outer._digests[holder.digestOID] = calculatedDigest.Clone(); - signerInfos.Add(holder.signerInf.Generate(_contentOID, digestAlgorithm, calculatedDigest)); - } - } + signerInfos.Add(holder.signerInf.Generate(_contentOID, digestAlgorithm, calculatedDigest)); + } + } - // + // // add the precalculated SignerInfo objects. // - { - foreach (SignerInformation signer in outer._signers) - { - // TODO Verify the content type and calculated digest match the precalculated SignerInfo + { + foreach (SignerInformation signer in outer._signers) + { + // TODO Verify the content type and calculated digest match the precalculated SignerInfo // if (!signer.ContentType.Equals(_contentOID)) // { // // TODO The precalculated content type did not match - error? @@ -911,11 +911,11 @@ namespace Org.BouncyCastle.Cms // } // } - signerInfos.Add(signer.ToSignerInfo()); - } - } + signerInfos.Add(signer.ToSignerInfo()); + } + } - WriteToGenerator(_sigGen, new DerSet(signerInfos)); + WriteToGenerator(_sigGen, new DerSet(signerInfos)); _sigGen.Close(); _sGen.Close(); diff --git a/crypto/src/crypto/engines/NaccacheSternEngine.cs b/crypto/src/crypto/engines/NaccacheSternEngine.cs index 64665c1d4..fe2d78da6 100644 --- a/crypto/src/crypto/engines/NaccacheSternEngine.cs +++ b/crypto/src/crypto/engines/NaccacheSternEngine.cs @@ -20,7 +20,7 @@ namespace Org.BouncyCastle.Crypto.Engines private IList[] lookup = null; - public string AlgorithmName + public string AlgorithmName { get { return "NaccacheStern"; } } @@ -78,7 +78,7 @@ namespace Org.BouncyCastle.Crypto.Engines set {} } - /** + /** * Returns the input block size of this algorithm. * * @see org.bouncycastle.crypto.AsymmetricBlockCipher#GetInputBlockSize() @@ -261,7 +261,7 @@ namespace Org.BouncyCastle.Crypto.Engines BigInteger m1m2Crypt = m1Crypt.Multiply(m2Crypt); m1m2Crypt = m1m2Crypt.Mod(key.Modulus); - //byte[] output = key.Modulus.ToByteArray(); + //byte[] output = key.Modulus.ToByteArray(); //Array.Clear(output, 0, output.Length); byte[] output = new byte[key.Modulus.BitLength / 8 + 1]; diff --git a/crypto/src/crypto/generators/NaccacheSternKeyPairGenerator.cs b/crypto/src/crypto/generators/NaccacheSternKeyPairGenerator.cs index 618ca9a1c..d68106844 100644 --- a/crypto/src/crypto/generators/NaccacheSternKeyPairGenerator.cs +++ b/crypto/src/crypto/generators/NaccacheSternKeyPairGenerator.cs @@ -52,7 +52,7 @@ namespace Org.BouncyCastle.Crypto.Generators SecureRandom rand = param.Random; int certainty = param.Certainty; - IList smallPrimes = findFirstPrimes(param.CountSmallPrimes); + IList smallPrimes = findFirstPrimes(param.CountSmallPrimes); smallPrimes = permuteList(smallPrimes, rand); @@ -87,7 +87,7 @@ namespace Org.BouncyCastle.Crypto.Generators long tries = 0; - BigInteger _2au = a.Multiply(u).ShiftLeft(1); + BigInteger _2au = a.Multiply(u).ShiftLeft(1); BigInteger _2bv = b.Multiply(v).ShiftLeft(1); for (;;) @@ -132,7 +132,7 @@ namespace Org.BouncyCastle.Crypto.Generators BigInteger g; tries = 0; - for (;;) + for (;;) { // TODO After the first loop, just regenerate one randomly-selected gPart each time? IList gParts = Platform.CreateArrayList(); @@ -205,7 +205,7 @@ namespace Org.BouncyCastle.Crypto.Generators break; } - return new AsymmetricCipherKeyPair(new NaccacheSternKeyParameters(false, g, n, sigma.BitLength), + return new AsymmetricCipherKeyPair(new NaccacheSternKeyParameters(false, g, n, sigma.BitLength), new NaccacheSternPrivateKeyParameters(g, n, sigma.BitLength, smallPrimes, phi_n)); } diff --git a/crypto/src/pkcs/Pkcs12Store.cs b/crypto/src/pkcs/Pkcs12Store.cs index 61240d774..cbfeab93a 100644 --- a/crypto/src/pkcs/Pkcs12Store.cs +++ b/crypto/src/pkcs/Pkcs12Store.cs @@ -21,16 +21,16 @@ namespace Org.BouncyCastle.Pkcs { public const string IgnoreUselessPasswordProperty = "Org.BouncyCastle.Pkcs12.IgnoreUselessPassword"; - private readonly IgnoresCaseHashtable keys = new IgnoresCaseHashtable(); + private readonly IgnoresCaseHashtable keys = new IgnoresCaseHashtable(); private readonly IDictionary localIds = Platform.CreateHashtable(); - private readonly IgnoresCaseHashtable certs = new IgnoresCaseHashtable(); + private readonly IgnoresCaseHashtable certs = new IgnoresCaseHashtable(); private readonly IDictionary chainCerts = Platform.CreateHashtable(); private readonly IDictionary keyCerts = Platform.CreateHashtable(); - private readonly DerObjectIdentifier keyAlgorithm; + private readonly DerObjectIdentifier keyAlgorithm; private readonly DerObjectIdentifier keyPrfAlgorithm; - private readonly DerObjectIdentifier certAlgorithm; + private readonly DerObjectIdentifier certAlgorithm; private readonly DerObjectIdentifier certPrfAlgorithm; - private readonly bool useDerEncoding; + private readonly bool useDerEncoding; private AsymmetricKeyEntry unmarkedKeyEntry = null; @@ -86,9 +86,9 @@ namespace Org.BouncyCastle.Pkcs } internal Pkcs12Store( - DerObjectIdentifier keyAlgorithm, - DerObjectIdentifier certAlgorithm, - bool useDerEncoding) + DerObjectIdentifier keyAlgorithm, + DerObjectIdentifier certAlgorithm, + bool useDerEncoding) { this.keyAlgorithm = keyAlgorithm; this.keyPrfAlgorithm = null; @@ -112,7 +112,7 @@ namespace Org.BouncyCastle.Pkcs } // TODO Consider making obsolete - // [Obsolete("Use 'Pkcs12StoreBuilder' instead")] + // [Obsolete("Use 'Pkcs12StoreBuilder' instead")] public Pkcs12Store() : this(PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc, PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc, false) @@ -120,10 +120,10 @@ namespace Org.BouncyCastle.Pkcs } // TODO Consider making obsolete -// [Obsolete("Use 'Pkcs12StoreBuilder' and 'Load' method instead")] +// [Obsolete("Use 'Pkcs12StoreBuilder' and 'Load' method instead")] public Pkcs12Store( - Stream input, - char[] password) + Stream input, + char[] password) : this() { Load(input, password); @@ -212,8 +212,8 @@ namespace Org.BouncyCastle.Pkcs } public void Load( - Stream input, - char[] password) + Stream input, + char[] password) { if (input == null) throw new ArgumentNullException("input"); @@ -638,8 +638,8 @@ namespace Org.BouncyCastle.Pkcs } public void SetCertificateEntry( - string alias, - X509CertificateEntry certEntry) + string alias, + X509CertificateEntry certEntry) { if (alias == null) throw new ArgumentNullException("alias"); @@ -653,9 +653,9 @@ namespace Org.BouncyCastle.Pkcs } public void SetKeyEntry( - string alias, - AsymmetricKeyEntry keyEntry, - X509CertificateEntry[] chain) + string alias, + AsymmetricKeyEntry keyEntry, + X509CertificateEntry[] chain) { if (alias == null) throw new ArgumentNullException("alias"); @@ -720,8 +720,8 @@ namespace Org.BouncyCastle.Pkcs } public bool IsEntryOfType( - string alias, - Type entryType) + string alias, + Type entryType) { if (entryType == typeof(X509CertificateEntry)) return IsCertificateEntry(alias); @@ -745,9 +745,9 @@ namespace Org.BouncyCastle.Pkcs } public void Save( - Stream stream, - char[] password, - SecureRandom random) + Stream stream, + char[] password, + SecureRandom random) { if (stream == null) throw new ArgumentNullException("stream"); @@ -844,10 +844,10 @@ namespace Org.BouncyCastle.Pkcs random.NextBytes(cSalt); - Asn1EncodableVector certBags = new Asn1EncodableVector(); - Pkcs12PbeParams cParams = new Pkcs12PbeParams(cSalt, MinIterations); - AlgorithmIdentifier cAlgId = new AlgorithmIdentifier(certAlgorithm, cParams.ToAsn1Object()); - ISet doneCerts = new HashSet(); + Asn1EncodableVector certBags = new Asn1EncodableVector(); + Pkcs12PbeParams cParams = new Pkcs12PbeParams(cSalt, MinIterations); + AlgorithmIdentifier cAlgId = new AlgorithmIdentifier(certAlgorithm, cParams.ToAsn1Object()); + ISet doneCerts = new HashSet(); foreach (string name in keys.Keys) { @@ -1044,12 +1044,12 @@ namespace Org.BouncyCastle.Pkcs } internal static byte[] CalculatePbeMac( - DerObjectIdentifier oid, - byte[] salt, - int itCount, - char[] password, - bool wrongPkcs12Zero, - byte[] data) + DerObjectIdentifier oid, + byte[] salt, + int itCount, + char[] password, + bool wrongPkcs12Zero, + byte[] data) { Asn1Encodable asn1Params = PbeUtilities.GenerateAlgorithmParameters( oid, salt, itCount); @@ -1062,11 +1062,11 @@ namespace Org.BouncyCastle.Pkcs } private static byte[] CryptPbeData( - bool forEncryption, - AlgorithmIdentifier algId, - char[] password, - bool wrongPkcs12Zero, - byte[] data) + bool forEncryption, + AlgorithmIdentifier algId, + char[] password, + bool wrongPkcs12Zero, + byte[] data) { IBufferedCipher cipher = PbeUtilities.CreateEngine(algId) as IBufferedCipher; diff --git a/crypto/src/util/zlib/ZDeflaterOutputStream.cs b/crypto/src/util/zlib/ZDeflaterOutputStream.cs index d0f0bcb8d..d0978942a 100644 --- a/crypto/src/util/zlib/ZDeflaterOutputStream.cs +++ b/crypto/src/util/zlib/ZDeflaterOutputStream.cs @@ -135,7 +135,7 @@ namespace Org.BouncyCastle.Utilities.Zlib { z.free(); z=null; } - + #if PORTABLE protected override void Dispose(bool disposing) { diff --git a/crypto/test/src/asn1/test/AdditionalInformationSyntaxUnitTest.cs b/crypto/test/src/asn1/test/AdditionalInformationSyntaxUnitTest.cs index ac4ff9809..b7246193b 100644 --- a/crypto/test/src/asn1/test/AdditionalInformationSyntaxUnitTest.cs +++ b/crypto/test/src/asn1/test/AdditionalInformationSyntaxUnitTest.cs @@ -60,7 +60,7 @@ namespace Org.BouncyCastle.Asn1.Tests checkMandatoryField("information", information, syntax.Information); } - public static void Main( + public static void Main( string[] args) { RunTest(new AdditionalInformationSyntaxUnitTest()); diff --git a/crypto/test/src/asn1/test/AdmissionSyntaxUnitTest.cs b/crypto/test/src/asn1/test/AdmissionSyntaxUnitTest.cs index 59464d212..8d0a1f821 100644 --- a/crypto/test/src/asn1/test/AdmissionSyntaxUnitTest.cs +++ b/crypto/test/src/asn1/test/AdmissionSyntaxUnitTest.cs @@ -82,7 +82,7 @@ namespace Org.BouncyCastle.Asn1.Tests } } - public static void Main( + public static void Main( string[] args) { RunTest(new AdmissionSyntaxUnitTest()); diff --git a/crypto/test/src/asn1/test/EssCertIDv2UnitTest.cs b/crypto/test/src/asn1/test/EssCertIDv2UnitTest.cs index 9aac777e1..8f53c9b3d 100644 --- a/crypto/test/src/asn1/test/EssCertIDv2UnitTest.cs +++ b/crypto/test/src/asn1/test/EssCertIDv2UnitTest.cs @@ -28,7 +28,7 @@ namespace Org.BouncyCastle.Asn1.Tests EssCertIDv2.GetInstance(asn1Object); } - + public static void Main( string[] args) { |