Recreate a valid Keystore from an existing “Importation Key Certificate” for my MAUI Android Project

I’m working on an android app which was release on Google Play Console in 2024 January.
I used the Windows keystore “mafirstkeystoreformyapp.keystore”.

Because I wanted to upgrade my laptop, I bought a new one, get back my project from my GitHub repository, do my test : everything was ok.

So I formated my first laptop.

But I realised, when I wanted to create a new version for Google Play Console that my app signature/footprint is not recognized :

Your android App Bundle was signed with the bad key. be sure your app bundle is signed with the good key and retry. The imported app bundle should be signed with the certificate associated to the “footprint”
SHA1: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:B2
, but the certificate used is associated to the footprint
SHA1: XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:A5

So I contacted the Google Play Console support that made me :

  • create a JKS file from my MAUI project :

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

  • Export the certificate for that key to PEM format

    keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks

  • Update the certificate from my account (2 days needed)

But this .jks file has no meaning for me : windows keystore are recognized as .keystore file, so it is useless

Is there a way to transform this .jks to .keystore ?
Or to easily recreate a valid Keystore from an existing “Importation Key Certificate” ?

There is many stackoverflow about the second question (which is linked to the first one) but, even if the response seems to be no, it look like the current situation evolved.
Android: I lost my android key store, what should I do?
I lost my .keystore file?
Recreate keystore file from private key and certificate

What I already tried

I found this : Android Package Signing for .NET MAUI app
It’s pretty close but the user issue is linked to his “App Signing key, whereas I must to use the App Importation Key (so his resolving steps cannot be done)

I tried to :

  1. create a new .keystore from Visual Studio, get the .der key from Play Console to add it : KO (the certificate is added but not used during Distribution)

  2. create a new key store, delete the default key, import the .der key from Play Console to add it : KO (the keystore seems to be “corrupted” and so Visual Studio doesn’t allow me to Distribute the app)

  3. import the .der key from Play Console and create keystore from it : KO (the keystore seems to be “corrupted” and so Visual Studio doesn’t allow me to Distribute the app)

  4. (do 3 before that) import the new keystore from the dedicated windows dialog : KO (a java error appears)

        à System.Runtime.InteropServices.Marshal.SecureStringToGlobalAllocUnicode(SecureString s) 
     à Xamarin.VisualStudio.SecureStringExtensions.ToUnsecureString(SecureString input) dans D:a_work1ssrcCoreVisualStudioExtensionsSecureStringExtensions.cs:ligne 16
    à Xamarin.VisualStudio.Publishing.Presentation.ViewModels.AndroidImportKeyViewModel.<ImportAsync>d__49.MoveNext() dans D:a_work1ssrcCoreVisualStudio.PublishingPresentationViewModelsAndroidImportKeyViewModel.cs:ligne 138
    

I used Keytool to update/create keystore :

keytool -import -alias vilolaboratory -file upload_cert.der -keystore vilolboratory.keystore

Okay, after many tries and research, the help of this How to convert .JKS to “keystore” format? helped me to publish a new version : I was able to recover usable .keystore file for my current app.

So here it is a summary of the main steps :

1st step : Generate .JKS

ask for the Key Importation Certificate reinitialization

It will bring you to the creation of a .jks file and his .pem certificate file.

You will need to use Keytool, a command line tool offered by JDK (this stackoverflow can help if you are experiencing issue : ERROR:’keytool’ is not recognized as an internal or external command, operable program or batch file)

Upload the .pem certificate file to play console and wait for two days.

2nd step : Convert it to .keystore

You will need to use keytool again to convert the JKS file.
Thanks to @Geo367 :

keytool -importkeystore -srckeystore {generatedfile}.jks -srcstoretype JKS -destkeystore {TemporaryName}.p12 -deststoretype PKCS12

keytool -importkeystore -srckeystore {TemporaryName}.p12 -srcstoretype PKCS12 -destkeystore {DefinitiveName}.keystore -deststoretype JKS

But the file generated will not be correctly identified by Visual studio there.
So continue with :

keytool -importkeystore -srckeystore {DefinitiveName}.keystore -destkeystore {DefinitiveName} -deststoretype pkcs12

It will apply the last keystore format (cannot be more specific about it : I don’t masterize this subject at all)

3rd step : Prepare Visual studio

Move the Keystore file in C:Users{USER}AppDataLocalXamarinMono for AndroidKeystore

Then, in visual studio, go in “Show/Displays archives” and push “Distribute…”

Normally, an “upload” keystore will appears : that’s your hero.

/! in my case I needed to delete the last archive created and republish in order to correctly refresh the datas and be able to watch the last keystore.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật