def secret_string(str, key):
    """
    :param str: Passes in a string to encrypt
    :param key: Uses a public key for encryption
    :return: returns an encrypted string in byte form
    """
    public_key = key.publickey()
    bytestr = str.encode('utf-8')
    enc_data = public_key.encrypt(bytestr, 32)
    return enc_data[0]