modules/jretools/src/main/java/org/apache/harmony/jretools/keytool/EntryManager.java [51:73]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    static void keyClone(KeytoolParameters param) throws KeyStoreException,
            NoSuchAlgorithmException, UnrecoverableKeyException,
            KeytoolException, CertificateException, FileNotFoundException,
            NoSuchProviderException, IOException {
        KeyStore keyStore = param.getKeyStore();
        String alias = param.getAlias();
        Key srcKey;
        try {
            srcKey = keyStore.getKey(alias, param.getKeyPass());
        } catch (NoSuchAlgorithmException e) {
            throw new NoSuchAlgorithmException(
                    "Cannot find the algorithm to recover the key. ", e);
        }
        // if the entry is a not a KeyEntry
        if (srcKey == null) {
            throw new KeytoolException("The entry <" + alias + "> has no key.");
        }
        Certificate[] certChain = keyStore
                .getCertificateChain(param.getAlias());
        keyStore.setKeyEntry(param.getDestAlias(), srcKey,
                param.getNewPasswd(), certChain);
        param.setNeedSaveKS(true);
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



modules/jdktools/src/main/java/org/apache/harmony/tools/keytool/EntryManager.java [51:73]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    static void keyClone(KeytoolParameters param) throws KeyStoreException,
            NoSuchAlgorithmException, UnrecoverableKeyException,
            KeytoolException, CertificateException, FileNotFoundException,
            NoSuchProviderException, IOException {
        KeyStore keyStore = param.getKeyStore();
        String alias = param.getAlias();
        Key srcKey;
        try {
            srcKey = keyStore.getKey(alias, param.getKeyPass());
        } catch (NoSuchAlgorithmException e) {
            throw new NoSuchAlgorithmException(
                    "Cannot find the algorithm to recover the key. ", e);
        }
        // if the entry is a not a KeyEntry
        if (srcKey == null) {
            throw new KeytoolException("The entry <" + alias + "> has no key.");
        }
        Certificate[] certChain = keyStore
                .getCertificateChain(param.getAlias());
        keyStore.setKeyEntry(param.getDestAlias(), srcKey,
                param.getNewPasswd(), certChain);
        param.setNeedSaveKS(true);
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



