From 7be0ab9cc8cb66aff5e2d792b86cdc8f9676ac2b Mon Sep 17 00:00:00 2001 From: Ryan Seys Date: Wed, 14 Jan 2015 10:36:47 -0500 Subject: [PATCH] Detect PEM error as sign error --- lib/common/util.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/common/util.js b/lib/common/util.js index 24c0781b749..b2bcf41c949 100644 --- a/lib/common/util.js +++ b/lib/common/util.js @@ -383,7 +383,12 @@ function makeAuthorizedRequest(config) { return; } - if (err.message === 'SignFinal error') { + // For detecting Sign errors on io.js (1.x) (or node 0.11.x) + // E.g. errors in form: error:code:PEM routines:PEM_read_bio:error_name + var pemError = err.message && + err.message.indexOf('error:') !== -1; + + if (err.message === 'SignFinal error' || pemError) { err.message = [ 'Your private key is in an unexpected format and cannot be used.', 'Please try again with another private key.'