Package org.microproxy.tls
Class SelfSignedSslContextSource
java.lang.Object
org.microproxy.tls.SelfSignedSslContextSource
- All Implemented Interfaces:
SslContextSource
An
SslContextSource backed by a self-signed certificate generated in memory for
localhost, 127.0.0.1 and ::1 (or the names given). The same instance can serve
both ends of a connection, e.g. an encrypted chained proxy and the proxy it chains to, because
its trust store contains its own certificate.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a TLS context source with a generated self-signed certificate.SelfSignedSslContextSource(boolean trustAllServers) Creates a TLS context source with a generated self-signed certificate.SelfSignedSslContextSource(boolean trustAllServers, boolean sendCerts, String... names) Creates a TLS context source with a generated self-signed certificate. -
Method Summary
Modifier and TypeMethodDescriptionReturns the certificate presented by this source.getKeyMaterial(String serverName) The generated certificate and its key, for the HTTP/3 listener; null when this source does not present its certificate.Returns the TLS context for this connection.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.microproxy.SslContextSource
configure
-
Constructor Details
-
SelfSignedSslContextSource
public SelfSignedSslContextSource()Creates a TLS context source with a generated self-signed certificate. -
SelfSignedSslContextSource
public SelfSignedSslContextSource(boolean trustAllServers) Creates a TLS context source with a generated self-signed certificate.- Parameters:
trustAllServers- whether to trust all peer certificates instead of only the generated certificate
-
SelfSignedSslContextSource
Creates a TLS context source with a generated self-signed certificate.- Parameters:
trustAllServers- trust any peer instead of only this certificatesendCerts- present the certificate (needed on the server side and for client auth)names- the DNS names or IP literals to include in the certificate
-
-
Method Details
-
getSslContext
Description copied from interface:SslContextSourceReturns the TLS context for this connection.- Specified by:
getSslContextin interfaceSslContextSource- Returns:
- the TLS context for this connection
-
getKeyMaterial
The generated certificate and its key, for the HTTP/3 listener; null when this source does not present its certificate.- Specified by:
getKeyMaterialin interfaceSslContextSource- Parameters:
serverName- the server name the client asked for (SNI), or null if it sent none- Returns:
- the chain and key to present, or null if this source has none
-
getCertificate
Returns the certificate presented by this source.- Returns:
- the certificate presented by this source
-