r0adkll / sign-android-release

A GitHub action to sign an APK or AAB
MIT License
362 stars 137 forks source link

java.io.IOException: DerInputStream.getLength(): lengthTag=107, too big #59

Open big-shadow opened 2 years ago

big-shadow commented 2 years ago

Yet another Failed to load signer "signer #1" but this one has a different inner exception (I looked at the other issues)

My private key file's base64 string seems to be too long? Interested in your take here.

Failed to load signer "signer #1"
java.io.IOException: DerInputStream.getLength(): lengthTag=107, too big.
    at java.base/sun.security.util.DerInputStream.getLength(DerInputStream.java:602)
    at java.base/sun.security.util.DerValue.init(DerValue.java:383)
    at java.base/sun.security.util.DerValue.<init>(DerValue.java:324)
    at java.base/sun.security.util.DerValue.<init>(DerValue.java:337)
    at java.base/sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1973)
    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.getSignerConfig(ApkSignerTool.java:368)
    at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:291)
    at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:84)
Error: The process '/usr/local/lib/android/sdk/build-tools/30.0.2/apksigner' failed with exit code 2
dercilima commented 2 years ago

It's happen with me as well! The problem was in my signingKeyBase64 stored in Github Secrets.

Follow the next steps:

openssl base64 < some_signing_key.jks | tr -d '\n' | tee some_signing_key.jks.base64.txt

It worked for me!