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.

  1. In Designer open the project.
  2. Switch to Definition Mode.
  3. In the left pane, select the class where you want to implement connection string encryption.
  4. On the toolbar, click Show/hide script .
  5. In the Script View dialog box, click Edit > References.
  6. In the References dialog box, select Cedar Crypt Library (5.80) and then click OK.
  7. 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
    
  8. To protect the private key, encrypt the script page that contains the code above through the standard script code encryption feature.
  9. 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.