SSLHandshakeException Trust anchor for certification path not found Android HTTPS

I’m trying to establish a connection to a HTTPS site and I got this exception: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path …

Extract raw certificate from PKCS#7 file in JAVA

I would like to achieve the same what this openssl command performs, but programmatically in Java: openssl pkcs7 -in toBeExported.p7c -inform DER -out certificate.pem -print_certs which means that …