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

◆ CreateFromPem() [2/2]

static X509Certificate2 System.Security.Cryptography.X509Certificates.X509Certificate2.CreateFromPem ( ReadOnlySpan< char > certPem,
ReadOnlySpan< char > keyPem )
inlinestatic

Definition at line 661 of file X509Certificate2.cs.

662 {
664 string keyAlgorithm = x509Certificate.GetKeyAlgorithm();
665 switch (keyAlgorithm)
666 {
667 case "1.2.840.113549.1.1.1":
668 return ExtractKeyFromPem(keyPem, s_RsaPublicKeyPrivateKeyLabels, RSA.Create, x509Certificate.CopyWithPrivateKey);
669 case "1.2.840.10040.4.1":
671 {
672 return ExtractKeyFromPem(keyPem, s_DsaPublicKeyPrivateKeyLabels, DSA.Create, x509Certificate.CopyWithPrivateKey);
673 }
674 break;
675 case "1.2.840.10045.2.1":
677 {
678 return ExtractKeyFromPem(keyPem, s_EcPublicKeyPrivateKeyLabels, ECDsa.Create, x509Certificate.CopyWithPrivateKey);
679 }
681 {
682 return ExtractKeyFromPem(keyPem, s_EcPublicKeyPrivateKeyLabels, ECDiffieHellman.Create, x509Certificate.CopyWithPrivateKey);
683 }
684 break;
685 }
686 throw new CryptographicException(System.SR.Format(System.SR.Cryptography_UnknownKeyAlgorithm, keyAlgorithm));
687 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Cryptography_UnknownKeyAlgorithm
Definition SR.cs:90
Definition SR.cs:7
static X509Certificate2 CreateFromPem(ReadOnlySpan< char > certPem, ReadOnlySpan< char > keyPem)
static bool IsECDiffieHellman(X509Certificate2 certificate)

References System.Security.Cryptography.DSA.Create(), System.Security.Cryptography.RSA.Create(), System.Security.Cryptography.ECDiffieHellman.Create(), System.Security.Cryptography.ECDsa.Create(), System.Security.Cryptography.X509Certificates.X509Certificate2.CreateFromPem(), System.SR.Cryptography_UnknownKeyAlgorithm, System.Runtime.Serialization.Dictionary, System.SR.Format(), Internal.Cryptography.Helpers.IsDSASupported, System.Security.Cryptography.X509Certificates.X509Certificate2.IsECDiffieHellman(), System.Security.Cryptography.X509Certificates.X509Certificate2.IsECDsa(), System.Security.Cryptography.X509Certificates.X509Certificate2.s_DsaPublicKeyPrivateKeyLabels, System.Security.Cryptography.X509Certificates.X509Certificate2.s_EcPublicKeyPrivateKeyLabels, and System.Security.Cryptography.X509Certificates.X509Certificate2.s_RsaPublicKeyPrivateKeyLabels.

Referenced by System.Security.Cryptography.X509Certificates.X509Certificate2.CreateFromEncryptedPem(), System.Security.Cryptography.X509Certificates.X509Certificate2.CreateFromPem(), and System.Security.Cryptography.X509Certificates.X509Certificate2.CreateFromPemFile().