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

◆ ConvertDerToIeee1363() [2/2]

static int Internal.Cryptography.AsymmetricAlgorithmHelpers.ConvertDerToIeee1363 ( ReadOnlySpan< byte > input,
int fieldSizeBits,
Span< byte > destination )
inlinestaticpackage

Definition at line 41 of file AsymmetricAlgorithmHelpers.cs.

42 {
43 int num = BitsToBytes(fieldSizeBits);
44 int result = 2 * num;
45 try
46 {
47 AsnValueReader asnValueReader = new AsnValueReader(input, AsnEncodingRules.DER);
48 AsnValueReader asnValueReader2 = asnValueReader.ReadSequence();
49 asnValueReader.ThrowIfNotEmpty();
50 ReadOnlySpan<byte> signatureField = asnValueReader2.ReadIntegerBytes();
51 ReadOnlySpan<byte> signatureField2 = asnValueReader2.ReadIntegerBytes();
52 asnValueReader2.ThrowIfNotEmpty();
53 CopySignatureField(signatureField, destination.Slice(0, num));
54 CopySignatureField(signatureField2, destination.Slice(num, num));
55 return result;
56 }
57 catch (AsnContentException inner)
58 {
60 }
61 }
static void CopySignatureField(ReadOnlySpan< byte > signatureField, Span< byte > response)
static string Cryptography_Der_Invalid_Encoding
Definition SR.cs:50
Definition SR.cs:7
ReadOnlySpan< byte > ReadIntegerBytes(Asn1Tag? expectedTag=null)
AsnValueReader ReadSequence(Asn1Tag? expectedTag=null)

References Internal.Cryptography.AsymmetricAlgorithmHelpers.BitsToBytes(), Internal.Cryptography.AsymmetricAlgorithmHelpers.CopySignatureField(), System.SR.Cryptography_Der_Invalid_Encoding, System.destination, System.input, System.Formats.Asn1.AsnValueReader.ReadIntegerBytes(), System.Formats.Asn1.AsnValueReader.ReadSequence(), System.ReadOnlySpan< T >.Slice(), and System.Formats.Asn1.AsnValueReader.ThrowIfNotEmpty().