From 4379bba2cd6e0a97fefb3e5efaa525c2c598b1d5 Mon Sep 17 00:00:00 2001 From: Niklas Femerstrand Date: Wed, 9 Oct 2013 23:36:46 +0700 Subject: [PATCH] Fixes erroneous linefeed handle in write_signed_message() Fixes #109, courtsey of encomiast --- src/openpgp.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openpgp.js b/src/openpgp.js index 9a2de801..53c4a992 100644 --- a/src/openpgp.js +++ b/src/openpgp.js @@ -400,8 +400,8 @@ function _openpgp () { * This can be directly used to OpenPGP armor the message */ function write_signed_message(privatekey, messagetext) { - var sig = new openpgp_packet_signature().write_message_signature(1, messagetext.replace(/\r\n/g,"\n").replace(/\n/,"\r\n"), privatekey); - var result = {text: messagetext.replace(/\r\n/g,"\n").replace(/\n/,"\r\n"), openpgp: sig.openpgp, hash: sig.hash}; + var sig = new openpgp_packet_signature().write_message_signature(1, messagetext.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"), privatekey); + var result = {text: messagetext.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"), openpgp: sig.openpgp, hash: sig.hash}; return openpgp_encoding_armor(2,result, null, null) }