public X509Certificate[] getCertificateChain(String alias) { X509Certificate[] certArray = keyManager.getCertificateChain(alias); if (Debug.verboseOn()) Debug.logVerbose( "getCertificateChain for alias [" + alias + "] got " + certArray.length + " results", module); return certArray; }
public PrivateKey getPrivateKey(String alias) { PrivateKey pk = keyManager.getPrivateKey(alias); if (Debug.verboseOn()) Debug.logVerbose( "getPrivateKey for alias [" + alias + "] got " + (pk == null ? "[Not Found!]" : "[alg:" + pk.getAlgorithm() + ";format:" + pk.getFormat() + "]"), module); // Debug.logInfo(new Exception(), "Location where getPrivateKey is called", module); return pk; }
// this is where the customization comes in public String chooseClientAlias(String[] keyTypes, Principal[] issuers, Socket socket) { for (String keyType : keyTypes) { String[] aliases = keyManager.getClientAliases(keyType, null); // ignoring the issuers if (aliases != null && aliases.length > 0) { for (String alias : aliases) { if (this.alias.equals(alias)) { if (Debug.verboseOn()) Debug.logVerbose( "chooseClientAlias for keyType [" + keyType + "] got alias " + this.alias, module); // Debug.logInfo(new Exception(), "Location where chooseClientAlias is called", module); return this.alias; } } } } return null; }