How to generate a .pfx certificate for Flutter windows MSIX lib?
So let’s dive right in.
When I was in a need to build the Flutter windows app and ship it to users, I came across MSIX Installer.
It helps you publish your windows app on Windows Store as well as a direct installer package, which indeed is a lifesaver.
So here are the steps
- You would need to download OpenSSL to generate your certificates
Download here. - Go to where you installed the OpenSSL. In my case, it is:
C:\Program Files\OpenSSL-Win64\bin - Run cmd from this folder, that it looks like this in cmd.
C:\Program Files\OpenSSL-Win64\bin>
or
make “C:\Program Files\OpenSSL-Win64\bin” a environment variable to access “OpenSSL” anywhere. - Now, it’s the cmd time! Type the following.
a). Generate a private key.
openssl genrsa -out mykeyname.key 2048
b). Generate a CSR file with the help of the private key.
openssl req -new -key mykeyname.key -out mycsrname.csr
c). Generate a CRT file with the help of the private key & CSR file.
openssl x509 -in mycsrname.csr -out mycrtname.crt -req -signkey mykeyname.key -days 365
d). Generate .pfx file (finally) with the help of the private key & CRT file.
openssl pkcs12 -export -out CERTIFICATE.pfx -inkey mykeyname.key -in mycrtname.crt
There you have you .pfx certificate.
I took help from these 2 videos.
https://www.youtube.com/watch?v=wzbf9ldvBjM&t=580s&ab_channel=TutorialsPedia
https://www.youtube.com/watch?v=-i7ugO8AVN4&t=16s&ab_channel=SSLCorp
Thanks, If you appreciate the work, please clap!