aboutsummaryrefslogtreecommitdiff
path: root/verify.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-03 13:17:11 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-03 13:17:11 +0100
commit9ab61d6884a9ac26592723523ed2521c79c47a1a (patch)
tree8607208b2a9f386eec1a39cbe219e09088d28bb3 /verify.go
parent4bef11c59c3e28f0f587b710d56d98c0f26591ad (diff)
fixed signature verification and client get-sth
Diffstat (limited to 'verify.go')
-rw-r--r--verify.go36
1 files changed, 0 insertions, 36 deletions
diff --git a/verify.go b/verify.go
deleted file mode 100644
index 50bd923..0000000
--- a/verify.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package stfe
-
-import (
- "fmt"
-
- "crypto/ed25519"
- "crypto/tls"
- "crypto/x509"
-)
-
-func (sdi *SignedDebugInfoV1) Verify(scheme tls.SignatureScheme, publicKey, message []byte) error {
- if scheme != tls.Ed25519 {
- return fmt.Errorf("unsupported signature scheme: %v", scheme)
- }
-
- // TODO: fix so that publicKey is already passed as crypto.PublicKey
- k, err := x509.ParsePKIXPublicKey(publicKey)
- if err != nil {
- return fmt.Errorf("failed parsing public key: %v", err)
- }
-
- switch t := k.(type) {
- case ed25519.PublicKey:
- vk := k.(ed25519.PublicKey)
- if !ed25519.Verify(vk, message, sdi.Signature) {
- return fmt.Errorf("invalid signature: PublicKey(%v) Message(%v) Signature(%v)", vk, message, sdi.Signature)
- }
- return nil
- default:
- return fmt.Errorf("Unsupported public key: %s", t)
- }
-}
-
-func (sth *SignedTreeHeadV1) Verify(scheme tls.SignatureScheme, publicKey []byte) error {
- return fmt.Errorf("TODO: verify signature")
-}