Partilhar via


X509Certificate.Import Método

Definição

Popula um objeto X509Certificate.

Sobrecargas

Import(String, String, X509KeyStorageFlags)
Obsoleto.
Obsoleto.

Popula o objeto X509Certificate com informações de um arquivo de certificado, uma senha e um valor X509KeyStorageFlags.

Import(String, SecureString, X509KeyStorageFlags)
Obsoleto.
Obsoleto.

Popula um objeto X509Certificate com informações de um arquivo de certificado, uma senha e um sinalizador de armazenamento de chaves.

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

Popula o objeto X509Certificate usando dados de uma matriz de bytes, uma senha e sinalizadores para determinar como a chave privada é importada.

Import(Byte[])
Obsoleto.
Obsoleto.

Preenche o objeto X509Certificate com os dados de uma matriz de bytes.

Import(String)
Obsoleto.
Obsoleto.

Popula o objeto X509Certificate com informações de um arquivo de certificado.

Import(Byte[], SecureString, X509KeyStorageFlags)
Obsoleto.
Obsoleto.

Popula um objeto X509Certificate usando dados de uma matriz de bytes, uma senha e um sinalizador de armazenamento de chaves.

Import(String, String, X509KeyStorageFlags)

Origem:
X509Certificate.cs
Origem:
X509Certificate.cs
Origem:
X509Certificate.cs

Cuidado

X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.

Cuidado

X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.

Popula o objeto X509Certificate com informações de um arquivo de certificado, uma senha e um valor X509KeyStorageFlags.

public:
 virtual void Import(System::String ^ fileName, System::String ^ password, System::Security::Cryptography::X509Certificates::X509KeyStorageFlags keyStorageFlags);
public virtual void Import (string fileName, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (string fileName, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (string fileName, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public virtual void Import (string fileName, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual void Import (string fileName, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public virtual void Import (string fileName, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
abstract member Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
abstract member Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Overridable Sub Import (fileName As String, password As String, keyStorageFlags As X509KeyStorageFlags)

Parâmetros

fileName
String

O nome de um arquivo de certificado representado como uma cadeia de caracteres.

password
String

A senha necessária para acessar os dados do certificado X.509.

keyStorageFlags
X509KeyStorageFlags

Uma combinação bit a bit dos valores de enumeração que controlam onde e como importar o certificado.

Atributos

Exceções

O parâmetro fileName é null.

Somente .NET Core e .NET 5+: Em todos os casos.

Comentários

Importante

Nunca codifique uma senha no código-fonte. Senhas embutidas em código podem ser recuperadas de um assembly usando o Ildasm.exe (IL Disassembler), um editor hexadecimal ou simplesmente abrindo o assembly em um editor de texto, como Notepad.exe.

Aplica-se a

Import(String, SecureString, X509KeyStorageFlags)

Origem:
X509Certificate.cs
Origem:
X509Certificate.cs
Origem:
X509Certificate.cs

Cuidado

X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.

Cuidado

X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.

Importante

Esta API não está em conformidade com CLS.

Popula um objeto X509Certificate com informações de um arquivo de certificado, uma senha e um sinalizador de armazenamento de chaves.

public:
 virtual void Import(System::String ^ fileName, System::Security::SecureString ^ password, System::Security::Cryptography::X509Certificates::X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
public virtual void Import (string fileName, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (string fileName, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (string fileName, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
public virtual void Import (string fileName, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public virtual void Import (string fileName, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Security.SecurityCritical]
public virtual void Import (string fileName, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[<System.CLSCompliant(false)>]
abstract member Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.CLSCompliant(false)>]
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.CLSCompliant(false)>]
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
abstract member Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Security.SecurityCritical>]
abstract member Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Overridable Sub Import (fileName As String, password As SecureString, keyStorageFlags As X509KeyStorageFlags)

Parâmetros

fileName
String

O nome de um arquivo de certificado.

password
SecureString

A senha necessária para acessar os dados do certificado X.509.

keyStorageFlags
X509KeyStorageFlags

Uma combinação bit a bit dos valores de enumeração que controlam onde e como importar o certificado.

Atributos

Exceções

O parâmetro fileName é null.

Somente .NET Core e .NET 5+: Em todos os casos.

Comentários

Importante

Nunca embuta uma senha no código-fonte. Senhas embutidas em código podem ser recuperadas de um assembly usando o Ildasm.exe (IL Disassembler), um editor hexadecimal ou simplesmente abrindo o assembly em um editor de texto, como Notepad.exe.

Aplica-se a

Import(Byte[], String, X509KeyStorageFlags)

Origem:
X509Certificate.cs
Origem:
X509Certificate.cs
Origem:
X509Certificate.cs

Cuidado

X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.

Cuidado

X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.

Popula o objeto X509Certificate usando dados de uma matriz de bytes, uma senha e sinalizadores para determinar como a chave privada é importada.

public:
 virtual void Import(cli::array <System::Byte> ^ rawData, System::String ^ password, System::Security::Cryptography::X509Certificates::X509KeyStorageFlags keyStorageFlags);
public virtual void Import (byte[] rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (byte[] rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (byte[] rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public virtual void Import (byte[] rawData, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual void Import (byte[] rawData, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public virtual void Import (byte[] rawData, string password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
abstract member Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
abstract member Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Overridable Sub Import (rawData As Byte(), password As String, keyStorageFlags As X509KeyStorageFlags)

Parâmetros

rawData
Byte[]

Uma matriz de bytes que contém dados de um certificado X.509.

password
String

A senha necessária para acessar os dados do certificado X.509.

keyStorageFlags
X509KeyStorageFlags

Uma combinação bit a bit dos valores de enumeração que controlam onde e como importar o certificado.

Atributos

Exceções

O parâmetro rawData é null.

- ou -

O tamanho do parâmetro rawData é 0.

Somente .NET Core e .NET 5+: Em todos os casos.

Comentários

Esse método pode ser usado para preencher um X509Certificate objeto usando uma senha para o certificado representado pela matriz de bytes. O X509KeyStorageFlags valor pode ser usado para controlar onde e como a chave privada é importada.

Aplica-se a

Import(Byte[])

Origem:
X509Certificate.cs
Origem:
X509Certificate.cs
Origem:
X509Certificate.cs

Cuidado

X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.

Cuidado

X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.

Preenche o objeto X509Certificate com os dados de uma matriz de bytes.

public:
 virtual void Import(cli::array <System::Byte> ^ rawData);
public virtual void Import (byte[] rawData);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (byte[] rawData);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (byte[] rawData);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual void Import (byte[] rawData);
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public virtual void Import (byte[] rawData);
abstract member Import : byte[] -> unit
override this.Import : byte[] -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : byte[] -> unit
override this.Import : byte[] -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : byte[] -> unit
override this.Import : byte[] -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member Import : byte[] -> unit
override this.Import : byte[] -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
abstract member Import : byte[] -> unit
override this.Import : byte[] -> unit
Public Overridable Sub Import (rawData As Byte())

Parâmetros

rawData
Byte[]

Uma matriz de bytes que contém dados de um certificado X.509.

Atributos

Exceções

O parâmetro rawData é null.

- ou -

O tamanho do parâmetro rawData é 0.

Somente .NET Core e .NET 5+: Em todos os casos.

Comentários

Esse método pode ser usado para pegar a matriz de bytes brutos de um certificado X.509 e preencher o X509Certificate objeto com seus valores associados.

Aplica-se a

Import(String)

Origem:
X509Certificate.cs
Origem:
X509Certificate.cs
Origem:
X509Certificate.cs

Cuidado

X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.

Cuidado

X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.

Popula o objeto X509Certificate com informações de um arquivo de certificado.

public:
 virtual void Import(System::String ^ fileName);
public virtual void Import (string fileName);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (string fileName);
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (string fileName);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual void Import (string fileName);
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public virtual void Import (string fileName);
abstract member Import : string -> unit
override this.Import : string -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : string -> unit
override this.Import : string -> unit
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : string -> unit
override this.Import : string -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member Import : string -> unit
override this.Import : string -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
abstract member Import : string -> unit
override this.Import : string -> unit
Public Overridable Sub Import (fileName As String)

Parâmetros

fileName
String

O nome de um arquivo de certificado representado como uma cadeia de caracteres.

Atributos

Exceções

O parâmetro fileName é null.

Somente .NET Core e .NET 5+: Em todos os casos.

Exemplos

O exemplo a seguir carrega um certificado X.509 de um arquivo, chama o ToString método e exibe os resultados para o console.

using namespace System;
using namespace System::Security::Cryptography::X509Certificates;
int main()
{
   
   // The path to the certificate.
   String^ Certificate = L"Certificate.cer";
   
   // Load the certificate into an X509Certificate object.
   X509Certificate^ cert = gcnew X509Certificate;
   cert->Import(Certificate);
   
   // Get the value.
   String^ resultsTrue = cert->ToString( true );
   
   // Display the value to the console.
   Console::WriteLine( resultsTrue );
   
   // Get the value.
   String^ resultsFalse = cert->ToString( false );
   
   // Display the value to the console.
   Console::WriteLine( resultsFalse );
}
using System;
using System.Security.Cryptography.X509Certificates;

class X509
{

    static void Main()
    {

        // The path to the certificate.
        string Certificate = "Certificate.cer";

        // Load the certificate into an X509Certificate object.
        X509Certificate cert = new X509Certificate();

        cert.Import(Certificate);

        // Get the value.
        string resultsTrue = cert.ToString(true);

        // Display the value to the console.
        Console.WriteLine(resultsTrue);

        // Get the value.
        string resultsFalse = cert.ToString(false);

        // Display the value to the console.
        Console.WriteLine(resultsFalse);
    }
}
Imports System.Security.Cryptography.X509Certificates

Module X509

    Sub Main()

        ' The path to the certificate.
        Dim Certificate As String = "Certificate.cer"

        ' Load the certificate into an X509Certificate object.
        Dim cert As New X509Certificate

        cert.Import(Certificate)

        ' Get the value.
        Dim resultsTrue As String = cert.ToString(True)

        ' Display the value to the console.
        Console.WriteLine(resultsTrue)

        ' Get the value.
        Dim resultsFalse As String = cert.ToString(False)

        ' Display the value to the console.
        Console.WriteLine(resultsFalse)

    End Sub
End Module

Comentários

Esse método usa um arquivo de certificado (como um arquivo com uma extensão .cer) que representa um certificado X.509 e preenche o X509Certificate objeto com o certificado que o arquivo contém.

Aplica-se a

Import(Byte[], SecureString, X509KeyStorageFlags)

Origem:
X509Certificate.cs
Origem:
X509Certificate.cs
Origem:
X509Certificate.cs

Cuidado

X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.

Cuidado

X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.

Importante

Esta API não está em conformidade com CLS.

Popula um objeto X509Certificate usando dados de uma matriz de bytes, uma senha e um sinalizador de armazenamento de chaves.

public:
 virtual void Import(cli::array <System::Byte> ^ rawData, System::Security::SecureString ^ password, System::Security::Cryptography::X509Certificates::X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
public virtual void Import (byte[] rawData, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (byte[] rawData, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
[System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public virtual void Import (byte[] rawData, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
public virtual void Import (byte[] rawData, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public virtual void Import (byte[] rawData, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.Security.SecurityCritical]
public virtual void Import (byte[] rawData, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[<System.CLSCompliant(false)>]
abstract member Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.CLSCompliant(false)>]
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.CLSCompliant(false)>]
[<System.Obsolete("X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.", DiagnosticId="SYSLIB0026", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
abstract member Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
abstract member Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.Security.SecurityCritical>]
abstract member Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
override this.Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Overridable Sub Import (rawData As Byte(), password As SecureString, keyStorageFlags As X509KeyStorageFlags)

Parâmetros

rawData
Byte[]

Uma matriz de bytes que contém dados de um certificado X.509.

password
SecureString

A senha necessária para acessar os dados do certificado X.509.

keyStorageFlags
X509KeyStorageFlags

Uma combinação bit a bit dos valores de enumeração que controlam onde e como importar o certificado.

Atributos

Exceções

O parâmetro rawData é null.

- ou -

O tamanho do parâmetro rawData é 0.

Somente .NET Core e .NET 5+: Em todos os casos.

Comentários

Importante

Nunca embuta uma senha no código-fonte. Senhas embutidas em código podem ser recuperadas de um assembly usando o Ildasm.exe (IL Disassembler), um editor hexadecimal ou simplesmente abrindo o assembly em um editor de texto, como Notepad.exe.

Aplica-se a