How to export the all intermediate certs including root certificates using keytool only

前端 未结 3 733
有刺的猬
有刺的猬 2021-02-09 04:00

I am Trying to configure SSL and got the .pfx file from server team. The Certificate chain length: 2

When i am trying to export the certificate chain using keytool, only

相关标签:
3条回答
  • 2021-02-09 04:24

    This works in Java 8 to export the whole certificate chain to a file:

    keytool -list -alias yourcert -keystore /path/to/keystore -rfc
    

    Same format as export except it dumps the whole chain. You lose out on the -file option, but you can simply redirect to a file using >

    0 讨论(0)
  • 2021-02-09 04:37
    keytool -list -rfc -keystore serverauth.jks
    

    This will output all the certs in a single stream. If you wanted to split them into separate files, you'd have more work to do.

    0 讨论(0)
  • 2021-02-09 04:41

    You could do (exemple with java cacert):

    for cert in `keytool -list -keystore cacerts -storepass changeit | grep trustedCertEntry | grep -Eo "^[^,]*"`;do
        `keytool -exportcert -keystore cacerts -alias $cert -file ${cert}.crt <<< $'changeit'`
    done
    

    That will export all cert in a separated .crt file

    0 讨论(0)
提交回复
热议问题