Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

PGP Encryption

Benkohler7
5 - Atom

Hello, 

 

I'm looking to PGP Encrypt a text file upon export. What I've found online seems to be that Alteryx can decrypt it or that I need admin rights, or that the whole workflow will need to be encrypted. Looking to see if there is a method that is fairly simple and straight forward. 

 

Any assistance would be greatly appreciated.  

4 REPLIES 4
apathetichell
19 - Altair

1) Python tool.

2) output file normally. use command line tool to run cli to encrypt after writing.

Benkohler7
5 - Atom

Do you know if this requires any particular package to run? I currently have pandas and numpy. 

apathetichell
19 - Altair

interesting- chatgpt says use a command line:

import subprocess

def pgp_encrypt(file_path, recipient):

try: # Use gpg command to encrypt the file subprocess.run(['gpg', '--encrypt', '--recipient', recipient, '--output', f'{file_path}.gpg', file_path], check=True) print(f'File encrypted successfully: {file_path}.gpg') except subprocess.CalledProcessError as e: print(f'Error encrypting file: {e}') # Replace 'recipient_email@example.com' with the actual recipient's PGP key ID or email recipient = 'recipient_email@example.com' file_to_encrypt = 'path/to/your/file.txt'

 

(sorry for the formatting)

 

Benkohler7
5 - Atom

Thanks again, so this is more my fault than anything. After speaking with my peer - we didn't need the actual encryption anymore. We just needed to make sure the file name was .txt.pgp in order for the end user to pickup the file for their automation. 

 

I wasn't initially able to do this in the output tool with the file name, but I was able to go back to the formula where we created the filename field initially - add onto the file ".txt" then on the output file, change the file type to .pgp. After running the workflow, the files generated with the expected extension, and we were able to open them in Notepad without an issue. 

 

I appreciate your help and idea even though it didn't work exactly for this scenario - hoping both our responses help folks in the future. 

Labels