For the latest version of JMP Help, visit JMP.com/help.


Scripting Guide > Programming Methods > Encrypt and Decrypt Scripts
Publication date: 04/21/2023

Encrypt and Decrypt Scripts

To add a basic level of protection to JSL scripts, you can encrypt it so only someone who knows the password can view it; you can also require a password to run it. This is useful in situations when you want to implement controlled sharing of a script.

To encrypt a script:

1. Open the script that you want to encrypt.

2. Select Edit > Encrypt Script.

3. Enter a decrypt password so that the user needs a password to view the script.

4. (Optional) Enter a run password to require the user to enter a password before running the encrypted script.

Note: The passwords must consist of single-byte characters; using a text Input Method Editor (IME) does not work.

5. Click OK.

6. If you entered only a decrypt password, click Yes to confirm that you do not want to assign a run password.

The encrypted script opens in a new window. For example:

//-e6.0.2
S@FTQ;VGMUTF?J<;LS;B<=IRLXCU=BV;@NS<TW;LR<ZFOP=JJS>NNDA@T<V><DZA>SU@MG;LR<ZFOP=JJS>NNDA@T<V><DZA>SU@MG;LR<ZFOP=JJS>NNDA@T<V><DZA>SU@MG;LR<ZFOP=JJS>NNDA@T<HNIZ;WDN?RMJ;FR>KYAXTEPPF?;XFJJOP=RQGBIAGXOYNNZ>PLIF>SW>L>ACL<KGP;=QQTCEG??U<PUXLV?TRBO?J>QGWTJCFJA@BNHWLVORNNGQYPIKL<IM<>JX>@G?LJ>=;RBODH@PTKK@SIUE;IJOR<TUTRMTGSYRSVGOR<XK<F=IWQYE=LVZFP;AUHA?YJLL;EIT?ZJZC;*

7. Save the encrypted script.

To encrypt a column formula in a script:

Column formulas created by an encrypted script are visible by default. If you want a formula to be encrypted, follow these steps:

1. Paste just the formula into a new script window.

2. Encrypt the script by clicking Edit > Encrypt Script.

3. Provide a password only.

4. Copy the encrypted script.

5. Paste the encrypted script in a new script as a string argument for JSL Encrypted() as shown below.

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
 
dt << New Column( "Encrypted",
	Numeric,
	Continuous,
	Format( "Best", 12 ),
	Formula(
		JSL Encrypted(
			"//-e6.0.2
0,
136,4112eJwFwYkRhCAMAMB+roUQcITwDcoP4fovxN3Ri0B+MFqvqXB8Z0hZdFC+dgqclJo0dwrlZbFjgyPlZRuR2hp399ObhpxhQXP8
GPtft0MN6Rwz8pDnjmK1K0qq1bEG+H0xvyBb
,0,"
		)
	)
);

To decrypt a JSL script:

1. Open the encrypted script in JMP.

2. Select Edit > Decrypt Script.

3. Enter the decrypt password and click OK.

The decrypted script opens in a new window.

To run an encrypted JSL script:

Note: You must know which data table the script runs on before running an encrypted script. If you do not know the name of the data table, you must decrypt the script before running it.

1. Open the encrypted script in JMP.

2. Select Edit > Run Script.

3. Enter the run password and click OK.

The script runs:

If the script references a data table, you are prompted to open the data table, and then the script runs.

If the script requires an empty data table, you must create the table and then run the encrypted script.

Note that entering the run password runs the script, but does not show the script: you must supply the decrypt password to actually view the script.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).