Skip to content

Commit

Permalink
修正两处在go1.16版本下编译不通过的地方
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZMarquis committed May 11, 2021
1 parent f7cf5ba commit 69ae6f3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sm2/sm2.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/asn1"
"encoding/binary"
"errors"
"fmt"
"hash"
"io"
"math/big"
Expand Down Expand Up @@ -112,7 +113,7 @@ func GenerateKey(rand io.Reader) (*PrivateKey, *PublicKey, error) {

func RawBytesToPublicKey(bytes []byte) (*PublicKey, error) {
if len(bytes) != KeyBytes*2 {
return nil, errors.New("Public key raw bytes length must be " + string(KeyBytes*2))
return nil, errors.New(fmt.Sprintf("Public key raw bytes length must be %d", KeyBytes*2))
}
publicKey := new(PublicKey)
publicKey.Curve = sm2P256V1
Expand All @@ -123,7 +124,7 @@ func RawBytesToPublicKey(bytes []byte) (*PublicKey, error) {

func RawBytesToPrivateKey(bytes []byte) (*PrivateKey, error) {
if len(bytes) != KeyBytes {
return nil, errors.New("Private key raw bytes length must be " + string(KeyBytes))
return nil, errors.New(fmt.Sprintf("Private key raw bytes length must be %d", KeyBytes))
}
privateKey := new(PrivateKey)
privateKey.Curve = sm2P256V1
Expand Down

0 comments on commit 69ae6f3

Please sign in to comment.