package Ġorg . ke thereum . crypto Ċ Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Assert . assertNotNull Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . ke thereum . crypto . data . ADDRESS Ċ import Ġorg . ke thereum . crypto . data . PUBLIC _ KEY Ċ import Ġorg . ke thereum . crypto . data . PUBLIC _ KEY _ STRING Ċ import Ġorg . ke thereum . crypto . model . PublicKey Ċ import Ġorg . ke thereum . model . Address Ċ Ċ class ĠKeys Test Ġ{ ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġinit () Ġ{ ĊĠĠĠĠĠĠĠ Ġinitialize Crypto () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Create Sec p 2 5 6 k 1 KeyPair () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġkey Pair Ġ= Ġcreate Sec p 2 5 6 k 1 KeyPair () ĊĠĠĠĠĠĠĠ Ġval ĠprivateKey Ġ= Ġkey Pair . private ĊĠĠĠĠĠĠĠ Ġval ĠpublicKey Ġ= Ġkey Pair . public ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( privateKey ) ĊĠĠĠĠĠĠĠ ĠassertNotNull ( publicKey ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( privateKey . encoded . size ). isEqualTo ( 1 4 4 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( publicKey . encoded . size ). isEqualTo ( 8 8 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Create Ec KeyPair () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġ( privateKey , ĠpublicKey ) Ġ= Ġcreate E thereum KeyPair () ĊĠĠĠĠĠĠĠ ĠassertThat ( publicKey . key . sign um ()). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( privateKey . key . sign um ()). isEqualTo ( 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠtestGet Address () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( PublicKey ( PUBLIC _ KEY _ STRING ). to Address ()). isEqualTo ( ADDRESS ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠtestGet Address Zero P added Address () Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠpublicKey Ġ= ĠPublicKey (" 0 xa 1 b 3 1 be 4 d 5 8 a 7 ddd 2 4 b 1 3 5 db 0 da 5 6 a 9 0 fb 5 3 8 2 0 7 7 ae 2 6 b 2 5 0 e 1 dc 9 cd 6 2 3 2 ce 2 2 " Ġ+ Ġ" 7 0 f 4 c 9 9 5 4 2 8 bc 7 6 aa 7 8 e 5 2 2 3 1 6 e 9 5 d 7 8 3 4 d 7 2 5 efc 9 ca 7 5 4 d 0 4 3 2 3 3 af 6 ca 9 0 1 1 3 ") ĊĠĠĠĠĠĠĠ ĠassertThat ( publicKey . to Address ()). isEqualTo ( Address (" 0 1 c 5 2 b 0 8 3 3 0 e 0 5 d 7 3 1 e 3 8 c 8 5 6 c 1 0 4 3 2 8 8 f 7 d 9 7 4 4 ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠtestGet Address BigInteger () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( PUBLIC _ KEY . to Address ()). isEqualTo ( ADDRESS ) ĊĠĠĠ Ġ} Ċ Ċ } Ċ