X509Certificate2Collection.Import 方法
定义
将证书导入到 X509Certificate2Collection 对象。Imports a certificate into a X509Certificate2Collection object.
重载
| Import(String, String, X509KeyStorageFlags) |
将要求密码的证书文件导入到 X509Certificate2Collection 对象。Imports a certificate file that requires a password into a X509Certificate2Collection object. |
| Import(String, ReadOnlySpan<Char>, X509KeyStorageFlags) |
将指定文件中的证书导入到此集合中。Imports the certificates from the specified file a into this collection. |
| Import(ReadOnlySpan<Byte>, String, X509KeyStorageFlags) |
将提供的数据中的证书导入到此集合中。Imports the certificates from the provided data into this collection. |
| Import(ReadOnlySpan<Byte>, ReadOnlySpan<Char>, X509KeyStorageFlags) |
将提供的数据中的证书导入到此集合中。Imports the certificates from the provided data into this collection. |
| Import(ReadOnlySpan<Byte>) |
将提供的数据中的证书导入到此集合中。Imports the certificates from the provided data into this collection. |
| Import(String) |
将证书文件导入到 X509Certificate2Collection 对象。Imports a certificate file into a X509Certificate2Collection object. |
| Import(Byte[]) |
将字节数组形式的证书导入到 X509Certificate2Collection 对象。Imports a certificate in the form of a byte array into a X509Certificate2Collection object. |
| Import(Byte[], String, X509KeyStorageFlags) |
将需要密码才能访问的、字节数组形式的证书导入到 X509Certificate2Collection 对象。Imports a certificate, in the form of a byte array that requires a password to access the certificate, into a X509Certificate2Collection object. |
Import(String, String, X509KeyStorageFlags)
将要求密码的证书文件导入到 X509Certificate2Collection 对象。Imports a certificate file that requires a password into a X509Certificate2Collection object.
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);
public void Import (string fileName, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
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
包含证书信息的文件的名称。The name of the file containing the certificate information.
- password
- String
访问证书信息所需的密码。The password required to access the certificate information.
- keyStorageFlags
- X509KeyStorageFlags
控制如何导入证书以及导入地点的枚举值的按位组合。A bitwise combination of the enumeration values that control how and where the certificate is imported.
注解
此方法可用于 PFX/PKCS12 文件或其他需要密码的证书文件。This method can be used with a PFX/PKCS12 file or other certificate files that require a password. 可以创建与 PFX/PKCS12 文件中的证书相关联的密钥容器,并且 X509KeyStorageFlags 可以使用该值来控制此进程。Key containers associated with certificates in the PFX/PKCS12 file can be created and X509KeyStorageFlags value can be used to control this process. 请注意,如果不创建密钥容器,则不会保留私钥。Note that if you do not create a key container, the private key is not persisted.
请注意,PFX/PKCS12 文件可以包含多个证书。Note that a PFX/PKCS12 file can contain more than one certificate. 此方法将导入与私钥关联的第一个证书,或者,如果未找到私钥,则找到第一个证书。This method imports the first certificate associated with the private key or, if no private key is found, the first certificate found.
此方法支持以下 X509ContentType 类型:This method supports the following X509ContentType types:
适用于
Import(String, ReadOnlySpan<Char>, X509KeyStorageFlags)
将指定文件中的证书导入到此集合中。Imports the certificates from the specified file a into this collection.
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
Public Sub Import (fileName As String, password As ReadOnlySpan(Of Char), Optional keyStorageFlags As X509KeyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet)
参数
- fileName
- String
包含证书信息的文件的名称。The name of the file containing the certificate information.
- password
- ReadOnlySpan<Char>
访问证书数据所需的密码。The password required to access the certificate data.
- keyStorageFlags
- X509KeyStorageFlags
一个枚举值的按位组合,这些值控制在何处以及如何导入证书。A bitwise combination of the enumeration values that control where and how to import the certificate.
适用于
Import(ReadOnlySpan<Byte>, String, X509KeyStorageFlags)
将提供的数据中的证书导入到此集合中。Imports the certificates from the provided data into this collection.
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
Public Sub Import (rawData As ReadOnlySpan(Of Byte), password As String, Optional keyStorageFlags As X509KeyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet)
参数
- rawData
- ReadOnlySpan<Byte>
要读取的证书数据。The certificate data to read.
- password
- String
访问证书数据所需的密码。The password required to access the certificate data.
- keyStorageFlags
- X509KeyStorageFlags
一个枚举值的按位组合,这些值控制在何处以及如何导入证书。A bitwise combination of the enumeration values that control where and how to import the certificate.
适用于
Import(ReadOnlySpan<Byte>, ReadOnlySpan<Char>, X509KeyStorageFlags)
将提供的数据中的证书导入到此集合中。Imports the certificates from the provided data into this collection.
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
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>
要读取的证书数据。The certificate data to read.
- password
- ReadOnlySpan<Char>
访问证书数据所需的密码。The password required to access the certificate data.
- keyStorageFlags
- X509KeyStorageFlags
一个枚举值的按位组合,这些值控制在何处以及如何导入证书。A bitwise combination of the enumeration values that control where and how to import the certificate.
适用于
Import(ReadOnlySpan<Byte>)
将提供的数据中的证书导入到此集合中。Imports the certificates from the provided data into this collection.
public:
void Import(ReadOnlySpan<System::Byte> rawData);
public void Import (ReadOnlySpan<byte> rawData);
member this.Import : ReadOnlySpan<byte> -> unit
Public Sub Import (rawData As ReadOnlySpan(Of Byte))
参数
- rawData
- ReadOnlySpan<Byte>
要读取的证书数据。The certificate data to read.
适用于
Import(String)
将证书文件导入到 X509Certificate2Collection 对象。Imports a certificate file into a X509Certificate2Collection object.
public:
void Import(System::String ^ fileName);
public void Import (string fileName);
member this.Import : string -> unit
Public Sub Import (fileName As String)
参数
- fileName
- String
包含证书信息的文件的名称。The name of the file containing the certificate information.
注解
此方法支持以下 X509ContentType 类型:This method supports the following X509ContentType types:
适用于
Import(Byte[])
将字节数组形式的证书导入到 X509Certificate2Collection 对象。Imports a certificate in the form of a byte array into a X509Certificate2Collection object.
public:
void Import(cli::array <System::Byte> ^ rawData);
public void Import (byte[] rawData);
member this.Import : byte[] -> unit
Public Sub Import (rawData As Byte())
参数
- rawData
- Byte[]
一个包含 X.509 证书数据的字节数组。A byte array containing data from an X.509 certificate.
注解
此方法将字节数组形式的证书导入 X509Certificate2Collection 对象。This method imports a certificate in the form of a byte array into a X509Certificate2Collection object. 此方法支持以下 X509ContentType 类型:This method supports the following X509ContentType types:
适用于
Import(Byte[], String, X509KeyStorageFlags)
将需要密码才能访问的、字节数组形式的证书导入到 X509Certificate2Collection 对象。Imports a certificate, in the form of a byte array that requires a password to access the certificate, into a X509Certificate2Collection object.
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);
public void Import (byte[] rawData, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
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 对象的数据的字节数组。A byte array containing data from an X509Certificate2 object.
- password
- String
访问证书信息所需的密码。The password required to access the certificate information.
- keyStorageFlags
- X509KeyStorageFlags
控制如何导入证书以及导入地点的枚举值的按位组合。A bitwise combination of the enumeration values that control how and where the certificate is imported.
注解
此方法可用于 PFX/PKCS12 二进制大型对象 (BLOB) 受密码保护。This method can be used with a PFX/PKCS12 binary large object (BLOB) protected by a password. 可在 PFX/PKCS12 BLOB 中创建与证书关联的密钥容器,并 X509KeyStorageFlags 使用该值来控制此过程。Key containers associated with certificates in the PFX/PKCS12 BLOB can be created and the X509KeyStorageFlags value can be used to control this process. 请注意,如果不创建密钥容器,则不会保留私钥。Note that if you do not create a key container, the private key is not persisted.
此方法将证书字节数组导入证书的集合。This method imports a certificate byte array into a collection of certificates. 此方法支持以下 X509ContentType 类型:This method supports the following X509ContentType types: