【问题标题】:How to list all SSL/TLS certificates programmatically in Linux?如何在 Linux 中以编程方式列出所有 SSL/TLS 证书?
【发布时间】:2016-01-05 23:16:27
【问题描述】:

在我使用的 Windows 中加载证书:

KeyStore keystore = KeyStore.getInstance("WINDOWS-ROOT"); //and WINDOWS-MY
keystore.load(null, null);
// here operations to make the list

在安卓中:

KeyStore keystore = KeyStore.getInstance("AndroidCAStore");
keystore.load(null, null);
// here operations to make the list

如何在 linux 中做到这一点?如果无法在 Linux 中使用此 API 完成,我该如何以其他方式完成?

【问题讨论】:

    标签: java linux certificate ssl-certificate keystore


    【解决方案1】:

    您可以在/etc/ssl/certs 下找到它们。只需做一个ls -l 告诉你更多。

    ls -l /etc/ssl/certs/
    

    它们都在.pem.crt。使用java.io.File 对象易于阅读。你需要一个循环来阅读它们。

    【讨论】:

      【解决方案2】:

      您是否尝试过用函数替换确切类型的密钥库以获得默认值?

      例如:

      KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
      keystore.load(null, null);
      

      【讨论】:

      • 是的,它不起作用。它会打开空的“jks”(java 密钥库)密钥库。无论如何感谢您的尝试!
      猜你喜欢
      • 1970-01-01
      • 2011-09-11
      • 2020-03-31
      • 1970-01-01
      • 2012-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-02
      相关资源
      最近更新 更多