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

Previously working Action now failing with java.io.IOException: Short read of DER length #61

Open
yuriykulikov opened this issue Apr 15, 2022 · 3 comments

Comments

@yuriykulikov
Copy link

Hello,
I have a GitHub action which was working fine for quite some time. Recently I have noticed that signing the app fails sometimes with this exception:

/usr/bin/cp app/build/outputs/apk/develop/release/app-develop-release-unsigned.apk app/build/outputs/apk/develop/release/app-develop-release-unsigned-aligned.apk
/usr/local/lib/android/sdk/build-tools/29.0.3/apksigner sign --ks app/build/outputs/apk/develop/release/signingKey.jks --ks-key-alias  --ks-pass pass: --out app/build/outputs/apk/develop/release/app-develop-release-unsigned-signed.apk app/build/outputs/apk/develop/release/app-develop-release-unsigned-aligned.apk
Failed to load signer "signer #1"
java.io.IOException: Short read of DER length
	at java.base/sun.security.util.DerInputStream.getLength(DerInputStream.java:588)
	at java.base/sun.security.util.DerValue.init(DerValue.java:390)
	at java.base/sun.security.util.DerValue.<init>(DerValue.java:331)
	at java.base/sun.security.util.DerValue.<init>(DerValue.java:344)
	at java.base/sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1[996](https://github.com/yuriykulikov/AlarmClock/runs/6041863318?check_suite_focus=true#step:6:996))
	at java.base/sun.security.util.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:222)
	at java.base/java.security.KeyStore.load(KeyStore.java:1479)
	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.sign(ApkSignerTool.java:277)
	at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:83)
Error: The process '/usr/local/lib/android/sdk/build-tools/29.0.3/apksigner' failed with exit code 2

Example run: https://github.com/yuriykulikov/AlarmClock/runs/6041847468?check_suite_focus=true

My configuration is:

      - name: Sign develop APK
        uses: r0adkll/sign-android-release@v1
        # ID used to access action output
        id: sign_develop_app
        with:
          releaseDirectory: app/build/outputs/apk/develop/release
          signingKeyBase64: ${{ secrets.SIGNING_KEY }}
          alias: ${{ secrets.ALIAS }}
          keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
          keyPassword: ${{ secrets.KEY_PASSWORD }}

What could be the problem?

@ehcorrea
Copy link

ehcorrea commented Jun 11, 2022

I'm having the same problem. I tried to upgrade the version to 30.0.2, but without success

edit: I solved sending the correct secret key

@vladimirevstratov
Copy link

Check for right secrets in repository - you should add secret with base 64 key

ozersa added a commit to analogdevicesinc/MAX78xxx-RefDes that referenced this issue Nov 22, 2022
Android build fails while signing image,
The below ticket exactly same as our case
 - r0adkll/sign-android-release#61
 - r0adkll/sign-android-release#34
The solution not found yet...

For now android build deleted add it when the issue has been fixed
There will be an open PR to follow up this case (Android auto build)

Signed-off-by: Sadik.Ozer <[email protected]>
@ghost
Copy link

ghost commented Jan 9, 2024

Check for right secrets in repository - you should add secret with base 64 key

What is the format? Should it be BEGIN/END PGP MESSAGE or BEGIN/END CERTIFICATE? Can this occur with an incorrect password?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants