fix lint errors
This commit is contained in:
parent
744f40143d
commit
efa3a47f76
@ -7,10 +7,11 @@ import (
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"crypto/sha256"
|
||||
"crypto/x509"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"os"
|
||||
_ "crypto/x509"
|
||||
_ "encoding/pem"
|
||||
_ "fmt"
|
||||
_ "os"
|
||||
"errors"
|
||||
)
|
||||
|
||||
var ErrInvalidSignature error = errors.New("Invalid signature")
|
||||
@ -31,7 +32,7 @@ func NewIdent() *Ident {
|
||||
func (i *Ident) Generate() error {
|
||||
var err error
|
||||
i.privateKey, err = rsa.GenerateKey(rand.Reader, 2048)
|
||||
i.publicKey = &privateKey.PublicKey
|
||||
i.publicKey = &i.privateKey.PublicKey
|
||||
return err
|
||||
}
|
||||
|
||||
@ -39,7 +40,7 @@ func (i *Ident) Sign(data []byte) ([]byte, error) {
|
||||
checksum := sha256.Sum256(data)
|
||||
sig, e := rsa.SignPKCS1v15(rand.Reader, i.privateKey, crypto.SHA256, checksum[:])
|
||||
if e != nil {
|
||||
return e
|
||||
return nil, e
|
||||
}
|
||||
return sig, e
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user