diff --git a/client/interop_test.go b/client/interop_test.go index 9f28f67f..86ab8c3f 100644 --- a/client/interop_test.go +++ b/client/interop_test.go @@ -12,10 +12,10 @@ import ( "path/filepath" "strings" - "github.com/agl/ed25519" "github.com/flynn/go-tuf" "github.com/flynn/go-tuf/data" "github.com/flynn/go-tuf/util" + "golang.org/x/crypto/ed25519" . "gopkg.in/check.v1" ) diff --git a/keys/db.go b/keys/db.go index c932b0d7..13964dd0 100644 --- a/keys/db.go +++ b/keys/db.go @@ -4,8 +4,8 @@ import ( "crypto/rand" "errors" - "github.com/agl/ed25519" "github.com/flynn/go-tuf/data" + "golang.org/x/crypto/ed25519" ) var ( diff --git a/repo_test.go b/repo_test.go index 1c656276..9ddc4e93 100644 --- a/repo_test.go +++ b/repo_test.go @@ -10,12 +10,12 @@ import ( "testing" "time" - "github.com/agl/ed25519" "github.com/flynn/go-tuf/data" "github.com/flynn/go-tuf/encrypted" "github.com/flynn/go-tuf/keys" "github.com/flynn/go-tuf/signed" "github.com/flynn/go-tuf/util" + "golang.org/x/crypto/ed25519" . "gopkg.in/check.v1" ) diff --git a/signed/verifiers.go b/signed/verifiers.go index 3eeb9cf9..54d9f3bc 100644 --- a/signed/verifiers.go +++ b/signed/verifiers.go @@ -1,7 +1,7 @@ package signed import ( - "github.com/agl/ed25519" + "golang.org/x/crypto/ed25519" ) // Verifier describes the verification interface. Implement this interface @@ -10,7 +10,7 @@ type Verifier interface { // Verify takes a key, message and signature, all as byte slices, // and determines whether the signature is valid for the given // key and message. - Verify(key []byte, msg []byte, sig []byte) error + Verify(key, msg, sig []byte) error } // Verifiers is used to map algorithm names to Verifier instances. @@ -28,16 +28,7 @@ func RegisterVerifier(name string, v Verifier) { type Ed25519Verifier struct{} func (v Ed25519Verifier) Verify(key []byte, msg []byte, sig []byte) error { - var sigBytes [ed25519.SignatureSize]byte - if len(sig) != len(sigBytes) { - return ErrInvalid - } - copy(sigBytes[:], sig) - - var keyBytes [ed25519.PublicKeySize]byte - copy(keyBytes[:], key) - - if !ed25519.Verify(&keyBytes, msg, &sigBytes) { + if !ed25519.Verify(key, msg, sig) { return ErrInvalid } return nil diff --git a/signed/verify.go b/signed/verify.go index e5a6cb4d..7a52aaed 100644 --- a/signed/verify.go +++ b/signed/verify.go @@ -6,10 +6,10 @@ import ( "strings" "time" - "github.com/agl/ed25519" "github.com/flynn/go-tuf/data" "github.com/flynn/go-tuf/keys" "github.com/tent/canonical-json-go" + "golang.org/x/crypto/ed25519" ) var ( diff --git a/signed/verify_test.go b/signed/verify_test.go index c8c374dd..47ec59ad 100644 --- a/signed/verify_test.go +++ b/signed/verify_test.go @@ -4,9 +4,9 @@ import ( "testing" "time" - "github.com/agl/ed25519" "github.com/flynn/go-tuf/data" "github.com/flynn/go-tuf/keys" + "golang.org/x/crypto/ed25519" . "gopkg.in/check.v1" )