src/pqc_ebpf_attestation/errors.py
| 1 | """Exception hierarchy for pqc-ebpf-attestation.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | |
| 6 | class BPFAttestationError(Exception): |
| 7 | """Base exception for all pqc-ebpf-attestation errors.""" |
| 8 | |
| 9 | |
| 10 | class ProgramNotFoundError(BPFAttestationError): |
| 11 | """Raised when an eBPF program file or reference cannot be located.""" |
| 12 | |
| 13 | |
| 14 | class SignatureVerificationError(BPFAttestationError): |
| 15 | """Raised when a SignedBPFProgram fails ML-DSA signature verification.""" |
| 16 | |
| 17 | |
| 18 | class ProgramHashMismatchError(SignatureVerificationError): |
| 19 | """Raised when the bytecode hash does not match the signed manifest.""" |
| 20 | |
| 21 | |
| 22 | class PolicyDeniedError(BPFAttestationError): |
| 23 | """Raised when a LoadPolicy denies a program from being loaded.""" |
| 24 | |
| 25 | |
| 26 | class UntrustedSignerError(PolicyDeniedError): |
| 27 | """Raised when the signer DID is not in the policy allow-list.""" |
| 28 | |