diff options
author | Gibheer <gibheer@gmail.com> | 2015-03-25 20:12:41 +0100 |
---|---|---|
committer | Gibheer <gibheer@gmail.com> | 2015-03-25 20:12:41 +0100 |
commit | 11423e25b5db9e6345bf5df6a3a53289ab44ca3b (patch) | |
tree | 65e93514121d2ad8f5432815ca298ef7396278ea /ecdsa.go | |
parent | a11b67a64e39aded4a4bb1337fb7a4cf3021f8ef (diff) |
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.
Diffstat (limited to 'ecdsa.go')
-rw-r--r-- | ecdsa.go | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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 |