Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework plugin to use Keystore Java API #14

Open
mthmulders opened this issue Jun 17, 2020 · 9 comments
Open

Rework plugin to use Keystore Java API #14

mthmulders opened this issue Jun 17, 2020 · 9 comments

Comments

@mthmulders
Copy link

When using the Keytool Maven Plugin, I noticed that it logs warnings for things that I would consider "informational".

For instance, if I ask the plugin to import a certificate into a keystore, the logs says

[WARNING] Certificate was added to keystore

I would expect the plugin to log that as informational message. It's not a problem or something that could turn into a problem. Following the idea that "a warning is an error in the making", I don't see why this message (and probably others) are logged as warning.

I am willing to provide a patch for this, if you agree that informational would be better suited.

@bmarwell
Copy link
Contributor

@mthmulders yes, highly appreciated! CI is fixed again.

@mthmulders
Copy link
Author

Hmm, it seems this is logged as a warning because the plugin delegates to the keytool program. The keytool program writes this informational message to standard error.

I have to say I find the use of stdout and stderr in keytool a bit strange:

  • The prompt "Enter keystore password: " goes to stderr
  • The error message "keytool error: java.io.IOException: keystore password was incorrect" goes to stdout

This makes it really hard to determine from the output stream if something is informational, or indeed an error. Not sure how to proceed here... Filing an issue against keytool might be a bit far-fetched?

@bmarwell
Copy link
Contributor

Yes, but I guess we could now use the keytool API from the JDK instead of invoking an executable.

@mthmulders
Copy link
Author

Yes, but I guess we could now use the keytool API from the JDK instead of invoking an executable.

Out of curiosity, was there something that prevented using KeyStore and friends? It has been there since Java 1.2, according to the Javadoc...

@bmarwell
Copy link
Contributor

I have no idea :D
But yes, that is exactly why there is no Tool API probably.

@bmarwell
Copy link
Contributor

bmarwell commented Apr 24, 2022

Tasks

  • drop module API for Java < 8
  • use Keystore API instead of external tool
  • then we only have one maven module left. Maybe contract it into a non-multimodule-project.
  • if so, rename to keytool-maven-plugin.

@slachiewicz
Copy link
Member

Maybe stupid question - maybe someone already build plugin for that?

@bmarwell
Copy link
Contributor

Quick Google search: nothing found. But good that you brought it up.

I can start a new branch this evening unless you want to.

@bmarwell bmarwell changed the title Severity of log messages Rework plugin to use Keystore Java API Apr 24, 2022
@slachiewicz
Copy link
Member

Feel free to continue, I'll dig deeper elsewhere :-))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants