0
0
Fork 0

add marshal test for public key

This commit is contained in:
Gibheer 2015-02-18 21:55:29 +01:00
parent 53be920308
commit 23f83f3c6e
1 changed files with 6 additions and 2 deletions

View File

@ -11,8 +11,8 @@ var (
)
// run the marshal test
func RunMarshalTest(pk_type string, pk Pemmer, label string, t *testing.T) ([]byte, error) {
marsh_pem, err := pk.MarshalPem()
func RunMarshalTest(pk_type string, pe Pemmer, label string, t *testing.T) ([]byte, error) {
marsh_pem, err := pe.MarshalPem()
if err != nil {
t.Errorf("%s: marshal pem not working: %s", pk_type, err)
return nil, err
@ -30,6 +30,10 @@ func RunMarshalTest(pk_type string, pk Pemmer, label string, t *testing.T) ([]by
func RunPrivateKeyTests(pk_type string, pk PrivateKey, t *testing.T) {
pu := pk.Public()
// TODO check return result of the marshalled public key
_, err := RunMarshalTest(pk_type + "-public", pu, PemLabelPublic, t)
if err != nil { return }
signature, err := pk.Sign(SignatureMessage)
if err != nil { t.Errorf("%s: error creating a signature: %s", pk_type, err) }