Skip to content

Instantly share code, notes, and snippets.

@sunnycmf
Created August 21, 2013 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunnycmf/6290948 to your computer and use it in GitHub Desktop.
Save sunnycmf/6290948 to your computer and use it in GitHub Desktop.
node-passbook missing private key input.
// Signs a manifest and returns the signature.
function signManifest(template, manifest, callback) {
var identifier = template.passTypeIdentifier().replace(/^pass./, "");
var args = [
"smime",
"-sign", "-binary",
"-signer", Path.resolve(template.keysPath, identifier + ".pem"),
"-certfile", Path.resolve(template.keysPath, "wwdr.pem"),
"-inkey", Path.resolve(template.keysPath, "key.pem"),
"-passin", "pass:" + template.password
];
var sign = execFile("openssl", args, { stdio: "pipe" }, function(error, stdout, stderr) {
if (error) {
callback(new Error(stderr));
} else {
var signature = stdout.split(/\n\n/)[3];
callback(null, new Buffer(signature, "base64"));
}
});
sign.stdin.write(manifest);
sign.stdin.end();
}
@sunnycmf
Copy link
Author

added line 9, sign with dev private key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment