⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e208. listing the aliases in a key store.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
A key store is a collection of keys and certificates. Each key or certificate has a unique alias used to identify that key or certificate in the key store. This example lists all the aliases in a key store. 
    try {
        // Load the keystore in the user's home directory
        File file = new File(System.getProperty("user.home") + File.separatorChar + ".keystore");
        FileInputStream is = new FileInputStream(file);
        KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
        String password = "my-keystore-password";
        keystore.load(is, password.toCharArray());
    
        // List the aliases
        Enumeration enum = keystore.aliases();
        for (; enum.hasMoreElements(); ) {
            String alias = (String)enum.nextElement();
    
            // Does alias refer to a private key?
            boolean b = keystore.isKeyEntry(alias);
    
            // Does alias refer to a trusted certificate?
            b = keystore.isCertificateEntry(alias);
        }
        is.close();
    } catch (java.security.cert.CertificateException e) {
    } catch (NoSuchAlgorithmException e) {
    } catch (FileNotFoundException e) {
        // Keystore does not exist
    } catch (KeyStoreException e) {
    } catch (IOException e) {
    }

The aliases can also be listed using keytool: 
    > keytool -list -storepass my-keystore-password


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -