Sunday, January 18, 2015

Visual Studio Cordova "The certificate specified has expired"

If you have been using a recent CTP of Visual Studio Tools for Apache Cordova to target Windows 8 apps, you may have recently hit this error on build:

Error 104 The certificate specified has expired. For more information about renewing certificates, see http://go.microsoft.com/fwlink/?LinkID=241478.


It turns out that this is an issue with the underlying Cordova support for Windows 8, which contains a recently expired certificate - as explained here. The certifcate expired on 11/11/2014.

UPDATE 1/18/2015: It appears the issue appeared again with another expired certificate. Please see this post for details on how to correct the issue for a single project (option 1) and for all projects (option 2)

The VS Tools for Apache Cordova (CTP3) picks up this certificate file on build from a subfolder in the \Users\ directory, and this is what fixed the issue for me...
  1. For CTP3, go to the following directory:

    c:\users\{yourUsername}\.cordova\lib\npm_cache\cordova-windows\3.6.4\package\template\CordovaApp_TemporaryKey.pfx 

  2. Using Visual Studio, create a new Windows Store "Universal App" - this will provide you with an unexpired key file, which will be located in the \BlankShared.Windows subfolder of the project.

    Make a copy of this file:

    BlankSharedAppX_TemporaryKey.pfx 
    ... and rename it to

    CordovaApp_TemporaryKey.pfx
  3. Backup the following PFX file (just in case) and then copy over the newly created PFX file in its place -

    c:\users\{yourUsername}\.cordova\lib\npm_cache\cordova-windows\3.6.4\package\template\CordovaApp_TemporaryKey.pfx

  4. Back in VS, do a build / Clean and then a Rebuild. 
Anyway, that worked for me. Good luck!

1 comment: