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

◆ GetCiphertextLengthCfb()

int System.Security.Cryptography.SymmetricAlgorithm.GetCiphertextLengthCfb ( int plaintextLength,
PaddingMode paddingMode = PaddingMode::None,
int feedbackSizeInBits = 8 )
inlineinherited

Definition at line 297 of file SymmetricAlgorithm.cs.

298 {
299 if (plaintextLength < 0)
300 {
301 throw new ArgumentOutOfRangeException("plaintextLength", System.SR.ArgumentOutOfRange_NeedNonNegNum);
302 }
303 if (feedbackSizeInBits <= 0)
304 {
305 throw new ArgumentOutOfRangeException("feedbackSizeInBits", System.SR.ArgumentOutOfRange_NeedPosNum);
306 }
307 if (((uint)feedbackSizeInBits & 7u) != 0)
308 {
309 throw new ArgumentException(System.SR.Argument_BitsMustBeWholeBytes, "feedbackSizeInBits");
310 }
311 int num = feedbackSizeInBits >> 3;
312 int result;
313 int num2 = Math.DivRem(plaintextLength, num, out result) * num;
314 switch (paddingMode)
315 {
316 case PaddingMode.None:
317 if (result != 0)
318 {
319 throw new ArgumentException(System.SR.Cryptography_MatchFeedbackSize, "plaintextLength");
320 }
321 goto IL_0083;
322 case PaddingMode.Zeros:
323 if (result == 0)
324 {
325 goto IL_0083;
326 }
327 goto case PaddingMode.PKCS7;
328 case PaddingMode.PKCS7:
329 case PaddingMode.ANSIX923:
330 case PaddingMode.ISO10126:
331 if (int.MaxValue - num2 < num)
332 {
333 throw new ArgumentOutOfRangeException("plaintextLength", System.SR.Cryptography_PlaintextTooLarge);
334 }
335 return num2 + num;
336 default:
337 {
338 throw new ArgumentOutOfRangeException("paddingMode", System.SR.Cryptography_InvalidPaddingMode);
339 }
340 IL_0083:
341 return plaintextLength;
342 }
343 }
static string ArgumentOutOfRange_NeedPosNum
Definition SR.cs:20
static string Cryptography_PlaintextTooLarge
Definition SR.cs:56
static string Cryptography_InvalidPaddingMode
Definition SR.cs:46
static string Argument_BitsMustBeWholeBytes
Definition SR.cs:26
static string ArgumentOutOfRange_NeedNonNegNum
Definition SR.cs:32
static string Cryptography_MatchFeedbackSize
Definition SR.cs:54
Definition SR.cs:7

References System.SR.Argument_BitsMustBeWholeBytes, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.SR.ArgumentOutOfRange_NeedPosNum, System.SR.Cryptography_InvalidPaddingMode, System.SR.Cryptography_MatchFeedbackSize, System.SR.Cryptography_PlaintextTooLarge, and System.Math.DivRem().

Referenced by System.Security.Cryptography.SymmetricAlgorithm.EncryptCfb().