mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 12:16:20 +08:00
sm2 ke: make sure the peer pub key using same curve
This commit is contained in:
parent
45d6a74b6a
commit
474168700e
@ -93,7 +93,7 @@ func (ke *KeyExchange) SetPeerParameters(peerPub *ecdsa.PublicKey, peerUID []byt
|
|||||||
return errors.New("sm2: 'peerPub' already exists, please do not set it")
|
return errors.New("sm2: 'peerPub' already exists, please do not set it")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !IsSM2PublicKey(peerPub) {
|
if peerPub.Curve != ke.privateKey.Curve {
|
||||||
return errors.New("sm2: peer public key is not expected/supported")
|
return errors.New("sm2: peer public key is not expected/supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user