aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go38
1 files changed, 13 insertions, 25 deletions
diff --git a/main.go b/main.go
index 16b1c18..47a636c 100644
--- a/main.go
+++ b/main.go
@@ -14,9 +14,12 @@ import (
"golang.org/x/crypto/ed25519"
)
+var (
+ PKAlg = [2]byte{'E', 'd'}
+ KDFAlg = [2]byte{'B', 'K'}
+)
+
const (
- PKAlg = "Ed"
- KDFAlg = "BK"
commentHdr = "untrusted comment: "
verifyWith = "verify with "
pubKey = "%s public key"
@@ -63,34 +66,19 @@ func main() {
}
*/
- log.Println(parseFile("test.sig"))
+ log.Println(parseFile("testcases/test.sig"))
s, _ := base64.StdEncoding.DecodeString("RWRCSwAAAACzJBN2gC5//jVvDiV76rs4m2aKXkljqDpbOC0bBf7abZhV/Zygr6b0KIbSI56JQutwzsQeouxnnHuVTZp3IW4M9qdpe5Nh8Jrr5g7r0rHLPxEPmcv/dNru6ZjqI7CcGsY=")
fmt.Printf("%v\n", s)
-}
-
-const KeyNumLen = 8
-type EncKey struct {
- PKAlg [2]byte
- KDFAlg [2]byte
- KDFRounds uint32 // network byte order
- Salt [16]byte
- Checksum [8]byte
- KeyNum [KeyNumLen]byte
- SecKey [ed25519.PrivateKeySize]byte
-}
-
-type PubKey struct {
- PKAlg [2]byte
- KeyNum [KeyNumLen]byte
- PubKey [ed25519.PublicKeySize]byte
+ ss := &Sig{
+ PKAlg: PKAlg,
+ }
+ rand.Read(ss.KeyNum[:])
+ ms, _ := ss.Marshal()
+ fmt.Println(string(ms))
}
-type Sig struct {
- PKAlg [2]byte
- KeyNum [KeyNumLen]byte
- Sig [ed25519.SignatureSize]byte
-}
+const KeyNumLen = 8
type File struct {
Comment string