def encrypt(text, pub_key): block_size = rsa.common.byte_size(pub_key.n) - 11 encrypted = "" for part in split_len(text, block_size): encrypted += rsa.encrypt(part, pub_key) return encrypted
def decrypt(encrypted, pri_key): block_size = rsa.common.byte_size(pri_key.n) text = "" for part in split_len(encrypted, block_size): text += rsa.decrypt(part, pri_key) return text