Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

methodiDSIDLArith.KeyAgreementScheme_DH1

function KeyAgreementScheme_DH1(const aPriv : iDLPrivateKey; const aWPr : iGroupElement; const aP : iSecretKey; aCoFactor : Boolean; aHashAlgorithm: tHashAlgorithm; aKeyDerivation: tKeyDerivation; akLen : Integer; var aK : iSecretKey; const aMacTag1 : iX9_42MacTagParams = nil; const aMacTag2 : iX9_42MacTagParams = nil) : Boolean;
Diffie-Hellman primitive DH1 (IEEE 1363 / X9.63 one-pass): combines this party's private key aPriv with the peer's public group element aWPr to derive a shared secret, then runs it through the selected key-derivation function (aKeyDerivation with aHashAlgorithm and shared info aP) to produce a key aK of akLen bytes. aCoFactor selects cofactor multiplication (guarding against small-subgroup attacks). Returns False without deriving a key when aWPr is trivial (IsNonTrivialFieldElement), when it fails IsGroupElement - checked unless aCoFactor is True and subgroup validation is disabled - or when the secret value is the group identity. This is the workhorse for ephemeral-static ECDH (e.g. a TLS/handshake share against a static peer key); the optional aMacTag1/aMacTag2 compute X9.42 key-confirmation tags. Both peers run the same call with their own private key and the other's public element.