ctron / pem-keystore

A PKCS #1 PEM KeyStore for Java
Eclipse Public License 1.0
40 stars 9 forks source link

Support store type probing to help auto-detecting the store type #25

Open jowerner opened 5 months ago

jowerner commented 5 months ago

The KeyStore class provides a getInstance(...) variant that tries to detect the store type and loads the store with a matching provider:

KeyStore.getInstance(storeFile, storePassword); 

This way, we could use stores of different types interchangeably without having to configure the store type.

This doesn't currently work for PEM key stores. What do you think about adding this feature? Looks like you would have to override KeyStoreSpi.engineProbe(InputStream) to support this. Thanks!

ctron commented 5 months ago

Kind of like a "meta" provider? That sounds like a great idea. PRs welcome :grin: