public void TestBlockDomains() { string encrypted = symBlockCipher.DoEncrypt("AES ", "CBC ", "ZEROBYTEPADDING ", key128, IV128, plainText); Assert.IsFalse(symBlockCipher.HasError()); string decrypted = symBlockCipher.DoDecrypt(" AES", " CBC", " ZEROBYTEPADDING", key128, IV128, encrypted); Assert.IsFalse(symBlockCipher.HasError()); Assert.IsTrue(SecurityUtils.compareStrings(decrypted, plainText)); }
private void testBulkAlgorithmCTS(string algorithm, string[] modes, string[] paddings, string key, string IV, string text) { for (int m = 0; m < arrayModes.Length; m++) { for (int p = 0; p < arrayPaddings.Length; p++) { SymmetricBlockCipher symBlockCipher = new SymmetricBlockCipher(); string encrypted = symBlockCipher.DoEncrypt(algorithm, arrayModes[m], arrayPaddings[p], key, IV, text); string decrypted = symBlockCipher.DoDecrypt(algorithm, arrayModes[m], arrayPaddings[p], key, IV, encrypted); /*eu.setEncoding("UTF_16"); * string encrypted = symBlockCipher.DoEncrypt(algorithm, arrayModes[2], arrayPaddings[0], key, IV, text); * string decrypted = symBlockCipher.DoDecrypt(algorithm, arrayModes[2], arrayPaddings[0], key, IV, * encrypted); * string encoding = eu.getEncoding();*/ string resText = eu.getString(eu.getBytes(text)); Assert.IsTrue(SecurityUtils.compareStrings(resText, decrypted)); True(true, symBlockCipher); } } }