Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[CB-4345] Added warning message for when signing keys are not installed
- Added check for bbidtoken.csk
- Added information to link old signing keys to the blackberry id token
- changed check_reqs-utils into signing-utils
- Migrated and added unit tests for signing-utils.js
- switched warning message for when author.p12 DNE to when barsigner.db DNE

Reviewed by Bryan Higgins <bhiggins@blackberry.com>
Tested by Daniel Audino <daudino@blackberry.com>
  • Loading branch information
Kristoffer Flores authored and bryanhiggins committed Sep 20, 2013
1 parent acc99de commit 95c4540327dcccdd49e0275bbbc9a83a2f090f55
Show file tree
Hide file tree
Showing 5 changed files with 497 additions and 373 deletions.
@@ -17,7 +17,8 @@
* under the License.
*/

var MIN_NODE_VER = "0.9.9";
var MIN_NODE_VER = "0.9.9",
signingUtils = require('./templates/project/cordova/lib/signing-utils');

function isNodeNewerThanMin () {
//Current version is stored as a String in format "X.X.X"
@@ -31,4 +32,12 @@ if (!isNodeNewerThanMin()) {
process.exit(1);
}

if (!signingUtils.getKeyStorePath() && !signingUtils.getKeyStorePathBBID()) {
console.log('WARNING: Signing keys are not installed on this machine.');
}

if (signingUtils.getDbPath()) {
console.log('NOTE: BlackBerry ID tokens can now be used in place of your old signing keys. For more information on linking old signing keys with a BlackBerry ID token, please log in at http://developer.blackberry.com and click on Code Signing in the top menu bar.');
}

process.exit(0);
@@ -22,45 +22,9 @@ var path = require('path'),
conf = require("./conf"),
pkgrUtils = require("./packager-utils"),
logger = require("./logger"),
AUTHOR_P12 = "author.p12",
CSK = "barsigner.csk",
DB = "barsigner.db",
signingUtils = require("./signing-utils.js"),
_self;

function getDefaultPath(file) {
// The default location where signing key files are stored will vary based on the OS:
// Windows XP: %HOMEPATH%\Local Settings\Application Data\Research In Motion
// Windows Vista and Windows 7: %HOMEPATH%\AppData\Local\Research In Motion
// Mac OS: ~/Library/Research In Motion
// UNIX or Linux: ~/.rim
var p = "";
if (os.type().toLowerCase().indexOf("windows") >= 0) {
// Try Windows XP location
p = process.env.HOMEDRIVE + process.env.HOMEPATH + "\\Local Settings\\Application Data\\Research In Motion\\" + file;
if (fs.existsSync(p)) {
return p;
}

// Try Windows Vista and Windows 7 location
p = process.env.HOMEDRIVE + process.env.HOMEPATH + "\\AppData\\Local\\Research In Motion\\" + file;
if (fs.existsSync(p)) {
return p;
}
} else if (os.type().toLowerCase().indexOf("darwin") >= 0) {
// Try Mac OS location
p = process.env.HOME + "/Library/Research In Motion/" + file;
if (fs.existsSync(p)) {
return p;
}
} else if (os.type().toLowerCase().indexOf("linux") >= 0) {
// Try Linux location
p = process.env.HOME + "/.rim/" + file;
if (fs.existsSync(p)) {
return p;
}
}
}

function execSigner(session, target, callback) {
var script = path.join(process.env.CORDOVA_BBTOOLS, "blackberry-signer"),
signer,
@@ -92,15 +56,15 @@ function execSigner(session, target, callback) {
_self = {
getKeyStorePath : function () {
// Todo: decide where to put sigtool.p12 which is genereated and used in WebWorks SDK for Tablet OS
return getDefaultPath(AUTHOR_P12);
return signingUtils.getKeyStorePath();
},

getCskPath : function () {
return getDefaultPath(CSK);
return signingUtils.getCskPath();
},

getDbPath : function () {
return getDefaultPath(DB);
return signingUtils.getDbPath();
},

execSigner: execSigner
@@ -0,0 +1,64 @@
var fs = require('fs'),
path = require('path'),
os = require('os'),
childProcess = require('child_process'),
AUTHOR_P12 = "author.p12",
BBIDTOKEN = "bbidtoken.csk",
CSK = "barsigner.csk",
DB = "barsigner.db",
_self;

function getDefaultPath(file) {
// The default location where signing key files are stored will vary based on the OS:
// Windows XP: %HOMEPATH%\Local Settings\Application Data\Research In Motion
// Windows Vista and Windows 7: %HOMEPATH%\AppData\Local\Research In Motion
// Mac OS: ~/Library/Research In Motion
// UNIX or Linux: ~/.rim
var p = "";
if (os.type().toLowerCase().indexOf("windows") >= 0) {
// Try Windows XP location
p = process.env.HOMEDRIVE + process.env.HOMEPATH + "\\Local Settings\\Application Data\\Research In Motion\\" + file;
if (fs.existsSync(p)) {
return p;
}

// Try Windows Vista and Windows 7 location
p = process.env.HOMEDRIVE + process.env.HOMEPATH + "\\AppData\\Local\\Research In Motion\\" + file;
if (fs.existsSync(p)) {
return p;
}
} else if (os.type().toLowerCase().indexOf("darwin") >= 0) {
// Try Mac OS location
p = process.env.HOME + "/Library/Research In Motion/" + file;
if (fs.existsSync(p)) {
return p;
}
} else if (os.type().toLowerCase().indexOf("linux") >= 0) {
// Try Linux location
p = process.env.HOME + "/.rim/" + file;
if (fs.existsSync(p)) {
return p;
}
}
}

_self = {
getKeyStorePath : function () {
// Todo: decide where to put sigtool.p12 which is genereated and used in WebWorks SDK for Tablet OS
return getDefaultPath(AUTHOR_P12);
},

getKeyStorePathBBID: function () {
return getDefaultPath(BBIDTOKEN);
},

getCskPath : function () {
return getDefaultPath(CSK);
},

getDbPath : function () {
return getDefaultPath(DB);
}
};

module.exports = _self;

0 comments on commit 95c4540

Please sign in to comment.