From e7707c482641053dce745a9a21a32a8a26bf2b1b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 9 Mar 2017 20:59:10 -0500 Subject: [PATCH] Set private key from asn1 on initial set --- src/app/services/cryptoService.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/services/cryptoService.js b/src/app/services/cryptoService.js index 4e4aa035a4..fbc5d07c01 100644 --- a/src/app/services/cryptoService.js +++ b/src/app/services/cryptoService.js @@ -16,9 +16,9 @@ angular _service.setPrivateKey = function (privateKeyCt, key) { try { - var privateKey = _service.decrypt(privateKeyCt, key, 'raw'); - _privateKey = privateKey; - $sessionStorage.privateKey = forge.util.encode64(privateKey); + var privateKeyBytes = _service.decrypt(privateKeyCt, key, 'raw'); + $sessionStorage.privateKey = forge.util.encode64(privateKeyBytes); + _privateKey = forge.pki.privateKeyFromAsn1(forge.asn1.fromDer(privateKeyBytes));; } catch (e) { console.log('Cannot set private key. Decryption failed.');