X509Certificate.Import 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
填充 X509Certificate 对象。
重载
Import(String, String, X509KeyStorageFlags) |
已过时.
已过时.
使用一个证书文件中的信息、一个密码和一个 X509Certificate 值填充 X509KeyStorageFlags 对象。 |
Import(String, SecureString, X509KeyStorageFlags) |
已过时.
已过时.
使用一个证书文件中的信息,一个密码和一个密钥存储标志填充 X509Certificate 对象。 |
Import(Byte[], String, X509KeyStorageFlags) |
已过时.
已过时.
使用一个字节数组中的数据、一个密码和用于确定如何导入私钥的标志填充 X509Certificate 对象。 |
Import(Byte[]) |
已过时.
已过时.
使用字节数组中的数据填充 X509Certificate 对象。 |
Import(String) |
已过时.
已过时.
使用证书文件中的信息填充 X509Certificate 对象。 |
Import(Byte[], SecureString, X509KeyStorageFlags) |
已过时.
已过时.
使用一个字节数组中的数据、一个密码和一个密钥存储标志填充 X509Certificate 对象。 |
Import(String, String, X509KeyStorageFlags)
- Source:
- X509Certificate.cs
- Source:
- X509Certificate.cs
- Source:
- X509Certificate.cs
注意
X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.
注意
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.
使用一个证书文件中的信息、一个密码和一个 X509Certificate 值填充 X509KeyStorageFlags 对象。
public:
virtual void Import(System::String ^ fileName, System::String ^ password, System::Security::Cryptography::X509Certificates::X509KeyStorageFlags keyStorageFlags);
public virtual void Import (string fileName, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (string fileName, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (string fileName, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public virtual void Import (string fileName, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual void Import (string fileName, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public virtual void Import (string fileName, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
abstract member Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
abstract member Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Overridable Sub Import (fileName As String, password As String, keyStorageFlags As X509KeyStorageFlags)
参数
- fileName
- String
以字符串形式表示的证书文件的名称。
- password
- String
访问 X.509 证书数据所需的密码。
- keyStorageFlags
- X509KeyStorageFlags
一个枚举值的按位组合,这些值控制在何处以及如何导入证书。
- 属性
例外
fileName
参数为 null
。
仅限 .NET Core 和 .NET 5 及更高版本:在所有情况下。
注解
重要
切勿在源代码中对密码进行硬编码。 可以使用 Ildasm.exe (IL 反汇编程序) (十六进制编辑器)或直接在文本编辑器(如 Notepad.exe)中打开程序集,从程序集检索硬编码密码。
适用于
Import(String, SecureString, X509KeyStorageFlags)
- Source:
- X509Certificate.cs
- Source:
- X509Certificate.cs
- Source:
- X509Certificate.cs
注意
X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.
注意
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.
重要
此 API 不符合 CLS。
使用一个证书文件中的信息,一个密码和一个密钥存储标志填充 X509Certificate 对象。
public:
virtual void Import(System::String ^ fileName, System::Security::SecureString ^ password, System::Security::Cryptography::X509Certificates::X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
public virtual void Import (string fileName, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (string fileName, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (string fileName, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
public virtual void Import (string fileName, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public virtual void Import (string fileName, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Security.SecurityCritical]
public virtual void Import (string fileName, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[<System.CLSCompliant(false)>]
abstract member Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.CLSCompliant(false)>]
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.CLSCompliant(false)>]
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
abstract member Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Security.SecurityCritical>]
abstract member Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Overridable Sub Import (fileName As String, password As SecureString, keyStorageFlags As X509KeyStorageFlags)
参数
- fileName
- String
一个证书文件的名称。
- password
- SecureString
访问 X.509 证书数据所需的密码。
- keyStorageFlags
- X509KeyStorageFlags
一个枚举值的按位组合,这些值控制在何处以及如何导入证书。
- 属性
例外
fileName
参数为 null
。
仅限 .NET Core 和 .NET 5 及更高版本:在所有情况下。
注解
重要
切勿在源代码中对密码进行硬编码。 可以使用 Ildasm.exe (IL 反汇编程序) (十六进制编辑器)或直接在文本编辑器(如 Notepad.exe)中打开程序集,从程序集检索硬编码密码。
适用于
Import(Byte[], String, X509KeyStorageFlags)
- Source:
- X509Certificate.cs
- Source:
- X509Certificate.cs
- Source:
- X509Certificate.cs
注意
X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.
注意
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.
使用一个字节数组中的数据、一个密码和用于确定如何导入私钥的标志填充 X509Certificate 对象。
public:
virtual void Import(cli::array <System::Byte> ^ rawData, System::String ^ password, System::Security::Cryptography::X509Certificates::X509KeyStorageFlags keyStorageFlags);
public virtual void Import (byte[] rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (byte[] rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (byte[] rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public virtual void Import (byte[] rawData, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual void Import (byte[] rawData, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public virtual void Import (byte[] rawData, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
abstract member Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
abstract member Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Overridable Sub Import (rawData As Byte(), password As String, keyStorageFlags As X509KeyStorageFlags)
参数
- rawData
- Byte[]
一个包含 X.509 证书数据的字节数组。
- password
- String
访问 X.509 证书数据所需的密码。
- keyStorageFlags
- X509KeyStorageFlags
一个枚举值的按位组合,这些值控制在何处以及如何导入证书。
- 属性
例外
仅限 .NET Core 和 .NET 5 及更高版本:在所有情况下。
注解
此方法可用于使用字节数组表示的证书的密码填充 X509Certificate 对象。 值 X509KeyStorageFlags 可用于控制私钥的导入位置和方式。
适用于
Import(Byte[])
- Source:
- X509Certificate.cs
- Source:
- X509Certificate.cs
- Source:
- X509Certificate.cs
注意
X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.
注意
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.
使用字节数组中的数据填充 X509Certificate 对象。
public:
virtual void Import(cli::array <System::Byte> ^ rawData);
public virtual void Import (byte[] rawData);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (byte[] rawData);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (byte[] rawData);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual void Import (byte[] rawData);
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public virtual void Import (byte[] rawData);
abstract member Import : byte[] -> unit
override this.Import : byte[] -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : byte[] -> unit
override this.Import : byte[] -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : byte[] -> unit
override this.Import : byte[] -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member Import : byte[] -> unit
override this.Import : byte[] -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
abstract member Import : byte[] -> unit
override this.Import : byte[] -> unit
Public Overridable Sub Import (rawData As Byte())
参数
- rawData
- Byte[]
一个包含 X.509 证书数据的字节数组。
- 属性
例外
仅限 .NET Core 和 .NET 5 及更高版本:在所有情况下。
注解
此方法可用于获取 X.509 证书的原始字节数组,并使用其关联的值填充 X509Certificate 对象。
适用于
Import(String)
- Source:
- X509Certificate.cs
- Source:
- X509Certificate.cs
- Source:
- X509Certificate.cs
注意
X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.
注意
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.
使用证书文件中的信息填充 X509Certificate 对象。
public:
virtual void Import(System::String ^ fileName);
public virtual void Import (string fileName);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (string fileName);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (string fileName);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual void Import (string fileName);
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public virtual void Import (string fileName);
abstract member Import : string -> unit
override this.Import : string -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : string -> unit
override this.Import : string -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : string -> unit
override this.Import : string -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member Import : string -> unit
override this.Import : string -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
abstract member Import : string -> unit
override this.Import : string -> unit
Public Overridable Sub Import (fileName As String)
参数
- fileName
- String
以字符串形式表示的证书文件的名称。
- 属性
例外
fileName
参数为 null
。
仅限 .NET Core 和 .NET 5 及更高版本:在所有情况下。
示例
以下示例从文件加载 X.509 证书,调用 ToString 方法,并将结果显示到控制台。
using namespace System;
using namespace System::Security::Cryptography::X509Certificates;
int main()
{
// The path to the certificate.
String^ Certificate = L"Certificate.cer";
// Load the certificate into an X509Certificate object.
X509Certificate^ cert = gcnew X509Certificate;
cert->Import(Certificate);
// Get the value.
String^ resultsTrue = cert->ToString( true );
// Display the value to the console.
Console::WriteLine( resultsTrue );
// Get the value.
String^ resultsFalse = cert->ToString( false );
// Display the value to the console.
Console::WriteLine( resultsFalse );
}
using System;
using System.Security.Cryptography.X509Certificates;
class X509
{
static void Main()
{
// The path to the certificate.
string Certificate = "Certificate.cer";
// Load the certificate into an X509Certificate object.
X509Certificate cert = new X509Certificate();
cert.Import(Certificate);
// Get the value.
string resultsTrue = cert.ToString(true);
// Display the value to the console.
Console.WriteLine(resultsTrue);
// Get the value.
string resultsFalse = cert.ToString(false);
// Display the value to the console.
Console.WriteLine(resultsFalse);
}
}
Imports System.Security.Cryptography.X509Certificates
Module X509
Sub Main()
' The path to the certificate.
Dim Certificate As String = "Certificate.cer"
' Load the certificate into an X509Certificate object.
Dim cert As New X509Certificate
cert.Import(Certificate)
' Get the value.
Dim resultsTrue As String = cert.ToString(True)
' Display the value to the console.
Console.WriteLine(resultsTrue)
' Get the value.
Dim resultsFalse As String = cert.ToString(False)
' Display the value to the console.
Console.WriteLine(resultsFalse)
End Sub
End Module
注解
此方法使用证书文件 (例如具有 .cer 扩展名的文件,) 表示 X.509 证书,并使用文件包含的证书填充 X509Certificate 对象。
适用于
Import(Byte[], SecureString, X509KeyStorageFlags)
- Source:
- X509Certificate.cs
- Source:
- X509Certificate.cs
- Source:
- X509Certificate.cs
注意
X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.
注意
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.
重要
此 API 不符合 CLS。
使用一个字节数组中的数据、一个密码和一个密钥存储标志填充 X509Certificate 对象。
public:
virtual void Import(cli::array <System::Byte> ^ rawData, System::Security::SecureString ^ password, System::Security::Cryptography::X509Certificates::X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
public virtual void Import (byte[] rawData, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (byte[] rawData, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (byte[] rawData, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
public virtual void Import (byte[] rawData, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public virtual void Import (byte[] rawData, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Security.SecurityCritical]
public virtual void Import (byte[] rawData, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[<System.CLSCompliant(false)>]
abstract member Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.CLSCompliant(false)>]
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.CLSCompliant(false)>]
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
abstract member Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Security.SecurityCritical>]
abstract member Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Overridable Sub Import (rawData As Byte(), password As SecureString, keyStorageFlags As X509KeyStorageFlags)
参数
- rawData
- Byte[]
包含 X.509 证书数据的字节数组。
- password
- SecureString
访问 X.509 证书数据所需的密码。
- keyStorageFlags
- X509KeyStorageFlags
一个枚举值的按位组合,这些值控制在何处以及如何导入证书。
- 属性
例外
仅限 .NET Core 和 .NET 5 及更高版本:在所有情况下。
注解
重要
切勿在源代码中对密码进行硬编码。 可以使用 Ildasm.exe (IL 反汇编程序) (十六进制编辑器)或直接在文本编辑器(如 Notepad.exe)中打开程序集,从程序集检索硬编码密码。