Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryDecryptCbcCore()

override bool Internal.Cryptography.RC2Implementation.TryDecryptCbcCore ( ReadOnlySpan< byte > ciphertext,
ReadOnlySpan< byte > iv,
Span< byte > destination,
PaddingMode paddingMode,
out int bytesWritten )
inlineprotectedvirtual

Reimplemented from System.Security.Cryptography.SymmetricAlgorithm.

Definition at line 122 of file RC2Implementation.cs.

123 {
124 if (!ValidKeySize(Key.Length, out var keySizeBits))
125 {
127 }
128 int effectiveKeyLength = ((EffectiveKeySizeValue == 0) ? keySizeBits : EffectiveKeySize);
129 UniversalCryptoTransform universalCryptoTransform = CreateTransformCore(CipherMode.CBC, paddingMode, Key, effectiveKeyLength, iv.ToArray(), BlockSize / 8, 0, BlockSize / 8, encrypting: false);
130 using (universalCryptoTransform)
131 {
132 return universalCryptoTransform.TransformOneShot(ciphertext, destination, out bytesWritten);
133 }
134 }
static UniversalCryptoTransform CreateTransformCore(CipherMode cipherMode, PaddingMode paddingMode, byte[] key, int effectiveKeyLength, byte[] iv, int blockSize, int feedbackSize, int paddingSize, bool encrypting)
bool ValidKeySize(int keySizeBytes, out int keySizeBits)
static string Cryptography_InvalidKeySize
Definition SR.cs:92
Definition SR.cs:7

References System.Security.Cryptography.SymmetricAlgorithm.BlockSize, Internal.Cryptography.RC2Implementation.CreateTransformCore(), System.SR.Cryptography_InvalidKeySize, System.destination, Internal.Cryptography.RC2Implementation.EffectiveKeySize, System.Security.Cryptography.RC2.EffectiveKeySizeValue, System.Security.Cryptography.SymmetricAlgorithm.Key, System.ReadOnlySpan< T >.ToArray(), Internal.Cryptography.UniversalCryptoTransform.TransformOneShot(), and Internal.Cryptography.RC2Implementation.ValidKeySize().