KeyDerivationParameters.BuildForSP80056a Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Crée un objet KeyDerivationParameters à utiliser dans la fonction de dérivation de clé SP800-56A.
public:
static KeyDerivationParameters ^ BuildForSP80056a(IBuffer ^ algorithmId, IBuffer ^ partyUInfo, IBuffer ^ partyVInfo, IBuffer ^ suppPubInfo, IBuffer ^ suppPrivInfo);
static KeyDerivationParameters BuildForSP80056a(IBuffer const& algorithmId, IBuffer const& partyUInfo, IBuffer const& partyVInfo, IBuffer const& suppPubInfo, IBuffer const& suppPrivInfo);
public static KeyDerivationParameters BuildForSP80056a(IBuffer algorithmId, IBuffer partyUInfo, IBuffer partyVInfo, IBuffer suppPubInfo, IBuffer suppPrivInfo);
function buildForSP80056a(algorithmId, partyUInfo, partyVInfo, suppPubInfo, suppPrivInfo)
Public Shared Function BuildForSP80056a (algorithmId As IBuffer, partyUInfo As IBuffer, partyVInfo As IBuffer, suppPubInfo As IBuffer, suppPrivInfo As IBuffer) As KeyDerivationParameters
Paramètres
- algorithmId
- IBuffer
Spécifie l’objectif prévu de la clé dérivée.
- partyUInfo
- IBuffer
Contient des informations publiques fournies par l’initiateur.
- partyVInfo
- IBuffer
Contient des informations publiques fournies par le répondeur.
- suppPubInfo
- IBuffer
Contient des informations publiques connues de l’initiateur et du répondeur.
- suppPrivInfo
- IBuffer
Contient des informations privées connues de l’initiateur et du répondeur, telles qu’un secret partagé.
Retours
Fait référence aux paramètres utilisés lors de la dérivation de clé.
Exemples
public void SampleDeriveFromSP80056a()
{
// Create a string that contains the algorithm name.
String strAlgName = KeyDerivationAlgorithmNames.Sp80056aConcatSha512;
// Open the specified algorithm.
KeyDerivationAlgorithmProvider objKdfProv = KeyDerivationAlgorithmProvider.OpenAlgorithm(strAlgName);
// Specify the requested size, in bytes, of the derived key.
UInt32 targetSize = 32;
// Create a buffer that contains the secret to be used during derivation.
IBuffer buffSecret = CryptographicBuffer.GenerateRandom(32);
// Create a buffer that contains the intended purpose of the derived key.
String strAlgId = "Purpose";
IBuffer buffAlgId = CryptographicBuffer.ConvertStringToBinary(strAlgId, BinaryStringEncoding.Utf8);
// Create a buffer that contains public information contributed by the initiator.
String strPartyUInfo = "Initiator public info";
IBuffer buffPartyUInfo = CryptographicBuffer.ConvertStringToBinary(strPartyUInfo, BinaryStringEncoding.Utf8);
// Create a buffer that contains public information contributed by the responder.
String strPartyVInfo = "Responder public info";
IBuffer buffPartyVInfo = CryptographicBuffer.ConvertStringToBinary(strPartyVInfo, BinaryStringEncoding.Utf8);
// Create a buffer that contains public information known to both parties.
String strSuppPubInfo = "Two party public info";
IBuffer buffSuppPubInfo = CryptographicBuffer.ConvertStringToBinary(strSuppPubInfo, BinaryStringEncoding.Utf8);
// Create a buffer that contains a shared private secret.
IBuffer buffSuppPrivInfo = CryptographicBuffer.GenerateRandom(32);
// Create the derivation parameters.
KeyDerivationParameters kdf80056AParamsEx = KeyDerivationParameters.BuildForSP80056a(
buffAlgId,
buffPartyUInfo,
buffPartyVInfo,
buffSuppPubInfo,
buffSuppPrivInfo);
// Create a key from the secret value.
CryptographicKey keyOriginal = objKdfProv.CreateKey(buffSecret);
// Derive a key based on the original key and the derivation parameters.
IBuffer keyDerived = CryptographicEngine.DeriveKeyMaterial(
keyOriginal,
kdf80056AParamsEx,
targetSize);
// Encode the key to a hexadecimal value (for display)
String strKeyHex = CryptographicBuffer.EncodeToHexString(keyDerived);
}
Remarques
Vous pouvez utiliser les noms d’algorithmes suivants avec la fonction OpenAlgorithm pour ouvrir un fournisseur d’algorithme KDF SP80056a :
- KeyDerivationAlgorithmNames.Sp80056aConcatMd5
- KeyDerivationAlgorithmNames.Sp80056aConcatSha1
- KeyDerivationAlgorithmNames.Sp80056aConcatSha256
- KeyDerivationAlgorithmNames.Sp80056aConcatSha384
- KeyDerivationAlgorithmNames.Sp80056aConcatSha512