public static void VerifyBlocksizeIVNulling() { using (var testIVAlg = Rijndael.Create()) { using (var alg = Rijndael.Create()) { alg.IV = testIVAlg.IV; alg.BlockSize = 128; Assert.Equal(testIVAlg.IV, alg.IV); } using (var alg = new RijndaelManaged()) { alg.IV = testIVAlg.IV; alg.BlockSize = 128; Assert.Equal(testIVAlg.IV, alg.IV); } using (var alg = new RijndaelLegalSizesBreaker()) { // This one should set IV to null on setting BlockSize since there is only one valid BlockSize alg.IV = testIVAlg.IV; alg.BlockSize = 1; Assert.Throws <NotImplementedException>(() => alg.IV); } using (var alg = new RijndaelMinimal()) { alg.IV = testIVAlg.IV; alg.BlockSize = 128; Assert.Equal(testIVAlg.IV, alg.IV); } } }
public static void RijndaelKeySize_BaseClass() { using (Rijndael alg = new RijndaelMinimal()) { Assert.Equal(128, alg.LegalKeySizes[0].MinSize); Assert.Equal(256, alg.LegalKeySizes[0].MaxSize); Assert.Equal(64, alg.LegalKeySizes[0].SkipSize); Assert.Equal(256, alg.KeySize); Assert.Equal(128, alg.LegalBlockSizes[0].MinSize); Assert.Equal(256, alg.LegalBlockSizes[0].MaxSize); Assert.Equal(64, alg.LegalBlockSizes[0].SkipSize); Assert.Equal(128, alg.BlockSize); } }