Add one-shot ECB methods
authorKevin Jones <kevin@vcsjones.com>
Mon, 28 Jun 2021 15:55:27 +0000 (11:55 -0400)
committerGitHub <noreply@github.com>
Mon, 28 Jun 2021 15:55:27 +0000 (08:55 -0700)
commit6b5dbf6bdb95aef88262b1eb949f1028c59dc5e2
tree9576e2e9dfe44c2d9b72c27e348e86a6662d9301
parentdaeee34715ea012d7a42af19137fd73f03b1f151
Add one-shot ECB methods

This change adds SymmetricAlgorithm.EncryptEcb, SymmetricAlgorithm.DecryptEcb, their
respective Try- and -Core methods, derived type implementations thereof, and tests.

There's an open question of should these members on on the base class throw or
"succeed if the Mode property is in agreement with the algorithm".  While the latter is "nicer",
just throwing  is easier to reason about, and that's the current behavior.

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
48 files changed:
src/libraries/Common/src/Internal/Cryptography/BasicSymmetricCipherBCrypt.cs
src/libraries/Common/src/Internal/Cryptography/Helpers.cs
src/libraries/Common/src/Internal/Cryptography/UniversalCryptoDecryptor.cs
src/libraries/Common/src/Internal/Cryptography/UniversalCryptoEncryptor.cs
src/libraries/Common/src/Internal/Cryptography/UniversalCryptoTransform.cs
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesCipherTests.OneShot.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesCipherTests.cs
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DES/DESCipherTests.OneShot.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DES/DESCipherTests.cs
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RC2/RC2CipherTests.OneShot.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RC2/RC2CipherTests.cs
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/TripleDES/TripleDESCipherTests.OneShot.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/TripleDES/TripleDESCipherTests.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.OSX.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.Unix.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.Windows.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AesImplementation.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/AppleCCCryptor.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.Android.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.OSX.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.Unix.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.Windows.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/DesImplementation.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.Android.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.OSX.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.Unix.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.Windows.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RC2Implementation.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.OSX.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.Unix.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.Windows.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/TripleDesImplementation.cs
src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj
src/libraries/System.Security.Cryptography.Cng/src/Internal/Cryptography/BasicSymmetricCipherNCrypt.cs
src/libraries/System.Security.Cryptography.Cng/src/Internal/Cryptography/CngSymmetricAlgorithmCore.cs
src/libraries/System.Security.Cryptography.Cng/src/Internal/Cryptography/ICngSymmetricAlgorithm.cs
src/libraries/System.Security.Cryptography.Cng/src/System/Security/Cryptography/AesCng.cs
src/libraries/System.Security.Cryptography.Cng/src/System/Security/Cryptography/TripleDESCng.cs
src/libraries/System.Security.Cryptography.Cng/tests/AesCngTests.cs
src/libraries/System.Security.Cryptography.Cng/tests/SymmetricCngTestHelpers.cs
src/libraries/System.Security.Cryptography.Cng/tests/System.Security.Cryptography.Cng.Tests.csproj
src/libraries/System.Security.Cryptography.Cng/tests/TripleDESCngTests.cs
src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DESCryptoServiceProvider.Windows.cs
src/libraries/System.Security.Cryptography.Csp/tests/ShimHelpers.cs
src/libraries/System.Security.Cryptography.Primitives/ref/System.Security.Cryptography.Primitives.cs
src/libraries/System.Security.Cryptography.Primitives/src/Resources/Strings.resx
src/libraries/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/SymmetricAlgorithm.cs
src/libraries/System.Security.Cryptography.Primitives/tests/SymmetricAlgorithmTests.cs