'How to convert keystore to older version

I have problem with building keystore jks.

I have a key that was generated using the following command:

keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks 

The problem is that I cant use this key as it gives me error:

Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256

As far as I understand this is due to jdk 11 not supporting this. I tried upgrading to newer jdk but android studio flutter does not appear to accept any other jdk other than 11 when compiling. https://github.com/flutter/flutter/issues/98072

The key command that works in the android studio flutter is the following:

keytool -genkey -v -keystore upload-keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload 

Since I am unable to create new Pem file I am trying to convert the key from the first command to second one I know its possible to import using something like this:

keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore.jks -deststoretype pkcs12

but pkcs12 is not support either and I am unsure how to figure out how to make it same as previous one The error I get when converted specifically to pkcs12 is the following:

Warning: The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore upload-keystore.jks -destkeystore upload-keystore.jks -deststoretype pkcs12".

So essentially what I am trying to do is. Make key that uses the same PEM as the one that is upload to google play. I have key which is linked to it already so if I can somehow duplicate it at lower encryption level as shown in the example that works that would do too. Alternative solutions are also welcome.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source