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. --- ecdsa.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ecdsa.go') diff --git a/ecdsa.go b/ecdsa.go index 4531d4e..96c317f 100644 --- a/ecdsa.go +++ b/ecdsa.go @@ -9,6 +9,7 @@ import ( "encoding/asn1" "encoding/pem" "errors" + "io" "math/big" ) @@ -72,11 +73,11 @@ func (pr EcdsaPrivateKey) PrivateKey() crypto.PrivateKey { // This function implements the Pemmer interface to marshal the private key // into a pem block. -func (pr EcdsaPrivateKey) MarshalPem() (marshalledPemBlock, error) { +func (pr EcdsaPrivateKey) MarshalPem() (io.WriterTo, error) { asn1, err := x509.MarshalECPrivateKey(pr.private_key) if err != nil { return nil, err } pem_block := pem.Block{Type: PemLabelEcdsa, Bytes: asn1} - return pem.EncodeToMemory(&pem_block), nil + return marshalledPemBlock(pem.EncodeToMemory(&pem_block)), nil } // This functoin loads an ecdsa public key from the asn.1 representation. @@ -91,11 +92,11 @@ func LoadPublicKeyEcdsa(raw []byte) (*EcdsaPublicKey, error) { // This function implements the Pemmer interface to marshal the public key into // a pem block. -func (pu *EcdsaPublicKey) MarshalPem() (marshalledPemBlock, error) { +func (pu *EcdsaPublicKey) 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 } // This function verifies a message using the public key, signature and hash -- cgit v1.2.3-70-g09d2