Breyta

Deila með


X509Certificate2Collection.Import Method

Definition

Imports a certificate into a X509Certificate2Collection object.

Overloads

Import(String, String, X509KeyStorageFlags)
Obsolete.

Imports a certificate file that requires a password into a X509Certificate2Collection object.

Import(String, ReadOnlySpan<Char>, X509KeyStorageFlags)
Obsolete.

Imports the certificates from the specified file a into this collection.

Import(ReadOnlySpan<Byte>, String, X509KeyStorageFlags)
Obsolete.

Imports the certificates from the provided data into this collection.

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

Imports the certificates from the provided data into this collection.

Import(ReadOnlySpan<Byte>)
Obsolete.

Imports the certificates from the provided data into this collection.

Import(String)
Obsolete.

Imports a certificate file into a X509Certificate2Collection object.

Import(Byte[])
Obsolete.

Imports a certificate in the form of a byte array into a X509Certificate2Collection object.

Import(Byte[], String, X509KeyStorageFlags)
Obsolete.

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)

Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs

Caution

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

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);
[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)

Parameters

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.

Attributes

Remarks

This method can be used with a PFX/PKCS12 file or other certificate files that require a password. 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.

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.

This method supports the following X509ContentType types:

Applies to

Import(String, ReadOnlySpan<Char>, X509KeyStorageFlags)

Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs

Caution

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

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);
[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)

Parameters

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.

Attributes

Applies to

Import(ReadOnlySpan<Byte>, String, X509KeyStorageFlags)

Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs

Caution

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

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);
[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)

Parameters

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.

Attributes

Applies to

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

Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs

Caution

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

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);
[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)

Parameters

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.

Attributes

Applies to

Import(ReadOnlySpan<Byte>)

Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs

Caution

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

Imports the certificates from the provided data into this collection.

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))

Parameters

rawData
ReadOnlySpan<Byte>

The certificate data to read.

Attributes

Applies to

Import(String)

Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs

Caution

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

Imports a certificate file into a X509Certificate2Collection object.

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)

Parameters

fileName
String

The name of the file containing the certificate information.

Attributes

Remarks

This method supports the following X509ContentType types:

Applies to

Import(Byte[])

Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs

Caution

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

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);
[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())

Parameters

rawData
Byte[]

A byte array containing data from an X.509 certificate.

Attributes

Remarks

This method imports a certificate in the form of a byte array into a X509Certificate2Collection object. This method supports the following X509ContentType types:

Applies to

Import(Byte[], String, X509KeyStorageFlags)

Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs
Source:
X509Certificate2Collection.cs

Caution

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

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);
[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)

Parameters

rawData
Byte[]

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.

Attributes

Remarks

This method can be used with a PFX/PKCS12 binary large object (BLOB) protected by a password. 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. This method supports the following X509ContentType types:

Applies to