Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static void DecryptKnownCBC256()
TestAesDecrypt(CipherMode.CBC, s_aes256Key, s_aes256CbcIv, encryptedBytes, s_multiBlockBytes);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void DecryptKnownCFB128_256()
{
byte[] encryptedBytes = new byte[]
Expand Down Expand Up @@ -122,7 +122,7 @@ public static void DecryptKnownECB192()
TestAesDecrypt(CipherMode.ECB, s_aes192Key, null, encryptedBytes, s_multiBlockBytes);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void DecryptKnownCFB128_192()
{
byte[] encryptedBytes = new byte[]
Expand All @@ -144,7 +144,7 @@ public static void DecryptKnownCFB128_192()
TestAesDecrypt(CipherMode.CFB, s_aes192Key, s_aes256CbcIv, encryptedBytes, s_multiBlockBytes, 128);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void DecryptKnownCFB128_128()
{
byte[] encryptedBytes = new byte[]
Expand Down Expand Up @@ -372,7 +372,7 @@ public static void VerifyKnownTransform_ECB192_NoPadding_2()
cipherBytes: new byte[] { 0x6C, 0xD0, 0x25, 0x13, 0xE8, 0xD4, 0xDC, 0x98, 0x6B, 0x4A, 0xFE, 0x08, 0x7A, 0x60, 0xBD, 0x0C });
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_8_NoPadding()
{
TestAesTransformDirectKey(
Expand All @@ -385,7 +385,7 @@ public static void VerifyKnownTransform_CFB128_8_NoPadding()
8);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_128_NoPadding()
{
TestAesTransformDirectKey(
Expand Down Expand Up @@ -422,7 +422,7 @@ public static void VerifyKnownTransform_CBC256_NoPadding()
cipherBytes: new byte[] { 0x19, 0x46, 0xDA, 0xBF, 0x6A, 0x03, 0xA2, 0xA2, 0xC3, 0xD0, 0xB0, 0x50, 0x80, 0xAE, 0xD6, 0xFC });
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_256_NoPadding()
{
TestAesTransformDirectKey(
Expand Down Expand Up @@ -460,7 +460,7 @@ public static void VerifyKnownTransform_CBC128_NoPadding_2()
cipherBytes: new byte[] { 0x0E, 0xDD, 0x33, 0xD3, 0xC6, 0x21, 0xE5, 0x46, 0x45, 0x5B, 0xD8, 0xBA, 0x14, 0x18, 0xBE, 0xC8 });
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_128_NoPadding_2()
{
TestAesTransformDirectKey(
Expand All @@ -485,7 +485,7 @@ public static void VerifyKnownTransform_CBC128_NoPadding_3()
cipherBytes: new byte[] { 0x3A, 0xD7, 0x8E, 0x72, 0x6C, 0x1E, 0xC0, 0x2B, 0x7E, 0xBF, 0xE9, 0x2B, 0x23, 0xD9, 0xEC, 0x34 });
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_128_NoPadding_3()
{
TestAesTransformDirectKey(
Expand All @@ -510,7 +510,7 @@ public static void VerifyKnownTransform_CBC192_NoPadding()
cipherBytes: new byte[] { 0xDE, 0x88, 0x5D, 0xC8, 0x7F, 0x5A, 0x92, 0x59, 0x40, 0x82, 0xD0, 0x2C, 0xC1, 0xE1, 0xB4, 0x2C });
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_192_NoPadding()
{
TestAesTransformDirectKey(
Expand Down Expand Up @@ -548,7 +548,7 @@ public static void VerifyKnownTransform_CBC192_NoPadding_2()
cipherBytes: new byte[] { 0x6C, 0xD0, 0x25, 0x13, 0xE8, 0xD4, 0xDC, 0x98, 0x6B, 0x4A, 0xFE, 0x08, 0x7A, 0x60, 0xBD, 0x0C });
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_192_NoPadding_2()
{
TestAesTransformDirectKey(
Expand Down Expand Up @@ -672,7 +672,7 @@ public static void VerifyKnownTransform_CFB8_128_NoPadding_4()
feedbackSize: 8);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_128_NoPadding_4_Fails()
{
Assert.Throws<CryptographicException>(() =>
Expand All @@ -687,7 +687,7 @@ public static void VerifyKnownTransform_CFB128_128_NoPadding_4_Fails()
);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_128_PKCS7_4()
{
TestAesTransformDirectKey(
Expand Down Expand Up @@ -821,7 +821,7 @@ public static void VerifyKnownTransform_CFB8_256_NoOrZeroPadding_9_Extended(Padd
feedbackSize: 8);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_128_NoPadding_0()
{
// NIST CAVP AESMMT.ZIP CFB128MMT128.rsp, [ENCRYPT] COUNT=0
Expand All @@ -835,7 +835,7 @@ public static void VerifyKnownTransform_CFB128_128_NoPadding_0()
feedbackSize: 128);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_128_NoPadding_1_Extended()
{
// NIST CAVP AESMMT.ZIP CFB128MMT128.rsp, [ENCRYPT] COUNT=1
Expand All @@ -849,7 +849,7 @@ public static void VerifyKnownTransform_CFB128_128_NoPadding_1_Extended()
feedbackSize: 128);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_192_NoPadding_0_Extended()
{
// NIST CAVP AESMMT.ZIP CFB128MMT192.rsp, [ENCRYPT] COUNT=0
Expand All @@ -863,7 +863,7 @@ public static void VerifyKnownTransform_CFB128_192_NoPadding_0_Extended()
feedbackSize: 128);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_192_NoPadding_1_Extended()
{
// NIST CAVP AESMMT.ZIP CFB128MMT192.rsp, [ENCRYPT] COUNT=1
Expand All @@ -877,7 +877,7 @@ public static void VerifyKnownTransform_CFB128_192_NoPadding_1_Extended()
feedbackSize: 128);
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Theory]
[InlineData(CipherMode.CBC, 0)]
[InlineData(CipherMode.CFB, 128)]
[InlineData(CipherMode.CFB, 8)]
Expand Down Expand Up @@ -907,7 +907,7 @@ public static void EncryptorReuse_LeadsToSameResults(CipherMode cipherMode, int
}
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Theory]
[InlineData(CipherMode.CBC, 0)]
[InlineData(CipherMode.CFB, 128)]
[InlineData(CipherMode.CFB, 8)]
Expand Down Expand Up @@ -942,7 +942,7 @@ public static void DecryptorReuse_LeadsToSameResults(CipherMode cipherMode, int
}
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_256_NoPadding_0_Extended()
{
// NIST CAVP AESMMT.ZIP CFB128MMT256.rsp, [ENCRYPT] COUNT=0
Expand All @@ -956,7 +956,7 @@ public static void VerifyKnownTransform_CFB128_256_NoPadding_0_Extended()
feedbackSize: 128);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void VerifyKnownTransform_CFB128_256_NoPadding_1_Extended()
{
// NIST CAVP AESMMT.ZIP CFB128MMT256.rsp, [ENCRYPT] COUNT=1
Expand All @@ -975,12 +975,7 @@ public static IEnumerable<object[]> AesZeroPadData
get
{
yield return new object[] { CipherMode.CBC };

if (!PlatformDetection.IsWindows7)
{
// Windows 7 does not support CFB128.
yield return new object[] { CipherMode.CFB };
}
yield return new object[] { CipherMode.CFB };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,6 @@ public static void InvalidCFBFeedbackSizes(int feedbackSize, bool discoverableIn
[InlineData(128)]
public static void ValidCFBFeedbackSizes(int feedbackSize)
{
// Windows 7 only supports CFB8.
if (feedbackSize != 8 && PlatformDetection.IsWindows7)
{
return;
}

using (Aes aes = AesFactory.Create())
{
aes.GenerateKey();
Expand Down Expand Up @@ -497,7 +491,7 @@ public static void SetKeySize_MakesRandomKey(int keySize)
{
one = enc.TransformFinalBlock(Array.Empty<byte>(), 0, 0);
}

iv = aes.IV;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,12 @@ public static void SupportsCFB8()
SupportsMode(CipherMode.CFB, feedbackSize: 8);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
[Fact]
public static void SupportsCFB128()
{
SupportsMode(CipherMode.CFB, feedbackSize: 128);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsWindows7))]
public static void Windows7DoesNotSupportCFB128()
{
DoesNotSupportMode(CipherMode.CFB, feedbackSize: 128);
}

[Fact]
public static void DoesNotSupportCTS()
{
Expand Down
Loading
Loading