@@ -117,17 +117,20 @@ describe("NodeRSA", function(){
117117 "KY4kQIIx8JEBsAYzgyP2iy0CAwEAAQ==\n" +
118118 "-----END PUBLIC KEY-----" ;
119119
120+ var privateKeyPEMNotTrimmed = ' \n\n \n\n ' + privateKeyPEM + '\n \n \n\n ' ;
121+ var publicKeyPEMNotTrimmed = '\n\n\n\n ' + publicKeyPEM + '\n \n\n\n ' ;
122+
120123 describe ( "Good cases" , function ( ) {
121- it ( ".loadFromPrivatePEM() should load private key from PEM string" , function ( ) {
122- privateNodeRSA = new NodeRSA ( privateKeyPEM ) ;
124+ it ( ".loadFromPrivatePEM() should load private key from (not trimmed) PEM string" , function ( ) {
125+ privateNodeRSA = new NodeRSA ( privateKeyPEMNotTrimmed ) ;
123126 assert . instanceOf ( privateNodeRSA . keyPair , Object ) ;
124127 assert ( privateNodeRSA . isPrivate ( ) ) ;
125128 assert ( privateNodeRSA . isPublic ( ) ) ;
126129 assert ( ! privateNodeRSA . isPublic ( true ) ) ;
127130 } ) ;
128131
129- it ( ".loadFromPublicPEM() should load public key from PEM string" , function ( ) {
130- publicNodeRSA = new NodeRSA ( publicKeyPEM ) ;
132+ it ( ".loadFromPublicPEM() should load public key from (not trimmed) PEM string" , function ( ) {
133+ publicNodeRSA = new NodeRSA ( publicKeyPEMNotTrimmed ) ;
131134 assert . instanceOf ( privateNodeRSA . keyPair , Object ) ;
132135 assert ( publicNodeRSA . isPublic ( ) ) ;
133136 assert ( publicNodeRSA . isPublic ( true ) ) ;
0 commit comments