aboutsummaryrefslogtreecommitdiff
path: root/keys_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'keys_test.go')
-rw-r--r--keys_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/keys_test.go b/keys_test.go
new file mode 100644
index 0000000..c9d6d1e
--- /dev/null
+++ b/keys_test.go
@@ -0,0 +1,36 @@
+package main
+
+import (
+ "bytes"
+ "testing"
+)
+
+func TestUnmarshalSig(t *testing.T) {
+ b64sig := []byte(`RWRbOC0bBf7abaGwGtq45KLDK63tgcF7CO4qTZSlTKCSbZTYlDfFm/DISQ60u+/jEzrk22suvXXAEsxQTe2xUOfV90get1YRGQo=`)
+ v := new(Sig)
+ DecodeBase64(v, b64sig)
+ out, _ := EncodeBase64(v)
+ if !bytes.Equal(b64sig, out) {
+ t.Errorf("expected %v, got %v", b64sig, out)
+ }
+}
+
+func TestUnmarshalPub(t *testing.T) {
+ b64pub := []byte(`RWRbOC0bBf7abfanaXuTYfCa6+YO69Kxyz8RD5nL/3Ta7umY6iOwnBrG`)
+ v := new(PubKey)
+ DecodeBase64(v, b64pub)
+ out, _ := EncodeBase64(v)
+ if !bytes.Equal(b64pub, out) {
+ t.Errorf("expected %v, got %v", b64pub, out)
+ }
+}
+
+func TestUnmarshalEnc(t *testing.T) {
+ b64enc := []byte(`RWRCSwAAAACzJBN2gC5//jVvDiV76rs4m2aKXkljqDpbOC0bBf7abZhV/Zygr6b0KIbSI56JQutwzsQeouxnnHuVTZp3IW4M9qdpe5Nh8Jrr5g7r0rHLPxEPmcv/dNru6ZjqI7CcGsY=`)
+ v := new(EncKey)
+ DecodeBase64(v, b64enc)
+ out, _ := EncodeBase64(v)
+ if !bytes.Equal(b64enc, out) {
+ t.Errorf("expected %v, got %v", b64enc, out)
+ }
+}