@@ -89,10 +89,7 @@ describe('ecdsa', function () {
8989      it ( 'recovers the pubKey for '  +  f . d ,  function  ( )  { 
9090        var  d  =  BigInteger . fromHex ( f . d ) 
9191        var  Q  =  curve . G . multiply ( d ) 
92-         var  signature  =  { 
93-           r : new  BigInteger ( f . signature . r ) , 
94-           s : new  BigInteger ( f . signature . s ) 
95-         } 
92+         var  signature  =  new  ECSignature ( new  BigInteger ( f . signature . r ) ,  new  BigInteger ( f . signature . s ) ) 
9693        var  h1  =  crypto . sha256 ( f . message ) 
9794        var  e  =  BigInteger . fromBuffer ( h1 ) 
9895        var  Qprime  =  ecdsa . recoverPubKey ( curve ,  e ,  signature ,  f . i ) 
@@ -125,9 +122,9 @@ describe('ecdsa', function () {
125122    } ) 
126123
127124    fixtures . invalid . recoverPubKey . forEach ( function  ( f )  { 
128-       it ( 'throws on '  +  f . description ,  function  ( )  { 
125+       it ( 'throws on '  +  f . description   +   ' ('   +   f . exception   +   ')' ,  function  ( )  { 
129126        var  e  =  BigInteger . fromHex ( f . e ) 
130-         var  signature  =  new  ECSignature ( new  BigInteger ( f . signature . r ) ,  new  BigInteger ( f . signature . s ) ) 
127+         var  signature  =  new  ECSignature ( new  BigInteger ( f . signature . r ,   16 ) ,  new  BigInteger ( f . signature . s ,   16 ) ) 
131128
132129        assert . throws ( function  ( )  { 
133130          ecdsa . recoverPubKey ( curve ,  e ,  signature ,  f . i ) 
@@ -174,7 +171,8 @@ describe('ecdsa', function () {
174171      it ( 'fails to verify with '  +  f . description ,  function  ( )  { 
175172        var  H  =  crypto . sha256 ( f . message ) 
176173        var  d  =  BigInteger . fromHex ( f . d ) 
177-         var  signature  =  new  ECSignature ( new  BigInteger ( f . signature . r ) ,  new  BigInteger ( f . signature . s ) ) 
174+         var  signature  =  new  ECSignature ( new  BigInteger ( f . signature . r ,  16 ) ,  new  BigInteger ( f . signature . s ,  16 ) ) 
175+ 
178176        var  Q  =  curve . G . multiply ( d ) 
179177
180178        assert . strictEqual ( ecdsa . verify ( curve ,  H ,  signature ,  Q ) ,  false ) 
0 commit comments