TrustPinError

Exception types for TrustPin SSL certificate pinning failures.

TrustPin provides detailed error information to help with debugging certificate pinning issues and implementing appropriate error handling strategies. Each error object represents a specific failure scenario with distinct security implications.

Error Categories

  • Configuration errors: Issues with setup parameters or credentials

  • Network errors: Problems fetching pinning configurations

  • Certificate errors: Invalid or malformed certificates

  • Validation errors: Certificate doesn't match configured pins

  • Security errors: Potential security threats or policy violations

Example Error Handling

try {
trustPin.verify("api.example.com", certificate)
} catch (e: TrustPinError.DomainNotRegistered) {
// Handle unregistered domain (strict mode only)
logger.warning("Unregistered domain accessed")
} catch (e: TrustPinError.PinsMismatch) {
// Critical security issue - possible MITM attack
logger.critical("Certificate pinning failed")
throw SecurityException("Potential MITM attack detected")
} catch (e: TrustPinError.InvalidServerCert) {
// Certificate format issue
logger.error("Invalid certificate format")
} catch (e: TrustPinError.ErrorFetchingPinningInfo) {
// Network connectivity issue
logger.error("Unable to fetch pinning configuration")
}

Security Response Guidelines

See also

Inheritors

Types

Link copied to clipboard

Thrown when all configured pins for the domain have expired.

Link copied to clipboard

Thrown when the configuration payload failed validation (e.g., signature mismatch or invalid structure).

Link copied to clipboard

Thrown when the domain is not registered for pinning and enforcement is enabled.

Link copied to clipboard

Thrown when fetching pinning information from the remote Configuration source fails.

Link copied to clipboard

Thrown when the project configuration is invalid or incomplete.

Link copied to clipboard

Thrown when the server certificate is invalid, corrupted, or could not be parsed.

Link copied to clipboard

Thrown when no matching pins were found for the provided certificate.

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard
Link copied to clipboard
open val message: String?
Link copied to clipboard
Link copied to clipboard