This repository was archived by the owner on Jul 10, 2019. It is now read-only.
Commit 2caeaee Tankred Hase
committed
File tree 2 files changed +6
-5
lines changed
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -772,11 +772,11 @@ define(function(require) {
772
772
/*
773
773
* any content before/after the PGP block will be discarded,
774
774
* "-----BEGIN/END (...)-----" must be at the start/end of a line,
775
- * after \n\n the signed payload begins,
775
+ * after the hash (and possibly other) arbitrary headers, the signed payload begins,
776
776
* the text is followed by a final \n and then the pgp signature begins
777
777
* untrusted attachments and html is ignored
778
778
*/
779
- var clearSignedMatch = / ^ - { 5 } B E G I N P G P S I G N E D M E S S A G E - { 5 } [ \s \S ] * \n \n ( [ \s \S ] * ) \n - { 5 } B E G I N P G P S I G N A T U R E - { 5 } [ \S \s ] * - { 5 } E N D P G P S I G N A T U R E - { 5 } $ / im. exec ( body ) ;
779
+ var clearSignedMatch = / ^ - { 5 } B E G I N P G P S I G N E D M E S S A G E - { 5 } \n H a s h : [ ] [ ^ \n ] + \n (?: [ A - Z a - z ] + : [ ] [ ^ \n ] + \n ) * \n ( [ \s \S ] * ) \n - { 5 } B E G I N P G P S I G N A T U R E - { 5 } [ \S \s ] * - { 5 } E N D P G P S I G N A T U R E - { 5 } $ / im. exec ( body ) ;
780
780
if ( clearSignedMatch ) {
781
781
// PGP/INLINE signed
782
782
message . signed = true ;
Original file line number Diff line number Diff line change @@ -1010,9 +1010,10 @@ define(function(require) {
1010
1010
} ) ;
1011
1011
1012
1012
it ( 'should read a signed pgp/inline from the device' , function ( done ) {
1013
- var message , pt ;
1013
+ var message , pt , expected ;
1014
1014
1015
- pt = '-----BEGIN PGP SIGNED MESSAGE-----\n\ntest6\n-----BEGIN PGP SIGNATURE----------END PGP SIGNATURE-----' ;
1015
+ expected = 'Lorem ipsum Aliquip tempor veniam proident.\n\nafguab;igab;igubalw\n\nLorem ipsum Dolor sed irure sint in non.\n\n\n' ;
1016
+ pt = '-----BEGIN PGP SIGNED MESSAGE-----\nHash: WTFHASH\n\n' + expected + '\n-----BEGIN PGP SIGNATURE----------END PGP SIGNATURE-----' ;
1016
1017
message = {
1017
1018
uid : uid ,
1018
1019
from : [ {
@@ -1036,7 +1037,7 @@ define(function(require) {
1036
1037
expect ( err ) . to . not . exist ;
1037
1038
1038
1039
expect ( msg ) . to . equal ( message ) ;
1039
- expect ( msg . body ) . to . equal ( 'test6' ) ;
1040
+ expect ( msg . body ) . to . equal ( expected ) ;
1040
1041
expect ( message . signed ) . to . be . true ;
1041
1042
expect ( message . signaturesValid ) . to . be . true ;
1042
1043
expect ( message . loadingBody ) . to . be . false ;
You can’t perform that action at this time.
0 commit comments