Skip to content

Commit

Permalink
Use golang.org ed25519 package
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Rudenberg <[email protected]>
  • Loading branch information
titanous committed Aug 9, 2016
1 parent 4c690a9 commit 5367c53
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion client/interop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion keys/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"crypto/rand"
"errors"

"github.com/agl/ed25519"
"github.com/flynn/go-tuf/data"
"golang.org/x/crypto/ed25519"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
15 changes: 3 additions & 12 deletions signed/verifiers.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package signed

import (
"github.com/agl/ed25519"
"golang.org/x/crypto/ed25519"
)

// Verifier describes the verification interface. Implement this interface
Expand All @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion signed/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion signed/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down

0 comments on commit 5367c53

Please sign in to comment.