InvalidServerCert

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

This error occurs when the certificate provided to TrustPin.verify is malformed, corrupted, or not in the expected format.

Common Causes

  • Invalid X.509 certificate format

  • Corrupted certificate data

  • Incorrect certificate encoding

  • Truncated or incomplete certificate

  • Wrong certificate type (not X.509)

Certificate Format Requirements

Certificates must be valid X.509 certificates. The TrustPin SDK accepts X509Certificate objects that can be properly parsed and processed.

Resolution Steps

  1. Verify format: Ensure certificate is valid X.509 format

  2. Check encoding: Validate certificate structure and encoding

  3. Test parsing: Use standard Java certificate parsing to validate

  4. Source validation: Verify certificate source and extraction method

Example

try {
trustPin.verify("api.example.com", certificate)
} catch (e: TrustPinError.InvalidServerCert) {
println("Certificate format is invalid - check certificate structure")
}

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