ECDiffieHellmanCng 類別

定義

提供 Elliptic Curve Diffie-Hellman (ECDH) 演算法的 Cryptography Next Generation (CNG) 實作。 這個類別是用來執行密碼編譯作業。

public ref class ECDiffieHellmanCng sealed : System::Security::Cryptography::ECDiffieHellman
public sealed class ECDiffieHellmanCng : System.Security.Cryptography.ECDiffieHellman
type ECDiffieHellmanCng = class
    inherit ECDiffieHellman
Public NotInheritable Class ECDiffieHellmanCng
Inherits ECDiffieHellman
繼承
繼承

範例

下列範例示範如何使用 ECDiffieHellmanCng 類別來建立金鑰交換,以及如何使用該金鑰來加密可透過公用通道傳送並由接收者解密的訊息。

using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;

class Alice
{
    public static byte[] alicePublicKey;

    public static void Main(string[] args)
    {
        using (ECDiffieHellmanCng alice = new ECDiffieHellmanCng())
        {

            alice.KeyDerivationFunction = ECDiffieHellmanKeyDerivationFunction.Hash;
            alice.HashAlgorithm = CngAlgorithm.Sha256;
            alicePublicKey = alice.PublicKey.ToByteArray();
            Bob bob = new Bob();
            CngKey bobKey = CngKey.Import(bob.bobPublicKey, CngKeyBlobFormat.EccPublicBlob);
            byte[] aliceKey = alice.DeriveKeyMaterial(bobKey);
            byte[] encryptedMessage = null;
            byte[] iv = null;
            Send(aliceKey, "Secret message", out encryptedMessage, out iv);
            bob.Receive(encryptedMessage, iv);
        }
    }

    private static void Send(byte[] key, string secretMessage, out byte[] encryptedMessage, out byte[] iv)
    {
        using (Aes aes = new AesCryptoServiceProvider())
        {
            aes.Key = key;
            iv = aes.IV;

            // Encrypt the message
            using (MemoryStream ciphertext = new MemoryStream())
            using (CryptoStream cs = new CryptoStream(ciphertext, aes.CreateEncryptor(), CryptoStreamMode.Write))
            {
                byte[] plaintextMessage = Encoding.UTF8.GetBytes(secretMessage);
                cs.Write(plaintextMessage, 0, plaintextMessage.Length);
                cs.Close();
                encryptedMessage = ciphertext.ToArray();
            }
        }
    }
}
public class Bob
{
    public byte[] bobPublicKey;
    private byte[] bobKey;
    public Bob()
    {
        using (ECDiffieHellmanCng bob = new ECDiffieHellmanCng())
        {

            bob.KeyDerivationFunction = ECDiffieHellmanKeyDerivationFunction.Hash;
            bob.HashAlgorithm = CngAlgorithm.Sha256;
            bobPublicKey = bob.PublicKey.ToByteArray();
            bobKey = bob.DeriveKeyMaterial(CngKey.Import(Alice.alicePublicKey, CngKeyBlobFormat.EccPublicBlob));
        }
    }

    public void Receive(byte[] encryptedMessage, byte[] iv)
    {

        using (Aes aes = new AesCryptoServiceProvider())
        {
            aes.Key = bobKey;
            aes.IV = iv;
            // Decrypt the message
            using (MemoryStream plaintext = new MemoryStream())
            {
                using (CryptoStream cs = new CryptoStream(plaintext, aes.CreateDecryptor(), CryptoStreamMode.Write))
                {
                    cs.Write(encryptedMessage, 0, encryptedMessage.Length);
                    cs.Close();
                    string message = Encoding.UTF8.GetString(plaintext.ToArray());
                    Console.WriteLine(message);
                }
            }
        }
    }
}
Imports System.IO
Imports System.Security.Cryptography
Imports System.Text




Class Alice
    Public Shared alicePublicKey() As Byte


    Public Shared Sub Main(ByVal args() As String)
        Using alice As New ECDiffieHellmanCng()
            alice.KeyDerivationFunction = ECDiffieHellmanKeyDerivationFunction.Hash
            alice.HashAlgorithm = CngAlgorithm.Sha256
            alicePublicKey = alice.PublicKey.ToByteArray()
            Dim bob As New Bob()
            Dim k As CngKey = CngKey.Import(bob.bobPublicKey, CngKeyBlobFormat.EccPublicBlob)
            Dim aliceKey As Byte() = alice.DeriveKeyMaterial(CngKey.Import(bob.bobPublicKey, CngKeyBlobFormat.EccPublicBlob))
            Dim encryptedMessage As Byte() = Nothing
            Dim iv As Byte() = Nothing
            Send(aliceKey, "Secret message", encryptedMessage, iv)
            bob.Receive(encryptedMessage, iv)
        End Using
    End Sub


    Private Shared Sub Send(ByVal key() As Byte, ByVal secretMessage As String, ByRef encryptedMessage() As Byte, ByRef iv() As Byte)
        Using aes As New AesCryptoServiceProvider()
            aes.Key = key
            iv = aes.IV

            ' Encrypt the message
            Using ciphertext As New MemoryStream()
                Using cs As New CryptoStream(ciphertext, aes.CreateEncryptor(), CryptoStreamMode.Write)
                    Dim plaintextMessage As Byte() = Encoding.UTF8.GetBytes(secretMessage)
                    cs.Write(plaintextMessage, 0, plaintextMessage.Length)
                    cs.Close()
                    encryptedMessage = ciphertext.ToArray()
                End Using
            End Using
        End Using

    End Sub
End Class

Public Class Bob
    Public bobPublicKey() As Byte
    Private bobKey() As Byte

    Public Sub New()
        Using bob As New ECDiffieHellmanCng()

            bob.KeyDerivationFunction = ECDiffieHellmanKeyDerivationFunction.Hash
            bob.HashAlgorithm = CngAlgorithm.Sha256
            bobPublicKey = bob.PublicKey.ToByteArray()
            bobKey = bob.DeriveKeyMaterial(CngKey.Import(Alice.alicePublicKey, CngKeyBlobFormat.EccPublicBlob))
        End Using

    End Sub


    Public Sub Receive(ByVal encryptedMessage() As Byte, ByVal iv() As Byte)

        Using aes As New AesCryptoServiceProvider()
                aes.Key = bobKey
                aes.IV = iv
                ' Decrypt the message
            Using plaintext As New MemoryStream()
                Using cs As New CryptoStream(plaintext, aes.CreateDecryptor(), CryptoStreamMode.Write)
                    cs.Write(encryptedMessage, 0, encryptedMessage.Length)
                    cs.Close()
                    Dim message As String = Encoding.UTF8.GetString(plaintext.ToArray())
                    Console.WriteLine(message)
                End Using
            End Using
        End Using
    End Sub
End Class

備註

類別 ECDiffieHellmanCng 可讓兩方交換私密金鑰資料,即使它們透過公用通道進行通訊也一樣。 這兩方可以計算相同的秘密值,這稱為 Managed Diffie-Hellman 類別中的 秘密合約 。 秘密協定接著可用於各種用途,包括作為對稱金鑰。 不過,類別不會直接公開秘密合約, ECDiffieHellmanCng 而是在提供值之前,先對合約執行一些後置處理。 此後置處理稱為 KDF) (金鑰衍生函 式;您可以選取您想要使用的 KDF,並透過 Diffie-Hellman 物件實例上的一組屬性來設定其參數。

金鑰衍生函式 屬性
Hash HashAlgorithm - 用來處理秘密合約的雜湊演算法。

SecretPrepend - 在雜湊密碼協定之前,要先加上秘密協定的選擇性位元組陣列。

SecretAppend - 要在雜湊之前附加至秘密合約的選擇性位元組陣列。
Hmac HashAlgorithm - 用來處理秘密合約的雜湊演算法。

SecretPrepend- 在雜湊密碼協定之前,要先加上秘密協定的選擇性位元組陣列。

SecretAppend - 要在雜湊之前附加至秘密合約的選擇性位元組陣列。
Tls Label - 金鑰衍生的標籤。

Seed - 金鑰衍生的種子。

透過金鑰衍生函式傳遞秘密合約的結果是位元組陣列,可用來做為應用程式的金鑰內容。 產生的金鑰資料位元組數目取決於金鑰衍生函式;例如,SHA-256 會產生 256 位的金鑰資料,而 SHA-512 則會產生 512 位的金鑰資料。 ECDH 金鑰交換的基本流程如下:

  1. Alice 和 Bob 會建立金鑰組,以用於 Diffie-Hellman 金鑰交換作業

  2. Alice 和 Bob 會使用同意的參數來設定 KDF。

  3. Alice 傳送 Bob 她的公開金鑰。

  4. Bob 將公開金鑰傳送給 Alice。

  5. Alice 和 Bob 會使用彼此的公開金鑰來產生秘密合約,並將 KDF 套用至秘密合約以產生金鑰資料。

建構函式

ECDiffieHellmanCng()

使用隨機金鑰組,初始化 ECDiffieHellmanCng 類別的新執行個體。

ECDiffieHellmanCng(CngKey)

使用指定的 CngKey 物件,初始化 ECDiffieHellmanCng 類別的新執行個體。

ECDiffieHellmanCng(ECCurve)

建立 ECDiffieHellmanCng 類別的新執行個體,其公開/私密金鑰組是在指定的曲線上所產生。

ECDiffieHellmanCng(Int32)

使用指定金鑰大小的隨機金鑰組,初始化 ECDiffieHellmanCng 類別的新執行個體。

欄位

KeySizeValue

表示非對稱演算法使用的金鑰模數大小,以位元為單位。

(繼承來源 AsymmetricAlgorithm)
LegalKeySizesValue

指定非對稱演算法所支援的金鑰大小。

(繼承來源 AsymmetricAlgorithm)

屬性

HashAlgorithm

取得或設定產生金鑰內容時使用的雜湊演算法。

HmacKey

取得或設定「雜湊式訊息驗證碼」(Hash-based Message Authentication Code,HMAC) 金鑰,以便在衍生金鑰內容時使用。

Key

指定 CngKey,由目前物件用於密碼編譯作業。

KeyDerivationFunction

取得或設定 ECDiffieHellmanCng 類別的金鑰衍生函數。

KeyExchangeAlgorithm

取得金鑰交換演算法的名稱。

(繼承來源 ECDiffieHellman)
KeySize

取得或設定非對稱演算法使用的金鑰模數大小,以位元為單位。

KeySize

取得或設定非對稱演算法使用的金鑰模數大小,以位元為單位。

(繼承來源 AsymmetricAlgorithm)
Label

取得或設定標籤值,用於金鑰衍生。

LegalKeySizes

取得非對稱演算法所支援的金鑰大小。

LegalKeySizes

取得非對稱演算法所支援的金鑰大小。

(繼承來源 AsymmetricAlgorithm)
PublicKey

取得公開金鑰,可讓其他 ECDiffieHellmanCng 物件用來產生共用的密碼協議。

SecretAppend

取得或設定值,該值將在產生金鑰內容時附加到密碼協議。

SecretPrepend

取得或設定值,該值將在衍生金鑰內容時加入至密碼協議的開頭。

Seed

取得或設定值,該值將在衍生金鑰內容時使用。

SignatureAlgorithm

取得簽章演算法的名稱。

(繼承來源 ECDiffieHellman)
UseSecretAgreementAsHmacKey

取得值,表示密碼協議是否做為「雜湊式訊息驗證碼」(Hash-based Message Authentication Code,HMAC) 金鑰用來衍生金鑰內容。

方法

Clear()

釋放 AsymmetricAlgorithm 類別所使用的所有資源。

(繼承來源 AsymmetricAlgorithm)
DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName)

使用所指定雜湊演算法來執行金鑰衍生。

(繼承來源 ECDiffieHellman)
DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[])

使用指定的雜湊演算法搭配選擇性的前置或附加資料,執行金鑰衍生。

DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[])

在衍生類別中實作時,使用指定的雜湊演算法搭配選擇性前置或附加資料來執行金鑰衍生。

(繼承來源 ECDiffieHellman)
DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[])

使用指定的 HMAC (雜湊式訊息驗證碼) 演算法來執行金鑰衍生。

(繼承來源 ECDiffieHellman)
DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[], Byte[])

使用指定的 HMAC (雜湊式訊息驗證碼) 演算法搭配選擇性的前置或附加資料來執行金鑰衍生。

DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[], Byte[])

在衍生類別中實作時,使用指定的 HMAC (雜湊式訊息驗證碼) 演算法搭配選擇性的前置或附加資料來執行金鑰衍生。

(繼承來源 ECDiffieHellman)
DeriveKeyMaterial(CngKey)

衍生金鑰內容,該內容產生自雙方的密碼協議 (如果 CngKey 物件包含另一方的公開金鑰)。

DeriveKeyMaterial(ECDiffieHellmanPublicKey)

衍生金鑰內容,該內容產生自雙方的密碼協議 (如果 ECDiffieHellmanPublicKey 物件包含另一方的公開金鑰)。

DeriveKeyTls(ECDiffieHellmanPublicKey, Byte[], Byte[])

使用 TLS (傳輸層安全性) 1.1 PRF (虛擬隨機函式) 來執行金鑰衍生。

DeriveKeyTls(ECDiffieHellmanPublicKey, Byte[], Byte[])

當在衍生類別中實作時,使用 TLS (傳輸層安全性) 1.1 PRF (虛擬隨機函式) 來執行金鑰衍生。

(繼承來源 ECDiffieHellman)
DeriveRawSecretAgreement(ECDiffieHellmanPublicKey)

衍生原始金鑰資料。

(繼承來源 ECDiffieHellman)
DeriveSecretAgreementHandle(CngKey)

取得雙方所產生密碼協議的控制代碼 (如果 CngKey 物件包含另一方的公開金鑰)。

DeriveSecretAgreementHandle(ECDiffieHellmanPublicKey)

取得雙方所產生密碼協議的控制代碼 (如果 ECDiffieHellmanPublicKey 物件包含另一方的公開金鑰)。

Dispose()

釋放 AsymmetricAlgorithm 類別目前的執行個體所使用的全部資源。

(繼承來源 AsymmetricAlgorithm)
Dispose(Boolean)

釋放 AsymmetricAlgorithm 類別所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。

(繼承來源 AsymmetricAlgorithm)
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
ExportECPrivateKey()

以 ECPrivateKey 格式匯出目前的金鑰。

(繼承來源 ECDiffieHellman)
ExportECPrivateKeyPem()

以 ECPrivateKey 格式匯出目前的金鑰,並編碼 PEM。

(繼承來源 ECAlgorithm)
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters)

使用位元組型密碼以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前金鑰。

ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters)

使用位元組型密碼以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前金鑰。

(繼承來源 AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters)

使用 Char 型密碼以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前金鑰。

ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters)

使用 Char 型密碼以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前金鑰。

(繼承來源 AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters)

使用以位元組為基礎的密碼 PEM 編碼,以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前的金鑰。

(繼承來源 AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters)

使用以字元為基礎的密碼 PEM 編碼,以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前的金鑰。

(繼承來源 AsymmetricAlgorithm)
ExportExplicitParameters(Boolean)

ECCurve 物件所使用的金鑰和明確的曲線參數匯出至 ECParameters 物件。

ExportExplicitParameters(Boolean)

在衍生類別中覆寫時,會使用明確的曲線形式,將公開或公開和私密金鑰資訊從運作中的 ECDiffieHellman 金鑰匯出至 ECParameters 結構,讓您可將它傳遞至 ImportParameters(ECParameters) 方法。

(繼承來源 ECDiffieHellman)
ExportParameters(Boolean)

ECCurve 物件所使用的金鑰匯出到 ECParameters 物件中。

ExportParameters(Boolean)

在衍生類別中覆寫時,會將公開或公開和私密金鑰資訊從運作中的 ECDiffieHellman 金鑰匯出至 ECParameters 結構,讓您可將它傳遞至 ImportParameters(ECParameters) 方法。

(繼承來源 ECDiffieHellman)
ExportPkcs8PrivateKey()

以 PKCS#8 PrivateKeyInfo 格式匯出目前金鑰。

(繼承來源 AsymmetricAlgorithm)
ExportPkcs8PrivateKeyPem()

以 PKCS#8 PrivateKeyInfo 格式匯出目前的金鑰,並編碼 PEM。

(繼承來源 AsymmetricAlgorithm)
ExportSubjectPublicKeyInfo()

以 X.509 SubjectPublicKeyInfo 格式匯出目前金鑰的公開金鑰部分。

(繼承來源 AsymmetricAlgorithm)
ExportSubjectPublicKeyInfoPem()

以 X.509 SubjectPublicKeyInfo 格式匯出目前金鑰的公開金鑰部分,並編碼 PEM。

(繼承來源 AsymmetricAlgorithm)
FromXmlString(String)

這個方法尚未實作。

FromXmlString(String)

這個方法在所有情況下都會擲回。

(繼承來源 ECDiffieHellman)
FromXmlString(String, ECKeyXmlFormat)
已淘汰.

使用指定的格式從 XML 字串還原金鑰資訊的序列化。

GenerateKey(ECCurve)

針對指定的曲線產生新的暫時性公開/私密金鑰組。

GenerateKey(ECCurve)

在衍生類別中覆寫時,會針對指定的曲線產生新的暫時性公開/私密金鑰組。

(繼承來源 ECDiffieHellman)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
ImportECPrivateKey(ReadOnlySpan<Byte>, Int32)

從 ECPrivateKey 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

(繼承來源 ECDiffieHellman)
ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32)

使用位元組型密碼解密之後,從 PKCS#8 EncryptedPrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32)

使用位元組型密碼解密之後,從 PKCS#8 EncryptedPrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

(繼承來源 ECDiffieHellman)
ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32)

使用 Char 型密碼解密之後,從 PKCS#8 EncryptedPrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32)

使用 Char 型密碼解密之後,從 PKCS#8 EncryptedPrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

(繼承來源 ECDiffieHellman)
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)

匯入 RFC 7468 PEM 編碼的加密私密金鑰,並取代這個物件的金鑰。

(繼承來源 ECDiffieHellman)
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

匯入 RFC 7468 PEM 編碼的加密私密金鑰,並取代這個物件的金鑰。

(繼承來源 ECDiffieHellman)
ImportFromPem(ReadOnlySpan<Char>)

匯入 RFC 7468 PEM 編碼的金鑰,並取代這個物件的金鑰。

(繼承來源 ECDiffieHellman)
ImportParameters(ECParameters)

ECCurve 物件的指定參數當做金鑰匯入至目前的執行個體。

ImportParameters(ECParameters)

在衍生類別中覆寫時,會將 ECCurve 的指定參數做為暫時性金鑰匯入目前的 ECDiffieHellman 物件。

(繼承來源 ECDiffieHellman)
ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

解密後,從 PKCS#8 PrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

解密後,從 PKCS#8 PrivateKeyInfo 結構匯入公開/私密金鑰組,以取代這個物件的金鑰。

(繼承來源 ECDiffieHellman)
ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32)

解密後,從 X.509 SubjectPublicKeyInfo 結構匯入公開金鑰,以取代這個物件的金鑰。

(繼承來源 ECDiffieHellman)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)
ToXmlString(Boolean)

這個方法尚未實作。

ToXmlString(Boolean)

這個方法在所有情況下都會擲回。

(繼承來源 ECDiffieHellman)
ToXmlString(ECKeyXmlFormat)
已淘汰.

使用指定的格式將金鑰資訊序列化成 XML 字串。

TryExportECPrivateKey(Span<Byte>, Int32)

嘗試以 ECPrivateKey 格式將目前的金鑰匯出至提供的緩衝區。

(繼承來源 ECDiffieHellman)
TryExportECPrivateKeyPem(Span<Char>, Int32)

嘗試將 PEM 編碼 ECPrivateKey 格式的目前金鑰匯出至提供的緩衝區。

(繼承來源 ECAlgorithm)
TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32)

使用位元組型密碼,嘗試以 PKCS#8 EncryptedPrivateKeyInfo 格式將目前的金鑰匯出至提供的緩衝區。

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32)

使用位元組型密碼,嘗試以 PKCS#8 EncryptedPrivateKeyInfo 格式將目前的金鑰匯出至提供的緩衝區。

(繼承來源 ECDiffieHellman)
TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32)

使用 Char 型密碼,嘗試以 PKCS#8 EncryptedPrivateKeyInfo 格式將目前的金鑰匯出至提供的緩衝區。

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32)

使用 Char 型密碼,嘗試以 PKCS#8 EncryptedPrivateKeyInfo 格式將目前的金鑰匯出至提供的緩衝區。

(繼承來源 ECDiffieHellman)
TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters, Span<Char>, Int32)

嘗試使用以位元組為基礎的密碼 PEM 編碼,以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前的金鑰。

(繼承來源 AsymmetricAlgorithm)
TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters, Span<Char>, Int32)

使用以字元為基礎的密碼 PEM 編碼,以 PKCS#8 EncryptedPrivateKeyInfo 格式匯出目前的金鑰。

(繼承來源 AsymmetricAlgorithm)
TryExportPkcs8PrivateKey(Span<Byte>, Int32)

嘗試以 PKCS#8 PrivateKeyInfo 格式將目前的金鑰匯出至提供的緩衝區。

TryExportPkcs8PrivateKey(Span<Byte>, Int32)

嘗試以 PKCS#8 PrivateKeyInfo 格式將目前的金鑰匯出至提供的緩衝區。

(繼承來源 ECDiffieHellman)
TryExportPkcs8PrivateKeyPem(Span<Char>, Int32)

嘗試將 PEM 編碼 PKCS#8 PrivateKeyInfo 格式中的目前金鑰匯出為提供的緩衝區。

(繼承來源 AsymmetricAlgorithm)
TryExportSubjectPublicKeyInfo(Span<Byte>, Int32)

嘗試以 X.509 SubjectPublicKeyInfo 格式將目前的金鑰匯出至提供的緩衝區。

(繼承來源 ECDiffieHellman)
TryExportSubjectPublicKeyInfoPem(Span<Char>, Int32)

嘗試將 PEM 編碼 X.509 SubjectPublicKeyInfo 格式中的目前金鑰匯出為提供的緩衝區。

(繼承來源 AsymmetricAlgorithm)

明確介面實作

IDisposable.Dispose()

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

如需這個成員的說明,請參閱 Dispose()

(繼承來源 AsymmetricAlgorithm)

適用於