diff options
author | Peter Dettman <peter.dettman@gmail.com> | 2022-06-22 23:29:08 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@gmail.com> | 2022-06-22 23:29:08 +0700 |
commit | 9a6df113d3192c4246832388299a4b45b3668d6c (patch) | |
tree | b2513fd29bb03935220761e1608f3aeb238b81f2 /crypto/src | |
parent | Code cleanup (diff) | |
download | BouncyCastle.NET-ed25519-9a6df113d3192c4246832388299a4b45b3668d6c.tar.xz |
Warnings cleanup
Diffstat (limited to 'crypto/src')
-rw-r--r-- | crypto/src/asn1/bc/BCObjectIdentifiers.cs | 2 | ||||
-rw-r--r-- | crypto/src/asn1/ua/UAObjectIdentifiers.cs | 6 | ||||
-rw-r--r-- | crypto/src/bzip2/CBZip2OutputStream.cs | 2 | ||||
-rw-r--r-- | crypto/src/cms/KeyTransRecipientInfoGenerator.cs | 47 | ||||
-rw-r--r-- | crypto/src/crypto/digests/Blake2bDigest.cs | 8 | ||||
-rw-r--r-- | crypto/src/crypto/generators/OpenSSLPBEParametersGenerator.cs | 11 | ||||
-rw-r--r-- | crypto/src/crypto/modes/GcmSivBlockCipher.cs | 7 | ||||
-rw-r--r-- | crypto/src/openpgp/PgpObjectFactory.cs | 2 | ||||
-rw-r--r-- | crypto/src/tls/TlsProtocol.cs | 2 |
9 files changed, 30 insertions, 57 deletions
diff --git a/crypto/src/asn1/bc/BCObjectIdentifiers.cs b/crypto/src/asn1/bc/BCObjectIdentifiers.cs index 7266e4b4c..ff165ace5 100644 --- a/crypto/src/asn1/bc/BCObjectIdentifiers.cs +++ b/crypto/src/asn1/bc/BCObjectIdentifiers.cs @@ -104,7 +104,7 @@ namespace Org.BouncyCastle.Asn1.BC /** * X.509 extension(4) values - * <p> + * <p/> * 1.3.6.1.4.1.22554.4 */ public static readonly DerObjectIdentifier bc_ext = bc.Branch("4"); diff --git a/crypto/src/asn1/ua/UAObjectIdentifiers.cs b/crypto/src/asn1/ua/UAObjectIdentifiers.cs index 9beca3af5..4c996c4f4 100644 --- a/crypto/src/asn1/ua/UAObjectIdentifiers.cs +++ b/crypto/src/asn1/ua/UAObjectIdentifiers.cs @@ -2,11 +2,11 @@ { /** * Ukrainian object identifiers - * <p> + * <p/> * {iso(1) member-body(2) Ukraine(804) root(2) security(1) cryptography(1) pki(1)} - * <p> + * <p/> * { ... pki-alg(1) pki-alg-sym(3) Dstu4145WithGost34311(1) PB(1)} - * <p> + * <p/> * DSTU4145 in polynomial basis has 2 oids, one for little-endian representation and one for big-endian */ public abstract class UAObjectIdentifiers diff --git a/crypto/src/bzip2/CBZip2OutputStream.cs b/crypto/src/bzip2/CBZip2OutputStream.cs index 33013b0d9..045506931 100644 --- a/crypto/src/bzip2/CBZip2OutputStream.cs +++ b/crypto/src/bzip2/CBZip2OutputStream.cs @@ -1545,7 +1545,7 @@ namespace Org.BouncyCastle.Bzip2 mtfFreq[i] = 0; } - int j, wr = 0, zPend = 0; + int wr = 0, zPend = 0; for (i = 0; i < count; i++) { byte blockByte = blockBytes[zptr[i]]; diff --git a/crypto/src/cms/KeyTransRecipientInfoGenerator.cs b/crypto/src/cms/KeyTransRecipientInfoGenerator.cs index 6ee3af6b6..9a2cbc5b0 100644 --- a/crypto/src/cms/KeyTransRecipientInfoGenerator.cs +++ b/crypto/src/cms/KeyTransRecipientInfoGenerator.cs @@ -1,5 +1,4 @@ using System; -using System.IO; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.Cms; @@ -11,52 +10,45 @@ using Org.BouncyCastle.X509; namespace Org.BouncyCastle.Cms { - public class KeyTransRecipientInfoGenerator : RecipientInfoGenerator + public class KeyTransRecipientInfoGenerator + : RecipientInfoGenerator { - private static readonly CmsEnvelopedHelper Helper = CmsEnvelopedHelper.Instance; + private readonly IKeyWrapper m_keyWrapper; - private Asn1OctetString subjectKeyIdentifier; - private IKeyWrapper keyWrapper; - - // Derived fields - private SubjectPublicKeyInfo info; - private IssuerAndSerialNumber issuerAndSerialNumber; - private SecureRandom random; - + private IssuerAndSerialNumber m_issuerAndSerialNumber; + private Asn1OctetString m_subjectKeyIdentifier; public KeyTransRecipientInfoGenerator(X509Certificate recipCert, IKeyWrapper keyWrapper) - : this(new Asn1.Cms.IssuerAndSerialNumber(recipCert.IssuerDN, new DerInteger(recipCert.SerialNumber)), keyWrapper) + : this(new IssuerAndSerialNumber(recipCert.IssuerDN, new DerInteger(recipCert.SerialNumber)), keyWrapper) { } public KeyTransRecipientInfoGenerator(IssuerAndSerialNumber issuerAndSerial, IKeyWrapper keyWrapper) { - this.issuerAndSerialNumber = issuerAndSerial; - this.keyWrapper = keyWrapper; + m_issuerAndSerialNumber = issuerAndSerial; + m_keyWrapper = keyWrapper; } public KeyTransRecipientInfoGenerator(byte[] subjectKeyID, IKeyWrapper keyWrapper) { - this.subjectKeyIdentifier = new DerOctetString(subjectKeyID); - this.keyWrapper = keyWrapper; + m_subjectKeyIdentifier = new DerOctetString(subjectKeyID); + m_keyWrapper = keyWrapper; } public RecipientInfo Generate(KeyParameter contentEncryptionKey, SecureRandom random) { - AlgorithmIdentifier keyEncryptionAlgorithm = this.AlgorithmDetails; - - this.random = random; + AlgorithmIdentifier keyEncryptionAlgorithm = AlgorithmDetails; byte[] encryptedKeyBytes = GenerateWrappedKey(contentEncryptionKey); RecipientIdentifier recipId; - if (issuerAndSerialNumber != null) + if (m_issuerAndSerialNumber != null) { - recipId = new RecipientIdentifier(issuerAndSerialNumber); + recipId = new RecipientIdentifier(m_issuerAndSerialNumber); } else { - recipId = new RecipientIdentifier(subjectKeyIdentifier); + recipId = new RecipientIdentifier(m_subjectKeyIdentifier); } return new RecipientInfo(new KeyTransRecipientInfo(recipId, keyEncryptionAlgorithm, @@ -65,19 +57,12 @@ namespace Org.BouncyCastle.Cms protected virtual AlgorithmIdentifier AlgorithmDetails { - get - { - if (this.keyWrapper != null) - { - return (AlgorithmIdentifier)keyWrapper.AlgorithmDetails; - } - return info.AlgorithmID; - } + get { return (AlgorithmIdentifier)m_keyWrapper.AlgorithmDetails; } } protected virtual byte[] GenerateWrappedKey(KeyParameter contentEncryptionKey) { - return keyWrapper.Wrap(contentEncryptionKey.GetKey()).Collect(); + return m_keyWrapper.Wrap(contentEncryptionKey.GetKey()).Collect(); } } } diff --git a/crypto/src/crypto/digests/Blake2bDigest.cs b/crypto/src/crypto/digests/Blake2bDigest.cs index 770e35caf..bc25e5258 100644 --- a/crypto/src/crypto/digests/Blake2bDigest.cs +++ b/crypto/src/crypto/digests/Blake2bDigest.cs @@ -28,14 +28,14 @@ namespace Org.BouncyCastle.Crypto.Digests */ /** - * Implementation of the cryptographic hash function Blakbe2b. - * <p> + * Implementation of the cryptographic hash function Blake2b. + * <p/> * Blake2b offers a built-in keying mechanism to be used directly * for authentication ("Prefix-MAC") rather than a HMAC construction. - * <p> + * <p/> * Blake2b offers a built-in support for a salt for randomized hashing * and a personal string for defining a unique hash function for each application. - * <p> + * <p/> * BLAKE2b is optimized for 64-bit platforms and produces digests of any size * between 1 and 64 bytes. */ diff --git a/crypto/src/crypto/generators/OpenSSLPBEParametersGenerator.cs b/crypto/src/crypto/generators/OpenSSLPBEParametersGenerator.cs index 226059e06..448cd1920 100644 --- a/crypto/src/crypto/generators/OpenSSLPBEParametersGenerator.cs +++ b/crypto/src/crypto/generators/OpenSSLPBEParametersGenerator.cs @@ -6,16 +6,11 @@ using Org.BouncyCastle.Security; namespace Org.BouncyCastle.Crypto.Generators { - /// /// <description> - /// - /// Generator for PBE derived keys and ivs as usd by OpenSSL. - /// <p> - /// Originally this scheme was a simple extension of PKCS 5 V2.0 Scheme 1 using MD5 with an - /// iteration count of 1. The default digest was changed to SHA-256 with OpenSSL 1.1.0. This - /// implementation still defaults to MD5, but the digest can now be set. + /// Generator for PBE derived keys and IVs as usd by OpenSSL. Originally this scheme was a simple extension of + /// PKCS 5 V2.0 Scheme 1 using MD5 with an iteration count of 1. The default digest was changed to SHA-256 with + /// OpenSSL 1.1.0. This implementation still defaults to MD5, but the digest can now be set. /// </description> - /// public class OpenSslPbeParametersGenerator : PbeParametersGenerator { diff --git a/crypto/src/crypto/modes/GcmSivBlockCipher.cs b/crypto/src/crypto/modes/GcmSivBlockCipher.cs index 23e9ca257..a6c729eae 100644 --- a/crypto/src/crypto/modes/GcmSivBlockCipher.cs +++ b/crypto/src/crypto/modes/GcmSivBlockCipher.cs @@ -648,13 +648,6 @@ namespace Org.BouncyCastle.Crypto.Modes theMultiplier.MultiplyH(theGHash); } - /** - * Byte reverse a buffer. - * @param pInput the input buffer - * @param pOffset the offset - * @param pLength the length of data (<= BUFLEN) - * @param pOutput the output buffer - */ private static void fillReverse(byte[] pInput, int pOffset, int pLength, byte[] pOutput) { /* Loop through the buffer */ diff --git a/crypto/src/openpgp/PgpObjectFactory.cs b/crypto/src/openpgp/PgpObjectFactory.cs index 8614d1e63..e2c4ac527 100644 --- a/crypto/src/openpgp/PgpObjectFactory.cs +++ b/crypto/src/openpgp/PgpObjectFactory.cs @@ -50,7 +50,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp { l.Add(new PgpSignature(bcpgIn)); } - catch (UnsupportedPacketVersionException e) + catch (UnsupportedPacketVersionException) { // Signatures of unsupported version MUST BE ignored // see: https://tests.sequoia-pgp.org/#Detached_signatures_with_unknown_packets diff --git a/crypto/src/tls/TlsProtocol.cs b/crypto/src/tls/TlsProtocol.cs index 41d8e109e..e442dd585 100644 --- a/crypto/src/tls/TlsProtocol.cs +++ b/crypto/src/tls/TlsProtocol.cs @@ -1227,7 +1227,7 @@ namespace Org.BouncyCastle.Tls } /// <summary>Gets the amount of received application data.</summary> - /// <remarks>A call to <see cref="readInput(byte[], int, int)"/> is guaranteed to be able to return at least + /// <remarks>A call to <see cref="ReadInput(byte[], int, int)"/> is guaranteed to be able to return at least /// this much data.<br/><br/> /// Only allowed in non-blocking mode. /// </remarks> |