KiwiSecurity and SimpleSSLContextFactory should support JCE providers #970
sleberknight
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While implementing #940 I realized that neither
KiwiSecurity
norSimpleSSLContextFactory
support a key store provider or a trust store provider that would be passed intoKeyStore#getInstance(String type, String provider)
when they are created. We can add support for this in both of these classes. We should also consider adding support inSSLContextConfiguration
, since then these values could be passed all the way from aTlsContextConfiguration
, e.g.We might also want to add convenience methods directory to
TlsContextConfiguration
to allow creating anSSLContext
directly1 and/or converting to aSimpleSSLContextFactory
, e.g.or directly...
There are probably more things that can be added to provide as much flexibility as needed, but without making things overly complex, since the properties come from the
XxxContextConfiguration
classes which then allow you to create theSimpleSSLContextFactory
and/or theSSLContext
.Currently, the
SimpleSSLContextFactory
has three telescoping constructors and a builder. From this point on, we should not add any more (public) constructors since (a) telescoping constructors are generally an anti-pattern and (b) we have the builder which can support any new properties we want to add. We will need to maintain a private all-args constructor that will need to be updated any time we add new properties, and this will be called by the builder and also by one of the public constructors (the one with the most arguments, which is called by the other public constructors).Footnotes
TlsContextConfiguration
implementsKeyAndTrustStoreConfigProvider
which in turn extendsTrustStoreConfigProvider
which defines bothtoSSLContext()
andtoSslSocketFactory()
methods. So we can already convert directly to those without going first to aSimpleSSLContextFactory
. As a result, it might not add much value to add a method to convert toSimpleSSLContextFactory
. The one reason to do so might be that onceSimpleSSLContextFactory
builds anSSLContext
it caches it, and then always returns that same instance, which I am (pretty sure) is safe to do because (as far as I can tell),SSLContext
is thread-safe. Unfortunately its javadocs do not say anything explicitly regarding thread safety.Beta Was this translation helpful? Give feedback.
All reactions