| 1 |
package keypair |
| 2 |
|
| 3 |
import "fmt" |
| 4 |
|
| 5 |
type EmptyPublicKeyError struct { |
| 6 |
} |
| 7 |
|
| 8 |
func (e EmptyPublicKeyError) Error() string { |
| 9 |
return "public key cannot be empty" |
| 10 |
} |
| 11 |
|
| 12 |
type InvalidPublicKeyError struct { |
| 13 |
Err error |
| 14 |
} |
| 15 |
|
| 16 |
func (e InvalidPublicKeyError) Error() string { |
| 17 |
return fmt.Sprintf("invalid public key: %v", e.Err) |
| 18 |
} |
| 19 |
|
| 20 |
type EmptyPrivateKeyError struct { |
| 21 |
} |
| 22 |
|
| 23 |
func (e EmptyPrivateKeyError) Error() string { |
| 24 |
return "private key cannot be empty" |
| 25 |
} |
| 26 |
|
| 27 |
type InvalidPrivateKeyError struct { |
| 28 |
Err error |
| 29 |
} |
| 30 |
|
| 31 |
func (e InvalidPrivateKeyError) Error() string { |
| 32 |
return fmt.Sprintf(" invalid private key: %v", e.Err) |
| 33 |
} |
| 34 |
|
| 35 |
type EmptyFormatError struct { |
| 36 |
} |
| 37 |
|
| 38 |
func (e EmptyFormatError) Error() string { |
| 39 |
return "key format cannot be empty, please call SetFormat() to set key format (PKCS1/PKCS8)" |
| 40 |
} |
| 41 |
|
| 42 |
type UnsupportedKeyFormatError struct { |
| 43 |
} |
| 44 |
|
| 45 |
func (e UnsupportedKeyFormatError) Error() string { |
| 46 |
return "unsupported key format, only PKCS1 and PKCS8 are supported" |
| 47 |
} |
| 48 |
|
| 49 |
type EmptyPaddingError struct { |
| 50 |
} |
| 51 |
|
| 52 |
func (e EmptyPaddingError) Error() string { |
| 53 |
return "padding scheme cannot be empty, please call SetPadding() to set padding scheme (PKCS1v15/OAEP/PSS)" |
| 54 |
} |
| 55 |
|
| 56 |
type UnsupportedPaddingSchemeError struct { |
| 57 |
Padding string |
| 58 |
} |
| 59 |
|
| 60 |
func (e UnsupportedPaddingSchemeError) Error() string { |
| 61 |
return fmt.Sprintf("unsupported padding scheme: %s, only PKCS1v15, OAEP, and PSS are supported", e.Padding) |
| 62 |
} |
| 63 |
|
| 64 |
type EmptySignatureError struct { |
| 65 |
} |
| 66 |
|
| 67 |
func (e EmptySignatureError) Error() string { |
| 68 |
return "no signature provided for verification" |
| 69 |
} |