-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
invalid key format error on generating private key #884
Comments
When I use the following command to convert the pem into der format, it works. Is it the way it should work? As I have to use the same private key file on both the platforms, Java and Python.
|
You are correct. For Java, the certificate must be in .PEM format for the MQTT sample to be able to produce the JWT. I've encountered the same issue; I can update the README to clarify this and correct the examples to reference files with the extension. Currently, the only indicator that you need the PEM file is that the certificate generation script has this additional step specific to the Java sample. |
Thanks, @gguuss. Good to know this. |
FYI @testover99 I'm looking at this again and the existing README references the correct keyfiles, which should in fact be in PKCS #8 format. |
I followed the steps mentioned but i am getting : An error occurred: Not authorized to connect mvn exec:java -Dexec.mainClass="com.example.cloud.iot.examples.MqttExample" -Dexec.args="-project_id=fueblabs-206511 |
@parameshwargouda did you register the device's public certificate that pairs with the private key (in PKCS8 format) used to connect? |
🤖 I have created a release *beep* *boop* --- ## [0.123.3](googleapis/java-errorreporting@v0.123.2...v0.123.3) (2022-06-23) ### Dependencies * update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#882](googleapis/java-errorreporting#882)) ([e35b3f9](googleapis/java-errorreporting@e35b3f9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [0.123.3](googleapis/java-errorreporting@v0.123.2...v0.123.3) (2022-06-23) ### Dependencies * update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#882](googleapis/java-errorreporting#882)) ([e35b3f9](googleapis/java-errorreporting@e35b3f9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [0.123.3](googleapis/java-errorreporting@v0.123.2...v0.123.3) (2022-06-23) ### Dependencies * update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#882](googleapis/java-errorreporting#882)) ([e35b3f9](googleapis/java-errorreporting@e35b3f9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
…8.0 (#884) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-pubsub](https://togithub.com/googleapis/java-pubsub) | `1.117.0` -> `1.118.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-pubsub/1.118.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-pubsub/1.118.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-pubsub/1.118.0/compatibility-slim/1.117.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-pubsub/1.118.0/confidence-slim/1.117.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/java-pubsub</summary> ### [`v1.118.0`](https://togithub.com/googleapis/java-pubsub/blob/HEAD/CHANGELOG.md#​11180-httpsgithubcomgoogleapisjava-pubsubcomparev11170v11180-2022-05-18) [Compare Source](https://togithub.com/googleapis/java-pubsub/compare/v1.117.0...v1.118.0) ##### Features - creating java backport ([#​1120](https://togithub.com/googleapis/java-pubsub/issues/1120)) ([d88f417](https://togithub.com/googleapis/java-pubsub/commit/d88f4175356b0fdeb0697cfb1a7e6cd83ac0b7a5)) - next release from main branch is 1.118.0 ([#​1127](https://togithub.com/googleapis/java-pubsub/issues/1127)) ([67605a7](https://togithub.com/googleapis/java-pubsub/commit/67605a7efb36da5b9e123efb8fe69c58d4cfcbfd)) ##### Bug Fixes - Too many leases ([#​1135](https://togithub.com/googleapis/java-pubsub/issues/1135)) ([c9bcec5](https://togithub.com/googleapis/java-pubsub/commit/c9bcec531bf175684306e50eaf7ef96ee60cba78)) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-dlp).
🤖 I have created a release *beep* *boop* --- ## [3.4.0](googleapis/java-dlp@v3.3.2...v3.4.0) (2022-05-19) ### Features * add build scripts for native image testing in Java 17 ([#1440](https://github.com/googleapis/java-dlp/issues/1440)) ([#885](googleapis/java-dlp#885)) ([fc0fd35](googleapis/java-dlp@fc0fd35)) ### Dependencies * update dependency com.google.cloud:google-cloud-pubsub to v1.118.0 ([#884](googleapis/java-dlp#884)) ([e5ac330](googleapis/java-dlp@e5ac330)) * update dependency com.google.cloud:google-cloud-shared-dependencies to v2.12.0 ([#883](googleapis/java-dlp#883)) ([ef507e8](googleapis/java-dlp@ef507e8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
In which file did you encounter the issue?
java-docs-samples/iot/api-client/mqtt_example/src/main/java/com/google/cloud/iot/examples/MqttExample.java
Describe the issue
The command I used to generate rsa private key and certificate is this:
openssl req -x509 -newkey rsa:2048 -keyout rsa_private.pem -nodes -out rsa_cert.pem -subj "/CN=unused"
In createJwtRsa method, the private key file which is working for the Python MQTT sample, giving the following error:
The text was updated successfully, but these errors were encountered: