public final class CustomTrust extends Object
Constructor and Description |
---|
CustomTrust() |
Modifier and Type | Method and Description |
---|---|
static void |
main(String... args) |
void |
run() |
SSLContext |
sslContextForTrustedCertificates(InputStream in)
Returns a SSL context that trusts
certificates and none other. |
public SSLContext sslContextForTrustedCertificates(InputStream in)
certificates
and none other. HTTPS services whose
certificates have not been signed by these certificates will fail with a SSLHandshakeException
.
This can be used to replace the host platform's built-in trusted certificates with a custom set. This is useful in development where certificate authority-trusted certificates aren't available. Or in production, to avoid reliance on third-party certificate authorities.
See also CertificatePinner
, which can limit trusted certificates while still using
the host platform's built-in trust store.
Copyright © 2016. All rights reserved.