X509Certificate2Collection.Import 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将证书导入 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)
注意
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)
注意
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)
注意
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)
注意
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>)
注意
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)
注意
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[])
注意
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)
注意
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 类型: