Package java.security

Examples of java.security.KeyStore.aliases()


        return ks;
    }

    private PublicKey getPublicKey() throws Exception {
        KeyStore keyStore = getKeyStore();
        Enumeration<String> aliases = keyStore.aliases();
        while (aliases.hasMoreElements()) {
            String alias = aliases.nextElement();
            if (keyStore.isKeyEntry(alias)) {
                return keyStore.getCertificate(alias).getPublicKey();
            }
View Full Code Here


        return null;
    }

    private PrivateKey getPrivateKey() throws Exception {
        KeyStore keyStore = getKeyStore();
        Enumeration<String> aliases = keyStore.aliases();
        while (aliases.hasMoreElements()) {
            String alias = aliases.nextElement();
            if (keyStore.isKeyEntry(alias)) {
                return (PrivateKey) keyStore.getKey(alias, KEYSTORE_PASSWORD);
            }
View Full Code Here

        return ks;
    }

    private PublicKey getPublicKey() throws Exception {
        KeyStore keyStore = getKeyStore();
        Enumeration<String> aliases = keyStore.aliases();
        while (aliases.hasMoreElements()) {
            String alias = aliases.nextElement();
            if (keyStore.isKeyEntry(alias)) {
                return keyStore.getCertificate(alias).getPublicKey();
            }
View Full Code Here

        return null;
    }

    private PrivateKey getPrivateKey() throws Exception {
        KeyStore keyStore = getKeyStore();
        Enumeration<String> aliases = keyStore.aliases();
        while (aliases.hasMoreElements()) {
            String alias = aliases.nextElement();
            if (keyStore.isKeyEntry(alias)) {
                return (PrivateKey) keyStore.getKey(alias, KEYSTORE_PASSWORD);
            }
View Full Code Here

        byte[] bytes = new byte[dis.available()];
        dis.readFully(bytes);
        dis.close();
        ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
        store.load(bin, keystorePassword.toCharArray());
        for (java.util.Enumeration<String> aliases = store.aliases(); aliases.hasMoreElements();) {
            final String alias = aliases.nextElement();
            if (id.equals(alias)) {
                return (X509Certificate) store.getCertificate(alias);
            }
        }
View Full Code Here

        }

        //Fetch all aliases from the keystore.
        Enumeration aliases = null;
        try {
            aliases = jksKeyStore.aliases();
            System.out.println("Got KeyStore aliases.");
        } catch (KeyStoreException e) {
            e.printStackTrace();
            System.exit(1);
        }
View Full Code Here

         {
            keyStore.load(null, null);
         }

         // Remove all nexj certificates, leaving others
         for (Enumeration e = keyStore.aliases(); e.hasMoreElements(); )
         {
            String sAlias = (String)e.nextElement();

            if (sAlias.startsWith(SysUtil.NAMESPACE + "-"))
            {
View Full Code Here

            //add code to change all the aliases that exist rather then change s1as only
            List<String> aliases = new ArrayList<String>();
            try {
                KeyStore keyStore = KeyStore.getInstance(keyStoreType);
                keyStore.load(new FileInputStream(keystore), storePassword.toCharArray());
                Enumeration<String> all = keyStore.aliases();
                while (all.hasMoreElements()) {
                    aliases.add(all.nextElement());
                }
            } catch (Exception e) {
                aliases.add(CERTIFICATE_ALIAS);
View Full Code Here

                        KeyStore s1 = c.getKeyStore();
                        KeyStore s2 = result.getKeyStore();
                        try {
                            // if the aliases differ we know it's not a match, this is a faster test than serial form
                            Set<String> a1 = new HashSet<String>(Collections.list(s1.aliases()));
                            Set<String> a2 = new HashSet<String>(Collections.list(s2.aliases()));
                            if (!a1.equals(a2)) {
                                continue;
                            }
                            // this may give false misses but it will not give false hits
                            ByteArrayOutputStream bos1 = new ByteArrayOutputStream();
View Full Code Here

            try {
                // ensure we map the keystore to the correct type
                KeyStore dst = KeyStore.getInstance("PKCS12");
                dst.load(null, null);
                KeyStore src = c.getKeyStore();
                for (Enumeration<String> e = src.aliases(); e.hasMoreElements(); ) {
                    String alias = e.nextElement();
                    KeyStore.Entry entry;
                    try {
                        entry = src.getEntry(alias, null);
                    } catch (UnrecoverableEntryException e1) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.