mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 20:26:19 +08:00
update error messages
This commit is contained in:
parent
4ba1372fa0
commit
9ba3e69efc
@ -227,7 +227,7 @@ func (pub *SignMasterPublicKey) UnmarshalASN1(der []byte) error {
|
|||||||
func (pub *SignMasterPublicKey) ParseFromPEM(data []byte) error {
|
func (pub *SignMasterPublicKey) ParseFromPEM(data []byte) error {
|
||||||
block, _ := pem.Decode([]byte(data))
|
block, _ := pem.Decode([]byte(data))
|
||||||
if block == nil {
|
if block == nil {
|
||||||
return errors.New("failed to parse PEM block")
|
return errors.New("sm9: failed to parse PEM block")
|
||||||
}
|
}
|
||||||
return pub.UnmarshalASN1(block.Bytes)
|
return pub.UnmarshalASN1(block.Bytes)
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ func (master *EncryptMasterPrivateKey) UnmarshalASN1(der []byte) error {
|
|||||||
return errors.New("sm9: invalid encrypt master public key asn1 data")
|
return errors.New("sm9: invalid encrypt master public key asn1 data")
|
||||||
}
|
}
|
||||||
} else if !input.ReadASN1Integer(d) || !input.Empty() {
|
} else if !input.ReadASN1Integer(d) || !input.Empty() {
|
||||||
return errors.New("sm9: invalid encrypt master key asn1 data")
|
return errors.New("sm9: invalid encrypt master private key asn1 data")
|
||||||
}
|
}
|
||||||
master.D = d
|
master.D = d
|
||||||
master.MasterPublicKey = new(bn256.G1).ScalarBaseMult(d)
|
master.MasterPublicKey = new(bn256.G1).ScalarBaseMult(d)
|
||||||
@ -459,7 +459,7 @@ func (pub *EncryptMasterPublicKey) UnmarshalRaw(bytes []byte) error {
|
|||||||
func (pub *EncryptMasterPublicKey) ParseFromPEM(data []byte) error {
|
func (pub *EncryptMasterPublicKey) ParseFromPEM(data []byte) error {
|
||||||
block, _ := pem.Decode([]byte(data))
|
block, _ := pem.Decode([]byte(data))
|
||||||
if block == nil {
|
if block == nil {
|
||||||
return errors.New("failed to parse PEM block")
|
return errors.New("sm9: failed to parse PEM block")
|
||||||
}
|
}
|
||||||
return pub.UnmarshalASN1(block.Bytes)
|
return pub.UnmarshalASN1(block.Bytes)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user