fix lint errors
Some checks failed
Lint / golangci-lint (push) Failing after 9m53s
Declarative Tests / test (push) Failing after 51s

This commit is contained in:
Matthew Rich 2024-04-17 23:20:38 -07:00
parent 744f40143d
commit efa3a47f76

View File

@ -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
}