Package java.security

Examples of java.security.KeyStore.containsAlias()


          // -> delete the specified entry and save back to disk
          FileInputStream fsIn = new FileInputStream( pathToKeystore );
          KeyStore certStore = KeyStore.getInstance( "JKS" );
          certStore.load( fsIn, keystorePassword.toCharArray());

          if ( certStore.containsAlias( accessKey[0] )) {
                certStore.deleteEntry( accessKey[0] );
                FileOutputStream fsOut = new FileOutputStream( pathToKeystore );
               certStore.store( fsOut, keystorePassword.toCharArray());
              
              // -> dis-associate the cert's uniqueId with the Cloud API keys
View Full Code Here


        store.load(null, null);

        store.setKeyEntry("privateKey", privKey, null, chain);
       
        if (!store.containsAlias("privateKey"))
        {
            fail("couldn't find alias privateKey");
        }
       
        if (store.isCertificateEntry("privateKey"))
View Full Code Here

        //
        // basic certificate check
        //
        store.setCertificateEntry("cert", ch[1]);
       
        if (!store.containsAlias("cert"))
        {
            fail("couldn't find alias cert");
        }
       
        if (!store.isCertificateEntry("cert"))
View Full Code Here

            // -> delete the specified entry and save back to disk
            FileInputStream fsIn = new FileInputStream( pathToKeystore );
            KeyStore certStore = KeyStore.getInstance( "JKS" );
            certStore.load( fsIn, keystorePassword.toCharArray());

            if ( certStore.containsAlias( accessKey[0] )) {
                certStore.deleteEntry( accessKey[0] );
                FileOutputStream fsOut = new FileOutputStream( pathToKeystore );
                certStore.store( fsOut, keystorePassword.toCharArray());

                // -> dis-associate the cert's uniqueId with the Cloud API keys
View Full Code Here

            // -> delete the specified entry and save back to disk
            FileInputStream fsIn = new FileInputStream( pathToKeystore );
            KeyStore certStore = KeyStore.getInstance( "JKS" );
            certStore.load( fsIn, keystorePassword.toCharArray());

            if ( certStore.containsAlias( accessKey[0] )) {
                certStore.deleteEntry( accessKey[0] );
                FileOutputStream fsOut = new FileOutputStream( pathToKeystore );
                certStore.store( fsOut, keystorePassword.toCharArray());

                // -> dis-associate the cert's uniqueId with the Cloud API keys
View Full Code Here

                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        String msg;
                        KeyStore ks = PlatformHookWindows.getRootKeystore();
                        if (ks.containsAlias(RemoteControlHttpsServer.ENTRY_ALIAS)) {
                            Main.info(tr("Removing certificate {0} from root keystore.", RemoteControlHttpsServer.ENTRY_ALIAS));
                            ks.deleteEntry(RemoteControlHttpsServer.ENTRY_ALIAS);
                            msg = tr("Certificate has been successfully uninstalled.");
                        } else {
                            msg = tr("Certificate is not installed. Nothing to do.");
View Full Code Here

        // check if the alias exists
        if (command == Command.CERTREQ || command == Command.DELETE
                || command == Command.EXPORT || command == Command.KEYCLONE
                || command == Command.KEYPASSWD || command == Command.SELFCERT
                || (command == Command.LIST && param.getAlias() != null)) {
            if (!keyStore.containsAlias(param.getAlias())) {
                throw new KeytoolException("Alias <" + alias
                        + "> doesn't exist");
            }
        } else if (command == Command.GENKEY){
            if (keyStore.containsAlias(param.getAlias())) {
View Full Code Here

            if (!keyStore.containsAlias(param.getAlias())) {
                throw new KeytoolException("Alias <" + alias
                        + "> doesn't exist");
            }
        } else if (command == Command.GENKEY){
            if (keyStore.containsAlias(param.getAlias())) {
                throw new KeytoolException("Key(s) not generated, alias <"
                        + alias + "> already exists.");
            }
        }
View Full Code Here

                        || command == Command.CERTREQ
                        || command == Command.KEYPASSWD
                        || command == Command.SELFCERT
                // if keystore contains alias, import of a certificate reply
                // is considered, otherwise password is unnecessary.
                || (command == Command.IMPORT && keyStore.containsAlias(alias)))) {
            param.setKeyPass(tryStorePassAsKeyPass(keyStore, alias, param
                    .getStorePass()));
        }
       
        switch (command) {
View Full Code Here

    private void ensureKeyPairForInstanceAlias() throws IOException, NoSuchAlgorithmException, CertificateException, KeyStoreException, UnrecoverableKeyException, ProcessManagerException {
        /*
         * No need to add glassfish-instance to the keystore if it already exists.
         */
        final KeyStore ks = sslUtils().getKeyStore();
        if (ks.containsAlias(SecureAdmin.Duck.DEFAULT_INSTANCE_ALIAS)) {
            return;
        }
       
        /*
         * This is ugly but effective.  We need to add a new private key to
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.