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

◆ ExtractKeyFromPem< TAlg >()

static X509Certificate2 System.Security.Cryptography.X509Certificates.X509Certificate2.ExtractKeyFromPem< TAlg > ( ReadOnlySpan< char > keyPem,
string[] labels,
Func< TAlg > factory,
Func< TAlg, X509Certificate2 > import )
inlinestaticprivate
Type Constraints
TAlg :AsymmetricAlgorithm 

Definition at line 764 of file X509Certificate2.cs.

764 : AsymmetricAlgorithm
765 {
767 while (enumerator.MoveNext())
768 {
770 ReadOnlySpan<char> readOnlySpan = contents;
771 PemFields pemFields2 = pemFields;
772 contents = readOnlySpan;
773 ReadOnlySpan<char> span = contents[pemFields2.Label];
774 foreach (string text in labels)
775 {
776 if (span.SequenceEqual(text))
777 {
778 TAlg val = factory();
779 contents = readOnlySpan;
780 val.ImportFromPem(contents[pemFields2.Location]);
781 try
782 {
783 return import(val);
784 }
785 catch (ArgumentException inner)
786 {
787 throw new CryptographicException(System.SR.Cryptography_X509_NoOrMismatchedPemKey, inner);
788 }
789 }
790 }
791 }
792 throw new CryptographicException(System.SR.Cryptography_X509_NoOrMismatchedPemKey);
793 }
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, Internal.Cryptography.PemEnumerator.GetEnumerator(), and System.text.