X509Certificate.GetKeyAlgorithmParameters 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
以字节数组的形式返回 X.509v3 证书的密钥算法参数。
public:
virtual cli::array <System::Byte> ^ GetKeyAlgorithmParameters();
public virtual byte[]? GetKeyAlgorithmParameters();
public virtual byte[] GetKeyAlgorithmParameters();
abstract member GetKeyAlgorithmParameters : unit -> byte[]
override this.GetKeyAlgorithmParameters : unit -> byte[]
Public Overridable Function GetKeyAlgorithmParameters () As Byte()
返回
Byte[]
X.509 证书的密钥算法参数作为字节数组。
例外
证书上下文无效。
示例
以下示例使用 GetKeyAlgorithmParameters 该方法将证书的密钥算法参数作为字节数组返回,并将其显示给控制台。
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.GetKeyAlgorithmParameters();
// Display the value to the console.
foreach(byte b in results)
{
Console.Write(b);
}
}
}
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.GetKeyAlgorithmParameters()
' Display the value to the console.
Dim b As Byte
For Each b In results
Console.Write(b)
Next b
End Sub
End Class