Domanda

I've a KeyManager array and I need to get all aliases from it. So I was going to call the method String[] getClientAliases(String keyType, Principal[] issuers) of X509KeyManager interface where I put null for issuers but I don't know what I should put as keyType, since I've any information about that.

Just for information, I'm doing that to build a KeyStore object from KeyManager[] array. After getting all aliases, for each alias I call getCertificateChain and getPrivateKey, before put both results as en entry in the keyStore. Maybe you know other ways to do that.

È stato utile?

Soluzione

The key types are listed in the Java™ Cryptography Architecture Standard Algorithm Name Documentation, in a table towards the end ("Additional JSSE Standard Names"): RSA, DSA, DH_RSA, DH_DSA, EC, EC_EC and EC_RSA.

Note that you might be able to get instances of PrivateKey this way, and re-construct some instance of KeyStore, but you might not be able to save that keystore with the content of the private key in all cases. PrivateKey is a class representing a private key, with method allowing it to be used as such. It doesn't necessarily contain the private key material, for example if this is a private key obtained from a PKCS#11 hardware token.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top