Udostępnij za pośrednictwem


X509Certificate.Import Metoda

Definicja

X509Certificate Wypełnia obiekt.

Przeciążenia

Import(String, String, X509KeyStorageFlags)
Przestarzałe.
Przestarzałe.

X509Certificate Wypełnia obiekt informacjami z pliku certyfikatu, hasła i X509KeyStorageFlags wartości.

Import(String, SecureString, X509KeyStorageFlags)
Przestarzałe.
Przestarzałe.

X509Certificate Wypełnia obiekt informacjami z pliku certyfikatu, hasła i flagi magazynu kluczy.

Import(Byte[], String, X509KeyStorageFlags)
Przestarzałe.
Przestarzałe.

X509Certificate Wypełnia obiekt przy użyciu danych z tablicy bajtów, hasła i flag w celu określenia sposobu importowania klucza prywatnego.

Import(Byte[])
Przestarzałe.
Przestarzałe.

X509Certificate Wypełnia obiekt danymi z tablicy bajtów.

Import(String)
Przestarzałe.
Przestarzałe.

X509Certificate Wypełnia obiekt informacjami z pliku certyfikatu.

Import(Byte[], SecureString, X509KeyStorageFlags)
Przestarzałe.
Przestarzałe.

X509Certificate Wypełnia obiekt przy użyciu danych z tablicy bajtów, hasła i flagi magazynu kluczy.

Import(String, String, X509KeyStorageFlags)

Źródło:
X509Certificate.cs
Źródło:
X509Certificate.cs
Źródło:
X509Certificate.cs

Przestroga

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

Przestroga

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

X509Certificate Wypełnia obiekt informacjami z pliku certyfikatu, hasła i X509KeyStorageFlags wartości.

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)

Parametry

fileName
String

Nazwa pliku certyfikatu reprezentowana jako ciąg.

password
String

Hasło wymagane do uzyskania dostępu do danych certyfikatu X.509.

keyStorageFlags
X509KeyStorageFlags

Bitowa kombinacja wartości wyliczenia, które kontrolują miejsce i sposób importowania certyfikatu.

Atrybuty

Wyjątki

Parametr fileName ma wartość null.

Tylko platformy .NET Core i .NET 5+: we wszystkich przypadkach.

Uwagi

Ważne

Nigdy nie należy kodować hasła w kodzie źródłowym. Zakodowane hasła można pobrać z zestawu przy użyciu Ildasm.exe (dezasembler IL), edytora szesnastkowego lub po prostu otwierając zestaw w edytorze tekstów, takim jak Notepad.exe.

Dotyczy

Import(String, SecureString, X509KeyStorageFlags)

Źródło:
X509Certificate.cs
Źródło:
X509Certificate.cs
Źródło:
X509Certificate.cs

Przestroga

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

Przestroga

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

Ważne

Ten interfejs API nie jest zgodny ze specyfikacją CLS.

X509Certificate Wypełnia obiekt informacjami z pliku certyfikatu, hasła i flagi magazynu kluczy.

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)

Parametry

fileName
String

Nazwa pliku certyfikatu.

password
SecureString

Hasło wymagane do uzyskania dostępu do danych certyfikatu X.509.

keyStorageFlags
X509KeyStorageFlags

Bitowa kombinacja wartości wyliczenia, które kontrolują miejsce i sposób importowania certyfikatu.

Atrybuty

Wyjątki

Parametr fileName ma wartość null.

Tylko platformy .NET Core i .NET 5+: we wszystkich przypadkach.

Uwagi

Ważne

Nigdy nie koduje trwale hasła w kodzie źródłowym. Zakodowane hasła można pobrać z zestawu przy użyciu Ildasm.exe (dezasembler IL), edytora szesnastkowego lub po prostu otwierając zestaw w edytorze tekstów, takim jak Notepad.exe.

Dotyczy

Import(Byte[], String, X509KeyStorageFlags)

Źródło:
X509Certificate.cs
Źródło:
X509Certificate.cs
Źródło:
X509Certificate.cs

Przestroga

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

Przestroga

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

X509Certificate Wypełnia obiekt przy użyciu danych z tablicy bajtów, hasła i flag w celu określenia sposobu importowania klucza prywatnego.

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)

Parametry

rawData
Byte[]

Tablica bajtów zawierająca dane z certyfikatu X.509.

password
String

Hasło wymagane do uzyskania dostępu do danych certyfikatu X.509.

keyStorageFlags
X509KeyStorageFlags

Bitowa kombinacja wartości wyliczenia, które kontrolują miejsce i sposób importowania certyfikatu.

Atrybuty

Wyjątki

Parametr rawData ma wartość null.

-lub-

Długość parametru rawData wynosi 0.

Tylko platformy .NET Core i .NET 5+: we wszystkich przypadkach.

Uwagi

Tej metody można użyć do wypełnienia X509Certificate obiektu przy użyciu hasła dla certyfikatu reprezentowanego przez tablicę bajtów. Wartość może służyć do kontrolowania X509KeyStorageFlags lokalizacji i sposobu importowania klucza prywatnego.

Dotyczy

Import(Byte[])

Źródło:
X509Certificate.cs
Źródło:
X509Certificate.cs
Źródło:
X509Certificate.cs

Przestroga

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

Przestroga

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

X509Certificate Wypełnia obiekt danymi z tablicy bajtów.

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

Parametry

rawData
Byte[]

Tablica bajtów zawierająca dane z certyfikatu X.509.

Atrybuty

Wyjątki

Parametr rawData ma wartość null.

-lub-

Długość parametru rawData wynosi 0.

Tylko platformy .NET Core i .NET 5+: we wszystkich przypadkach.

Uwagi

Tej metody można użyć do pobrania nieprzetworzonej tablicy bajtów certyfikatu X.509 i wypełnienia X509Certificate obiektu skojarzonymi wartościami.

Dotyczy

Import(String)

Źródło:
X509Certificate.cs
Źródło:
X509Certificate.cs
Źródło:
X509Certificate.cs

Przestroga

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

Przestroga

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

X509Certificate Wypełnia obiekt informacjami z pliku certyfikatu.

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)

Parametry

fileName
String

Nazwa pliku certyfikatu reprezentowana jako ciąg.

Atrybuty

Wyjątki

Parametr fileName ma wartość null.

Tylko platformy .NET Core i .NET 5+: we wszystkich przypadkach.

Przykłady

Poniższy przykład ładuje certyfikat X.509 z pliku, wywołuje ToString metodę i wyświetla wyniki w konsoli.

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

Uwagi

Ta metoda używa pliku certyfikatu (takiego jak plik z rozszerzeniem .cer), który reprezentuje certyfikat X.509 i wypełnia X509Certificate obiekt certyfikatem, który zawiera plik.

Dotyczy

Import(Byte[], SecureString, X509KeyStorageFlags)

Źródło:
X509Certificate.cs
Źródło:
X509Certificate.cs
Źródło:
X509Certificate.cs

Przestroga

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

Przestroga

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

Ważne

Ten interfejs API nie jest zgodny ze specyfikacją CLS.

X509Certificate Wypełnia obiekt przy użyciu danych z tablicy bajtów, hasła i flagi magazynu kluczy.

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)

Parametry

rawData
Byte[]

Tablica bajtów zawierająca dane z certyfikatu X.509.

password
SecureString

Hasło wymagane do uzyskania dostępu do danych certyfikatu X.509.

keyStorageFlags
X509KeyStorageFlags

Bitowa kombinacja wartości wyliczenia, które kontrolują miejsce i sposób importowania certyfikatu.

Atrybuty

Wyjątki

Parametr rawData ma wartość null.

-lub-

Długość parametru rawData wynosi 0.

Tylko platformy .NET Core i .NET 5+: we wszystkich przypadkach.

Uwagi

Ważne

Nigdy nie koduje trwale hasła w kodzie źródłowym. Zakodowane hasła można pobrać z zestawu przy użyciu Ildasm.exe (dezasembler IL), edytora szesnastkowego lub po prostu otwierając zestaw w edytorze tekstów, takim jak Notepad.exe.

Dotyczy