I am trying to identify a proper way how to list all supported cryptographic key types, sizes, and hashing functions, for a particular Java KeyStore.
According to the JDK Providers Documentation, there are different providers that offer various implementation of the services and algorithms.
I do not understand what is the relation of the KeyStore type, in my case it is JKS (by SUN provider), and the key types it can store. According to the documentation the SUN provider can work only with DSA key pair, however I am able to store RSA or EC key pairs in the JKS provided by SUN provider.
How can I know which key pair types particular KeyStore type can store and manage? Is there any documentation or description about that? Is the KeyStore just storage facility with the particular implementation and protection and does not depend what key pair type generated by which provider is stored inside?
My goal is to take the KeyStore, and based on its properties list all supported cryptographic algorithms, key sizes, and hashing function that can be used to generate key pair and sign the data.
An example: I have the
JKSKeyStoreprovided bySUNprovider. It can containDSA,RSA,ECkey pairs. ForRSA, it can support from512to16384bits long keys andSHA1withRSA,SHA256withRSA,... and similar for the other key types.
Because I am loading KeyStore dynamically and I do not know before that its provider (I am using the keytool command), I am looking for a proper way how to dynamically load all supported algorithms based on the supported providers.