From 11423e25b5db9e6345bf5df6a3a53289ab44ca3b Mon Sep 17 00:00:00 2001 From: Gibheer Date: Wed, 25 Mar 2015 20:12:41 +0100 Subject: fix go evt problem Go vet reported a problem with the interface of WriteTo returning an int. Line 13: method WriteTo(stream io.Writer) (int, error) should have signature WriteTo(io.Writer) (int64, error) To fix that problem, the interface was changed to return io.WriterTo, which uses int64 for return values. --- rsa.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'rsa.go') diff --git a/rsa.go b/rsa.go index ac649b7..bcdfe6e 100644 --- a/rsa.go +++ b/rsa.go @@ -7,6 +7,7 @@ import ( "crypto/x509" "encoding/pem" "errors" + "io" ) const ( @@ -50,10 +51,10 @@ func (pr RsaPrivateKey) PrivateKey() crypto.PrivateKey { return pr.private_key } -func (pr RsaPrivateKey) MarshalPem() (marshalledPemBlock, error) { +func (pr RsaPrivateKey) MarshalPem() (io.WriterTo, error) { asn1 := x509.MarshalPKCS1PrivateKey(pr.private_key) pem_block := pem.Block{Type: PemLabelRsa, Bytes: asn1} - return pem.EncodeToMemory(&pem_block), nil + return marshalledPemBlock(pem.EncodeToMemory(&pem_block)), nil } // restore a rsa public key @@ -62,11 +63,11 @@ func LoadPublicKeyRsa(raw []byte) (*RsaPublicKey, error) { } // marshal a rsa public key into pem format -func (pu *RsaPublicKey) MarshalPem() (marshalledPemBlock, error) { +func (pu *RsaPublicKey) MarshalPem() (io.WriterTo, error) { asn1, err := x509.MarshalPKIXPublicKey(pu.public_key) if err != nil { return nil, err } pem_block := pem.Block{Type: PemLabelPublic, Bytes: asn1} - return pem.EncodeToMemory(&pem_block), nil + return marshalledPemBlock(pem.EncodeToMemory(&pem_block)), nil } // verify a message with a signature using the public key -- cgit v1.2.3-70-g09d2