AsymmetricKeyAlgorithmProvider.CreateKeyPairWithCurveParameters Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Crea una coppia di chiavi pubblica/privata asimmetrica usando i parametri della curva.
public:
virtual CryptographicKey ^ CreateKeyPairWithCurveParameters(Platform::Array <byte> ^ parameters) = CreateKeyPairWithCurveParameters;
CryptographicKey CreateKeyPairWithCurveParameters(winrt::array_view <byte> const& parameters);
public CryptographicKey CreateKeyPairWithCurveParameters(byte[] parameters);
function createKeyPairWithCurveParameters(parameters)
Public Function CreateKeyPairWithCurveParameters (parameters As Byte()) As CryptographicKey
Parametri
- parameters
-
Byte[]
byte[]
Matrice di byte contenenti i parametri della curva.
Restituisce
Rappresenta la coppia di chiavi asimmetrica ECDSA (Elliptic Curve Digital Signature Algorithm) generata.
Esempio
Nell'esempio seguente viene creata una nuova curva ECDSA dai parametri della curva.
Byte[] myCurveParameters =
{
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xAC, 0x73,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x3B, 0x4C, 0x38, 0x2C, 0xE3, 0x7A, 0xA1, 0x92,
0xA4, 0x01, 0x9E, 0x76, 0x30, 0x36, 0xF4, 0xF5, 0xDD, 0x4D, 0x7E, 0xBB, 0x93, 0x8C, 0xF9, 0x35,
0x31, 0x8F, 0xDC, 0xED, 0x6B, 0xC2, 0x82, 0x86, 0x53, 0x17, 0x33, 0xC3, 0xF0, 0x3C, 0x4F, 0xEE,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xB8, 0xFA, 0x16, 0xDF, 0xAB,
0x9A, 0xCA, 0x16, 0xB6, 0xB3, 0x01
};
AsymmetricKeyAlgorithmProvider eccAlgorithmProvider =
AsymmetricKeyAlgorithmProvider.OpenAlgorithm(AsymmetricAlgorithmNames.EcdsaSha256);
CryptographicKey keyPair = eccAlgorithmProvider.CreateKeyPairWithCurveParameters(myCurveParameters);
Byte^ myCurveParameters[] =
{
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xAC, 0x73,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x3B, 0x4C, 0x38, 0x2C, 0xE3, 0x7A, 0xA1, 0x92,
0xA4, 0x01, 0x9E, 0x76, 0x30, 0x36, 0xF4, 0xF5, 0xDD, 0x4D, 0x7E, 0xBB, 0x93, 0x8C, 0xF9, 0x35,
0x31, 0x8F, 0xDC, 0xED, 0x6B, 0xC2, 0x82, 0x86, 0x53, 0x17, 0x33, 0xC3, 0xF0, 0x3C, 0x4F, 0xEE,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xB8, 0xFA, 0x16, 0xDF, 0xAB,
0x9A, 0xCA, 0x16, 0xB6, 0xB3, 0x01
};
AsymmetricKeyAlgorithmProvider^ eccAlgorithmProvider = AsymmetricKeyAlgorithmProvider::OpenAlgorithm(
AsymmetricAlgorithmNames::EcdsaSha256);
CryptographicKey^ keyPair = eccAlgorithmProvider->CreateKeyPairWithCurveParameters(myCurveParameters);
Commenti
La chiave privata generata è un intero casuale. La chiave pubblica è un punto, con coordinate X e Y, su una curva ECDSA.