package Ġjp . co . sor am its u . fe ar less _ utils . encrypt Ċ Ċ import Ġjp . co . sor am its u . fe ar less _ utils . TestData Ċ import Ġjp . co . sor am its u . fe ar less _ utils . encrypt . key pair . Base Key pair Ċ import Ġjp . co . sor am its u . fe ar less _ utils . encrypt . key pair . substr ate . Sub strate Key pair Factory Ċ import Ġjp . co . sor am its u . fe ar less _ utils . extensions . from Hex Ċ import Ġjp . co . sor am its u . fe ar less _ utils . extensions . to HexString Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠSign er Test Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġsign Ġmessage ĠED 2 5 5 1 9 `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmessage Hex Ġ= Ġ" this Ġis Ġa Ġmessage " ĊĊĠĠĠĠĠĠĠ Ġval Ġkey pair Ġ= ĠSub strate Key pair Factory . generate ( Encryption Type . ED 2 5 5 1 9 , ĠTest Data . SEED _ BYTES ) ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= ĠSign er . sign ( Multi Chain Encryption . Sub strate ( Encryption Type . ED 2 5 5 1 9 ), Ġmessage Hex . toByteArray (), Ġkey pair ) ĊĊĠĠĠĠĠĠĠ Ġassert ( Signer . verify Ed 2 5 5 1 9 ( message Hex . toByteArray (), Ġresult . signature , Ġkey pair . publicKey )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġsign Ġmessage ĠE CD SA `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠpublicKey Hex Ġ= Ġ" f 6 5 a 7 d 5 6 0 1 0 2 f 2 0 1 9 da 9 b 9 d 8 9 9 3 f 5 3 f 5 1 cc 3 8 d 5 0 cd ff 3 d 0 b 8 e 7 1 9 9 7 d 7 f 9 1 1 ff 1 " ĊĠĠĠĠĠĠĠ Ġval ĠprivateKey Hex Ġ= Ġ" ae 4 0 9 3 af 3 c 4 0 f 2 ecc 3 2 c 1 4 d 4 d ada 9 6 2 8 a 4 a 4 2 b 2 8 ca 1 a 5 b 2 0 0 b 8 9 3 2 1 cbc 8 8 3 1 8 2 " ĊĊĠĠĠĠĠĠĠ Ġval Ġkey pair Ġ= ĠBase Key pair ( privateKey Hex . from Hex (), ĠpublicKey Hex . from Hex ()) ĊĊĠĠĠĠĠĠĠ Ġval Ġmessage Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" 0 4 0 0 3 4 0 a 8 0 6 4 1 9 d 5 e 2 7 8 1 7 2 e 4 5 cb 0 e 5 0 da 1 b 0 3 1 7 9 5 3 6 6 c 9 9 dd fe 0 a 6 8 0 bd 5 3 b 1 4 2 c 6 3 0 2 2 8 6 bee 0 0 0 0 0 0 2 d 0 0 0 0 0 0 0 3 0 0 0 0 0 0 e 1 4 3 f 2 3 8 0 3 ac 5 0 e 8 f 6 f 8 e 6 2 6 9 5 d 1 ce 9 e 4 e 1 d 6 8 aa 3 6 c 1 cd 2 cfd 1 5 3 4 0 2 1 3 f 3 4 2 3 ee 1 4 3 f 2 3 8 0 3 ac 5 0 e 8 f 6 f 8 e 6 2 6 9 5 d 1 ce 9 e 4 e 1 d 6 8 aa 3 6 c 1 cd 2 cfd 1 5 3 4 0 2 1 3 f 3 4 2 3 e " ĊĠĠĠĠĠĠĠ Ġval Ġmessage Bytes Ġ= Ġmessage . from Hex () ĊĊĠĠĠĠĠĠĠ Ġval Ġsignature Wrapper Ġ= ĠSign er . sign ( Multi Chain Encryption . Sub strate ( Encryption Type . ECD SA ), Ġmessage Bytes , Ġkey pair ) Ġas ĠSignature Wrapper . E cd sa ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" 3 5 2 e 2 7 3 8 b 0 e 3 6 1 a 7 c 5 9 be 0 5 d 5 2 e 7 e 7 fb 8 6 0 bf 7 9 c 0 3 bb 7 8 5 8 ce 3 e 4 8 7 4 8 b 0 0 0 4 0 c 4 dc 6 ead bfd 5 2 6 d 3 5 ba 6 dff 1 4 6 8 bf 6 1 1 9 8 cc 5 e 8 5 7 0 a 8 0 ddc 6 3 fde be 6 8 dc 6 0 1 6 a 4 1 b " ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( expected , Ġsignature Wrapper . signature . to HexString ()) ĊĠĠĠ Ġ} Ċ }