Skip to content
ComPDF
DemoSampleAPI ReferenceFAQ
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Guides

Remove Trust Certificate

The ComPDF SDK allows you to remove a previously trusted digital certificate. This can be useful for managing certificate trust lists dynamically based on user preferences or policy changes.

java
// Retrieve the list of currently trusted certificates
List<X509Certificate> trustedCertificates = CPDFX509.getTrustedCertificates(getContext());

// Remove the first certificate in the list (as an example)
if (!trustedCertificates.isEmpty()) {
    CPDFX509.removeTrustedCertificate(getContext(), trustedCertificates.get(0));
}
kotlin
// Retrieve the list of currently trusted certificates
val trustedCertificates = CPDFX509.getTrustedCertificates(context)
// Remove the first certificate in the list (as an example)
if (trustedCertificates.isNotEmpty()) {
    CPDFX509.removeTrustedCertificate(context, trustedCertificates[0])
}