@@ -101,21 +101,14 @@ module.exports = () => describe('ASCII armor', function() {
101101 expect ( msg ) . to . be . an . instanceof ( openpgp . CleartextMessage ) ;
102102 } ) ;
103103
104- it ( 'Exception if improperly formatted armor header - plaintext section' , async function ( ) {
105- let msg = getArmor ( [ 'Hash:SHA256' ] ) ;
106- msg = openpgp . readCleartextMessage ( { cleartextMessage : msg } ) ;
107- await expect ( msg ) . to . be . rejectedWith ( Error , / I m p r o p e r l y f o r m a t t e d a r m o r h e a d e r / ) ;
108- msg = getArmor ( [ 'Ha sh: SHA256' ] ) ;
109- msg = openpgp . readCleartextMessage ( { cleartextMessage : msg } ) ;
104+ it ( 'Exception if header is not Hash in cleartext signed message' , async function ( ) {
105+ const msg = openpgp . readCleartextMessage ( { cleartextMessage : getArmor ( [ 'Ha sh: SHA256' ] ) } ) ;
110106 await expect ( msg ) . to . be . rejectedWith ( Error , / O n l y " H a s h " h e a d e r a l l o w e d i n c l e a r t e x t s i g n e d m e s s a g e / ) ;
111- msg = getArmor ( [ 'Hash SHA256' ] ) ;
112- msg = openpgp . readCleartextMessage ( { cleartextMessage : msg } ) ;
113- await expect ( msg ) . to . be . rejectedWith ( Error , / I m p r o p e r l y f o r m a t t e d a r m o r h e a d e r / ) ;
114107 } ) ;
115108
116- it ( 'Exception if improperly formatted armor header - signature section ' , async function ( ) {
109+ it ( 'Ignore improperly formatted armor header' , async function ( ) {
117110 await Promise . all ( [ 'Space : trailing' , 'Space :switched' , ': empty' , 'none' , 'Space:missing' ] . map ( async function ( invalidHeader ) {
118- await expect ( openpgp . readCleartextMessage ( { cleartextMessage : getArmor ( [ 'Hash: SHA1' ] , [ invalidHeader ] ) } ) ) . to . be . rejectedWith ( Error , / I m p r o p e r l y f o r m a t t e d a r m o r h e a d e r / ) ;
111+ expect ( await openpgp . readCleartextMessage ( { cleartextMessage : getArmor ( [ 'Hash: SHA1' ] , [ invalidHeader ] ) } ) ) . to . be . an . instanceof ( openpgp . CleartextMessage ) ;
119112 } ) ) ;
120113 } ) ;
121114
0 commit comments