Exemple #1
0
 def __new_signing_key(self, pars: List[str]) -> None:
     if len(pars) == 0:
         raise Exception('enter privkey' 's name')
     for sk_name in pars:
         sk = Privkey.new()
         PrivkeyStorage.store_signing_key(sk_name, sk)
         self.__signing_keys[sk_name] = sk
Exemple #2
0
 def setUp(self) -> None:
     self.trx = Transaction(123, [Output(100, TEST_PUBADDR).id], [Output(10, TEST_PUBADDR), Output(90, TEST_PUBADDR)])
     self.trx.sign(Privkey.from_pem(io.StringIO(PEM_FILE_DATA)))
     # self.blk = Block(345, GENESIS_BLOCK, [self.trx.id])
     self.blk = Block(345, GENESIS_BLOCK, [self.trx])
Exemple #3
0
 def setUp(self) -> None:
     self.trx = Trans(123, [Output(100, TEST_PUBADDR).id],
                      [Output(10, TEST_PUBADDR),
                       Output(90, TEST_PUBADDR)])
     self.trx.sign(Privkey.from_pem(io.StringIO(PEM_FILE_DATA)))
Exemple #4
0
 def setUp(self) -> None:
     self.sk = Privkey.from_pem(io.StringIO(PEM_FILE_DATA))
     _, self.sgn = self.sk.sign(b'abc')
Exemple #5
0
 def test_from_pem_and_sign(self) -> None:
     sk = Privkey.from_pem(io.StringIO(PEM_FILE_DATA))
     _, sgn = sk.sign(b'abc')
     self.assertTrue(sk.pubkey.verify(sgn, b'abc'))