John starr rocks!

This commit is contained in:
didier.amyot committed 2014-10-31 16:51:49 -07:00
1 parent d2cd50b2e3
commit 0095eb7159
12 files changed
+343 -9

No files matched your search

+5 -5
View File
@@ -10,11 +10,11 @@ import (
// All the method to encode/decode keys to json, yaml...
type encodingRSAKey struct {
N string
P string
Q string
D string
E int
N string `json:"n,omitempty"`
P string `json:"p,omitempty"`
Q string `json:"q,omitempty"`
D string `json:"d,omitempty"`
E int `json:"e,omitempty"`
}
func (this *encodingRSAKey) CreateFromRSAPrivateKey(key *RSAPrivateKey) *encodingRSAKey {
+12
View File
@@ -41,3 +41,15 @@ func TestRSAPublicKeyJsonification(t *testing.T) {
t.Fail()
}
}
func TestRSAPublicKeyJsonificationFromString(t *testing.T) {
data := []byte(`{"N":"3ff","E":89}`)
key := new(RSAPublicKey)
if err := json.Unmarshal(data, key); err != nil {
t.Error(err)
return
}
if !reflect.DeepEqual(key, &RSAPublicKey{B(1023), 89}) {
t.Fail()
}
}