some work done
This commit is contained in:
1 parent
1230137626
commit
d2cd50b2e3
8 files changed
+150
-132
No files matched your search
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user