示例#1
0
def test_decryption(card):
    msg = b"encrypt me please"
    pk = card.cmd_get_public_key(2)
    pk_info = (pk[9:9 + 256], pk[9 + 256 + 2:9 + 256 + 2 + 3])
    ciphertext = rsa_keys.encrypt_with_pubkey(pk_info, msg)
    r = card.cmd_pso(0x80, 0x86, ciphertext)
    assert r == msg
示例#2
0
 def test_decryption(self, card):
     msg = b"encrypt me please"
     pk = card.cmd_get_public_key(2)
     pk_info = get_pk_info(pk)
     ciphertext = rsa_keys.encrypt_with_pubkey(pk_info, msg)
     r = card.cmd_pso(0x80, 0x86, ciphertext)
     assert r == msg
def encrypt_on_host_public_key():
    scc.ciphertext = rsa_keys.encrypt_with_pubkey(scc.pubkey_info, scc.plaintext)