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

◆ TryEncryptCbcCore()

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

Reimplemented from System.Security.Cryptography.SymmetricAlgorithm.

Definition at line 108 of file RC2Implementation.cs.

109 {
110 if (!ValidKeySize(Key.Length, out var keySizeBits))
111 {
113 }
114 int effectiveKeyLength = ((EffectiveKeySizeValue == 0) ? keySizeBits : EffectiveKeySize);
115 UniversalCryptoTransform universalCryptoTransform = CreateTransformCore(CipherMode.CBC, paddingMode, Key, effectiveKeyLength, iv.ToArray(), BlockSize / 8, 0, BlockSize / 8, encrypting: true);
116 using (universalCryptoTransform)
117 {
118 return universalCryptoTransform.TransformOneShot(plaintext, destination, out bytesWritten);
119 }
120 }
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().