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

◆ GetEncodedSize()

static int System.Security.Cryptography.PemEncoding.GetEncodedSize ( int labelLength,
int dataLength )
inlinestatic

Definition at line 198 of file PemEncoding.cs.

199 {
200 if (labelLength < 0)
201 {
202 throw new ArgumentOutOfRangeException("labelLength", System.SR.ArgumentOutOfRange_NeedPositiveNumber);
203 }
204 if (dataLength < 0)
205 {
206 throw new ArgumentOutOfRangeException("dataLength", System.SR.ArgumentOutOfRange_NeedPositiveNumber);
207 }
208 if (labelLength > 1073741808)
209 {
210 throw new ArgumentOutOfRangeException("labelLength", System.SR.Argument_PemEncoding_EncodedSizeTooLarge);
211 }
212 if (dataLength > 1585834053)
213 {
214 throw new ArgumentOutOfRangeException("dataLength", System.SR.Argument_PemEncoding_EncodedSizeTooLarge);
215 }
216 int num = "-----BEGIN ".Length + labelLength + "-----".Length;
217 int num2 = "-----END ".Length + labelLength + "-----".Length;
218 int num3 = num + num2 + 1;
219 int num4 = (dataLength + 2) / 3 << 2;
220 int result;
221 int num5 = Math.DivRem(num4, 64, out result);
222 if (result > 0)
223 {
224 num5++;
225 }
226 int num6 = num4 + num5;
227 if (int.MaxValue - num6 < num3)
228 {
230 }
231 return num6 + num3;
232 }
static string Argument_PemEncoding_EncodedSizeTooLarge
Definition SR.cs:34
static string ArgumentOutOfRange_NeedPositiveNumber
Definition SR.cs:56
Definition SR.cs:7

References System.SR.Argument_PemEncoding_EncodedSizeTooLarge, System.SR.ArgumentOutOfRange_NeedPositiveNumber, and System.Math.DivRem().

Referenced by System.Security.Cryptography.PemEncoding.TryWrite(), and System.Security.Cryptography.PemEncoding.Write().