Skip to content
New issue

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

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

Already on GitHub? # to your account

Base64 cannot be decoded to KeyStore with Java client #1295

Closed
nagyesta opened this issue Dec 29, 2024 · 1 comment
Closed

Base64 cannot be decoded to KeyStore with Java client #1295

nagyesta opened this issue Dec 29, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@nagyesta
Copy link
Owner

Describe the bug

nagyesta/lowkey-vault-example#444 failed because the Base64 string of the certificate cannot be decoded by the client.

To reproduce

Steps to reproduce the behavior:

  1. Use v2.6.3 of Lowkey Vault
  2. Fetch a certificate from Lowkey Vault
  3. Try building a KeyStore from the Base64 string

Expected behavior

The KeyStore is working and contains the key and the cert.

Actual behavior

An exception is thrown:

java.lang.IllegalStateException: java.lang.IllegalStateException: Unable to load key store.
	at com.github.nagyesta.lowkeyvault.example.impl.AzureCertificateRepositoryImpl.getCertificate(AzureCertificateRepositoryImpl.java:33)
	at com.github.nagyesta.lowkeyvault.example.LowkeyVaultExampleApplicationTests.testCertificateRepositoryGetCertificateAndGetPrivateKeyShouldReturnGeneratedCertificateAndKeyWhenCalled(LowkeyVaultExampleApplicationTests.java:103)
...
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: java.lang.IllegalStateException: Unable to load key store.
	at com.github.nagyesta.lowkeyvault.example.impl.AzureCertificateRepositoryImpl.fetchKeyStore(AzureCertificateRepositoryImpl.java:56)
	at com.github.nagyesta.lowkeyvault.example.impl.AzureCertificateRepositoryImpl.getCertificate(AzureCertificateRepositoryImpl.java:29)
	... 85 more
Caused by: java.lang.IllegalArgumentException: Illegal base64 character d
	at java.base/java.util.Base64$Decoder.decode0(Base64.java:848)
	at java.base/java.util.Base64$Decoder.decode(Base64.java:566)
	at java.base/java.util.Base64$Decoder.decode(Base64.java:589)
	at com.github.nagyesta.lowkeyvault.example.impl.AzureCertificateRepositoryImpl.fetchKeyStore(AzureCertificateRepositoryImpl.java:51)
	... 86 more

The command you used

N/A

A minimal project that can be used to reproduce the issue

See PR above

Environment

  • OS: Any
  • Version: 2.6.3
  • Java version 17

Additional context

N/A

@nagyesta nagyesta added the bug Something isn't working label Dec 29, 2024
@nagyesta nagyesta self-assigned this Dec 29, 2024
@nagyesta nagyesta moved this from Ideas to In progress in Lowkey Vault Roadmap Dec 29, 2024
nagyesta added a commit that referenced this issue Dec 29, 2024
- Fixes encoder to generate same format as before
- Changes end-to-end tests to only accept the right format (and no longer accept Base64Mime)

Resolves #1295
{patch}

Signed-off-by: Esta Nagy <nagyesta@gmail.com>
@nagyesta
Copy link
Owner Author

nagyesta commented Dec 29, 2024

Caused by #1294

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

1 participant