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>
diff --git a/crypto/test/src/crypto/test/NaccacheSternTest.cs b/crypto/test/src/crypto/test/NaccacheSternTest.cs
index 732f0a02a..3f89768f1 100644
--- a/crypto/test/src/crypto/test/NaccacheSternTest.cs
+++ b/crypto/test/src/crypto/test/NaccacheSternTest.cs
@@ -30,8 +30,6 @@ namespace Org.BouncyCastle.Crypto.Tests
public class NaccacheSternTest
: SimpleTest
{
- private const bool debug = false;
-
static readonly NaccacheSternEngine cryptEng = new NaccacheSternEngine();
static readonly NaccacheSternEngine decryptEng = new NaccacheSternEngine();
@@ -105,16 +103,7 @@ namespace Org.BouncyCastle.Crypto.Tests
// Initialize Engines with KeyPair
- if (debug)
- {
- Console.WriteLine("initializing encryption engine");
- }
cryptEng.Init(true, pair.Public);
-
- if (debug)
- {
- Console.WriteLine("initializing decryption engine");
- }
decryptEng.Init(false, pair.Private);
byte[] data = paperTest.ToByteArray();
@@ -132,12 +121,6 @@ namespace Org.BouncyCastle.Crypto.Tests
// 768 Bit test
//
- if (debug)
- {
- Console.WriteLine();
- Console.WriteLine("768 Bit TEST");
- }
-
// specify key generation parameters
NaccacheSternKeyGenerationParameters genParam
= new NaccacheSternKeyGenerationParameters(new SecureRandom(), 768, 8, 30);
@@ -157,16 +140,7 @@ namespace Org.BouncyCastle.Crypto.Tests
// Initialize Engines with KeyPair
- if (debug)
- {
- Console.WriteLine("initializing " + genParam.Strength + " bit encryption engine");
- }
cryptEng.Init(true, pair.Public);
-
- if (debug)
- {
- Console.WriteLine("initializing " + genParam.Strength + " bit decryption engine");
- }
decryptEng.Init(false, pair.Private);
// Basic data input
@@ -261,11 +235,6 @@ namespace Org.BouncyCastle.Crypto.Tests
{
// expected
}
-
- if (debug)
- {
- Console.WriteLine("All tests successful");
- }
}
private byte[] enDeCrypt(
@@ -276,13 +245,6 @@ namespace Org.BouncyCastle.Crypto.Tests
Array.Copy(input, 0, data, 0, data.Length);
// Perform encryption like in the paper from Naccache-Stern
- if (debug)
- {
- Console.WriteLine("encrypting data. Data representation\n"
- // + "As string:.... " + new string(data) + "\n"
- + "As BigInteger: " + new BigInteger(1, data));
- Console.WriteLine("data length is " + data.Length);
- }
try
{
@@ -290,42 +252,18 @@ namespace Org.BouncyCastle.Crypto.Tests
}
catch (InvalidCipherTextException e)
{
- if (debug)
- {
- Console.WriteLine("failed - exception " + e + "\n" + e.Message);
- }
Fail("failed - exception " + e + "\n" + e.Message);
}
- if (debug)
- {
- Console.WriteLine("enrypted data representation\n"
- // + "As string:.... " + new string(data) + "\n"
- + "As BigInteger: " + new BigInteger(1, data));
- Console.WriteLine("data length is " + data.Length);
- }
-
try
{
data = decryptEng.ProcessData(data);
}
catch (InvalidCipherTextException e)
{
- if (debug)
- {
- Console.WriteLine("failed - exception " + e + "\n" + e.Message);
- }
Fail("failed - exception " + e + "\n" + e.Message);
}
- if (debug)
- {
- Console.WriteLine("decrypted data representation\n"
- // + "As string:.... " + new string(data) + "\n"
- + "As BigInteger: " + new BigInteger(1, data));
- Console.WriteLine("data length is " + data.Length);
- }
-
return data;
}
@@ -337,13 +275,9 @@ namespace Org.BouncyCastle.Crypto.Tests
Assert.AreEqual(Name + ": Okay", resultText);
}
- public static void Main(
- string[] args)
+ public static void Main(string[] args)
{
- ITest test = new NaccacheSternTest();
- ITestResult result = test.Perform();
-
- Console.WriteLine(result);
+ RunTest(new NaccacheSternTest());
}
}
}
|