DomainNotRegistered

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

This error occurs only in TrustPinMode.STRICT mode when attempting to verify a certificate for a domain that is not configured in your TrustPin pinning configuration. This enforces the security policy that all connections must be explicitly validated.

When This Occurs

  • Strict mode only: This error is not thrown in TrustPinMode.PERMISSIVE mode

  • Unregistered domains: Domain not found in TrustPin dashboard configuration

  • Typos in domain: Incorrect domain name or subdomain

  • New services: Recently added services not yet registered

Resolution Steps

  1. Register domain: Add domain to TrustPin dashboard with appropriate pins

  2. Verify domain name: Check for typos or incorrect subdomain

  3. Update configuration: Refresh TrustPin configuration if recently added

  4. Consider mode: Evaluate if TrustPinMode.PERMISSIVE is appropriate

Domain Registration

To register a domain in TrustPin:

  1. TrustPin Dashboard: Log into your TrustPin account

  2. Add Domain: Configure domain with certificate pins

  3. Generate Pins: Create SHA-256 or SHA-512 hashes of certificates

  4. Set Expiration: Configure appropriate expiration dates

  5. Test Configuration: Verify in staging environment

Example Handling

try {
trustPin.verify("new-api.example.com", certificate)
} catch (e: TrustPinError.DomainNotRegistered) {
// Domain not configured for pinning
logger.warning("Unregistered domain accessed: $domain")

// Options:
// 1. Register domain in TrustPin dashboard
// 2. Switch to permissive mode temporarily
// 3. Update application to handle unregistered domains
}

Security Considerations

  • Intentional restriction: This error enforces your security policy

  • Audit trail: Log these events for security monitoring

  • Process improvement: May indicate need for better domain management

  • Compliance: Helps maintain strict security compliance

Migration Strategy

When implementing strict mode:

// Phase 1: Discovery with permissive mode
trustPin.setLogLevel(TrustPinLogLevel.INFO)
trustPin.setup(mode = TrustPinMode.PERMISSIVE)

// Phase 2: Register discovered domains
// (Use logs to identify all accessed domains)

// Phase 3: Enable strict mode
trustPin.setup(mode = TrustPinMode.STRICT)

See also

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