| 1 |
package cert |
| 2 |
|
| 3 |
import ( |
| 4 |
"errors" |
| 5 |
"fmt" |
| 6 |
) |
| 7 |
|
| 8 |
var ( |
| 9 |
ErrBadFormat = errors.New("bad wire format") |
| 10 |
ErrRootExpired = errors.New("root certificate is expired") |
| 11 |
ErrExpired = errors.New("certificate is expired") |
| 12 |
ErrNotCA = errors.New("certificate is not a CA") |
| 13 |
ErrNotSelfSigned = errors.New("certificate is not self-signed") |
| 14 |
ErrBlockListed = errors.New("certificate is in the block list") |
| 15 |
ErrFingerprintMismatch = errors.New("certificate fingerprint did not match") |
| 16 |
ErrSignatureMismatch = errors.New("certificate signature did not match") |
| 17 |
ErrInvalidPublicKey = errors.New("invalid public key") |
| 18 |
ErrInvalidPrivateKey = errors.New("invalid private key") |
| 19 |
ErrPublicPrivateCurveMismatch = errors.New("public key does not match private key curve") |
| 20 |
ErrPublicPrivateKeyMismatch = errors.New("public key and private key are not a pair") |
| 21 |
ErrPrivateKeyEncrypted = errors.New("private key must be decrypted") |
| 22 |
ErrCaNotFound = errors.New("could not find ca for the certificate") |
| 23 |
ErrUnknownVersion = errors.New("certificate version unrecognized") |
| 24 |
ErrCertPubkeyPresent = errors.New("certificate has unexpected pubkey present") |
| 25 |
ErrCurveMismatch = errors.New("certificate curve does not match CA") |
| 26 |
|
| 27 |
ErrInvalidPEMBlock = errors.New("input did not contain a valid PEM encoded block") |
| 28 |
ErrInvalidPEMCertificateBanner = errors.New("bytes did not contain a proper certificate banner") |
| 29 |
ErrInvalidPEMX25519PublicKeyBanner = errors.New("bytes did not contain a proper X25519 public key banner") |
| 30 |
ErrInvalidPEMX25519PrivateKeyBanner = errors.New("bytes did not contain a proper X25519 private key banner") |
| 31 |
ErrInvalidPEMEd25519PublicKeyBanner = errors.New("bytes did not contain a proper Ed25519 public key banner") |
| 32 |
ErrInvalidPEMEd25519PrivateKeyBanner = errors.New("bytes did not contain a proper Ed25519 private key banner") |
| 33 |
|
| 34 |
ErrNoPeerStaticKey = errors.New("no peer static key was present") |
| 35 |
ErrNoPayload = errors.New("provided payload was empty") |
| 36 |
|
| 37 |
ErrMissingDetails = errors.New("certificate did not contain details") |
| 38 |
ErrEmptySignature = errors.New("empty signature") |
| 39 |
ErrEmptyRawDetails = errors.New("empty rawDetails not allowed") |
| 40 |
) |
| 41 |
|
| 42 |
type ErrInvalidCertificateProperties struct { |
| 43 |
str string |
| 44 |
} |
| 45 |
|
| 46 |
func NewErrInvalidCertificateProperties(format string, a ...any) error { |
| 47 |
return &ErrInvalidCertificateProperties{fmt.Sprintf(format, a...)} |
| 48 |
} |
| 49 |
|
| 50 |
func (e *ErrInvalidCertificateProperties) Error() string { |
| 51 |
return e.str |
| 52 |
} |