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

◆ ExtractKeyFromEncryptedPem< TAlg >()

static X509Certificate2 System.Security.Cryptography.X509Certificates.X509Certificate2.ExtractKeyFromEncryptedPem< TAlg > ( ReadOnlySpan< char > keyPem,
ReadOnlySpan< char > password,
Func< TAlg > factory,
Func< TAlg, X509Certificate2 > import )
inlinestaticprivate
Type Constraints
TAlg :AsymmetricAlgorithm 

Definition at line 795 of file X509Certificate2.cs.

795 : AsymmetricAlgorithm
796 {
798 while (enumerator.MoveNext())
799 {
801 ReadOnlySpan<char> readOnlySpan = contents;
802 PemFields pemFields2 = pemFields;
803 contents = readOnlySpan;
804 ReadOnlySpan<char> span = contents[pemFields2.Label];
805 if (span.SequenceEqual("ENCRYPTED PRIVATE KEY"))
806 {
807 TAlg val = factory();
808 contents = readOnlySpan;
809 val.ImportFromEncryptedPem(contents[pemFields2.Location], password);
810 try
811 {
812 return import(val);
813 }
814 catch (ArgumentException inner)
815 {
816 throw new CryptographicException(System.SR.Cryptography_X509_NoOrMismatchedPemKey, inner);
817 }
818 }
819 }
820 throw new CryptographicException(System.SR.Cryptography_X509_NoOrMismatchedPemKey);
821 }
static string Cryptography_X509_NoOrMismatchedPemKey
Definition SR.cs:106
Definition SR.cs:7
void Deconstruct(out ReadOnlySpan< char > contents, out PemFields pemFields)

References System.SR.Cryptography_X509_NoOrMismatchedPemKey, Internal.Cryptography.PemEnumerator.Enumerator.Current, Internal.Cryptography.PemEnumerator.Enumerator.PemFieldItem.Deconstruct(), System.Runtime.Serialization.Dictionary, and Internal.Cryptography.PemEnumerator.GetEnumerator().