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

Unable to read client key file #187

Closed
ctron opened this issue Feb 4, 2021 · 1 comment
Closed

Unable to read client key file #187

ctron opened this issue Feb 4, 2021 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@ctron
Copy link

ctron commented Feb 4, 2021

Expected behavior

Use --key to pass in a key for X.509 client certificate authentication.

Actual behavior

$ mqtt pub -v -h localhost -p 8883 --cert device.1.crt --key device.1.key --cafile ca-bundle.pem -t temp -m '{\"temp\":42}'
Invalid value for option '--key': cannot convert 'device.1.key' to PrivateKey (The private key could not be recognized.)
Try 'mqtt pub --help' for more information.
$ head device.1.key
-----BEGIN PRIVATE KEY-----
…

--help gives me:

      --cert <clientCertificate>
                            The client certificate to use for client side authentication
      --key <clientPrivateKey>
                            The path to the client private key for client side authentication

If there is a specific format required, I would expect this to be mentioned in the help.

To Reproduce

Steps

Run the example above.

Reproducer code

Details

  • Affected MQTT CLI version(s):

    4.4.1
    Picocli 4.5.0
    JVM: 11.0.9.1 (Red Hat, Inc. OpenJDK 64-Bit Server VM 11.0.9.1+11)
    OS: Linux 5.9.16-200.fc33.x86_64 amd64
    
  • Used JVM version:

    openjdk 11.0.9.1 2020-11-04
    OpenJDK Runtime Environment 18.9 (build 11.0.9.1+11)
    OpenJDK 64-Bit Server VM 18.9 (build 11.0.9.1+11, mixed mode, sharing)
    
@gitseti
Copy link
Contributor

gitseti commented Feb 4, 2021

Hi @ctron and thanks for the Issue!

This is a known issue with reading in unencrypted .pem files which will be fixed in the upcoming version: See #185
For now you could just use an encrypted pem file instead or just wait for the upcoming version.

Therefore, I will close this for now.

@gitseti gitseti closed this as completed Feb 4, 2021
@gitseti gitseti added the duplicate This issue or pull request already exists label Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants