Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ CreateFromEncryptedPem()

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

Definition at line 689 of file X509Certificate2.cs.

690 {
692 string keyAlgorithm = x509Certificate.GetKeyAlgorithm();
693 switch (keyAlgorithm)
694 {
695 case "1.2.840.113549.1.1.1":
696 return ExtractKeyFromEncryptedPem(keyPem, password, RSA.Create, x509Certificate.CopyWithPrivateKey);
697 case "1.2.840.10040.4.1":
699 {
700 return ExtractKeyFromEncryptedPem(keyPem, password, DSA.Create, x509Certificate.CopyWithPrivateKey);
701 }
702 break;
703 case "1.2.840.10045.2.1":
705 {
706 return ExtractKeyFromEncryptedPem(keyPem, password, ECDsa.Create, x509Certificate.CopyWithPrivateKey);
707 }
709 {
710 return ExtractKeyFromEncryptedPem(keyPem, password, ECDiffieHellman.Create, x509Certificate.CopyWithPrivateKey);
711 }
712 break;
713 }
714 throw new CryptographicException(System.SR.Format(System.SR.Cryptography_UnknownKeyAlgorithm, keyAlgorithm));
715 }
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(), and System.Security.Cryptography.X509Certificates.X509Certificate2.IsECDsa().

Referenced by System.Security.Cryptography.X509Certificates.X509Certificate2.CreateFromEncryptedPemFile().