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

◆ FromECPrivateKey() [3/4]

static unsafe ECParameters System.Security.Cryptography.EccKeyFormatHelper.FromECPrivateKey ( ReadOnlySpan< byte > key,
out int bytesRead )
inlinestaticpackage

Definition at line 12 of file EccKeyFormatHelper.cs.

13 {
14 try
15 {
16 AsnDecoder.ReadEncodedValue(key, AsnEncodingRules.BER, out var _, out var _, out var bytesConsumed);
17 fixed (byte* pointer = &MemoryMarshal.GetReference(key))
18 {
19 using MemoryManager<byte> memoryManager = new PointerMemoryManager<byte>(pointer, bytesConsumed);
21 FromECPrivateKey(memoryManager.Memory, in algId, out var ret);
22 bytesRead = bytesConsumed;
23 return ret;
24 }
25 }
26 catch (AsnContentException inner)
27 {
28 throw new CryptographicException(System.SR.Cryptography_Der_Invalid_Encoding, inner);
29 }
30 }
static Asn1Tag ReadEncodedValue(ReadOnlySpan< byte > source, AsnEncodingRules ruleSet, out int contentOffset, out int contentLength, out int bytesConsumed)
Definition AsnDecoder.cs:57
static string Cryptography_Der_Invalid_Encoding
Definition SR.cs:50
Definition SR.cs:7
static unsafe ECParameters FromECPrivateKey(ReadOnlySpan< byte > key, out int bytesRead)

References System.SR.Cryptography_Der_Invalid_Encoding, System.Security.Cryptography.EccKeyFormatHelper.FromECPrivateKey(), System.key, System.pointer, and System.Formats.Asn1.AsnDecoder.ReadEncodedValue().

Referenced by System.Security.Cryptography.EccKeyFormatHelper.FromECPrivateKey(), System.Security.Cryptography.EccKeyFormatHelper.FromECPrivateKey(), System.Security.Cryptography.ECDiffieHellman.ImportECPrivateKey(), System.Security.Cryptography.ECDsa.ImportECPrivateKey(), System.Security.Cryptography.ECDiffieHellman.ImportEncryptedPkcs8PrivateKey(), System.Security.Cryptography.ECDsa.ImportEncryptedPkcs8PrivateKey(), System.Security.Cryptography.ECDiffieHellman.ImportEncryptedPkcs8PrivateKey(), System.Security.Cryptography.ECDsa.ImportEncryptedPkcs8PrivateKey(), System.Security.Cryptography.ECDiffieHellman.ImportPkcs8PrivateKey(), System.Security.Cryptography.ECDsa.ImportPkcs8PrivateKey(), and System.Security.Cryptography.CngPkcs8.RewritePkcs8ECPrivateKeyWithZeroPublicKey().