diff options
author | Peter Dettman <peter.dettman@gmail.com> | 2022-06-22 22:08:13 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@gmail.com> | 2022-06-22 22:08:13 +0700 |
commit | 5af9e09a87cc120e2f2da4fadc6b04685f96dda0 (patch) | |
tree | 9647961b98f60c9706ab8491e73070759d4a3545 /crypto/src | |
parent | Change namespace for bzip2 code (diff) | |
download | BouncyCastle.NET-ed25519-5af9e09a87cc120e2f2da4fadc6b04685f96dda0.tar.xz |
Code cleanup
Diffstat (limited to 'crypto/src')
53 files changed, 90 insertions, 93 deletions
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 { /// <summary>The algorithm details object for this calculator.</summary> - Object AlgorithmDetails { get ; } + object AlgorithmDetails { get ; } /// <summary> /// 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. /// </summary> /// <returns>The result of processing the stream.</returns> - 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 { /// <summary>The algorithm details object for this verifier.</summary> - Object AlgorithmDetails { get ; } + object AlgorithmDetails { get ; } /// <summary> /// 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 /// </summary> /// <param name="algorithmDetails">The details of the signature algorithm verification is required for.</param> /// <returns>A new signature verifier.</returns> - 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 /// <code>2^(128 * r / 8)</code>.</param> /// <param name="r">the block size, must be >= 1.</param> /// <param name="p">Parallelization parameter. Must be a positive integer less than or equal to - /// <code>Int32.MaxValue / (128 * r * 8)</code>.</param> + /// <code>int.MaxValue / (128 * r * 8)</code>.</param> /// <param name="dkLen">the length of the key to generate.</param> /// <returns>the generated key.</returns> 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 /// </summary> 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 } /// <exception cref="IOException"/> - 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 <see cref="PemObject"/> /// </param> /// <returns> - /// A <see cref="System.Object"/> + /// An <see cref="object"/> /// </returns> /// <exception cref="IOException"></exception> 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 /// <param name="value">expected string</param> /// <returns>false if not consumed</returns> - private bool expect(String value) + private bool expect(string value) { for (int t=0; t<value.Length; t++) { diff --git a/crypto/src/util/net/IPAddress.cs b/crypto/src/util/net/IPAddress.cs index 38c124590..69e8e4680 100644 --- a/crypto/src/util/net/IPAddress.cs +++ b/crypto/src/util/net/IPAddress.cs @@ -70,7 +70,7 @@ namespace Org.BouncyCastle.Utilities.Net return false; string octetStr = temp.Substring(start, pos - start); - int octet = Int32.Parse(octetStr); + int octet = int.Parse(octetStr); if (octet < 0 || octet > 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; |