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

◆ ToUnsignedIntegerBytes() [4/4]

static byte[] System.Security.Cryptography.KeyBlobHelpers.ToUnsignedIntegerBytes ( this ReadOnlyMemory< byte > memory,
int length )
inlinestaticpackage

Definition at line 5 of file KeyBlobHelpers.cs.

6 {
7 if (memory.Length == length)
8 {
9 return memory.ToArray();
10 }
11 ReadOnlySpan<byte> span = memory.Span;
12 if (memory.Length == length + 1 && span[0] == 0)
13 {
14 return span.Slice(1).ToArray();
15 }
16 if (span.Length > length)
17 {
18 throw new CryptographicException(System.SR.Cryptography_Der_Invalid_Encoding);
19 }
20 byte[] array = new byte[length];
21 span.CopyTo(array.AsSpan(length - span.Length));
22 return array;
23 }
static string Cryptography_Der_Invalid_Encoding
Definition SR.cs:50
Definition SR.cs:7

References System.array, System.ReadOnlySpan< T >.CopyTo(), System.SR.Cryptography_Der_Invalid_Encoding, System.length, System.ReadOnlyMemory< T >.Length, System.ReadOnlySpan< T >.Length, System.ReadOnlySpan< T >.Slice(), System.ReadOnlyMemory< T >.Span, and System.ReadOnlyMemory< T >.ToArray().