Skip to content

Commit 3f0f15b

Browse files
Harshini Ramanujamarmfazh
authored andcommitted
Revert to using package-declared HPKE errors for shortkem instead of standard library errors
1 parent 23491bd commit 3f0f15b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hpke/shortkem.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func (s shortKEM) GenerateKeyPair() (kem.PublicKey, kem.PrivateKey, error) {
103103
func (s shortKEM) UnmarshalBinaryPrivateKey(data []byte) (kem.PrivateKey, error) {
104104
key, err := s.Curve.NewPrivateKey(data)
105105
if err != nil {
106-
return nil, err
106+
return nil, ErrInvalidKEMPrivateKey
107107
}
108108

109109
return &shortKEMPrivKey{s, key}, nil
@@ -112,7 +112,7 @@ func (s shortKEM) UnmarshalBinaryPrivateKey(data []byte) (kem.PrivateKey, error)
112112
func (s shortKEM) UnmarshalBinaryPublicKey(data []byte) (kem.PublicKey, error) {
113113
key, err := s.Curve.NewPublicKey(data)
114114
if err != nil {
115-
return nil, err
115+
return nil, ErrInvalidKEMPublicKey
116116
}
117117

118118
return &shortKEMPubKey{s, *key}, nil

0 commit comments

Comments
 (0)