Official Go implementation of the Bytom protocol
Révision | 5d5c9ef7d6813fe5dd82b36aa35d80a745a274ca (tree) |
---|---|
l'heure | 2019-10-12 21:01:45 |
Auteur | Yahtoo Ma <yahtoo.ma@gmai...> |
Commiter | Yahtoo Ma |
Only allow ed25519 pubkeys when connecting
@@ -87,7 +87,12 @@ func MakeSecretConnection(conn io.ReadWriteCloser, locPrivKey crypto.PrivKeyEd25 | ||
87 | 87 | if err != nil { |
88 | 88 | return nil, err |
89 | 89 | } |
90 | + | |
90 | 91 | remPubKey, remSignature := authSigMsg.Key, authSigMsg.Sig |
92 | + if _, ok := remPubKey.PubKeyInner.(crypto.PubKeyEd25519); !ok { | |
93 | + return nil, errors.New("peer sent a nil public key") | |
94 | + } | |
95 | + | |
91 | 96 | if !remPubKey.VerifyBytes(challenge[:], remSignature) { |
92 | 97 | return nil, errors.New("Challenge verification failed") |
93 | 98 | } |