X509Certificate2.Import メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定された証明書情報を X509Certificate2 オブジェクトに設定します。
オーバーロード
| 名前 | 説明 |
|---|---|
| Import(Byte[]) |
古い.
古い.
バイト配列のデータを X509Certificate2 オブジェクトに設定します。 |
| Import(String) |
古い.
古い.
証明書ファイルからの情報を X509Certificate2 オブジェクトに設定します。 |
| Import(Byte[], SecureString, X509KeyStorageFlags) |
古い.
古い.
バイト配列、パスワード、およびキー ストレージ フラグのデータを使用して、 X509Certificate2 オブジェクトを設定します。 |
| Import(Byte[], String, X509KeyStorageFlags) |
古い.
古い.
バイト配列のデータ、パスワード、秘密キーのインポート方法を決定するためのフラグを使用して、 X509Certificate2 オブジェクトを設定します。 |
| Import(String, SecureString, X509KeyStorageFlags) |
古い.
古い.
証明書ファイル、パスワード、およびキー ストレージ フラグからの情報を X509Certificate2 オブジェクトに設定します。 |
| Import(String, String, X509KeyStorageFlags) |
古い.
古い.
証明書ファイル、パスワード、およびX509Certificate2値からの情報をX509KeyStorageFlags オブジェクトに設定します。 |
Import(Byte[])
注意事項
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.
注意事項
X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.
バイト配列のデータを X509Certificate2 オブジェクトに設定します。
public:
override void Import(cli::array <System::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 override void Import(byte[] rawData);
public override 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 override 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}")>]
override this.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}")>]
override this.Import : byte[] -> unit
Public Overrides Sub Import (rawData As Byte())
パラメーター
- rawData
- Byte[]
X.509 証明書のデータを含むバイト配列。
- 属性
注釈
このメソッドを使用すると、X.509 証明書の生のバイト配列を取得し、 X509Certificate2 オブジェクトに関連付けられた値を設定できます。
このメソッドはバイト配列のみを受け入れるため、PEM でエンコードまたは DER でエンコードされた X.509 証明書や PFX/PKCS12 証明書など、パスワードを必要としない証明書の種類にのみ使用できます。 PFX/PKCS12 証明書には複数の証明書を含めることができます。 その場合、秘密キーに関連付けられている最初の証明書が使用されます。秘密キーが見つからない場合は、最初の証明書が使用されます。
適用対象
Import(String)
注意事項
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.
注意事項
X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.
証明書ファイルからの情報を X509Certificate2 オブジェクトに設定します。
public:
override void Import(System::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 override void Import(string fileName);
public override 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 override 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}")>]
override this.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}")>]
override this.Import : string -> unit
Public Overrides Sub Import (fileName As String)
パラメーター
- fileName
- String
証明書の名前。
- 属性
注釈
このメソッドは、X.509 証明書を表し、ファイルに含まれる証明書を X509Certificate2 オブジェクトに設定する、.cer拡張子を持つファイルなどの証明書ファイルを使用します。
この方法は、PEM エンコードまたは DER でエンコードされた X.509 証明書、PFX/PKCS12 証明書、Authenticode などの署名者証明書など、いくつかの証明書の種類で使用できます。 PFX/PKCS12 証明書には複数の証明書を含めることができます。 その場合、秘密キーに関連付けられている最初の証明書が使用されます。秘密キーが見つからない場合は、最初の証明書が使用されます。
適用対象
Import(Byte[], SecureString, X509KeyStorageFlags)
注意事項
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.
注意事項
X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.
重要
この API は CLS 準拠ではありません。
バイト配列、パスワード、およびキー ストレージ フラグのデータを使用して、 X509Certificate2 オブジェクトを設定します。
public:
override void Import(cli::array <System::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 override void Import(byte[] rawData, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
public override 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 override void Import(byte[] rawData, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
public override void Import(byte[] rawData, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public override 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}")>]
override this.Import : byte[] * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.CLSCompliant(false)>]
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}")>]
override this.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 Overrides Sub Import (rawData As Byte(), password As SecureString, keyStorageFlags As X509KeyStorageFlags)
パラメーター
- rawData
- Byte[]
X.509 証明書のデータを含むバイト配列。
- password
- SecureString
X.509 証明書データにアクセスするために必要なパスワード。
- keyStorageFlags
- X509KeyStorageFlags
証明書をインポートする場所と方法を制御する列挙値のビットごとの組み合わせ。
- 属性
注釈
この方法は、PEM でエンコードされた証明書、DER でエンコードされた X.509 証明書、PFX/PKCS12 証明書などの証明書の種類に使用できます。 PFX/PKCS12 証明書には複数の証明書を含めることができます。 その場合、秘密キーに関連付けられている最初の証明書が使用されます。秘密キーが見つからない場合は、最初の証明書が使用されます。
Important
ソース コード内でパスワードをハード コーディングしないでください。 ハードコーディングされたパスワードは、 Ildasm.exe (IL 逆アセンブラー)、16 進エディター、または Notepad.exeなどのテキスト エディターでアセンブリを開くだけで、アセンブリから取得できます。
適用対象
Import(Byte[], String, X509KeyStorageFlags)
注意事項
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.
注意事項
X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.
バイト配列のデータ、パスワード、秘密キーのインポート方法を決定するためのフラグを使用して、 X509Certificate2 オブジェクトを設定します。
public:
override void Import(cli::array <System::Byte> ^ rawData, System::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 override void Import(byte[] rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public override 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 override void Import(byte[] rawData, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public override 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}")>]
override this.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}")>]
override this.Import : byte[] * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Overrides Sub Import (rawData As Byte(), password As String, keyStorageFlags As X509KeyStorageFlags)
パラメーター
- rawData
- Byte[]
X.509 証明書のデータを含むバイト配列。
- password
- String
X.509 証明書データにアクセスするために必要なパスワード。
- keyStorageFlags
- X509KeyStorageFlags
証明書をインポートする場所と方法を制御する列挙値のビットごとの組み合わせ。
- 属性
例
次のコード例では、証明書ファイルを引数として受け取り、さまざまな証明書プロパティをコンソールに出力するコマンド ライン実行可能ファイルを作成します。
using System;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.IO;
using System.Security.Cryptography.X509Certificates;
class CertInfo
{
//Reads a file.
internal static byte[] ReadFile (string fileName)
{
FileStream f = new FileStream(fileName, FileMode.Open, FileAccess.Read);
int size = (int)f.Length;
byte[] data = new byte[size];
size = f.Read(data, 0, size);
f.Close();
return data;
}
//Main method begins here.
static void Main(string[] args)
{
//Test for correct number of arguments.
if (args.Length < 1)
{
Console.WriteLine("Usage: CertInfo <filename>");
return;
}
try
{
byte[] rawData = ReadFile(args[0]);
//Create X509Certificate2 object from .cer file.
X509Certificate2 x509 = new X509Certificate2(rawData);
//Print to console information contained in the certificate.
Console.WriteLine("{0}Subject: {1}{0}", Environment.NewLine, x509.Subject);
Console.WriteLine("{0}Issuer: {1}{0}", Environment.NewLine, x509.Issuer);
Console.WriteLine("{0}Version: {1}{0}", Environment.NewLine, x509.Version);
Console.WriteLine("{0}Valid Date: {1}{0}", Environment.NewLine, x509.NotBefore);
Console.WriteLine("{0}Expiry Date: {1}{0}", Environment.NewLine, x509.NotAfter);
Console.WriteLine("{0}Thumbprint: {1}{0}", Environment.NewLine, x509.Thumbprint);
Console.WriteLine("{0}Serial Number: {1}{0}", Environment.NewLine, x509.SerialNumber);
Console.WriteLine("{0}Friendly Name: {1}{0}", Environment.NewLine, x509.PublicKey.Oid.FriendlyName);
Console.WriteLine("{0}Public Key Format: {1}{0}", Environment.NewLine, x509.PublicKey.EncodedKeyValue.Format(true));
Console.WriteLine("{0}Raw Data Length: {1}{0}", Environment.NewLine, x509.RawData.Length);
Console.WriteLine("{0}Certificate to string: {1}{0}", Environment.NewLine, x509.ToString(true));
Console.WriteLine("{0}Certificate to XML String: {1}{0}", Environment.NewLine, x509.PublicKey.Key.ToXmlString(false));
//Add the certificate to a X509Store.
X509Store store = new X509Store();
store.Open(OpenFlags.MaxAllowed);
store.Add(x509);
store.Close();
}
catch (DirectoryNotFoundException)
{
Console.WriteLine("Error: The directory specified could not be found.");
}
catch (IOException)
{
Console.WriteLine("Error: A file in the directory could not be accessed.");
}
catch (NullReferenceException)
{
Console.WriteLine("File must be a .cer file. Program does not have access to that type of file.");
}
}
}
Imports System.Security.Cryptography
Imports System.Security.Permissions
Imports System.IO
Imports System.Security.Cryptography.X509Certificates
Class CertInfo
'Reads a file.
Friend Shared Function ReadFile(ByVal fileName As String) As Byte()
Dim f As New FileStream(fileName, FileMode.Open, FileAccess.Read)
Dim size As Integer = Fix(f.Length)
Dim data(size - 1) As Byte
size = f.Read(data, 0, size)
f.Close()
Return data
End Function
<SecurityPermission(SecurityAction.LinkDemand, Unrestricted:=True)> _
Shared Sub Main(ByVal args() As String)
'Test for correct number of arguments.
If args.Length < 1 Then
Console.WriteLine("Usage: CertInfo <filename>")
Return
End If
Try
Dim x509 As New X509Certificate2()
'Create X509Certificate2 object from .cer file.
Dim rawData As Byte() = ReadFile(args(0))
x509.Import(rawData)
'Print to console information contained in the certificate.
Console.WriteLine("{0}Subject: {1}{0}", Environment.NewLine, x509.Subject)
Console.WriteLine("{0}Issuer: {1}{0}", Environment.NewLine, x509.Issuer)
Console.WriteLine("{0}Version: {1}{0}", Environment.NewLine, x509.Version)
Console.WriteLine("{0}Valid Date: {1}{0}", Environment.NewLine, x509.NotBefore)
Console.WriteLine("{0}Expiry Date: {1}{0}", Environment.NewLine, x509.NotAfter)
Console.WriteLine("{0}Thumbprint: {1}{0}", Environment.NewLine, x509.Thumbprint)
Console.WriteLine("{0}Serial Number: {1}{0}", Environment.NewLine, x509.SerialNumber)
Console.WriteLine("{0}Friendly Name: {1}{0}", Environment.NewLine, x509.PublicKey.Oid.FriendlyName)
Console.WriteLine("{0}Public Key Format: {1}{0}", Environment.NewLine, x509.PublicKey.EncodedKeyValue.Format(True))
Console.WriteLine("{0}Raw Data Length: {1}{0}", Environment.NewLine, x509.RawData.Length)
Console.WriteLine("{0}Certificate to string: {1}{0}", Environment.NewLine, x509.ToString(True))
Console.WriteLine("{0}Certificate to XML String: {1}{0}", Environment.NewLine, x509.PublicKey.Key.ToXmlString(False))
'Add the certificate to a X509Store.
Dim store As New X509Store()
store.Open(OpenFlags.MaxAllowed)
store.Add(x509)
store.Close()
Catch dnfExcept As DirectoryNotFoundException
Console.WriteLine("Error: The directory specified could not be found.")
Catch ioExpcept As IOException
Console.WriteLine("Error: A file in the directory could not be accessed.")
Catch nrExcept As NullReferenceException
Console.WriteLine("File must be a .cer file. Program does not have access to that type of file.")
End Try
End Sub
End Class
注釈
このメソッドを使用すると、バイト配列で表される証明書のパスワードを使用して、 X509Certificate2 オブジェクトを設定できます。 X509KeyStorageFlags値を使用して、秘密キーをインポートする場所と方法を制御できます。
このメソッドはバイト配列を受け入れ、PEM でエンコードされた証明書、DER でエンコードされた X.509 証明書、PFX/PKCS12 証明書などの証明書の種類に使用できます。 PFX/PKCS12 証明書には複数の証明書を含めることができます。 その場合、秘密キーに関連付けられている最初の証明書が使用されます。秘密キーが見つからない場合は、最初の証明書が使用されます。
Important
ソース コード内でパスワードをハード コーディングしないでください。 ハードコーディングされたパスワードは、 Ildasm.exe (IL 逆アセンブラー)、16 進エディター、または Notepad.exeなどのテキスト エディターでアセンブリを開くだけで、アセンブリから取得できます。
適用対象
Import(String, SecureString, X509KeyStorageFlags)
注意事項
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.
注意事項
X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.
重要
この API は CLS 準拠ではありません。
証明書ファイル、パスワード、およびキー ストレージ フラグからの情報を X509Certificate2 オブジェクトに設定します。
public:
override void Import(System::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 override void Import(string fileName, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
public override 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 override void Import(string fileName, System.Security.SecureString? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
[System.CLSCompliant(false)]
public override void Import(string fileName, System.Security.SecureString password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public override 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}")>]
override this.Import : string * System.Security.SecureString * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
[<System.CLSCompliant(false)>]
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}")>]
override this.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 Overrides Sub Import (fileName As String, password As SecureString, keyStorageFlags As X509KeyStorageFlags)
パラメーター
- fileName
- String
証明書ファイルの名前。
- password
- SecureString
X.509 証明書データにアクセスするために必要なパスワード。
- keyStorageFlags
- X509KeyStorageFlags
証明書をインポートする場所と方法を制御する列挙値のビットごとの組み合わせ。
- 属性
注釈
セキュリティに関する注意 ソース コード内でパスワードをハード コーディングしないでください。 ハードコーディングされたパスワードは、 Ildasm.exe (IL 逆アセンブラー)、16 進エディター、または Notepad.exeなどのテキスト エディターでアセンブリを開くだけで、アセンブリから取得できます。
適用対象
Import(String, String, X509KeyStorageFlags)
注意事項
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.
注意事項
X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.
証明書ファイル、パスワード、およびX509Certificate2値からの情報をX509KeyStorageFlags オブジェクトに設定します。
public:
override void Import(System::String ^ fileName, System::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 override void Import(string fileName, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public override 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 override void Import(string fileName, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags);
public override 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}")>]
override this.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}")>]
override this.Import : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags -> unit
Public Overrides Sub Import (fileName As String, password As String, keyStorageFlags As X509KeyStorageFlags)
パラメーター
- fileName
- String
証明書ファイルの名前。
- password
- String
X.509 証明書データにアクセスするために必要なパスワード。
- keyStorageFlags
- X509KeyStorageFlags
証明書をインポートする場所と方法を制御する列挙値のビットごとの組み合わせ。
- 属性
注釈
このメソッドを使用すると、証明書ファイル、パスワード、およびX509Certificate2値からの情報をX509KeyStorageFlags オブジェクトに設定できます。
Important
ソース コード内でパスワードをハード コーディングしないでください。 ハードコーディングされたパスワードは、 Ildasm.exe (IL 逆アセンブラー)、16 進エディター、または Notepad.exeなどのテキスト エディターでアセンブリを開くだけで、アセンブリから取得できます。