Decrypting a password
Encrypted passwords stored in custom INI and CONFIG files can later be decrypted in script. To decrypt an encrypted password, complete the following steps.
- In Designer open the project.
- Switch to Definition Mode.
- In the left pane, select the class where you want to implement connection string encryption.
-
On the toolbar, click
Show/hide script
.
- In the Script View dialog box, click .
- In the References dialog box, select Cedar Crypt Library (5.80) and then click OK.
-
To decrypt the encrypted password and adapt the connection string read from the
[Project].ini file, modify your script according to the
following example, replacing
[Custom Private Key]
with the private key corresponding to the public key used when encrypting the password.Dim theCedarCryptographyHelper as New CdrCrypt.RSACodecInt Dim strEncryptedPassword as String Dim strOpenPassword as String Dim strPrivateKey as String strPrivateKey = "<RSAKeyValue><Modulus>[Custom Private Key]</D></RSAKeyValue>" strEncryptedPassword = DicVal("01" & "ConnectionPassword", "SQL") If Len(strEncryptedPassword) > 0 Then strOpenPassword = theCedarCryptographyHelper.Decode(strEncryptedPassword, strPrivateKey) End If If Len(strOpenPassword) > 0 Then strConnection = strConnection + ";Password=" + strOpenPassword End If
- To protect the private key, encrypt the script page that contains the code above through the standard script code encryption feature.
-
When you release your project, distribute the public key along
with the project.
Note: Professional Services representatives will use this public key to encrypt the passwords when installing the project.