1 Reply Latest reply on Feb 28, 2017 4:36 AM by Darghon

    Self Signed Windows Certificate not recognised for code signing

    Darghon Level 1

      Hello all,

       

      I have created a self signed windows 10 certificate based on the help from Phonegap and the referenced websites that explain how to generate this cert.

      I've made sure to make it a code signing certificate, exported in from my local cert store, and uploaded it to my phonegap account.

       

      The build starts, but shortly after fails with the notice "warning APPX0107: The certificate specified is not valid for signing."

      Now, I guess I'm doing something wrong, but unfortionatly I can't seem to figure it out, hence the post.

       

      What I did for the certificate (in windows powershell):

      New-SelfSignedCertificate -Type CodeSigningCert -Subject "<my-windows-published-id>" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3") -KeyUsage DigitalSignature -FriendlyName win_app_certificate -CertStoreLocation "Cert:\LocalMachine\My"

       

      $pwd = ConvertTo-SecureString -String <my-password> -Force -AsPlainText

      Export-PfxCertificate -cert "Cert:\LocalMachine\My\<thumbprint>" -FilePath win_app_cert.pfx -Password $pwd

      In the used code, the "1.3.6.1.5.5.7.3.3" specifies it can be used for code signing (ref: https://technet.microsoft.com/itpro/powershell/windows/pki/new-selfsignedcertificate#-text extension)

       

      My build output when I try to build with this cert.

       

      Build Date: 2017-02-17 19:54:01 +0000

      ================ Certificate 0 ================

      ================ Begin Nesting Level 1 ================

      Element 0:

      Serial Number: 6444431bd3ba90a042d39d12ca308724

      Issuer: CN=7B9E792E-4FB6-4C3E-A5A5-5477CC031ED4

      NotBefore: 2/16/2017 7:45 PM

      NotAfter: 2/16/2018 8:05 PM

      Subject: CN=7B9E792E-4FB6-4C3E-A5A5-5477CC031ED4

      Signature matches Public Key

      Root Certificate: Subject matches Issuer

      Cert Hash(sha1): ab 03 75 56 7b 18 b5 81 e1 22 92 b2 87 82 e2 44 5f ec 1b 4d

      ---------------- End Nesting Level 1 ----------------

        Provider = Microsoft Software Key Storage Provider

      Private key is NOT plain text exportable

      Encryption test passed

      CertUtil: -dump command completed successfully.

      --------------------------------------------------------------------------------

      PLUGIN OUTPUT

      --------------------------------------------------------------------------------

      Fetching plugin "cordova-plugin-whitelist@~1.2.0" via npm

      Installing "cordova-plugin-whitelist" at "1.2.2" for windows

      Fetching plugin "cordova-plugin-console@~1.0.1" via npm

      Installing "cordova-plugin-console" at "1.0.5" for windows

      Fetching plugin "cordova-plugin-statusbar@~1.0.1" via npm

      Installing "cordova-plugin-statusbar" at "1.0.1" for windows

      Fetching plugin "cordova-plugin-globalization@~1.0.5" via npm

      Installing "cordova-plugin-globalization" at "1.0.5" for windows

      Certificate "Quickstage_win_app" added to store.

       

      CertUtil: -importPFX command completed successfully.

      My "Personal"

      Deleting Certificate 0: CN=7B9E792E-4FB6-4C3E-A5A5-5477CC031ED4:ab0375567b18b581e12292b28782e2445fec1b4d

      CertUtil: -delstore command completed successfully.

      Building project: C:\cygwin\tmp\gimlet\2419608\project\CordovaApp.Windows10.jsproj

      Configuration : release

      Platform : x86

        Patching 10 in prebuild event...

        Injected base.js reference to the www/index.html

        Removing /( *)(<script\s+(?:type="text\/javascript"\s+)?src="\/\/Microsoft.WinJS.2.0\/js\/base.js">\s *<\/script>)(\s*)/ from www/index.html

        Removing /( *)(<script\s+(?:type="text\/javascript"\s+)?src="\/\/Microsoft.Phone.WinJS.2.1\/js\/base. js">\s*<\/script>)(\s*)/ from www/index.html

      MakePRI : warning 0xdef00522: Resources found for language(s) 'en,nl' but no resources found for default language(s): 'en-US'. Change the default language or qualify resources with the default language. http://go.microsoft.com/fwlink/?LinkId=231899 [C:\cygwin\tmp\gimlet\2419608\project\CordovaApp.Windows10.jsproj]

      C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1854 ,5): warning APPX0107: The certificate specified is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478. [C:\cygwin\tmp\gimlet\2419608\project\CordovaApp.Windows10.jsproj]

        Starting .NET Native compilation

        C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /unsafe+ /pdb:C:\cygwin\tmp\gimlet\2419608\project\build\windows\bld\ilc\intermediate\Edulogistix. Quickstage.pdb /nostdlib+ /reference:"C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\lib\Private\System.Private.CoreLib.dll" /debug:full /out:C:\cygwin\tmp\gimlet\2419608\project\build\windows\bld\ilc\intermediate\Edulogistix. Quickstage.exe /target:winexe C:\cygwin\tmp\gimlet\2419608\project\build\windows\bld\ilc\intermediate\fake.cs

        Processing application code

      C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\IlcInternals.targets(885,5): warning : Your application is missing a Runtime Directives (rd.xml) file. Runtime Directives are used to describe the dynamic behavior of your application and control the .NET Native optimizer. It is recommended to have at least one rd.xml file in your project. [C:\cygwin\tmp\gimlet\2419608\project\CordovaApp.Windows10.jsproj]

        Computing application closure and generating interop code

        Generating serialization code

        Compiling interop code

        Cleaning up unreferenced code

        Generating native code

        Generating fixups for native code

        CordovaApp.Windows10 -> C:\cygwin\tmp\gimlet\2419608\project\AppPackages\CordovaApp.Windows10_1.0.1.0_x86_Test\Co rdovaApp.Windows10_1.0.1.0_x86.appx

      C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(2465 ,5): error APPX0107: The certificate specified is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478. [C:\cygwin\tmp\gimlet\2419608\project\CordovaApp.Windows10.jsproj]

      If needed, additional information will be given.

       

      Thx in advance