some work done

This commit is contained in:
didier.amyot committed 2014-10-24 20:03:41 -04:00
1 parent 1230137626
commit d2cd50b2e3
8 files changed
+150 -132

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
package keys
import (
"encoding/json"
"reflect"
"testing"
. "github.com/didiercrunch/filou/helper"
)
func TestRSAPrivateKeyJsonification(t *testing.T) {
key := &RSAPrivateKey{B(1023), B(2112), B(328723), B(2332), 89}
data, err := json.Marshal(key)
if err != nil {
t.Error(err)
return
}
key2 := new(RSAPrivateKey)
if err := json.Unmarshal(data, key2); err != nil {
t.Error(err)
return
}
if !reflect.DeepEqual(key, key2) {
t.Fail()
}
}
func TestRSAPublicKeyJsonification(t *testing.T) {
key := &RSAPublicKey{B(1023), 89}
data, err := json.Marshal(key)
if err != nil {
t.Error(err)
return
}
key2 := new(RSAPublicKey)
if err := json.Unmarshal(data, key2); err != nil {
t.Error(err)
return
}
if !reflect.DeepEqual(key, key2) {
t.Fail()
}
}