Search code examples
uwpcertificatesignaturesideloading

Visual Studio add CN= in Identity Publisher Field in appxmanifest File


I'm currently developping an UWP application for another company. I don't have the real certificate used to sign the app so i tried to generate a temporary certificate using a given publisher name. The publisher name should look like this so the other company could override the appxbundle signature:

[email protected], CN=COMPANY NAME, O=COMPANY NAME, L=City, S=Region, C=FR

I tried to generate a certificate using these commands:

"C:\Program Files (x86)\Windows Kits\10\bin\x64\makecert.exe" -r -n "[email protected], CN=COMPANY NAME, O=COMPANY NAME, L=City, S=Region, C=FR" -sv mycert.pvk mycert.cer

"C:\Program Files (x86)\Windows Kits\10\bin\x64\pvk2pfx.exe"  –pvk infoliaison.pvk –spc mycert.cer –pfx mycert.pfx –po mycert

or

New-SelfSignedCertificate -Type Custom -Subject "[email protected], CN=COMPANY NAME, O=COMPANY NAME, L=City, S=Region, C=FR" -KeyUsage DigitalSignature -FriendlyName myproject -CertStoreLocation "Cert:\LocalMachine\My"

but Visual studio 2015 refuses to import them. I checked and they are not expired

If I try to generate a test certificate with visual studio with my publisher, the manifest in the appxbundle is modified like this:

<Identity Name="[...]" Publisher="CN=&quot;[email protected], CN=COMPANY NAME, O=COMPANY NAME, L=City, S=Region, C=FR&quot;"/>

Is there any way i can do this?


Solution

  • I finally managed to create a valid certificate, working with Visual Studio with the following command in powershell with admin rights

    New-SelfSignedCertificate -Type Custom -Subject "[email protected], CN=COMPANY NAME, O=COMPANY NAME, L=City, S=Region, C=FR" -KeyUsage DigitalSignature -FriendlyName myproject -CertStoreLocation "Cert:\LocalMachine\My" -TextExtension '2.5.29.37={text}1.3.6.1.5.5.7.3.3','2.5.29.19={critical}{text}ca=0'
    

    I then exported the certificate in a pfx file and used it to sign my app