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

◆ GetMaxDerSignatureSize()

static int Internal.Cryptography.AsymmetricAlgorithmHelpers.GetMaxDerSignatureSize ( int fieldSizeBits)
inlinestaticpackage

Definition at line 63 of file AsymmetricAlgorithmHelpers.cs.

64 {
65 int num = BitsToBytes(fieldSizeBits + 1);
66 if (num <= 61)
67 {
68 return 2 * num + 6;
69 }
70 if (num <= 127)
71 {
72 return 2 * num + 7;
73 }
74 int num2 = 2 + GetDerLengthLength(num) + num;
75 int num3 = 2 * num2;
76 return 2 + GetDerLengthLength(num3) + num3;
77 static int GetDerLengthLength(int payloadLength)
78 {
79 if (payloadLength <= 127)
80 {
81 return 0;
82 }
83 if (payloadLength <= 255)
84 {
85 return 1;
86 }
87 if (payloadLength <= 65535)
88 {
89 return 2;
90 }
91 if (payloadLength <= 16777215)
92 {
93 return 3;
94 }
95 return 4;
96 }
97 }

References Internal.Cryptography.AsymmetricAlgorithmHelpers.BitsToBytes().

Referenced by System.Security.Cryptography.DSA.GetMaxSignatureSize(), and System.Security.Cryptography.ECDsa.GetMaxSignatureSize().