Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.

Python SDK - decrypting password from HTML GUI

pavloko
7 - Meteor

Hello folks, 

 

For those of you who have troubles with encryption/decryption of your secrets between HTML and Python SDKs. 


I found that documentation describing different states of encryption is wrong about the modes.

'machine' encryption specified in HTML corresponds to 0 in Python decrypt_password.

window.Alteryx.Gui.Utils.Functions
     .postJsEventWithCallback('Encrypt',  { text: this.state.apiToken, encryptionMode: 'machine' }, encryptedToken => {
         console.log(encryptedToken)
})

to decrypt the token you would need to use:

 

self.alteryx_engine.decrypt_password(config.token, 0)

 

 

2 REPLIES 2
wthompson
Alteryx
Alteryx

The documentation is correct.  The confusion may be in the name of the method decrypt_password, because it is used to both encrypt and decrypt a password.  To encrypt a password, the user would set mode to either 2 or 3 and the encrypted_password would be a non-encrypted string.  To decrypt an encrypted password, the user would set mode to 0 and the encrypted_password would be an encrypted string from a previous Machine(2) or User(3) mode encryption.

 

Returns a string of encrypted or decrypted text. Works with user and machine encryption.

decrypt_password(encrypted_password, mode) -> str :

encrypted_password: The text to be treated.

Supported options include:

0: Decrypt.

2: Machine encryption

3: User encryption

pavloko
7 - Meteor

Thank you for clarification @wthompson!

 

With the setup above, when I try to upload the workflow to the private Gallery in the cloud, I'm getting the error, even though it works fine locally.

 

 

RuntimeError: InternalError: DecryptPassword - buffer too small.


In the docs, it's says 'machine' encryption is recommended to upload workflows to the Gallery. Is there other ways to store secrets between environments?