X509Certificate2Collection.Import 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將憑證匯 X509Certificate2Collection 入物件。
多載
| 名稱 | Description |
|---|---|
| Import(Byte[]) |
已淘汰.
將以位元組陣列形式匯入憑證到物件中 X509Certificate2Collection 。 |
| Import(ReadOnlySpan<Byte>) |
已淘汰.
將所提供資料中的憑證匯入此集合。 |
| Import(String) |
已淘汰.
將憑證檔案 X509Certificate2Collection 匯入物件。 |
| Import(Byte[], String, X509KeyStorageFlags) |
已淘汰.
將憑證以位元組陣列的形式匯入,該陣列需要密碼才能存取憑證,並匯入物件。X509Certificate2Collection |
| Import(ReadOnlySpan<Byte>, ReadOnlySpan<Char>, X509KeyStorageFlags) |
已淘汰.
將所提供資料中的憑證匯入此集合。 |
| Import(ReadOnlySpan<Byte>, String, X509KeyStorageFlags) |
已淘汰.
將所提供資料中的憑證匯入此集合。 |
| Import(String, ReadOnlySpan<Char>, X509KeyStorageFlags) |
已淘汰.
將指定檔案 a 的憑證匯入此集合。 |
| Import(String, String, X509KeyStorageFlags) |
已淘汰.
將需要密碼的憑證檔案匯入物件。X509Certificate2Collection |
Import(Byte[])
警告
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.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);
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}")>]
member this.Import : byte[] -> unit
member this.Import : byte[] -> unit
Public Sub Import (rawData As Byte())
參數
- rawData
- Byte[]
一個包含 X.509 憑證資料的位元組陣列。
- 屬性
備註
此方法將以位元組陣列形式匯入憑證到物件中 X509Certificate2Collection 。 此方法支援以下 X509ContentType 類型:
適用於
Import(ReadOnlySpan<Byte>)
警告
Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.
將所提供資料中的憑證匯入此集合。
public:
void Import(ReadOnlySpan<System::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);
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}")>]
member this.Import : ReadOnlySpan<byte> -> unit
member this.Import : ReadOnlySpan<byte> -> unit
Public Sub Import (rawData As ReadOnlySpan(Of Byte))
參數
- rawData
- ReadOnlySpan<Byte>
要讀取的憑證資料。
- 屬性
適用於
Import(String)
警告
Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.
將憑證檔案 X509Certificate2Collection 匯入物件。
public:
void Import(System::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);
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}")>]
member this.Import : string -> unit
member this.Import : string -> unit
Public Sub Import (fileName As String)
參數
- fileName
- String
包含憑證資訊的檔案名稱。
- 屬性
備註
此方法支援以下 X509ContentType 類型:
適用於
Import(Byte[], String, X509KeyStorageFlags)
警告
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);
[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 = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet);
public void Import(byte[] rawData, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[<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
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 類型:
適用於
Import(ReadOnlySpan<Byte>, ReadOnlySpan<Char>, X509KeyStorageFlags)
警告
Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.
將所提供資料中的憑證匯入此集合。
[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);
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}")>]
member this.Import : ReadOnlySpan<byte> * ReadOnlySpan<char> * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
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>, String, X509KeyStorageFlags)
警告
Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.
將所提供資料中的憑證匯入此集合。
[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);
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}")>]
member this.Import : ReadOnlySpan<byte> * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
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(String, ReadOnlySpan<Char>, X509KeyStorageFlags)
警告
Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.
將指定檔案 a 的憑證匯入此集合。
[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);
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}")>]
member this.Import : string * ReadOnlySpan<char> * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
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(String, String, X509KeyStorageFlags)
警告
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);
[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 = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet);
public void Import(string fileName, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[<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
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 類型: