- Home /
How to create a new self-signed wsa certificate with Customized validity in Unity 3D?
I created an application into UWP platform. So I am able to create a self-signed WSA certificate by doing below steps.
step1 : Publishing settings -> Certificate -> Create.
Step 2 : Enter Publisher name
Step 3 : Create
The above popup does not show any options for date modification. The WSA(.pfx) test certificate is generated. But with the default validity as 1 year. After generating the build, I need to open the .sln file to create the build from VS to generate .appx file. so that the WSA certificate needs to be selected for packaging needs to be selected as the image below.
https://ibb.co/Snqzkk7
I would like to edit the validity of this certificate to 5 years instead of the default validity duration, so that the application can be installed into any machine atleast till 5 years with out taking the build again.
Note : This application is not to publish on windows store.
Can anyone throw some light on it!!
Answer by Bunny83 · Dec 16, 2021 at 08:57 PM
Well, you should be able to create your own certifican using openssl. I just successfully created one using the two commands. I used the openssl installation that came with git (`C:\Program Files\Git\usr\bin`).
So first create a public / private key pair with this command
openssl req -x509 -newkey rsa:4096 -sha256 -keyout my.key -out my.crt -subj "/CN=YourName" -days 1825
Note that instead of "my.key" and "my.crt" you should specify the full path to a folder where you can actually write the two files. You can not creates those files inside the "Program Files" folder as applications do not have write permission here. The CN could be whatever you like. I set the days to 1825 (==5 * 365). When you execute this command you should enter an encryption passphrase to secure the key twice.
Once you have your key you can execute the second command
openssl pkcs12 -export -name “YourName” -out my.pfx -inkey my.key -in my.crt
Again make sure you use absolute paths for "my.pfx" and the two key files we have created in step 1. When you execute this command you should be prompted to enter the key passphrase from step 1 and after that you should enter an export passphrase for the certificate, again twice.
When this is done you should have a certificate that expires in 5 years. You can install the certificate on your local machine and copy it into your Unity project folder so you can select the certificate in the settings.
Thank you very much for the quick response Bunny. I followed the steps mentioned and after installing the .pfx file, I did select the same which is generated - from the Unity editor.
But I got few errors like the screen shot attached eventhough I clearly entered the same export PWD from the CMD prompt. Do you have Any idea on this issue?
Your answer
Follow this Question
Related Questions
Facebook for Android SSL Problem 0 Answers
Upload certificate problem on Google Play Console 0 Answers
HTTPS + Android (sha2 certificate) 0 Answers
packaging my .app 1 Answer