When you import a certificate other than a self-signed root certificate (e.g. intermediate certificates), keytool
tries to build and validate a proper certificate path first.
If you use the trustcacerts
parameter, then for building the path, keytool
will not only consider the certificates already contained in the trust store, but it will additionally consider the certificates contained in the cacerts
key store (this file is located in the lib/security folder of your JRE installation). The certificates in cacerts
are a kind of default trust list, the officially trusted root certificates (similar to the lists your browser trusts by default).
The option is not really necessary since you can always force the import for a certificate. It also makes no sense when importing a self-signed root certificate, because no certificate path can be built in this situation - you either trust a root or you don't.
But it may be a nice feature if you know that the imported certificate should be issued by one of the certificates contained in cacerts - keytool
would warn you if it still could not build and validate an entire certificate path - which would most likely be a warning that something is not right with the certificate you tried to import.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…