X509Certificate.GetCertHash メソッド
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
X509Certificate オブジェクトのハッシュ値を返します。
GetCertHash() |
X.509v3 証明書のハッシュ値をバイト配列として返します。 |
GetCertHash(HashAlgorithmName) |
指定された暗号ハッシュ アルゴリズムを使用して計算される X.509v3 証明書のハッシュ値を返します。 |
X.509v3 証明書のハッシュ値をバイト配列として返します。
public:
virtual cli::array <System::Byte> ^ GetCertHash();
public virtual byte[] GetCertHash ();
abstract member GetCertHash : unit -> byte[]
override this.GetCertHash : unit -> byte[]
Public Overridable Function GetCertHash () As Byte()
戻り値
X.509 証明書のハッシュ値。
例
次の例では、 メソッドを GetCertHash 使用して、X.509 証明書のハッシュ値をバイト配列に入力します。
using namespace System;
using namespace System::Security::Cryptography::X509Certificates;
int main()
{
// The path to the certificate.
String^ Certificate = "Certificate.cer";
// Load the certificate into an X509Certificate object.
X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate );
// Get the value.
array<Byte>^results = cert->GetCertHash();
}
using System;
using System.Security.Cryptography.X509Certificates;
public class X509
{
public static void Main()
{
// The path to the certificate.
string Certificate = "Certificate.cer";
// Load the certificate into an X509Certificate object.
X509Certificate cert = X509Certificate.CreateFromCertFile(Certificate);
// Get the value.
byte[] results = cert.GetCertHash();
}
}
Imports System.Security.Cryptography.X509Certificates
Public Class X509
Public Shared Sub Main()
' The path to the certificate.
Dim Certificate As String = "Certificate.cer"
' Load the certificate into an X509Certificate object.
Dim cert As X509Certificate = X509Certificate.CreateFromCertFile(Certificate)
' Get the value.
Dim results As Byte() = cert.GetCertHash()
End Sub
End Class
適用対象
.NET 9 およびその他のバージョン
製品 | バージョン |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.3, 1.4, 1.6, 2.0, 2.1 |
指定された暗号ハッシュ アルゴリズムを使用して計算される X.509v3 証明書のハッシュ値を返します。
public:
virtual cli::array <System::Byte> ^ GetCertHash(System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public virtual byte[] GetCertHash (System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
abstract member GetCertHash : System.Security.Cryptography.HashAlgorithmName -> byte[]
override this.GetCertHash : System.Security.Cryptography.HashAlgorithmName -> byte[]
Public Overridable Function GetCertHash (hashAlgorithm As HashAlgorithmName) As Byte()
パラメーター
- hashAlgorithm
- HashAlgorithmName
使用する暗号化ハッシュ アルゴリズムの名前。
戻り値
X.509 証明書のハッシュ値を含むバイト配列。
例外
hashAlgorithm
。Name が null
または空の文字列です。
hashAlgorithm
は既知のハッシュ アルゴリズムではありません。
こちらもご覧ください
適用対象
.NET 9 およびその他のバージョン
製品 | バージョン |
---|---|
.NET | Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.8, 4.8.1 |
.NET Standard | 2.1 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。