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

java.io.IOException: Invalid keystore format #73

Open
auroraanna opened this issue Jan 12, 2022 · 6 comments
Open

java.io.IOException: Invalid keystore format #73

auroraanna opened this issue Jan 12, 2022 · 6 comments
Labels
bug Something isn't working missing information Further information is requested

Comments

@auroraanna
Copy link

When I build our Godot app with your CI for Android I get this:

...
ADDING: res/mipmap/icon_foreground.png
ADDING: resources.arsc
	export: step 1: Adding files...
	export: step 103: Aligning APK...
Starting signing of the APK binary using /usr/lib/android-sdk/build-tools/30.0.3/apksigner
	export: step 104: Signing release APK...
Failed to load signer "signer #1"
java.io.IOException: Invalid keystore format
	at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:666)
	at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:57)
	at sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:224)
	at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:71)
	at java.security.KeyStore.load(KeyStore.java:1445)
	at com.android.apksigner.SignerParams.loadKeyStoreFromFile(SignerParams.java:353)
	at com.android.apksigner.SignerParams.loadPrivateKeyAndCertsFromKeyStore(SignerParams.java:239)
	at com.android.apksigner.SignerParams.loadPrivateKeyAndCerts(SignerParams.java:181)
	at com.android.apksigner.ApkSignerTool.getSignerConfig(ApkSignerTool.java:395)
	at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:316)
	at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:88)

export: end
ERROR: Project export failed with error code 20 for preset "Android".
   at: _fs_changed (editor/editor_node.cpp:801)
EditorSettings: Save OK!

I followed the steps in the documentation of the CI config to encode the key and all that. I verified multiple times now that the from base64 decoded key is exactly the same as the original non base64 key. I have no idea what this error means.

@myin142
Copy link

myin142 commented Feb 4, 2022

Did you generate the keystore with java 8? Apparently the version of the apksigner and the version used to generate the keystore has to match.

@Calinou Calinou added bug Something isn't working missing information Further information is requested labels Feb 4, 2022
@auroraanna
Copy link
Author

I did not use java 8 but java 11.

@auroraanna
Copy link
Author

I'm not sure how to use Java 8 either.

@myin142
Copy link

myin142 commented Mar 20, 2022

I think you just have to set the environment variable JAVA_HOME to a different directory with java 8.

@auroraanna
Copy link
Author

auroraanna commented Mar 21, 2022

So I did export JAVA_HOME="/nix/store/6aj4vbk6hnbi7hv6lq98xyv6ikz3q45c-openjdk-8u272-b10-debug" and generated a new keystore with keytool but it's giving the same error,

@myin142
Copy link

myin142 commented Mar 21, 2022

My bad, it isn't just setting JAVA_HOME. You have to use the keytool scripts of the correct JDK to use a different version. So in your case it should be in /nix/store/6aj4vbk6hnbi7hv6lq98xyv6ikz3q45c-openjdk-8u272-b10-debug/bin/keytool.

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

No branches or pull requests

3 participants