diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-09-12 13:37:38 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-09-12 13:37:38 +0700 |
commit | 1298385506df2df9f8fd9c1ceacfaf952e02fd5d (patch) | |
tree | 5725137d5bdd744127a7cb91f7822949f85cbf7d /crypto/test | |
parent | Add basic support for JKS keystores (diff) | |
download | BouncyCastle.NET-ed25519-1298385506df2df9f8fd9c1ceacfaf952e02fd5d.tar.xz |
Separate out new IBlockCipherMode from IBlockCipher
Diffstat (limited to 'crypto/test')
-rw-r--r-- | crypto/test/src/crypto/io/test/CipherStreamTest.cs | 4 | ||||
-rw-r--r-- | crypto/test/src/crypto/prng/test/CtrDrbgTest.cs | 10 | ||||
-rw-r--r-- | crypto/test/src/crypto/test/NullTest.cs | 82 |
3 files changed, 2 insertions, 94 deletions
diff --git a/crypto/test/src/crypto/io/test/CipherStreamTest.cs b/crypto/test/src/crypto/io/test/CipherStreamTest.cs index 799b44521..9dc1f4c2a 100644 --- a/crypto/test/src/crypto/io/test/CipherStreamTest.cs +++ b/crypto/test/src/crypto/io/test/CipherStreamTest.cs @@ -144,8 +144,8 @@ namespace Org.BouncyCastle.Crypto.IO.Tests IBlockCipher blockCipher = AesUtilities.CreateEngine(); int bits = 8 * blockCipher.GetBlockSize(); // TODO Is this right? - blockCipher = new CfbBlockCipher(blockCipher, bits); - IBufferedCipher cipher = new BufferedBlockCipher(blockCipher); + IBlockCipherMode blockCipherMode = new CfbBlockCipher(blockCipher, bits); + IBufferedCipher cipher = new BufferedBlockCipher(blockCipherMode); // SecureRandom random = new SecureRandom(); byte[] keyBytes = new byte[32]; diff --git a/crypto/test/src/crypto/prng/test/CtrDrbgTest.cs b/crypto/test/src/crypto/prng/test/CtrDrbgTest.cs index 3e90c5752..047405c77 100644 --- a/crypto/test/src/crypto/prng/test/CtrDrbgTest.cs +++ b/crypto/test/src/crypto/prng/test/CtrDrbgTest.cs @@ -497,11 +497,6 @@ namespace Org.BouncyCastle.Crypto.Prng.Test get { return cipher.AlgorithmName; } } - public bool IsPartialBlockOkay - { - get { return false; } - } - public int GetBlockSize() { return cipher.GetBlockSize(); @@ -520,11 +515,6 @@ namespace Org.BouncyCastle.Crypto.Prng.Test return cipher.ProcessBlock(input, output); } #endif - - public void Reset() - { - cipher.Reset(); - } } } } diff --git a/crypto/test/src/crypto/test/NullTest.cs b/crypto/test/src/crypto/test/NullTest.cs deleted file mode 100644 index 0bc9d28cf..000000000 --- a/crypto/test/src/crypto/test/NullTest.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; - -using NUnit.Framework; - -using Org.BouncyCastle.Crypto.Engines; -using Org.BouncyCastle.Crypto.Parameters; -using Org.BouncyCastle.Utilities.Encoders; -using Org.BouncyCastle.Utilities.Test; - -namespace Org.BouncyCastle.Crypto.Tests -{ - [TestFixture] - public class NullTest - : CipherTest - { - static SimpleTest[] tests = - { - new BlockCipherVectorTest(0, new NullEngine(), - new KeyParameter(Hex.Decode("00")), "00", "00") - }; - - public NullTest() - : base(tests, new NullEngine(), new KeyParameter(new byte[2])) - { - } - - public override string Name - { - get { return "Null"; } - } - - public override void PerformTest() - { - base.PerformTest(); - - IBlockCipher engine = new NullEngine(); - - engine.Init(true, null); - - byte[] buf = new byte[1]; - - engine.ProcessBlock(buf, 0, buf, 0); - - if (buf[0] != 0) - { - Fail("NullCipher changed data!"); - } - - byte[] shortBuf = new byte[0]; - - try - { - engine.ProcessBlock(shortBuf, 0, buf, 0); - - Fail("failed short input check"); - } - catch (DataLengthException) - { - // expected - } - - try - { - engine.ProcessBlock(buf, 0, shortBuf, 0); - - Fail("failed short output check"); - } - catch (DataLengthException) - { - // expected - } - } - - [Test] - public void TestFunction() - { - string resultText = Perform().ToString(); - - Assert.AreEqual(Name + ": Okay", resultText); - } - } -} |