FileDocCategorySizeDatePackage
KeyManagerFactoryImpl.javaAPI DocAndroid 1.5 API4823Wed May 06 22:41:06 BST 2009org.apache.harmony.xnet.provider.jsse

KeyManagerFactoryImpl

public class KeyManagerFactoryImpl extends KeyManagerFactorySpi
KeyManagerFactory implementation.
see
javax.net.ssl.KeyManagerFactorySpi

Fields Summary
private KeyStore
keyStore
private char[]
pwd
Constructors Summary
Methods Summary
public javax.net.ssl.KeyManager[]engineGetKeyManagers()

see
javax.net.ssl.KeyManagerFactorySpi#engineGetKeyManagers()

        if (keyStore == null) {
            throw new IllegalStateException("KeyManagerFactory is not initialized");
        }
        return new KeyManager[] { new KeyManagerImpl(keyStore, pwd) };
    
public voidengineInit(java.security.KeyStore ks, char[] password)

see
javax.net.ssl.KeyManagerFactorySpi#engineInit(KeyStore ks, char[] password)

        if (ks != null) {
            keyStore = ks;
            if (password != null) {
                pwd = (char[]) password.clone();
            } else {
                pwd = new char[0];
            }
        } else {
            keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
            String keyStoreName = AccessController
                    .doPrivileged(new java.security.PrivilegedAction<String>() {
                        public String run() {
                            return System.getProperty("javax.net.ssl.keyStore");
                        }
                    });
            String keyStorePwd = null;
            if (keyStoreName == null || keyStoreName.equalsIgnoreCase("NONE")
                    || keyStoreName.length() == 0) {
                try {
                    keyStore.load(null, null);
                } catch (IOException e) {
                    throw new KeyStoreException(e);
                } catch (CertificateException e) {
                    throw new KeyStoreException(e);
                }
            } else {
                keyStorePwd = AccessController
                        .doPrivileged(new java.security.PrivilegedAction<String>() {
                            public String run() {
                                return System
                                        .getProperty("javax.net.ssl.keyStorePassword");
                            }
                        });
                if (keyStorePwd == null) {
                    pwd = new char[0];
                } else {
                    pwd = keyStorePwd.toCharArray();
                }
                try {
                    keyStore.load(new FileInputStream(new File(keyStoreName)),
                            pwd);

                } catch (FileNotFoundException e) {
                    throw new KeyStoreException(e);
                } catch (IOException e) {
                    throw new KeyStoreException(e);
                } catch (CertificateException e) {
                    throw new KeyStoreException(e);
                }
            }

        }

    
public voidengineInit(javax.net.ssl.ManagerFactoryParameters spec)

see
javax.net.ssl.KeyManagerFactorySpi#engineInit(ManagerFactoryParameters spec)

        throw new InvalidAlgorithmParameterException(
                "ManagerFactoryParameters not supported");