共用方式為


X509Certificate2Collection.Import 方法

定義

將憑證匯入 X509Certificate2Collection 物件。

多載

Import(String, String, X509KeyStorageFlags)
已淘汰.

將需要密碼的憑證檔案匯入 X509Certificate2Collection 物件。

Import(String, ReadOnlySpan<Char>, X509KeyStorageFlags)
已淘汰.

將指定檔案中的憑證匯入至這個集合。

Import(ReadOnlySpan<Byte>, String, X509KeyStorageFlags)
已淘汰.

將所提供數據的憑證匯入此集合。

Import(ReadOnlySpan<Byte>, ReadOnlySpan<Char>, X509KeyStorageFlags)
已淘汰.

將所提供數據的憑證匯入此集合。

Import(ReadOnlySpan<Byte>)
已淘汰.

將所提供數據的憑證匯入此集合。

Import(String)
已淘汰.

將憑證檔案匯入 X509Certificate2Collection 物件。

Import(Byte[])
已淘汰.

將位元組數位形式的憑證匯入至 X509Certificate2Collection 物件。

Import(Byte[], String, X509KeyStorageFlags)
已淘汰.

以需要密碼存取憑證的位元組數位形式,將憑證匯入 X509Certificate2Collection 物件。

Import(String, String, X509KeyStorageFlags)

來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs

警告

Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.

將需要密碼的憑證檔案匯入 X509Certificate2Collection 物件。

public:
 void Import(System::String ^ fileName, System::String ^ password, System::Security::Cryptography::X509Certificates::X509KeyStorageFlags keyStorageFlags);
public void Import (string fileName, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet);
[System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public void Import (string fileName, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet);
public void Import (string fileName, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
member this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Sub Import (fileName As String, password As String, Optional keyStorageFlags As X509KeyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet)
Public Sub Import (fileName As String, password As String, keyStorageFlags As X509KeyStorageFlags)

參數

fileName
String

包含憑證信息的檔名。

password
String

存取憑證資訊所需的密碼。

keyStorageFlags
X509KeyStorageFlags

列舉值的位元組合,可控制憑證匯入的方式和位置。

屬性

備註

這個方法可以搭配 PFX/PKCS12 檔案或其他需要密碼的憑證檔案使用。 您可以建立與 PFX/PKCS12 檔案中憑證相關聯的密鑰容器,並使用 X509KeyStorageFlags 值來控制此程式。 請注意,如果您未建立密鑰容器,則不會保存私鑰。

請注意,PFX/PKCS12 檔案可以包含多個憑證。 這個方法會匯入與私鑰相關聯的第一個憑證,如果找不到私鑰,則找到第一個憑證。

此方法支援下列 X509ContentType 型態:

適用於

Import(String, ReadOnlySpan<Char>, X509KeyStorageFlags)

來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs

警告

Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.

將指定檔案中的憑證匯入至這個集合。

public void Import (string fileName, ReadOnlySpan<char> password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet);
[System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public void Import (string fileName, ReadOnlySpan<char> password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet);
member this.Import : string * ReadOnlySpan<char> * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.Import : string * ReadOnlySpan<char> * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Sub Import (fileName As String, password As ReadOnlySpan(Of Char), Optional keyStorageFlags As X509KeyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet)

參數

fileName
String

包含憑證信息的檔名。

password
ReadOnlySpan<Char>

存取憑證數據所需的密碼。

keyStorageFlags
X509KeyStorageFlags

列舉值的位元組合,可控制憑證的匯入位置及方式。

屬性

適用於

Import(ReadOnlySpan<Byte>, String, X509KeyStorageFlags)

來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs

警告

Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.

將所提供數據的憑證匯入此集合。

public void Import (ReadOnlySpan<byte> rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet);
[System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public void Import (ReadOnlySpan<byte> rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet);
member this.Import : ReadOnlySpan<byte> * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.Import : ReadOnlySpan<byte> * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Sub Import (rawData As ReadOnlySpan(Of Byte), password As String, Optional keyStorageFlags As X509KeyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet)

參數

rawData
ReadOnlySpan<Byte>

要讀取的憑證數據。

password
String

存取憑證數據所需的密碼。

keyStorageFlags
X509KeyStorageFlags

列舉值的位元組合,可控制憑證的匯入位置及方式。

屬性

適用於

Import(ReadOnlySpan<Byte>, ReadOnlySpan<Char>, X509KeyStorageFlags)

來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs

警告

Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.

將所提供數據的憑證匯入此集合。

public void Import (ReadOnlySpan<byte> rawData, ReadOnlySpan<char> password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet);
[System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public void Import (ReadOnlySpan<byte> rawData, ReadOnlySpan<char> password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet);
member this.Import : ReadOnlySpan<byte> * ReadOnlySpan<char> * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.Import : ReadOnlySpan<byte> * ReadOnlySpan<char> * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Sub Import (rawData As ReadOnlySpan(Of Byte), password As ReadOnlySpan(Of Char), Optional keyStorageFlags As X509KeyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet)

參數

rawData
ReadOnlySpan<Byte>

要讀取的憑證數據。

password
ReadOnlySpan<Char>

存取憑證數據所需的密碼。

keyStorageFlags
X509KeyStorageFlags

列舉值的位元組合,可控制憑證的匯入位置及方式。

屬性

適用於

Import(ReadOnlySpan<Byte>)

來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs

警告

Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.

將所提供數據的憑證匯入此集合。

public:
 void Import(ReadOnlySpan<System::Byte> rawData);
public void Import (ReadOnlySpan<byte> rawData);
[System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public void Import (ReadOnlySpan<byte> rawData);
member this.Import : ReadOnlySpan<byte> -> unit
[<System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.Import : ReadOnlySpan<byte> -> unit
Public Sub Import (rawData As ReadOnlySpan(Of Byte))

參數

rawData
ReadOnlySpan<Byte>

要讀取的憑證數據。

屬性

適用於

Import(String)

來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs

警告

Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.

將憑證檔案匯入 X509Certificate2Collection 物件。

public:
 void Import(System::String ^ fileName);
public void Import (string fileName);
[System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public void Import (string fileName);
member this.Import : string -> unit
[<System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.Import : string -> unit
Public Sub Import (fileName As String)

參數

fileName
String

包含憑證信息的檔名。

屬性

備註

此方法支援下列 X509ContentType 型態:

適用於

Import(Byte[])

來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs

警告

Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.

將位元組數位形式的憑證匯入至 X509Certificate2Collection 物件。

public:
 void Import(cli::array <System::Byte> ^ rawData);
public void Import (byte[] rawData);
[System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public void Import (byte[] rawData);
member this.Import : byte[] -> unit
[<System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.Import : byte[] -> unit
Public Sub Import (rawData As Byte())

參數

rawData
Byte[]

位元組陣列,包含來自 X.509 憑證的數據。

屬性

備註

這個方法會將位元組陣列形式的憑證匯入 X509Certificate2Collection 物件。 此方法支援下列 X509ContentType 型態:

適用於

Import(Byte[], String, X509KeyStorageFlags)

來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs
來源:
X509Certificate2Collection.cs

警告

Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.

以需要密碼存取憑證的位元組數位形式,將憑證匯入 X509Certificate2Collection 物件。

public:
 void Import(cli::array <System::Byte> ^ rawData, System::String ^ password, System::Security::Cryptography::X509Certificates::X509KeyStorageFlags keyStorageFlags);
public void Import (byte[] rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet);
[System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public void Import (byte[] rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet);
public void Import (byte[] rawData, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
member this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.", DiagnosticId="SYSLIB0057", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Sub Import (rawData As Byte(), password As String, Optional keyStorageFlags As X509KeyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet)
Public Sub Import (rawData As Byte(), password As String, keyStorageFlags As X509KeyStorageFlags)

參數

rawData
Byte[]

位元組陣列,包含來自 X509Certificate2 對象的數據。

password
String

存取憑證資訊所需的密碼。

keyStorageFlags
X509KeyStorageFlags

列舉值的位元組合,可控制憑證匯入的方式和位置。

屬性

備註

這個方法可以與受密碼保護的 PFX/PKCS12 二進位大型物件(BLOB)搭配使用。 您可以建立與 PFX/PKCS12 BLOB 中憑證相關聯的密鑰容器,並使用 X509KeyStorageFlags 值來控制此程式。 請注意,如果您未建立密鑰容器,則不會保存私鑰。

這個方法會將憑證位元組數位組匯入憑證集合。 此方法支援下列 X509ContentType 型態:

適用於