Invalid Server Cert
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
Verify format: Ensure certificate is valid X.509 format
Check encoding: Validate certificate structure and encoding
Test parsing: Use standard Java certificate parsing to validate
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")
}Content copied to clipboard