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

Private key not recognized #122

Closed
andrewthad opened this issue Dec 19, 2019 · 1 comment · Fixed by #127
Closed

Private key not recognized #122

andrewthad opened this issue Dec 19, 2019 · 1 comment · Fixed by #127
Assignees
Labels
bug Something isn't working

Comments

@andrewthad
Copy link

andrewthad commented Dec 19, 2019

Expected behavior

The --key option of mqtt-cli should recognize 4096-bit RSA private key files with just a private key in them.

Actual behavior

The --key option of mqtt-cli does not recognize 4096-bit RSA private keys with just a private key in them.

To Reproduce

I cannot provide my private key, but I have confirmed it works correctly with other mqtt clients that support client certificates. Here are some commands that will communicate what is going on:

> openssl rsa -text -noout  -in app.key
RSA Private-Key: (4096 bit, 2 primes)
modulus:
...
> mqtt sub -t '$my/topic/name' -h example.com -p 443 --cafile AmazonRootCA1.pem --key app.key --cert app.pem
Invalid value for option '--key': cannot convert '/etc/mqtt_status/certs/probation.key' to PrivateKey (The private key could not be recognized.)

The source code in FileToPrivateKeyConverter suggests that the application is making it all the way down to where UNRECOGNIZED_KEY gets thrown. This means that the key is being parsed correctly (it isn't malformed), but it is not an instanceof either PKCS8EncryptedPrivateKeyInfo or PEMKeyPair. I'm not sure what it is an instanceof though. I'm not familiar with Java's crypto ecosystem.

Details

Version info from mqtt client:

> mqtt --version
1.1.1
Picocli 4.0.4
JVM: 11.0.5 (Private Build OpenJDK 64-Bit Server VM 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)
OS: Linux 4.15.0-65-generic amd64
@gitseti gitseti self-assigned this Jan 8, 2020
@gitseti gitseti added the bug Something isn't working label Jan 8, 2020
@andrewthad
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants