2016-05-23 06:22:42 +02:00
|
|
|
// Copyright (c) 2015-2016 The btcsuite developers
|
2015-04-10 00:13:35 +02:00
|
|
|
// Use of this source code is governed by an ISC
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package btcec
|
|
|
|
|
|
|
|
import (
|
2021-11-19 03:25:56 +01:00
|
|
|
secp "github.com/decred/dcrd/dcrec/secp256k1/v4"
|
2015-04-10 00:13:35 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// GenerateSharedSecret generates a shared secret based on a private key and a
|
2016-05-15 05:56:29 +02:00
|
|
|
// public key using Diffie-Hellman key exchange (ECDH) (RFC 4753).
|
2015-04-10 00:13:35 +02:00
|
|
|
// RFC5903 Section 9 states we should only return x.
|
|
|
|
func GenerateSharedSecret(privkey *PrivateKey, pubkey *PublicKey) []byte {
|
2021-11-19 03:25:56 +01:00
|
|
|
return secp.GenerateSharedSecret(privkey, pubkey)
|
2015-04-10 00:13:35 +02:00
|
|
|
}
|