Creating an Application Link fails with java.io.IOException: DER length more than 4 bytes
Problem
When setting up an application link between an Atlassian Server application and an Atlassian Cloud application you receive the following error in the application logs:
A system error has occurred.
java.lang.RuntimeException: java.security.spec.InvalidKeySpecException: java.io.IOException: DER length more than 4 bytes
at com.atlassian.security.auth.trustedapps.ListApplicationRetriever.getApplicationProtocolV0(ListApplicationRetriever.java:93)
at com.atlassian.security.auth.trustedapps.ListApplicationRetriever.getApplicationProtocolV1(ListApplicationRetriever.java:52)
at com.atlassian.security.auth.trustedapps.ListApplicationRetriever.getApplication(ListApplicationRetriever.java:46)
at com.atlassian.security.auth.trustedapps.ReaderApplicationRetriever.getApplication(ReaderApplicationRetriever.java:27)
at com.atlassian.security.auth.trustedapps.InputStreamApplicationRetriever.getApplication(InputStreamApplicationRetriever.java:21)
...
Caused by: java.security.spec.InvalidKeySpecException: java.io.IOException: DER length more than 4 bytes
at org.bouncycastle.jce.provider.JDKKeyFactory.engineGeneratePublic(Unknown Source)
at org.bouncycastle.jce.provider.JDKKeyFactory$RSA.engineGeneratePublic(Unknown Source)
...
Referer URL: http://jira.example.com:8080/plugins/servlet/applinks/auth/conf/trusted/inbound-non-ual/XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
Cause
Application links between Server and Cloud instances can only be performed if your Server application is running on either port 80 or port 443 (with valid SSL certificates). The instance also needs to be accessible publicly over the internet.
The Referer URL in the above error message may display that your Server instance is running on port 8080 or some other non standard port for web applications.
Resolution
- Make sure that your Atlassian Server application is running on either port 80 or port 443 (with valid SSL certificates) and can be accessed over the internet.
If you have any doubts on how to configure this please contact the Atlassian Server support team at https://support.atlassian.com