From 5af9e09a87cc120e2f2da4fadc6b04685f96dda0 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Wed, 22 Jun 2022 22:08:13 +0700 Subject: Code cleanup --- crypto/src/asn1/Asn1RelativeOid.cs | 4 +-- crypto/src/asn1/Asn1TaggedObject.cs | 2 +- crypto/src/asn1/DerObjectIdentifier.cs | 6 ++-- crypto/src/asn1/nist/KMACwithSHAKE256_params.cs | 2 +- crypto/src/asn1/x509/GeneralName.cs | 12 +++---- crypto/src/asn1/x9/X9ECParameters.cs | 2 +- crypto/src/cms/CMSSignedDataStreamGenerator.cs | 2 +- crypto/src/crypto/ISignatureFactory.cs | 2 +- crypto/src/crypto/IStreamCalculator.cs | 2 +- crypto/src/crypto/IVerifierFactory.cs | 2 +- crypto/src/crypto/IVerifierFactoryProvider.cs | 2 +- crypto/src/crypto/digests/SkeinDigest.cs | 2 +- crypto/src/crypto/digests/SkeinEngine.cs | 2 +- .../crypto/generators/KDFCounterBytesGenerator.cs | 2 +- .../KDFDoublePipelineIterationBytesGenerator.cs | 2 +- .../crypto/generators/KDFFeedbackBytesGenerator.cs | 4 +-- crypto/src/crypto/generators/OpenBsdBCrypt.cs | 2 +- crypto/src/crypto/generators/SCrypt.cs | 4 +-- crypto/src/crypto/modes/GcmSivBlockCipher.cs | 11 +++--- crypto/src/crypto/modes/KCcmBlockCipher.cs | 4 +-- crypto/src/crypto/operators/Asn1DigestFactory.cs | 2 +- crypto/src/crypto/operators/Asn1Signature.cs | 6 ++-- crypto/src/crypto/parameters/RsaKeyParameters.cs | 4 +-- crypto/src/math/BigInteger.cs | 10 +++--- crypto/src/math/ec/ECCurve.cs | 4 +-- .../src/math/ec/custom/sec/SecT571FieldElement.cs | 2 +- crypto/src/ocsp/CertificateID.cs | 2 +- crypto/src/openpgp/PgpPublicKey.cs | 2 +- crypto/src/openpgp/PgpSecretKey.cs | 2 +- crypto/src/openpgp/SXprUtilities.cs | 2 +- crypto/src/pkcs/Pkcs12Store.cs | 2 +- crypto/src/pkcs/PkcsIOException.cs | 4 +-- crypto/src/pkix/PkixCertPathValidatorResult.cs | 2 +- crypto/src/pkix/PkixCertPathValidatorUtilities.cs | 2 +- crypto/src/pkix/PkixNameConstraintValidator.cs | 10 +++--- .../pkix/PkixNameConstraintValidatorException.cs | 2 +- crypto/src/pkix/PkixParameters.cs | 7 ++-- crypto/src/tls/CertificateStatus.cs | 2 +- crypto/src/tls/DtlsRecordLayer.cs | 2 +- crypto/src/tls/ProtocolName.cs | 2 +- crypto/src/tsp/TSPUtil.cs | 2 +- crypto/src/tsp/TimeStampResponseGenerator.cs | 2 +- crypto/src/tsp/TimeStampTokenGenerator.cs | 2 +- crypto/src/util/Platform.cs | 2 +- crypto/src/util/Strings.cs | 2 +- crypto/src/util/io/pem/PemObject.cs | 2 +- crypto/src/util/io/pem/PemObjectParser.cs | 2 +- crypto/src/util/io/pem/PemReader.cs | 2 +- crypto/src/util/net/IPAddress.cs | 6 ++-- crypto/src/util/zlib/Deflate.cs | 2 +- crypto/src/util/zlib/InfBlocks.cs | 4 +-- crypto/src/util/zlib/JZlib.cs | 11 +++--- crypto/src/util/zlib/ZStream.cs | 2 +- crypto/test/src/asn1/test/ASN1IntegerTest.cs | 4 +-- .../test/AdditionalInformationSyntaxUnitTest.cs | 2 +- .../test/src/asn1/test/AdmissionSyntaxUnitTest.cs | 2 +- crypto/test/src/asn1/test/AdmissionsUnitTest.cs | 2 +- crypto/test/src/asn1/test/CertHashUnitTest.cs | 2 +- crypto/test/src/asn1/test/ContentHintsUnitTest.cs | 2 +- .../src/asn1/test/DeclarationOfMajorityUnitTest.cs | 2 +- crypto/test/src/asn1/test/MonetaryLimitUnitTest.cs | 2 +- .../test/src/asn1/test/NameOrPseudonymUnitTest.cs | 2 +- .../test/src/asn1/test/NamingAuthorityUnitTest.cs | 2 +- crypto/test/src/asn1/test/OIDTest.cs | 2 +- crypto/test/src/asn1/test/OtherCertIDUnitTest.cs | 2 +- .../asn1/test/OtherSigningCertificateUnitTest.cs | 2 +- crypto/test/src/asn1/test/ParsingTest.cs | 4 +-- crypto/test/src/asn1/test/PersonalDataUnitTest.cs | 2 +- .../src/asn1/test/ProcurationSyntaxUnitTest.cs | 2 +- .../test/src/asn1/test/ProfessionInfoUnitTest.cs | 2 +- crypto/test/src/asn1/test/RestrictionUnitTest.cs | 2 +- crypto/test/src/cmp/test/ProtectedMessageTest.cs | 2 +- crypto/test/src/crypto/prng/test/CtrDrbgTest.cs | 2 +- crypto/test/src/crypto/prng/test/DrbgTestVector.cs | 2 +- crypto/test/src/crypto/test/AriaTest.cs | 2 +- crypto/test/src/crypto/test/BCryptTest.cs | 2 +- .../src/crypto/test/GOST3411_2012_256DigestTest.cs | 4 +-- .../src/crypto/test/GOST3411_2012_512DigestTest.cs | 4 +-- crypto/test/src/crypto/test/HCFamilyVecTest.cs | 4 +-- crypto/test/src/crypto/test/KeccakDigestTest.cs | 2 +- crypto/test/src/crypto/test/RipeMD128DigestTest.cs | 2 +- crypto/test/src/crypto/test/SCryptTest.cs | 4 +-- crypto/test/src/crypto/test/SHA3DigestTest.cs | 4 +-- crypto/test/src/crypto/test/SP80038GTest.cs | 41 +++++++++++----------- crypto/test/src/crypto/test/ShakeDigestTest.cs | 4 +-- crypto/test/src/crypto/test/SkeinMacTest.cs | 7 ++-- crypto/test/src/crypto/test/XSalsa20Test.cs | 2 +- crypto/test/src/crypto/test/cavp/CavpReader.cs | 6 ++-- .../test/src/crypto/test/cavp/KDFCounterTests.cs | 2 +- .../src/crypto/test/cavp/KDFDoublePipelineTests.cs | 2 +- .../crypto/test/cavp/KDFFeedbackCounterTests.cs | 2 +- crypto/test/src/math/ec/test/ECPointTest.cs | 2 +- crypto/test/src/math/ec/test/TnafTest.cs | 2 +- .../src/openpgp/examples/DirectKeySignature.cs | 6 ++-- crypto/test/src/openpgp/test/PgpUnicodeTest.cs | 2 +- crypto/test/src/openssl/test/AllTests.cs | 2 +- crypto/test/src/openssl/test/ReaderTest.cs | 2 +- crypto/test/src/pkcs/test/PKCS10Test.cs | 7 ++-- crypto/test/src/test/PkixTest.cs | 2 +- crypto/test/src/test/SP80038GTest.cs | 41 +++++++++++----------- crypto/test/src/tls/test/MockDtlsClient.cs | 2 +- 101 files changed, 193 insertions(+), 198 deletions(-) (limited to 'crypto') diff --git a/crypto/src/asn1/Asn1RelativeOid.cs b/crypto/src/asn1/Asn1RelativeOid.cs index 9c4f917f2..d3c031913 100644 --- a/crypto/src/asn1/Asn1RelativeOid.cs +++ b/crypto/src/asn1/Asn1RelativeOid.cs @@ -59,7 +59,7 @@ namespace Org.BouncyCastle.Asn1 return (Asn1RelativeOid)Meta.Instance.GetContextInstance(taggedObject, declaredExplicit); } - private const long LongLimit = (Int64.MaxValue >> 7) - 0x7F; + private const long LongLimit = (long.MaxValue >> 7) - 0x7F; private readonly string identifier; private byte[] contents; @@ -133,7 +133,7 @@ namespace Org.BouncyCastle.Asn1 string token = tok.NextToken(); if (token.Length <= 18) { - WriteField(bOut, Int64.Parse(token)); + WriteField(bOut, long.Parse(token)); } else { diff --git a/crypto/src/asn1/Asn1TaggedObject.cs b/crypto/src/asn1/Asn1TaggedObject.cs index 82fe0913c..cba199fb3 100644 --- a/crypto/src/asn1/Asn1TaggedObject.cs +++ b/crypto/src/asn1/Asn1TaggedObject.cs @@ -59,7 +59,7 @@ namespace Org.BouncyCastle.Asn1 return taggedObject; } - public static Asn1TaggedObject GetInstance(Object obj, int tagClass, int tagNo) + public static Asn1TaggedObject GetInstance(object obj, int tagClass, int tagNo) { if (obj == null) throw new ArgumentNullException(nameof(obj)); diff --git a/crypto/src/asn1/DerObjectIdentifier.cs b/crypto/src/asn1/DerObjectIdentifier.cs index 8b77f966c..b10f8f8b6 100644 --- a/crypto/src/asn1/DerObjectIdentifier.cs +++ b/crypto/src/asn1/DerObjectIdentifier.cs @@ -76,7 +76,7 @@ namespace Org.BouncyCastle.Asn1 return (DerObjectIdentifier)Meta.Instance.GetContextInstance(taggedObject, declaredExplicit); } - private const long LongLimit = (Int64.MaxValue >> 7) - 0x7F; + private const long LongLimit = (long.MaxValue >> 7) - 0x7F; private static readonly DerObjectIdentifier[] cache = new DerObjectIdentifier[1024]; @@ -165,7 +165,7 @@ namespace Org.BouncyCastle.Asn1 token = tok.NextToken(); if (token.Length <= 18) { - Asn1RelativeOid.WriteField(bOut, first + Int64.Parse(token)); + Asn1RelativeOid.WriteField(bOut, first + long.Parse(token)); } else { @@ -177,7 +177,7 @@ namespace Org.BouncyCastle.Asn1 token = tok.NextToken(); if (token.Length <= 18) { - Asn1RelativeOid.WriteField(bOut, Int64.Parse(token)); + Asn1RelativeOid.WriteField(bOut, long.Parse(token)); } else { diff --git a/crypto/src/asn1/nist/KMACwithSHAKE256_params.cs b/crypto/src/asn1/nist/KMACwithSHAKE256_params.cs index fa7471913..f0560e9da 100644 --- a/crypto/src/asn1/nist/KMACwithSHAKE256_params.cs +++ b/crypto/src/asn1/nist/KMACwithSHAKE256_params.cs @@ -29,7 +29,7 @@ public class KMacWithShake256Params : Asn1Encodable this.customizationString = Arrays.Clone(customizationString); } - public static KMacWithShake256Params GetInstance(Object o) + public static KMacWithShake256Params GetInstance(object o) { if (o is KMacWithShake256Params) { diff --git a/crypto/src/asn1/x509/GeneralName.cs b/crypto/src/asn1/x509/GeneralName.cs index fe00323ee..7b65e3239 100644 --- a/crypto/src/asn1/x509/GeneralName.cs +++ b/crypto/src/asn1/x509/GeneralName.cs @@ -319,7 +319,7 @@ namespace Org.BouncyCastle.Asn1.X509 private void parseIPv4Mask(string mask, byte[] addr, int offset) { - int maskVal = Int32.Parse(mask); + int maskVal = int.Parse(mask); for (int i = 0; i != maskVal; i++) { @@ -331,14 +331,14 @@ namespace Org.BouncyCastle.Asn1.X509 { foreach (string token in ip.Split('.', '/')) { - addr[offset++] = (byte)Int32.Parse(token); + addr[offset++] = (byte)int.Parse(token); } } private int[] parseMask(string mask) { int[] res = new int[8]; - int maskVal = Int32.Parse(mask); + int maskVal = int.Parse(mask); for (int i = 0; i != maskVal; i++) { @@ -387,14 +387,14 @@ namespace Org.BouncyCastle.Asn1.X509 { if (e.IndexOf('.') < 0) { - val[index++] = Int32.Parse(e, NumberStyles.AllowHexSpecifier); + val[index++] = int.Parse(e, NumberStyles.AllowHexSpecifier); } else { string[] tokens = e.Split('.'); - val[index++] = (Int32.Parse(tokens[0]) << 8) | Int32.Parse(tokens[1]); - val[index++] = (Int32.Parse(tokens[2]) << 8) | Int32.Parse(tokens[3]); + val[index++] = (int.Parse(tokens[0]) << 8) | int.Parse(tokens[1]); + val[index++] = (int.Parse(tokens[2]) << 8) | int.Parse(tokens[3]); } } } diff --git a/crypto/src/asn1/x9/X9ECParameters.cs b/crypto/src/asn1/x9/X9ECParameters.cs index c484fc62d..077f74ce4 100644 --- a/crypto/src/asn1/x9/X9ECParameters.cs +++ b/crypto/src/asn1/x9/X9ECParameters.cs @@ -20,7 +20,7 @@ namespace Org.BouncyCastle.Asn1.X9 private BigInteger h; private byte[] seed; - public static X9ECParameters GetInstance(Object obj) + public static X9ECParameters GetInstance(object obj) { if (obj is X9ECParameters) return (X9ECParameters)obj; diff --git a/crypto/src/cms/CMSSignedDataStreamGenerator.cs b/crypto/src/cms/CMSSignedDataStreamGenerator.cs index a6835f279..8e8b996f4 100644 --- a/crypto/src/cms/CMSSignedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSSignedDataStreamGenerator.cs @@ -55,7 +55,7 @@ namespace Org.BouncyCastle.Cms internal readonly ISignerInfoGenerator signerInf; internal readonly string digestOID; - internal DigestAndSignerInfoGeneratorHolder(ISignerInfoGenerator signerInf, String digestOID) + internal DigestAndSignerInfoGeneratorHolder(ISignerInfoGenerator signerInf, string digestOID) { this.signerInf = signerInf; this.digestOID = digestOID; diff --git a/crypto/src/crypto/ISignatureFactory.cs b/crypto/src/crypto/ISignatureFactory.cs index cbca7d1a7..1186d85a6 100644 --- a/crypto/src/crypto/ISignatureFactory.cs +++ b/crypto/src/crypto/ISignatureFactory.cs @@ -8,7 +8,7 @@ namespace Org.BouncyCastle.Crypto public interface ISignatureFactory { /// The algorithm details object for this calculator. - Object AlgorithmDetails { get ; } + object AlgorithmDetails { get ; } /// /// Create a stream calculator for this signature calculator. The stream diff --git a/crypto/src/crypto/IStreamCalculator.cs b/crypto/src/crypto/IStreamCalculator.cs index 19a542845..502b29d2d 100644 --- a/crypto/src/crypto/IStreamCalculator.cs +++ b/crypto/src/crypto/IStreamCalculator.cs @@ -18,6 +18,6 @@ namespace Org.BouncyCastle.Crypto /// has been closed. /// /// The result of processing the stream. - Object GetResult(); + object GetResult(); } } diff --git a/crypto/src/crypto/IVerifierFactory.cs b/crypto/src/crypto/IVerifierFactory.cs index 9502b14a7..707c72111 100644 --- a/crypto/src/crypto/IVerifierFactory.cs +++ b/crypto/src/crypto/IVerifierFactory.cs @@ -8,7 +8,7 @@ namespace Org.BouncyCastle.Crypto public interface IVerifierFactory { /// The algorithm details object for this verifier. - Object AlgorithmDetails { get ; } + object AlgorithmDetails { get ; } /// /// Create a stream calculator for this verifier. The stream diff --git a/crypto/src/crypto/IVerifierFactoryProvider.cs b/crypto/src/crypto/IVerifierFactoryProvider.cs index 9cfcbb2c1..7cd783aaa 100644 --- a/crypto/src/crypto/IVerifierFactoryProvider.cs +++ b/crypto/src/crypto/IVerifierFactoryProvider.cs @@ -12,7 +12,7 @@ namespace Org.BouncyCastle.Crypto /// /// The details of the signature algorithm verification is required for. /// A new signature verifier. - IVerifierFactory CreateVerifierFactory (Object algorithmDetails); + IVerifierFactory CreateVerifierFactory (object algorithmDetails); } } diff --git a/crypto/src/crypto/digests/SkeinDigest.cs b/crypto/src/crypto/digests/SkeinDigest.cs index f826ce503..7fae9c630 100644 --- a/crypto/src/crypto/digests/SkeinDigest.cs +++ b/crypto/src/crypto/digests/SkeinDigest.cs @@ -68,7 +68,7 @@ namespace Org.BouncyCastle.Crypto.Digests return new SkeinDigest(this); } - public String AlgorithmName + public string AlgorithmName { get { return "Skein-" + (engine.BlockSize * 8) + "-" + (engine.OutputSize * 8); } } diff --git a/crypto/src/crypto/digests/SkeinEngine.cs b/crypto/src/crypto/digests/SkeinEngine.cs index cfedfadf3..e93ec601c 100644 --- a/crypto/src/crypto/digests/SkeinEngine.cs +++ b/crypto/src/crypto/digests/SkeinEngine.cs @@ -226,7 +226,7 @@ namespace Org.BouncyCastle.Crypto.Digests /** * Point at which position might overflow long, so switch to add with carry logic */ - private const ulong LOW_RANGE = UInt64.MaxValue - UInt32.MaxValue; + private const ulong LOW_RANGE = ulong.MaxValue - uint.MaxValue; /** * Bit 127 = final diff --git a/crypto/src/crypto/generators/KDFCounterBytesGenerator.cs b/crypto/src/crypto/generators/KDFCounterBytesGenerator.cs index 9c2b2fdd8..0d7647289 100644 --- a/crypto/src/crypto/generators/KDFCounterBytesGenerator.cs +++ b/crypto/src/crypto/generators/KDFCounterBytesGenerator.cs @@ -59,7 +59,7 @@ namespace Org.BouncyCastle.Crypto.Generators BigInteger maxSize = Two.Pow(r).Multiply(BigInteger.ValueOf(h)); this.maxSizeExcl = maxSize.CompareTo(IntegerMax) == 1 ? - Int32.MaxValue : maxSize.IntValue; + int.MaxValue : maxSize.IntValue; // --- set operational state --- diff --git a/crypto/src/crypto/generators/KDFDoublePipelineIterationBytesGenerator.cs b/crypto/src/crypto/generators/KDFDoublePipelineIterationBytesGenerator.cs index 9010ae2cb..63c0787f3 100644 --- a/crypto/src/crypto/generators/KDFDoublePipelineIterationBytesGenerator.cs +++ b/crypto/src/crypto/generators/KDFDoublePipelineIterationBytesGenerator.cs @@ -64,7 +64,7 @@ namespace Org.BouncyCastle.Crypto.Generators // this is more conservative than the spec BigInteger maxSize = Two.Pow(r).Multiply(BigInteger.ValueOf(h)); this.maxSizeExcl = maxSize.CompareTo(IntegerMax) == 1 ? - Int32.MaxValue : maxSize.IntValue; + int.MaxValue : maxSize.IntValue; } else { diff --git a/crypto/src/crypto/generators/KDFFeedbackBytesGenerator.cs b/crypto/src/crypto/generators/KDFFeedbackBytesGenerator.cs index 19ce0ea2e..11a5552fe 100644 --- a/crypto/src/crypto/generators/KDFFeedbackBytesGenerator.cs +++ b/crypto/src/crypto/generators/KDFFeedbackBytesGenerator.cs @@ -64,11 +64,11 @@ namespace Org.BouncyCastle.Crypto.Generators // this is more conservative than the spec BigInteger maxSize = Two.Pow(r).Multiply(BigInteger.ValueOf(h)); this.maxSizeExcl = maxSize.CompareTo(IntegerMax) == 1 ? - Int32.MaxValue : maxSize.IntValue; + int.MaxValue : maxSize.IntValue; } else { - this.maxSizeExcl = Int32.MaxValue; + this.maxSizeExcl = int.MaxValue; } this.iv = feedbackParams.Iv; diff --git a/crypto/src/crypto/generators/OpenBsdBCrypt.cs b/crypto/src/crypto/generators/OpenBsdBCrypt.cs index da6e2b952..d019731d6 100644 --- a/crypto/src/crypto/generators/OpenBsdBCrypt.cs +++ b/crypto/src/crypto/generators/OpenBsdBCrypt.cs @@ -170,7 +170,7 @@ namespace Org.BouncyCastle.Crypto.Generators int cost = 0; try { - cost = Int32.Parse(bcryptString.Substring(4, 2)); + cost = int.Parse(bcryptString.Substring(4, 2)); } catch (Exception nfe) { diff --git a/crypto/src/crypto/generators/SCrypt.cs b/crypto/src/crypto/generators/SCrypt.cs index 0753820c9..0c51d89bc 100644 --- a/crypto/src/crypto/generators/SCrypt.cs +++ b/crypto/src/crypto/generators/SCrypt.cs @@ -23,7 +23,7 @@ namespace Org.BouncyCastle.Crypto.Generators /// 2^(128 * r / 8). /// the block size, must be >= 1. /// Parallelization parameter. Must be a positive integer less than or equal to - /// Int32.MaxValue / (128 * r * 8). + /// int.MaxValue / (128 * r * 8). /// the length of the key to generate. /// the generated key. public static byte[] Generate(byte[] P, byte[] S, int N, int r, int p, int dkLen) @@ -39,7 +39,7 @@ namespace Org.BouncyCastle.Crypto.Generators throw new ArgumentException("Cost parameter N must be > 1 and < 65536."); if (r < 1) throw new ArgumentException("Block size r must be >= 1."); - int maxParallel = Int32.MaxValue / (128 * r * 8); + int maxParallel = int.MaxValue / (128 * r * 8); if (p < 1 || p > maxParallel) { throw new ArgumentException("Parallelisation parameter p must be >= 1 and <= " + maxParallel diff --git a/crypto/src/crypto/modes/GcmSivBlockCipher.cs b/crypto/src/crypto/modes/GcmSivBlockCipher.cs index 9615931ab..23e9ca257 100644 --- a/crypto/src/crypto/modes/GcmSivBlockCipher.cs +++ b/crypto/src/crypto/modes/GcmSivBlockCipher.cs @@ -37,17 +37,17 @@ namespace Org.BouncyCastle.Crypto.Modes * The maximum data length (AEAD/PlainText). Due to implementation constraints this is restricted to the maximum * array length (https://programming.guide/java/array-maximum-length.html) minus the BUFLEN to allow for the MAC */ - private static readonly int MAX_DATALEN = Int32.MaxValue - 8 - BUFLEN; + private static readonly int MAX_DATALEN = int.MaxValue - 8 - BUFLEN; /** * The top bit mask. */ - private static readonly byte MASK = (byte)0x80; + private static readonly byte MASK = 0x80; /** * The addition constant. */ - private static readonly byte ADD = (byte)0xE1; + private static readonly byte ADD = 0xE1; /** * The initialisation flag. @@ -246,7 +246,7 @@ namespace Org.BouncyCastle.Crypto.Modes } /* Make sure that we haven't breached AEAD data limit */ - if ((long)theAEADHasher.getBytesProcessed() + Int64.MinValue > (MAX_DATALEN - pLen) + Int64.MinValue) + if ((long)theAEADHasher.getBytesProcessed() + long.MinValue > (MAX_DATALEN - pLen) + long.MinValue) { throw new InvalidOperationException("AEAD byte count exceeded"); } @@ -279,8 +279,7 @@ namespace Org.BouncyCastle.Crypto.Modes dataLimit += BUFLEN; currBytes = theEncData.Length; } - if (currBytes + System.Int64.MinValue - > (dataLimit - pLen) + System.Int64.MinValue) + if (currBytes + long.MinValue > (dataLimit - pLen) + long.MinValue) { throw new InvalidOperationException("byte count exceeded"); } diff --git a/crypto/src/crypto/modes/KCcmBlockCipher.cs b/crypto/src/crypto/modes/KCcmBlockCipher.cs index 4f7821452..e56b8897d 100644 --- a/crypto/src/crypto/modes/KCcmBlockCipher.cs +++ b/crypto/src/crypto/modes/KCcmBlockCipher.cs @@ -130,7 +130,7 @@ namespace Org.BouncyCastle.Crypto.Modes } } - public virtual String AlgorithmName + public virtual string AlgorithmName { get { @@ -476,7 +476,7 @@ namespace Org.BouncyCastle.Crypto.Modes break; } - String binaryNb = Convert.ToString(Nb_ - 1, 2); + string binaryNb = Convert.ToString(Nb_ - 1, 2); while (binaryNb.Length < 4) { binaryNb = new StringBuilder(binaryNb).Insert(0, "0").ToString(); diff --git a/crypto/src/crypto/operators/Asn1DigestFactory.cs b/crypto/src/crypto/operators/Asn1DigestFactory.cs index 91fb46c51..16bd33fdf 100644 --- a/crypto/src/crypto/operators/Asn1DigestFactory.cs +++ b/crypto/src/crypto/operators/Asn1DigestFactory.cs @@ -15,7 +15,7 @@ namespace Org.BouncyCastle.Crypto.Operators return new Asn1DigestFactory(DigestUtilities.GetDigest(oid), oid); } - public static Asn1DigestFactory Get(String mechanism) + public static Asn1DigestFactory Get(string mechanism) { DerObjectIdentifier oid = DigestUtilities.GetObjectIdentifier(mechanism); return new Asn1DigestFactory(DigestUtilities.GetDigest(oid), oid); diff --git a/crypto/src/crypto/operators/Asn1Signature.cs b/crypto/src/crypto/operators/Asn1Signature.cs index 965f8e7f1..a61b6793d 100644 --- a/crypto/src/crypto/operators/Asn1Signature.cs +++ b/crypto/src/crypto/operators/Asn1Signature.cs @@ -319,7 +319,7 @@ namespace Org.BouncyCastle.Crypto.Operators this.algID = X509Utilities.GetSigAlgID(sigOid, algorithm); } - public Object AlgorithmDetails + public object AlgorithmDetails { get { return this.algID; } } @@ -376,7 +376,7 @@ namespace Org.BouncyCastle.Crypto.Operators this.algID = algorithm; } - public Object AlgorithmDetails + public object AlgorithmDetails { get { return this.algID; } } @@ -406,7 +406,7 @@ namespace Org.BouncyCastle.Crypto.Operators this.publicKey = publicKey; } - public IVerifierFactory CreateVerifierFactory(Object algorithmDetails) + public IVerifierFactory CreateVerifierFactory(object algorithmDetails) { return new Asn1VerifierFactory((AlgorithmIdentifier)algorithmDetails, publicKey); } diff --git a/crypto/src/crypto/parameters/RsaKeyParameters.cs b/crypto/src/crypto/parameters/RsaKeyParameters.cs index 4f8dba680..dbee49045 100644 --- a/crypto/src/crypto/parameters/RsaKeyParameters.cs +++ b/crypto/src/crypto/parameters/RsaKeyParameters.cs @@ -93,14 +93,14 @@ namespace Org.BouncyCastle.Crypto.Parameters internal static int AsInteger(string envVariable, int defaultValue) { - String v = Platform.GetEnvironmentVariable(envVariable); + string v = Platform.GetEnvironmentVariable(envVariable); if (v == null) { return defaultValue; } - return Int32.Parse(v); + return int.Parse(v); } } } diff --git a/crypto/src/math/BigInteger.cs b/crypto/src/math/BigInteger.cs index 96d74870d..c6e760db9 100644 --- a/crypto/src/math/BigInteger.cs +++ b/crypto/src/math/BigInteger.cs @@ -188,7 +188,7 @@ namespace Org.BouncyCastle.Math * They are calculated according to the expected savings in multiplications. * Some squares will also be saved on average, but we offset these against the extra storage costs. */ - private static readonly int[] ExpWindowThresholds = { 7, 25, 81, 241, 673, 1793, 4609, Int32.MaxValue }; + private static readonly int[] ExpWindowThresholds = { 7, 25, 81, 241, 673, 1793, 4609, int.MaxValue }; private const int BitsPerByte = 8; private const int BitsPerInt = 32; @@ -361,7 +361,7 @@ namespace Org.BouncyCastle.Math } // strip leading zeros from the string str - while (index < str.Length && Int32.Parse(str[index].ToString(), style) == 0) + while (index < str.Length && int.Parse(str[index].ToString(), style) == 0) { index++; } @@ -473,7 +473,7 @@ namespace Org.BouncyCastle.Math // { // char c = value[index]; // string s = c.ToString(); -// int i = Int32.Parse(s, style); +// int i = int.Parse(s, style); // // b = b.Multiply(r).Add(ValueOf(i)); // index++; @@ -2570,7 +2570,7 @@ namespace Org.BouncyCastle.Math if (QuickPow2Check()) { long powOf2 = (long)exp * (BitLength - 1); - if (powOf2 > Int32.MaxValue) + if (powOf2 > int.MaxValue) { throw new ArithmeticException("Result too large"); } @@ -2788,7 +2788,7 @@ namespace Org.BouncyCastle.Math int excessBits = (numWords << 5) - n; if (excessBits > 0) { - result[0] &= (int)(UInt32.MaxValue >> excessBits); + result[0] &= (int)(uint.MaxValue >> excessBits); } return result; diff --git a/crypto/src/math/ec/ECCurve.cs b/crypto/src/math/ec/ECCurve.cs index 52d634cd2..838e407e3 100644 --- a/crypto/src/math/ec/ECCurve.cs +++ b/crypto/src/math/ec/ECCurve.cs @@ -843,14 +843,14 @@ namespace Org.BouncyCastle.Math.EC int AsInteger(string envVariable, int defaultValue) { - String v = Platform.GetEnvironmentVariable(envVariable); + string v = Platform.GetEnvironmentVariable(envVariable); if (v == null) { return defaultValue; } - return Int32.Parse(v); + return int.Parse(v); } } diff --git a/crypto/src/math/ec/custom/sec/SecT571FieldElement.cs b/crypto/src/math/ec/custom/sec/SecT571FieldElement.cs index 22edfe0a2..b9c581860 100644 --- a/crypto/src/math/ec/custom/sec/SecT571FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecT571FieldElement.cs @@ -48,7 +48,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return Nat576.ToBigInteger64(x); } - public override String FieldName + public override string FieldName { get { return "SecT571Field"; } } diff --git a/crypto/src/ocsp/CertificateID.cs b/crypto/src/ocsp/CertificateID.cs index ec902d5c3..215857ae9 100644 --- a/crypto/src/ocsp/CertificateID.cs +++ b/crypto/src/ocsp/CertificateID.cs @@ -118,7 +118,7 @@ namespace Org.BouncyCastle.Ocsp { try { - String hashAlgorithm = hashAlg.Algorithm.Id; + string hashAlgorithm = hashAlg.Algorithm.Id; X509Name issuerName = PrincipalUtilities.GetSubjectX509Principal(issuerCert); byte[] issuerNameHash = DigestUtilities.CalculateDigest( diff --git a/crypto/src/openpgp/PgpPublicKey.cs b/crypto/src/openpgp/PgpPublicKey.cs index f9e8c31f4..82f2d7cbc 100644 --- a/crypto/src/openpgp/PgpPublicKey.cs +++ b/crypto/src/openpgp/PgpPublicKey.cs @@ -966,7 +966,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp } else { - foreach (String id in key.GetUserIds()) + foreach (string id in key.GetUserIds()) { foreach (object sig in key.GetSignaturesForId(id)) { diff --git a/crypto/src/openpgp/PgpSecretKey.cs b/crypto/src/openpgp/PgpSecretKey.cs index 2462db4e4..856f4ad14 100644 --- a/crypto/src/openpgp/PgpSecretKey.cs +++ b/crypto/src/openpgp/PgpSecretKey.cs @@ -1277,7 +1277,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp SXprUtilities.SkipOpenParenthesis(keyIn); SXprUtilities.SkipOpenParenthesis(keyIn); SXprUtilities.SkipOpenParenthesis(keyIn); - String name = SXprUtilities.ReadString(keyIn, keyIn.ReadByte()); + string name = SXprUtilities.ReadString(keyIn, keyIn.ReadByte()); return SXprUtilities.ReadBytes(keyIn, keyIn.ReadByte()); } } diff --git a/crypto/src/openpgp/SXprUtilities.cs b/crypto/src/openpgp/SXprUtilities.cs index 68ff373a8..d7969813f 100644 --- a/crypto/src/openpgp/SXprUtilities.cs +++ b/crypto/src/openpgp/SXprUtilities.cs @@ -61,7 +61,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp string alg = ReadString(input, input.ReadByte()); byte[] iv = ReadBytes(input, input.ReadByte()); - long iterationCount = Int64.Parse(ReadString(input, input.ReadByte())); + long iterationCount = long.Parse(ReadString(input, input.ReadByte())); SkipCloseParenthesis(input); diff --git a/crypto/src/pkcs/Pkcs12Store.cs b/crypto/src/pkcs/Pkcs12Store.cs index d09b8828f..7553088a2 100644 --- a/crypto/src/pkcs/Pkcs12Store.cs +++ b/crypto/src/pkcs/Pkcs12Store.cs @@ -328,7 +328,7 @@ namespace Org.BouncyCastle.Pkcs // we've found more than one - one might be incorrect if (aOid.Equals(PkcsObjectIdentifiers.Pkcs9AtLocalKeyID)) { - String id = Hex.ToHexString(Asn1OctetString.GetInstance(attr).GetOctets()); + string id = Hex.ToHexString(Asn1OctetString.GetInstance(attr).GetOctets()); if (!(keys[id] != null || localIds[id] != null)) { continue; // ignore this one - it's not valid diff --git a/crypto/src/pkcs/PkcsIOException.cs b/crypto/src/pkcs/PkcsIOException.cs index 19f17a394..889b0fcb0 100644 --- a/crypto/src/pkcs/PkcsIOException.cs +++ b/crypto/src/pkcs/PkcsIOException.cs @@ -8,11 +8,11 @@ namespace Org.BouncyCastle.Pkcs /// public class PkcsIOException: IOException { - public PkcsIOException(String message) : base(message) + public PkcsIOException(string message) : base(message) { } - public PkcsIOException(String message, Exception underlying) : base(message, underlying) + public PkcsIOException(string message, Exception underlying) : base(message, underlying) { } } diff --git a/crypto/src/pkix/PkixCertPathValidatorResult.cs b/crypto/src/pkix/PkixCertPathValidatorResult.cs index c7d81c7f5..e316128b0 100644 --- a/crypto/src/pkix/PkixCertPathValidatorResult.cs +++ b/crypto/src/pkix/PkixCertPathValidatorResult.cs @@ -55,7 +55,7 @@ namespace Org.BouncyCastle.Pkix return new PkixCertPathValidatorResult(this.TrustAnchor, this.PolicyTree, this.SubjectPublicKey); } - public override String ToString() + public override string ToString() { StringBuilder sB = new StringBuilder(); sB.Append("PKIXCertPathValidatorResult: [ \n"); diff --git a/crypto/src/pkix/PkixCertPathValidatorUtilities.cs b/crypto/src/pkix/PkixCertPathValidatorUtilities.cs index 57dfcd6ed..86f9f4beb 100644 --- a/crypto/src/pkix/PkixCertPathValidatorUtilities.cs +++ b/crypto/src/pkix/PkixCertPathValidatorUtilities.cs @@ -508,7 +508,7 @@ namespace Org.BouncyCastle.Pkix internal static void GetCertStatus( DateTime validDate, X509Crl crl, - Object cert, + object cert, CertStatus certStatus) { X509Crl bcCRL = null; diff --git a/crypto/src/pkix/PkixNameConstraintValidator.cs b/crypto/src/pkix/PkixNameConstraintValidator.cs index 5b032152a..28e8f36ba 100644 --- a/crypto/src/pkix/PkixNameConstraintValidator.cs +++ b/crypto/src/pkix/PkixNameConstraintValidator.cs @@ -1714,7 +1714,7 @@ namespace Org.BouncyCastle.Pkix return 0; int hash = 0; - foreach (Object o in c) + foreach (object o in c) { if (o is byte[]) { @@ -1728,7 +1728,7 @@ namespace Org.BouncyCastle.Pkix return hash; } - public override bool Equals(Object o) + public override bool Equals(object o) { if (!(o is PkixNameConstraintValidator)) return false; @@ -1756,10 +1756,10 @@ namespace Org.BouncyCastle.Pkix if (coll1 == null || coll2 == null || coll1.Count != coll2.Count) return false; - foreach (Object a in coll1) + foreach (object a in coll1) { bool found = false; - foreach (Object b in coll2) + foreach (object b in coll2) { if (SpecialEquals(a, b)) { @@ -1774,7 +1774,7 @@ namespace Org.BouncyCastle.Pkix return true; } - private bool SpecialEquals(Object o1, Object o2) + private bool SpecialEquals(object o1, object o2) { if (o1 == o2) { diff --git a/crypto/src/pkix/PkixNameConstraintValidatorException.cs b/crypto/src/pkix/PkixNameConstraintValidatorException.cs index b6a05246f..d0882ca96 100644 --- a/crypto/src/pkix/PkixNameConstraintValidatorException.cs +++ b/crypto/src/pkix/PkixNameConstraintValidatorException.cs @@ -8,7 +8,7 @@ namespace Org.BouncyCastle.Pkix public class PkixNameConstraintValidatorException : Exception { - public PkixNameConstraintValidatorException(String msg) + public PkixNameConstraintValidatorException(string msg) : base(msg) { } diff --git a/crypto/src/pkix/PkixParameters.cs b/crypto/src/pkix/PkixParameters.cs index 01ed9d4fa..54b077f29 100644 --- a/crypto/src/pkix/PkixParameters.cs +++ b/crypto/src/pkix/PkixParameters.cs @@ -833,11 +833,8 @@ namespace Org.BouncyCastle.Pkix { foreach (object obj in prohibitedACAttributes) { - if (!(obj is String)) - { - throw new InvalidCastException("All elements of set must be " - + "of type string."); - } + if (!(obj is string)) + throw new InvalidCastException("All elements of set must be of type string."); } this.prohibitedACAttributes = new HashSet(prohibitedACAttributes); } diff --git a/crypto/src/tls/CertificateStatus.cs b/crypto/src/tls/CertificateStatus.cs index cbf5600f6..11c4d4571 100644 --- a/crypto/src/tls/CertificateStatus.cs +++ b/crypto/src/tls/CertificateStatus.cs @@ -176,7 +176,7 @@ namespace Org.BouncyCastle.Tls return new CertificateStatus(status_type, response); } - private static bool IsCorrectType(short statusType, Object response) + private static bool IsCorrectType(short statusType, object response) { switch (statusType) { diff --git a/crypto/src/tls/DtlsRecordLayer.cs b/crypto/src/tls/DtlsRecordLayer.cs index ffc071967..b93253146 100644 --- a/crypto/src/tls/DtlsRecordLayer.cs +++ b/crypto/src/tls/DtlsRecordLayer.cs @@ -396,7 +396,7 @@ namespace Org.BouncyCastle.Tls } /// - internal virtual void Warn(short alertDescription, String message) + internal virtual void Warn(short alertDescription, string message) { RaiseAlert(AlertLevel.warning, alertDescription, message, null); } diff --git a/crypto/src/tls/ProtocolName.cs b/crypto/src/tls/ProtocolName.cs index 8a850209f..eec5f6f45 100644 --- a/crypto/src/tls/ProtocolName.cs +++ b/crypto/src/tls/ProtocolName.cs @@ -13,7 +13,7 @@ namespace Org.BouncyCastle.Tls return new ProtocolName(Arrays.Clone(bytes)); } - public static ProtocolName AsUtf8Encoding(String name) + public static ProtocolName AsUtf8Encoding(string name) { return new ProtocolName(Strings.ToUtf8ByteArray(name)); } diff --git a/crypto/src/tsp/TSPUtil.cs b/crypto/src/tsp/TSPUtil.cs index a17657472..34ff53b60 100644 --- a/crypto/src/tsp/TSPUtil.cs +++ b/crypto/src/tsp/TSPUtil.cs @@ -179,7 +179,7 @@ namespace Org.BouncyCastle.Tsp } internal static IDigest CreateDigestInstance( - String digestAlgOID) + string digestAlgOID) { string digestName = GetDigestAlgName(digestAlgOID); diff --git a/crypto/src/tsp/TimeStampResponseGenerator.cs b/crypto/src/tsp/TimeStampResponseGenerator.cs index 69a5c098b..a88320027 100644 --- a/crypto/src/tsp/TimeStampResponseGenerator.cs +++ b/crypto/src/tsp/TimeStampResponseGenerator.cs @@ -169,7 +169,7 @@ namespace Org.BouncyCastle.Tsp TimeStampRequest request, BigInteger serialNumber, DateTimeObject genTime, - String statusString, + string statusString, X509Extensions additionalExtensions) { TimeStampResp resp; diff --git a/crypto/src/tsp/TimeStampTokenGenerator.cs b/crypto/src/tsp/TimeStampTokenGenerator.cs index 55142a5e9..ff85fe46e 100644 --- a/crypto/src/tsp/TimeStampTokenGenerator.cs +++ b/crypto/src/tsp/TimeStampTokenGenerator.cs @@ -398,7 +398,7 @@ namespace Org.BouncyCastle.Tsp private string createGeneralizedTime(DateTime genTime) { - String format = "yyyyMMddHHmmss.fff"; + string format = "yyyyMMddHHmmss.fff"; StringBuilder sBuild = new StringBuilder(genTime.ToString(format)); int dotIndex = sBuild.ToString().IndexOf("."); diff --git a/crypto/src/util/Platform.cs b/crypto/src/util/Platform.cs index 106362d34..cb96adc8b 100644 --- a/crypto/src/util/Platform.cs +++ b/crypto/src/util/Platform.cs @@ -18,7 +18,7 @@ namespace Org.BouncyCastle.Utilities internal static bool EqualsIgnoreCase(string a, string b) { #if PORTABLE - return String.Equals(a, b, StringComparison.OrdinalIgnoreCase); + return string.Equals(a, b, StringComparison.OrdinalIgnoreCase); #else return ToUpperInvariant(a) == ToUpperInvariant(b); #endif diff --git a/crypto/src/util/Strings.cs b/crypto/src/util/Strings.cs index 83d1f13fb..1a94d2bff 100644 --- a/crypto/src/util/Strings.cs +++ b/crypto/src/util/Strings.cs @@ -24,7 +24,7 @@ namespace Org.BouncyCastle.Utilities if (changed) { - return new String(chars); + return new string(chars); } return original; diff --git a/crypto/src/util/io/pem/PemObject.cs b/crypto/src/util/io/pem/PemObject.cs index 41212f997..fce429f39 100644 --- a/crypto/src/util/io/pem/PemObject.cs +++ b/crypto/src/util/io/pem/PemObject.cs @@ -17,7 +17,7 @@ namespace Org.BouncyCastle.Utilities.IO.Pem { } - public PemObject(String type, IList headers, byte[] content) + public PemObject(string type, IList headers, byte[] content) { this.type = type; this.headers = Platform.CreateArrayList(headers); diff --git a/crypto/src/util/io/pem/PemObjectParser.cs b/crypto/src/util/io/pem/PemObjectParser.cs index 91d26dc3a..928483d2a 100644 --- a/crypto/src/util/io/pem/PemObjectParser.cs +++ b/crypto/src/util/io/pem/PemObjectParser.cs @@ -9,7 +9,7 @@ namespace Org.BouncyCastle.Utilities.IO.Pem /// A /// /// - /// A + /// An /// /// object ParseObject(PemObject obj); diff --git a/crypto/src/util/io/pem/PemReader.cs b/crypto/src/util/io/pem/PemReader.cs index 008a03524..a32ca8181 100644 --- a/crypto/src/util/io/pem/PemReader.cs +++ b/crypto/src/util/io/pem/PemReader.cs @@ -292,7 +292,7 @@ namespace Org.BouncyCastle.Utilities.IO.Pem /// expected string /// false if not consumed - private bool expect(String value) + private bool expect(string value) { for (int t=0; t 255) return false; @@ -106,7 +106,7 @@ namespace Org.BouncyCastle.Utilities.Net string component, int size) { - int val = Int32.Parse(component); + int val = int.Parse(component); try { return val >= 0 && val <= size; @@ -173,7 +173,7 @@ namespace Org.BouncyCastle.Utilities.Net else { string octetStr = temp.Substring(start, pos - start); - int octet = Int32.Parse(octetStr, NumberStyles.AllowHexSpecifier); + int octet = int.Parse(octetStr, NumberStyles.AllowHexSpecifier); if (octet < 0 || octet > 0xffff) return false; diff --git a/crypto/src/util/zlib/Deflate.cs b/crypto/src/util/zlib/Deflate.cs index 90f8eb09c..ccd771eaa 100644 --- a/crypto/src/util/zlib/Deflate.cs +++ b/crypto/src/util/zlib/Deflate.cs @@ -82,7 +82,7 @@ namespace Org.BouncyCastle.Utilities.Zlib { config_table[9]=new Config(32, 258, 258, 4096, SLOW); } - private static readonly String[] z_errmsg = { + private static readonly string[] z_errmsg = { "need dictionary", // Z_NEED_DICT 2 "stream end", // Z_STREAM_END 1 "", // Z_OK 0 diff --git a/crypto/src/util/zlib/InfBlocks.cs b/crypto/src/util/zlib/InfBlocks.cs index 479d9b5c9..9e18e3f60 100644 --- a/crypto/src/util/zlib/InfBlocks.cs +++ b/crypto/src/util/zlib/InfBlocks.cs @@ -95,12 +95,12 @@ namespace Org.BouncyCastle.Utilities.Zlib { internal int end; // one byte after sliding window internal int read; // window read pointer internal int write; // window write pointer - internal Object checkfn; // check function + internal object checkfn; // check function internal long check; // check on output internal InfTree inftree=new InfTree(); - internal InfBlocks(ZStream z, Object checkfn, int w){ + internal InfBlocks(ZStream z, object checkfn, int w){ hufts=new int[MANY*3]; window=new byte[w]; end=w; diff --git a/crypto/src/util/zlib/JZlib.cs b/crypto/src/util/zlib/JZlib.cs index 4f2cfdaa9..d4a9cbf04 100644 --- a/crypto/src/util/zlib/JZlib.cs +++ b/crypto/src/util/zlib/JZlib.cs @@ -34,11 +34,12 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * and contributors of zlib. */ -namespace Org.BouncyCastle.Utilities.Zlib { - - public sealed class JZlib{ - private const String _version="1.0.7"; - public static String version() +namespace Org.BouncyCastle.Utilities.Zlib +{ + public sealed class JZlib + { + private const string _version="1.0.7"; + public static string version() { return _version; } diff --git a/crypto/src/util/zlib/ZStream.cs b/crypto/src/util/zlib/ZStream.cs index 7ff961462..9378bf78f 100644 --- a/crypto/src/util/zlib/ZStream.cs +++ b/crypto/src/util/zlib/ZStream.cs @@ -69,7 +69,7 @@ namespace Org.BouncyCastle.Utilities.Zlib { public int avail_out; // remaining free space at next_out public long total_out; // total nb of bytes output so far - public String msg; + public string msg; internal Deflate dstate; internal Inflate istate; diff --git a/crypto/test/src/asn1/test/ASN1IntegerTest.cs b/crypto/test/src/asn1/test/ASN1IntegerTest.cs index 0e37a7e10..c11a099bf 100644 --- a/crypto/test/src/asn1/test/ASN1IntegerTest.cs +++ b/crypto/test/src/asn1/test/ASN1IntegerTest.cs @@ -339,12 +339,12 @@ namespace Org.BouncyCastle.Asn1.Tests CheckArgumentException(e, "malformed integer"); } } - private void CheckArgumentException(ArgumentException e, String expectedMessage) + private void CheckArgumentException(ArgumentException e, string expectedMessage) { IsTrue(e.Message.StartsWith(expectedMessage)); } - private void CheckArgumentException(String errorText, ArgumentException e, String expectedMessage) + private void CheckArgumentException(string errorText, ArgumentException e, string expectedMessage) { IsTrue(errorText, e.Message.StartsWith(expectedMessage)); } diff --git a/crypto/test/src/asn1/test/AdditionalInformationSyntaxUnitTest.cs b/crypto/test/src/asn1/test/AdditionalInformationSyntaxUnitTest.cs index b7246193b..7e92fc02f 100644 --- a/crypto/test/src/asn1/test/AdditionalInformationSyntaxUnitTest.cs +++ b/crypto/test/src/asn1/test/AdditionalInformationSyntaxUnitTest.cs @@ -24,7 +24,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - AdditionalInformationSyntax.GetInstance(new Object()); + AdditionalInformationSyntax.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/AdmissionSyntaxUnitTest.cs b/crypto/test/src/asn1/test/AdmissionSyntaxUnitTest.cs index 8d0a1f821..0a454f6a9 100644 --- a/crypto/test/src/asn1/test/AdmissionSyntaxUnitTest.cs +++ b/crypto/test/src/asn1/test/AdmissionSyntaxUnitTest.cs @@ -37,7 +37,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - AdmissionSyntax.GetInstance(new Object()); + AdmissionSyntax.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/AdmissionsUnitTest.cs b/crypto/test/src/asn1/test/AdmissionsUnitTest.cs index edefeb830..8d65258ee 100644 --- a/crypto/test/src/asn1/test/AdmissionsUnitTest.cs +++ b/crypto/test/src/asn1/test/AdmissionsUnitTest.cs @@ -34,7 +34,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - Admissions.GetInstance(new Object()); + Admissions.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/CertHashUnitTest.cs b/crypto/test/src/asn1/test/CertHashUnitTest.cs index 1e271a9c0..d3311a9ad 100644 --- a/crypto/test/src/asn1/test/CertHashUnitTest.cs +++ b/crypto/test/src/asn1/test/CertHashUnitTest.cs @@ -36,7 +36,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - CertHash.GetInstance(new Object()); + CertHash.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/ContentHintsUnitTest.cs b/crypto/test/src/asn1/test/ContentHintsUnitTest.cs index d7453c27e..7d96fc5c4 100644 --- a/crypto/test/src/asn1/test/ContentHintsUnitTest.cs +++ b/crypto/test/src/asn1/test/ContentHintsUnitTest.cs @@ -37,7 +37,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - ContentHints.GetInstance(new Object()); + ContentHints.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/DeclarationOfMajorityUnitTest.cs b/crypto/test/src/asn1/test/DeclarationOfMajorityUnitTest.cs index f9eef4f47..a7cf28798 100644 --- a/crypto/test/src/asn1/test/DeclarationOfMajorityUnitTest.cs +++ b/crypto/test/src/asn1/test/DeclarationOfMajorityUnitTest.cs @@ -35,7 +35,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - DeclarationOfMajority.GetInstance(new Object()); + DeclarationOfMajority.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/MonetaryLimitUnitTest.cs b/crypto/test/src/asn1/test/MonetaryLimitUnitTest.cs index cdeb2eca5..01f3b564d 100644 --- a/crypto/test/src/asn1/test/MonetaryLimitUnitTest.cs +++ b/crypto/test/src/asn1/test/MonetaryLimitUnitTest.cs @@ -34,7 +34,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - MonetaryLimit.GetInstance(new Object()); + MonetaryLimit.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/NameOrPseudonymUnitTest.cs b/crypto/test/src/asn1/test/NameOrPseudonymUnitTest.cs index 45f66613b..c8233fb08 100644 --- a/crypto/test/src/asn1/test/NameOrPseudonymUnitTest.cs +++ b/crypto/test/src/asn1/test/NameOrPseudonymUnitTest.cs @@ -39,7 +39,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - NameOrPseudonym.GetInstance(new Object()); + NameOrPseudonym.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/NamingAuthorityUnitTest.cs b/crypto/test/src/asn1/test/NamingAuthorityUnitTest.cs index 787b2c32d..8eb1d2118 100644 --- a/crypto/test/src/asn1/test/NamingAuthorityUnitTest.cs +++ b/crypto/test/src/asn1/test/NamingAuthorityUnitTest.cs @@ -47,7 +47,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - NamingAuthority.GetInstance(new Object()); + NamingAuthority.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/OIDTest.cs b/crypto/test/src/asn1/test/OIDTest.cs index 9a1927a41..1a46d5993 100644 --- a/crypto/test/src/asn1/test/OIDTest.cs +++ b/crypto/test/src/asn1/test/OIDTest.cs @@ -77,7 +77,7 @@ namespace Org.BouncyCastle.Asn1.Tests } } - private void OnCheck(String stem, String test, bool expected) + private void OnCheck(string stem, string test, bool expected) { if (expected != new DerObjectIdentifier(test).On(new DerObjectIdentifier(stem))) { diff --git a/crypto/test/src/asn1/test/OtherCertIDUnitTest.cs b/crypto/test/src/asn1/test/OtherCertIDUnitTest.cs index a09c18e8a..a7b720679 100644 --- a/crypto/test/src/asn1/test/OtherCertIDUnitTest.cs +++ b/crypto/test/src/asn1/test/OtherCertIDUnitTest.cs @@ -40,7 +40,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - OtherCertID.GetInstance(new Object()); + OtherCertID.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/OtherSigningCertificateUnitTest.cs b/crypto/test/src/asn1/test/OtherSigningCertificateUnitTest.cs index 4410d8e4c..692dd9cc1 100644 --- a/crypto/test/src/asn1/test/OtherSigningCertificateUnitTest.cs +++ b/crypto/test/src/asn1/test/OtherSigningCertificateUnitTest.cs @@ -37,7 +37,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - OtherCertID.GetInstance(new Object()); + OtherCertID.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/ParsingTest.cs b/crypto/test/src/asn1/test/ParsingTest.cs index bb219e2fc..a243ac194 100644 --- a/crypto/test/src/asn1/test/ParsingTest.cs +++ b/crypto/test/src/asn1/test/ParsingTest.cs @@ -49,7 +49,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - Object obj; + object obj; while ((obj = aIn.ReadObject()) != null) { } @@ -76,7 +76,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - Object obj; + object obj; while ((obj = aIn.ReadObject()) != null) { } diff --git a/crypto/test/src/asn1/test/PersonalDataUnitTest.cs b/crypto/test/src/asn1/test/PersonalDataUnitTest.cs index f92e619cf..faeab6253 100644 --- a/crypto/test/src/asn1/test/PersonalDataUnitTest.cs +++ b/crypto/test/src/asn1/test/PersonalDataUnitTest.cs @@ -59,7 +59,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - PersonalData.GetInstance(new Object()); + PersonalData.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/ProcurationSyntaxUnitTest.cs b/crypto/test/src/asn1/test/ProcurationSyntaxUnitTest.cs index 97d0e3eee..d89d7d83d 100644 --- a/crypto/test/src/asn1/test/ProcurationSyntaxUnitTest.cs +++ b/crypto/test/src/asn1/test/ProcurationSyntaxUnitTest.cs @@ -49,7 +49,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - ProcurationSyntax.GetInstance(new Object()); + ProcurationSyntax.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/ProfessionInfoUnitTest.cs b/crypto/test/src/asn1/test/ProfessionInfoUnitTest.cs index 6af2658ef..9504c46b8 100644 --- a/crypto/test/src/asn1/test/ProfessionInfoUnitTest.cs +++ b/crypto/test/src/asn1/test/ProfessionInfoUnitTest.cs @@ -53,7 +53,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - ProcurationSyntax.GetInstance(new Object()); + ProfessionInfo.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/asn1/test/RestrictionUnitTest.cs b/crypto/test/src/asn1/test/RestrictionUnitTest.cs index 5dd6438cb..073b2ebf9 100644 --- a/crypto/test/src/asn1/test/RestrictionUnitTest.cs +++ b/crypto/test/src/asn1/test/RestrictionUnitTest.cs @@ -25,7 +25,7 @@ namespace Org.BouncyCastle.Asn1.Tests try { - Restriction.GetInstance(new Object()); + Restriction.GetInstance(new object()); Fail("GetInstance() failed to detect bad object."); } diff --git a/crypto/test/src/cmp/test/ProtectedMessageTest.cs b/crypto/test/src/cmp/test/ProtectedMessageTest.cs index d28984af6..1b7d84eea 100644 --- a/crypto/test/src/cmp/test/ProtectedMessageTest.cs +++ b/crypto/test/src/cmp/test/ProtectedMessageTest.cs @@ -366,7 +366,7 @@ namespace Org.BouncyCastle.Cmp.Tests set { this.subject = value; } } - public TestCertBuilder AddAttribute(DerObjectIdentifier name, Object value) + public TestCertBuilder AddAttribute(DerObjectIdentifier name, object value) { attrs[name] = value; ord.Add(name); diff --git a/crypto/test/src/crypto/prng/test/CtrDrbgTest.cs b/crypto/test/src/crypto/prng/test/CtrDrbgTest.cs index 4dc09f4e8..3a023fe3a 100644 --- a/crypto/test/src/crypto/prng/test/CtrDrbgTest.cs +++ b/crypto/test/src/crypto/prng/test/CtrDrbgTest.cs @@ -497,7 +497,7 @@ namespace Org.BouncyCastle.Crypto.Prng.Test cipher.Init(forEncryption, parameters); } - public String AlgorithmName + public string AlgorithmName { get { return cipher.AlgorithmName; } } diff --git a/crypto/test/src/crypto/prng/test/DrbgTestVector.cs b/crypto/test/src/crypto/prng/test/DrbgTestVector.cs index e0a8eeaf5..b3f17e458 100644 --- a/crypto/test/src/crypto/prng/test/DrbgTestVector.cs +++ b/crypto/test/src/crypto/prng/test/DrbgTestVector.cs @@ -15,7 +15,7 @@ namespace Org.BouncyCastle.Crypto.Prng.Test private string _nonce; private string _personalisation; private int _ss; - private String[] _ev; + private string[] _ev; private IList _ai = new ArrayList(); public DrbgTestVector(IDigest digest, IEntropySource eSource, bool predictionResistance, string nonce, diff --git a/crypto/test/src/crypto/test/AriaTest.cs b/crypto/test/src/crypto/test/AriaTest.cs index da92792f9..56244ed71 100644 --- a/crypto/test/src/crypto/test/AriaTest.cs +++ b/crypto/test/src/crypto/test/AriaTest.cs @@ -88,7 +88,7 @@ namespace Org.BouncyCastle.Crypto.Tests } } - private void CheckTestVector_RFC5794(String[] tv) + private void CheckTestVector_RFC5794(string[] tv) { string name = "'" + tv[0] + "'"; diff --git a/crypto/test/src/crypto/test/BCryptTest.cs b/crypto/test/src/crypto/test/BCryptTest.cs index 42d925f80..05c1cbff5 100644 --- a/crypto/test/src/crypto/test/BCryptTest.cs +++ b/crypto/test/src/crypto/test/BCryptTest.cs @@ -109,7 +109,7 @@ namespace Org.BouncyCastle.Crypto.Tests } } - private void CheckIllegal(String msg, byte[] pass, byte[] salt, int cost) + private void CheckIllegal(string msg, byte[] pass, byte[] salt, int cost) { try { diff --git a/crypto/test/src/crypto/test/GOST3411_2012_256DigestTest.cs b/crypto/test/src/crypto/test/GOST3411_2012_256DigestTest.cs index 1f2ef1823..4b48eab4f 100644 --- a/crypto/test/src/crypto/test/GOST3411_2012_256DigestTest.cs +++ b/crypto/test/src/crypto/test/GOST3411_2012_256DigestTest.cs @@ -17,7 +17,7 @@ namespace Org.BouncyCastle.Crypto.Tests public class GOST3411_2012_256DigestTest : DigestTest { - private static readonly String[] messages; + private static readonly string[] messages; private static char[] M1 = { @@ -55,7 +55,7 @@ namespace Org.BouncyCastle.Crypto.Tests messages = new string[] { new string(M1), new string(M2) }; } - private static readonly String[] digests = { + private static readonly string[] digests = { "9d151eefd8590b89daa6ba6cb74af9275dd051026bb149a452fd84e5e57b5500", "9dd2fe4e90409e5da87f53976d7405b0c0cac628fc669a741d50063c557e8f50" }; diff --git a/crypto/test/src/crypto/test/GOST3411_2012_512DigestTest.cs b/crypto/test/src/crypto/test/GOST3411_2012_512DigestTest.cs index f4398952b..7b4c0273a 100644 --- a/crypto/test/src/crypto/test/GOST3411_2012_512DigestTest.cs +++ b/crypto/test/src/crypto/test/GOST3411_2012_512DigestTest.cs @@ -15,7 +15,7 @@ namespace Org.BouncyCastle.Crypto.Tests public class GOST3411_2012_512DigestTest : DigestTest { - private static readonly String[] messages; + private static readonly string[] messages; private static char[] M1 = { @@ -52,7 +52,7 @@ namespace Org.BouncyCastle.Crypto.Tests messages = new string[]{ new string(M1), new string(M2) }; } - private static readonly String[] digests = { + private static readonly string[] digests = { "1b54d01a4af5b9d5cc3d86d68d285462b19abc2475222f35c085122be4ba1ffa00ad30f8767b3a82384c6574f024c311e2a481332b08ef7f41797891c1646f48", "1e88e62226bfca6f9994f1f2d51569e0daf8475a3b0fe61a5300eee46d961376035fe83549ada2b8620fcd7c496ce5b33f0cb9dddc2b6460143b03dabac9fb28", }; diff --git a/crypto/test/src/crypto/test/HCFamilyVecTest.cs b/crypto/test/src/crypto/test/HCFamilyVecTest.cs index 00b0ee75c..cbac30c4b 100644 --- a/crypto/test/src/crypto/test/HCFamilyVecTest.cs +++ b/crypto/test/src/crypto/test/HCFamilyVecTest.cs @@ -123,8 +123,8 @@ namespace Org.BouncyCastle.Crypto.Tests int posA = lead.IndexOf('['); int posB = lead.IndexOf(".."); int posC = lead.IndexOf(']'); - int start = Int32.Parse(lead.Substring(posA + 1, posB - (posA + 1))); - int end = Int32.Parse(lead.Substring(posB + 2, posC - (posB + 2))); + int start = int.Parse(lead.Substring(posA + 1, posB - (posA + 1))); + int end = int.Parse(lead.Substring(posB + 2, posC - (posB + 2))); if (start % 64 != 0 || (end - start != 63)) throw new InvalidOperationException(vectorName + ": " + lead + " not on 64 byte boundaries"); diff --git a/crypto/test/src/crypto/test/KeccakDigestTest.cs b/crypto/test/src/crypto/test/KeccakDigestTest.cs index 961a5d2e3..9020d0261 100644 --- a/crypto/test/src/crypto/test/KeccakDigestTest.cs +++ b/crypto/test/src/crypto/test/KeccakDigestTest.cs @@ -295,7 +295,7 @@ namespace Org.BouncyCastle.Crypto.Tests } } - private void TestMac(IDigest digest, byte[][] keys, String[] data, String[] expected, byte[] truncExpected) + private void TestMac(IDigest digest, byte[][] keys, string[] data, string[] expected, byte[] truncExpected) { IMac mac = new HMac(digest); diff --git a/crypto/test/src/crypto/test/RipeMD128DigestTest.cs b/crypto/test/src/crypto/test/RipeMD128DigestTest.cs index ead4f06ad..d3b25af66 100644 --- a/crypto/test/src/crypto/test/RipeMD128DigestTest.cs +++ b/crypto/test/src/crypto/test/RipeMD128DigestTest.cs @@ -38,7 +38,7 @@ namespace Org.BouncyCastle.Crypto.Tests "3f45ef194732c2dbb2c4a2c769795fa3" }; - readonly static String million_a_digest = "4a7f5723f954eba1216c9d8f6320431f"; + readonly static string million_a_digest = "4a7f5723f954eba1216c9d8f6320431f"; public RipeMD128DigestTest() : base(new RipeMD128Digest(), messages, digests) diff --git a/crypto/test/src/crypto/test/SCryptTest.cs b/crypto/test/src/crypto/test/SCryptTest.cs index f236c4bf0..24ec1dffd 100644 --- a/crypto/test/src/crypto/test/SCryptTest.cs +++ b/crypto/test/src/crypto/test/SCryptTest.cs @@ -45,7 +45,7 @@ namespace Org.BouncyCastle.Crypto.Tests CheckIllegal("Len parameter must be > 1", new byte[0], new byte[0], 2, 1, 1, 0); } - private void CheckOK(String msg, byte[] pass, byte[] salt, int N, int r, int p, int len) + private void CheckOK(string msg, byte[] pass, byte[] salt, int N, int r, int p, int len) { try { @@ -58,7 +58,7 @@ namespace Org.BouncyCastle.Crypto.Tests } } - private void CheckIllegal(String msg, byte[] pass, byte[] salt, int N, int r, int p, int len) + private void CheckIllegal(string msg, byte[] pass, byte[] salt, int N, int r, int p, int len) { try { diff --git a/crypto/test/src/crypto/test/SHA3DigestTest.cs b/crypto/test/src/crypto/test/SHA3DigestTest.cs index 71f51f43b..c905ded72 100644 --- a/crypto/test/src/crypto/test/SHA3DigestTest.cs +++ b/crypto/test/src/crypto/test/SHA3DigestTest.cs @@ -46,7 +46,7 @@ namespace Org.BouncyCastle.Crypto.Tests { using (StreamReader r = new StreamReader(SimpleTest.GetTestDataAsStream("crypto.SHA3TestVectors.txt"))) { - String line; + string line; while (null != (line = ReadLine(r))) { if (line.Length != 0) @@ -97,7 +97,7 @@ namespace Org.BouncyCastle.Crypto.Tests private int ParseDecimal(string s) { - return Int32.Parse(s); + return int.Parse(s); } private string ReadBlock(StreamReader r) diff --git a/crypto/test/src/crypto/test/SP80038GTest.cs b/crypto/test/src/crypto/test/SP80038GTest.cs index d8fe83150..119813681 100644 --- a/crypto/test/src/crypto/test/SP80038GTest.cs +++ b/crypto/test/src/crypto/test/SP80038GTest.cs @@ -26,12 +26,13 @@ namespace Org.BouncyCastle.Crypto.Tests private readonly byte[] ciphertext; private readonly byte[] tweak; - public static FFSample from(int radix, String hexKey, String asciiPT, String asciiCT, String hexTweak) + public static FFSample From(int radix, string hexKey, string asciiPT, string asciiCT, string hexTweak) { - return new FFSample(radix, fromHex(hexKey), fromAscii(radix, asciiPT), fromAscii(radix, asciiCT), fromHex(hexTweak)); + return new FFSample(radix, FromHex(hexKey), FromAscii(radix, asciiPT), FromAscii(radix, asciiCT), + FromHex(hexTweak)); } - private static byte fromAlphaNumeric(char c) + private static byte FromAlphaNumeric(char c) { if (c >= '0' && c <= '9') { @@ -51,12 +52,12 @@ namespace Org.BouncyCastle.Crypto.Tests } } - private static byte[] fromAscii(int radix, string ascii) + private static byte[] FromAscii(int radix, string ascii) { byte[] result = new byte[ascii.Length]; for (int i = 0; i < result.Length; ++i) { - result[i] = fromAlphaNumeric(ascii[i]); + result[i] = FromAlphaNumeric(ascii[i]); if (result[i] < 0 || result[i] >= radix) { throw new ArgumentException(); @@ -65,7 +66,7 @@ namespace Org.BouncyCastle.Crypto.Tests return result; } - private static byte[] fromHex(string hex) + private static byte[] FromHex(string hex) { return Hex.Decode(hex); } @@ -108,25 +109,25 @@ namespace Org.BouncyCastle.Crypto.Tests private static FFSample[] ff1Samples = new FFSample[] { // FF1-AES128 - FFSample.from(10, "2B7E151628AED2A6ABF7158809CF4F3C", "0123456789", "2433477484", ""), - FFSample.from(10, "2B7E151628AED2A6ABF7158809CF4F3C", "0123456789", "6124200773", "39383736353433323130"), - FFSample.from(36, "2B7E151628AED2A6ABF7158809CF4F3C", "0123456789abcdefghi", "a9tv40mll9kdu509eum", "3737373770717273373737"), + FFSample.From(10, "2B7E151628AED2A6ABF7158809CF4F3C", "0123456789", "2433477484", ""), + FFSample.From(10, "2B7E151628AED2A6ABF7158809CF4F3C", "0123456789", "6124200773", "39383736353433323130"), + FFSample.From(36, "2B7E151628AED2A6ABF7158809CF4F3C", "0123456789abcdefghi", "a9tv40mll9kdu509eum", "3737373770717273373737"), // FF1-AES192 - FFSample.from(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F", "0123456789", "2830668132", ""), - FFSample.from(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F", "0123456789", "2496655549", "39383736353433323130"), - FFSample.from(36, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F", "0123456789abcdefghi", "xbj3kv35jrawxv32ysr", "3737373770717273373737"), + FFSample.From(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F", "0123456789", "2830668132", ""), + FFSample.From(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F", "0123456789", "2496655549", "39383736353433323130"), + FFSample.From(36, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F", "0123456789abcdefghi", "xbj3kv35jrawxv32ysr", "3737373770717273373737"), // FF1-AES256 - FFSample.from(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F7F036D6F04FC6A94", "0123456789", "6657667009", ""), - FFSample.from(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F7F036D6F04FC6A94", "0123456789", "1001623463", "39383736353433323130"), - FFSample.from(36, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F7F036D6F04FC6A94", "0123456789abcdefghi", "xs8a0azh2avyalyzuwd", "3737373770717273373737"), + FFSample.From(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F7F036D6F04FC6A94", "0123456789", "6657667009", ""), + FFSample.From(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F7F036D6F04FC6A94", "0123456789", "1001623463", "39383736353433323130"), + FFSample.From(36, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F7F036D6F04FC6A94", "0123456789abcdefghi", "xs8a0azh2avyalyzuwd", "3737373770717273373737"), }; private static FFSample[] ff3_1Samples = new FFSample[] { // FF3-AES128 - FFSample.from(62, "7793833CE891B496381BD5B882F77EA1", "YbpT3hDo0J9xwCQ5qUWt93iv", "dDEYxViK56lGbV1WdZTPTe4w", "C58797C2580174"), + FFSample.From(62, "7793833CE891B496381BD5B882F77EA1", "YbpT3hDo0J9xwCQ5qUWt93iv", "dDEYxViK56lGbV1WdZTPTe4w", "C58797C2580174"), }; private void testFF1() @@ -423,7 +424,7 @@ namespace Org.BouncyCastle.Crypto.Tests private void testFF3_1Bounds() { - String bigAlpha = "+-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; + string bigAlpha = "+-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; IAlphabetMapper alphabetMapper = new BasicAlphabetMapper(bigAlpha); @@ -463,7 +464,7 @@ namespace Org.BouncyCastle.Crypto.Tests } } - private void ff3_1Test(IAlphabetMapper alphabetMapper, String skey, String stweak, String input, String output) + private void ff3_1Test(IAlphabetMapper alphabetMapper, string skey, string stweak, string input, string output) { FpeEngine fpeEncEngine = new FpeFf3_1Engine(); FpeEngine fpeDecEngine = new FpeFf3_1Engine(); @@ -478,12 +479,12 @@ namespace Org.BouncyCastle.Crypto.Tests byte[] bytes = alphabetMapper.ConvertToIndexes(input.ToCharArray()); byte[] encryptedBytes = process(fpeEncEngine, bytes); - IsEquals(output, new String(alphabetMapper.ConvertToChars(encryptedBytes))); + IsEquals(output, new string(alphabetMapper.ConvertToChars(encryptedBytes))); byte[] decryptedBytes = process(fpeDecEngine, encryptedBytes); IsTrue(Arrays.AreEqual(bytes, decryptedBytes)); char[] chars = alphabetMapper.ConvertToChars(decryptedBytes); - IsEquals(input, new String(chars)); + IsEquals(input, new string(chars)); } private byte[] process(FpeEngine fpeEngine, byte[] bytes) diff --git a/crypto/test/src/crypto/test/ShakeDigestTest.cs b/crypto/test/src/crypto/test/ShakeDigestTest.cs index d8b2d55d6..70d7436ec 100644 --- a/crypto/test/src/crypto/test/ShakeDigestTest.cs +++ b/crypto/test/src/crypto/test/ShakeDigestTest.cs @@ -46,7 +46,7 @@ namespace Org.BouncyCastle.Crypto.Tests { using (StreamReader r = new StreamReader(SimpleTest.GetTestDataAsStream("crypto.SHAKETestVectors.txt"))) { - String line; + string line; while (null != (line = ReadLine(r))) { if (line.Length != 0) @@ -97,7 +97,7 @@ namespace Org.BouncyCastle.Crypto.Tests private int ParseDecimal(string s) { - return Int32.Parse(s); + return int.Parse(s); } private string ReadBlock(StreamReader r) diff --git a/crypto/test/src/crypto/test/SkeinMacTest.cs b/crypto/test/src/crypto/test/SkeinMacTest.cs index 852c3b2c7..fcd654233 100644 --- a/crypto/test/src/crypto/test/SkeinMacTest.cs +++ b/crypto/test/src/crypto/test/SkeinMacTest.cs @@ -24,7 +24,7 @@ namespace Org.BouncyCastle.Crypto.Tests private int blockSize; private int outputSize; - public Case(int blockSize, int outputSize, String message, String key, String digest) + public Case(int blockSize, int outputSize, string message, string key, string digest) { this.blockSize = blockSize; this.outputSize = outputSize; @@ -60,10 +60,9 @@ namespace Org.BouncyCastle.Crypto.Tests public override string ToString() { - return String.Format("new Case({0}, {1}, \"{2}\", \"{3}\", \"{4}\"),", blockSize, outputSize, - Hex.ToHexString(message), Hex.ToHexString(key), Hex.ToHexString(digest)); + return string.Format("new Case({0}, {1}, \"{2}\", \"{3}\", \"{4}\"),", blockSize, outputSize, + Hex.ToHexString(message), Hex.ToHexString(key), Hex.ToHexString(digest)); } - } // Test cases from skein_golden_kat.txt in Skein 1.3 NIST CD diff --git a/crypto/test/src/crypto/test/XSalsa20Test.cs b/crypto/test/src/crypto/test/XSalsa20Test.cs index 74ed04e88..519c5bcb9 100644 --- a/crypto/test/src/crypto/test/XSalsa20Test.cs +++ b/crypto/test/src/crypto/test/XSalsa20Test.cs @@ -25,7 +25,7 @@ namespace Org.BouncyCastle.Crypto.Tests private byte[] plaintext; private byte[] ciphertext; - public TestCase(String key, string iv, string plaintext, string ciphertext) + public TestCase(string key, string iv, string plaintext, string ciphertext) { this.key = Hex.Decode(key); this.iv = Hex.Decode(iv); diff --git a/crypto/test/src/crypto/test/cavp/CavpReader.cs b/crypto/test/src/crypto/test/cavp/CavpReader.cs index 0b040927e..dc32e0ff8 100644 --- a/crypto/test/src/crypto/test/cavp/CavpReader.cs +++ b/crypto/test/src/crypto/test/cavp/CavpReader.cs @@ -64,7 +64,7 @@ namespace Org.BouncyCastle.Crypto.Tests.Cavp if (value == null) throw new InvalidOperationException(name + " was null"); - return Int32.Parse(value); + return int.Parse(value); } public int ValueAsInt(string name, int def) @@ -73,7 +73,7 @@ namespace Org.BouncyCastle.Crypto.Tests.Cavp if (value == null) return def; - return Int32.Parse(value); + return int.Parse(value); } } @@ -89,7 +89,7 @@ namespace Org.BouncyCastle.Crypto.Tests.Cavp using (StreamReader r = new StreamReader(SimpleTest.GetTestDataAsStream("crypto.cavp." + name))) { - String line; + string line; while (null != (line = r.ReadLine())) { // Reading a header or waiting to encounter a header diff --git a/crypto/test/src/crypto/test/cavp/KDFCounterTests.cs b/crypto/test/src/crypto/test/cavp/KDFCounterTests.cs index e0f8755e7..4cd20a93b 100644 --- a/crypto/test/src/crypto/test/cavp/KDFCounterTests.cs +++ b/crypto/test/src/crypto/test/cavp/KDFCounterTests.cs @@ -43,7 +43,7 @@ namespace Org.BouncyCastle.Crypto.Tests.Cavp { Assert.Fail("No RLEN"); } - r = Int32.Parse(rlen.Split('_')[0]); + r = int.Parse(rlen.Split('_')[0]); } int count = vector.ValueAsInt("COUNT"); int l = vector.ValueAsInt("L"); diff --git a/crypto/test/src/crypto/test/cavp/KDFDoublePipelineTests.cs b/crypto/test/src/crypto/test/cavp/KDFDoublePipelineTests.cs index 674224447..7d1558ce9 100644 --- a/crypto/test/src/crypto/test/cavp/KDFDoublePipelineTests.cs +++ b/crypto/test/src/crypto/test/cavp/KDFDoublePipelineTests.cs @@ -69,7 +69,7 @@ namespace Org.BouncyCastle.Crypto.Tests.Cavp { Assert.Fail("No RLEN"); } - r = Int32.Parse(rlen.Split('_')[0]); + r = int.Parse(rlen.Split('_')[0]); } int count = vector.ValueAsInt("COUNT"); int l = vector.ValueAsInt("L"); diff --git a/crypto/test/src/crypto/test/cavp/KDFFeedbackCounterTests.cs b/crypto/test/src/crypto/test/cavp/KDFFeedbackCounterTests.cs index ea052b8f5..26789bf28 100644 --- a/crypto/test/src/crypto/test/cavp/KDFFeedbackCounterTests.cs +++ b/crypto/test/src/crypto/test/cavp/KDFFeedbackCounterTests.cs @@ -70,7 +70,7 @@ namespace Org.BouncyCastle.Crypto.Tests.Cavp { Fail("No RLEN"); } - r = Int32.Parse(rlen.Split('_')[0]); + r = int.Parse(rlen.Split('_')[0]); } int count = vector.ValueAsInt("COUNT"); int l = vector.ValueAsInt("L"); diff --git a/crypto/test/src/math/ec/test/ECPointTest.cs b/crypto/test/src/math/ec/test/ECPointTest.cs index 4b17d8c0a..f3fc6e592 100644 --- a/crypto/test/src/math/ec/test/ECPointTest.cs +++ b/crypto/test/src/math/ec/test/ECPointTest.cs @@ -88,7 +88,7 @@ namespace Org.BouncyCastle.Math.EC.Tests internal static readonly ECPoint infinity = curve.Infinity; - internal static readonly String[] pointSource = { "0010", "1111", "1100", "1100", + internal static readonly string[] pointSource = { "0010", "1111", "1100", "1100", "0001", "0001", "1011", "0010" }; internal static readonly ECPoint[] p = new ECPoint[pointSource.Length / 2]; diff --git a/crypto/test/src/math/ec/test/TnafTest.cs b/crypto/test/src/math/ec/test/TnafTest.cs index 98aff0025..36245b5a6 100644 --- a/crypto/test/src/math/ec/test/TnafTest.cs +++ b/crypto/test/src/math/ec/test/TnafTest.cs @@ -91,7 +91,7 @@ // ImplTestMultiplyTnaf("sect571k1"); // } // -// private void ImplTestMultiplyWnaf(String curveName) +// private void ImplTestMultiplyWnaf(string curveName) // { // X9ECParameters x9ECParameters = SecNamedCurves.GetByName(curveName); // diff --git a/crypto/test/src/openpgp/examples/DirectKeySignature.cs b/crypto/test/src/openpgp/examples/DirectKeySignature.cs index 3926a787b..c36bba996 100644 --- a/crypto/test/src/openpgp/examples/DirectKeySignature.cs +++ b/crypto/test/src/openpgp/examples/DirectKeySignature.cs @@ -57,11 +57,11 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Examples // gather command line arguments PgpSecretKeyRing secRing = new PgpSecretKeyRing( PgpUtilities.GetDecoderStream(secFis)); - String secretKeyPass = args[1]; + string secretKeyPass = args[1]; PgpPublicKeyRing ring = new PgpPublicKeyRing( PgpUtilities.GetDecoderStream(pubFis)); - String notationName = args[3]; - String notationValue = args[4]; + string notationName = args[3]; + string notationValue = args[4]; // create the signed keyRing PgpPublicKeyRing sRing = null; diff --git a/crypto/test/src/openpgp/test/PgpUnicodeTest.cs b/crypto/test/src/openpgp/test/PgpUnicodeTest.cs index d73e3d7a6..afc0d1cbc 100644 --- a/crypto/test/src/openpgp/test/PgpUnicodeTest.cs +++ b/crypto/test/src/openpgp/test/PgpUnicodeTest.cs @@ -55,7 +55,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests // byte[] password = new byte[passwordFile.available()]; // passwordFile.read(password); // passwordFile.close(); - // String passphrase = new String(password); + // string passphrase = new string(password); DoTestKey(keyId, passphrase, true); diff --git a/crypto/test/src/openssl/test/AllTests.cs b/crypto/test/src/openssl/test/AllTests.cs index 0cc2dcd85..1d528b27b 100644 --- a/crypto/test/src/openssl/test/AllTests.cs +++ b/crypto/test/src/openssl/test/AllTests.cs @@ -96,7 +96,7 @@ namespace Org.BouncyCastle.OpenSsl.Tests pWrt.WriteObject(pkcs8); pWrt.Writer.Close(); - String result = sw.ToString(); + string result = sw.ToString(); PemReader pRd = new PemReader(new StringReader(result), new Password("hello".ToCharArray())); diff --git a/crypto/test/src/openssl/test/ReaderTest.cs b/crypto/test/src/openssl/test/ReaderTest.cs index 95bbe6a4d..6dd78ff93 100644 --- a/crypto/test/src/openssl/test/ReaderTest.cs +++ b/crypto/test/src/openssl/test/ReaderTest.cs @@ -335,7 +335,7 @@ namespace Org.BouncyCastle.OpenSsl.Tests IPasswordFinder pGet = new Password(password.ToCharArray()); PemReader pemRd = OpenPemResource("test.pem", pGet); - Object o; + object o; while ((o = pemRd.ReadObject()) != null) { } diff --git a/crypto/test/src/pkcs/test/PKCS10Test.cs b/crypto/test/src/pkcs/test/PKCS10Test.cs index 45d59ed49..c3bc4c948 100644 --- a/crypto/test/src/pkcs/test/PKCS10Test.cs +++ b/crypto/test/src/pkcs/test/PKCS10Test.cs @@ -32,15 +32,12 @@ namespace Org.BouncyCastle.Pkcs.Tests [Test] public void BrokenRequestWithDuplicateExtension() { - - String keyName = "RSA"; + string keyName = "RSA"; int keySize = 2048; - String sigName = "SHA256withRSA"; + string sigName = "SHA256withRSA"; IAsymmetricCipherKeyPairGenerator kpg = GeneratorUtilities.GetKeyPairGenerator(keyName); - - // kpg.initialize(keySize); kpg.Init(new KeyGenerationParameters(new SecureRandom(), keySize)); AsymmetricCipherKeyPair kp = kpg.GenerateKeyPair(); diff --git a/crypto/test/src/test/PkixTest.cs b/crypto/test/src/test/PkixTest.cs index 882319610..904f8af0c 100644 --- a/crypto/test/src/test/PkixTest.cs +++ b/crypto/test/src/test/PkixTest.cs @@ -226,7 +226,7 @@ namespace Org.BouncyCastle.Tests } } - public override String Name + public override string Name { get { return "PkixTest"; } } diff --git a/crypto/test/src/test/SP80038GTest.cs b/crypto/test/src/test/SP80038GTest.cs index adf6f35d8..842513218 100644 --- a/crypto/test/src/test/SP80038GTest.cs +++ b/crypto/test/src/test/SP80038GTest.cs @@ -24,12 +24,13 @@ namespace Org.BouncyCastle.Tests private readonly byte[] ciphertext; private readonly byte[] tweak; - public static FFSample from(int radix, String hexKey, String asciiPT, String asciiCT, String hexTweak) + public static FFSample From(int radix, string hexKey, string asciiPT, string asciiCT, string hexTweak) { - return new FFSample(radix, fromHex(hexKey), fromAscii(radix, asciiPT), fromAscii(radix, asciiCT), fromHex(hexTweak)); + return new FFSample(radix, FromHex(hexKey), FromAscii(radix, asciiPT), FromAscii(radix, asciiCT), + FromHex(hexTweak)); } - private static byte fromAlphaNumeric(char c) + private static byte FromAlphaNumeric(char c) { if (c >= '0' && c <= '9') { @@ -49,12 +50,12 @@ namespace Org.BouncyCastle.Tests } } - private static byte[] fromAscii(int radix, string ascii) + private static byte[] FromAscii(int radix, string ascii) { byte[] result = new byte[ascii.Length]; for (int i = 0; i < result.Length; ++i) { - result[i] = fromAlphaNumeric(ascii[i]); + result[i] = FromAlphaNumeric(ascii[i]); if (result[i] < 0 || result[i] >= radix) { throw new ArgumentException(); @@ -63,7 +64,7 @@ namespace Org.BouncyCastle.Tests return result; } - private static byte[] fromHex(string hex) + private static byte[] FromHex(string hex) { return Hex.Decode(hex); } @@ -106,25 +107,25 @@ namespace Org.BouncyCastle.Tests private static FFSample[] ff1Samples = new FFSample[] { // FF1-AES128 - FFSample.from(10, "2B7E151628AED2A6ABF7158809CF4F3C", "0123456789", "2433477484", ""), - FFSample.from(10, "2B7E151628AED2A6ABF7158809CF4F3C", "0123456789", "6124200773", "39383736353433323130"), - FFSample.from(36, "2B7E151628AED2A6ABF7158809CF4F3C", "0123456789abcdefghi", "a9tv40mll9kdu509eum", "3737373770717273373737"), + FFSample.From(10, "2B7E151628AED2A6ABF7158809CF4F3C", "0123456789", "2433477484", ""), + FFSample.From(10, "2B7E151628AED2A6ABF7158809CF4F3C", "0123456789", "6124200773", "39383736353433323130"), + FFSample.From(36, "2B7E151628AED2A6ABF7158809CF4F3C", "0123456789abcdefghi", "a9tv40mll9kdu509eum", "3737373770717273373737"), // FF1-AES192 - FFSample.from(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F", "0123456789", "2830668132", ""), - FFSample.from(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F", "0123456789", "2496655549", "39383736353433323130"), - FFSample.from(36, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F", "0123456789abcdefghi", "xbj3kv35jrawxv32ysr", "3737373770717273373737"), + FFSample.From(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F", "0123456789", "2830668132", ""), + FFSample.From(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F", "0123456789", "2496655549", "39383736353433323130"), + FFSample.From(36, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F", "0123456789abcdefghi", "xbj3kv35jrawxv32ysr", "3737373770717273373737"), // FF1-AES256 - FFSample.from(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F7F036D6F04FC6A94", "0123456789", "6657667009", ""), - FFSample.from(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F7F036D6F04FC6A94", "0123456789", "1001623463", "39383736353433323130"), - FFSample.from(36, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F7F036D6F04FC6A94", "0123456789abcdefghi", "xs8a0azh2avyalyzuwd", "3737373770717273373737"), + FFSample.From(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F7F036D6F04FC6A94", "0123456789", "6657667009", ""), + FFSample.From(10, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F7F036D6F04FC6A94", "0123456789", "1001623463", "39383736353433323130"), + FFSample.From(36, "2B7E151628AED2A6ABF7158809CF4F3CEF4359D8D580AA4F7F036D6F04FC6A94", "0123456789abcdefghi", "xs8a0azh2avyalyzuwd", "3737373770717273373737"), }; private static FFSample[] ff3_1Samples = new FFSample[] { // FF3-AES128 - FFSample.from(62, "7793833CE891B496381BD5B882F77EA1", "YbpT3hDo0J9xwCQ5qUWt93iv", "dDEYxViK56lGbV1WdZTPTe4w", "C58797C2580174"), + FFSample.From(62, "7793833CE891B496381BD5B882F77EA1", "YbpT3hDo0J9xwCQ5qUWt93iv", "dDEYxViK56lGbV1WdZTPTe4w", "C58797C2580174"), }; private void testFF1() @@ -421,7 +422,7 @@ namespace Org.BouncyCastle.Tests private void testFF3_1Bounds() { - String bigAlpha = "+-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; + string bigAlpha = "+-ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; IAlphabetMapper alphabetMapper = new BasicAlphabetMapper(bigAlpha); @@ -461,7 +462,7 @@ namespace Org.BouncyCastle.Tests } } - private void ff3_1Test(IAlphabetMapper alphabetMapper, String skey, String stweak, String input, String output) + private void ff3_1Test(IAlphabetMapper alphabetMapper, string skey, string stweak, string input, string output) { FpeEngine fpeEncEngine = new FpeFf3_1Engine(); FpeEngine fpeDecEngine = new FpeFf3_1Engine(); @@ -476,12 +477,12 @@ namespace Org.BouncyCastle.Tests byte[] bytes = alphabetMapper.ConvertToIndexes(input.ToCharArray()); byte[] encryptedBytes = process(fpeEncEngine, bytes); - IsEquals(output, new String(alphabetMapper.ConvertToChars(encryptedBytes))); + IsEquals(output, new string(alphabetMapper.ConvertToChars(encryptedBytes))); byte[] decryptedBytes = process(fpeDecEngine, encryptedBytes); IsTrue(Arrays.AreEqual(bytes, decryptedBytes)); char[] chars = alphabetMapper.ConvertToChars(decryptedBytes); - IsEquals(input, new String(chars)); + IsEquals(input, new string(chars)); } private byte[] process(FpeEngine fpeEngine, byte[] bytes) diff --git a/crypto/test/src/tls/test/MockDtlsClient.cs b/crypto/test/src/tls/test/MockDtlsClient.cs index e758639ec..e56f035d1 100644 --- a/crypto/test/src/tls/test/MockDtlsClient.cs +++ b/crypto/test/src/tls/test/MockDtlsClient.cs @@ -158,7 +158,7 @@ namespace Org.BouncyCastle.Tls.Tests if (isEmpty) throw new TlsFatalAlert(AlertDescription.bad_certificate); - string[] trustedCertResources = new String[]{ "x509-server-dsa.pem", "x509-server-ecdh.pem", + string[] trustedCertResources = new string[]{ "x509-server-dsa.pem", "x509-server-ecdh.pem", "x509-server-ecdsa.pem", "x509-server-ed25519.pem", "x509-server-ed448.pem", "x509-server-rsa_pss_256.pem", "x509-server-rsa_pss_384.pem", "x509-server-rsa_pss_512.pem", "x509-server-rsa-enc.pem", "x509-server-rsa-sign.pem" }; -- cgit 1.4.1