For the complete experience, please enable JavaScript in your browser. Thank you!

  • Creative Cloud
  • Photoshop
  • Illustrator
  • InDesign
  • Premiere Pro
  • After Effects
  • Lightroom
  • See all
  • See plans for: businesses photographers students
  • Document Cloud
  • Acrobat DC
  • eSign
  • Stock
  • Elements
  • Marketing Cloud
  • Analytics
  • Audience Manager
  • Campaign
  • Experience Manager
  • Media Optimizer
  • Target
  • See all
  • Acrobat Reader DC
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player
  • All products
  • Creative Cloud
  • Individuals
  • Photographers
  • Students and Teachers
  • Business
  • Schools and Universities
  • Marketing Cloud
  • Document Cloud
  • Stock
  • Elements
  • All products
  • Get Support
    Find answers quickly. Contact us if you need to.
    Start now >
  • Learn the apps
    Get started or learn new ways to work.
    Learn now >
  • Ask the community
    Post questions and get answers from experts.
    Start now >
    • About Us
    • Careers At Adobe
    • Investor Relations
    • Privacy  |  Security
    • Corporate Responsibility
    • Customer Showcase
    • Events
    • Contact Us
News
    • 3/22/2016
      Adobe Summit 2016: Are You An Experience Business?
    • 3/22/2016
      Adobe Announces Cross-Device Co-op to Enable People-Based Marketing
    • 3/22/2016
      Adobe and comScore Advance Digital TV and Ad Measurement
    • 3/22/2016
      Adobe Marketing Cloud Redefines TV Experience
CFML Reference / 

Decrypt

Adobe Community Help


Applies to

  • ColdFusion

Contact support

 
By clicking Submit, you accept the Adobe Terms of Use.
 

Description

Decrypts a string that is encrypted using a standard encryption technique, including strings encrypted by the Encrypt function.

Returns

An unencrypted string.

Category

Security functions, String functions

Function syntax

Decrypt(encrypted_string, key[, algorithm, encoding, IVorSalt, iterations])

See also

Duplicate, Encrypt

History

ColdFusion 8: Added support for encryption using the RSA BSafe Crypto-J library on Enterprise Edition.

ColdFusion MX 7.01: Added the IVorSalt and iterations parameters.

ColdFusion MX 7: Added the algorithm and encoding parameters.

Parameters

Parameter

Description

encrypted_string

String to decrypt.

key

String. For the CFMX_COMPAT algorithm, the seed that was used to encrypt the string; for all other algorithms, the string generated by the generateSecretKey() method.

algorithm

(Optional) The Enterprise Edition of ColdFusion installs the RSA BSafe Crypto-J library, which provides FIPS-140 Compliant Strong Cryptography. For a list of algorithms, see the Encrypt function.The Standard Edition of ColdFusion installs a cryptography library with the following algorithms:

  • CFMX_COMPAT: the algorithm used in ColdFusion MX and prior releases. This algorithm is the least secure option (default).
  • AES: the Advanced Encryption Standard specified by the National Institute of Standards and Technology (NIST) FIPS-197.
  • BLOWFISH: the Blowfish algorithm defined by Bruce Schneier.
  • DES: the Data Encryption Standard algorithm defined by NIST FIPS-46-3.
  • DESEDE: the "Triple DES" algorithm defined by NIST FIPS-46-3.
    If you install a security provider with additional cryptography algorithms, you can also specify any of its string encryption and decryption algorithms.

encoding

(Optional; if you specify this parameter, also specify the algorithm parameter.) The binary encoding used to represent the data as a string. Must be the same as the algorithm used to encrypt the string.

  • Base64: the Base64 algorithm, as specified by IETF RFC 2045.
  • Hex: the characters A-F and 0-9 represent the hexadecimal byte values.
  • UU: the UNIX standard UUEncode algorithm (default).

IVorSalt

(Optional) Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software. If you specify this parameter, also specify the algorithm parameter.

  • For Block Encryption Algorithms: The binary Initialization Vector value to use with the algorithm. The algorithm must contain a Feedback Mode other than ECB. This must be a binary value that is exactly the same size as the algorithm block size.
  • For Password Based Encryption Algorithms: The binary Salt value to transform the password into a key.

iterations

(Optional) The number of iterations to transform the password into a binary key. Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software. If you specify this parameter, also specify the algorithm parameter with a Password Based Encryption (PBE) algorithm. Do not specify this parameter for Block Encryption Algorithms. Use the same value to encrypt and decrypt the data.

Usage

This function uses a symmetric key-based algorithm, in which the same key is used to encrypt and decrypt a string. The parameter values must match the values used to encode string. The security of the encrypted string depends on maintaining the secrecy of the key. ColdFusion uses the Java Cryptography Extension (JCE) and installs a Sun Java runtime that includes the Sun JCE default security provider. This provider includes the algorithms listed in the Parameters section. The JCE framework includes facilities for using other provider implementations; however, Adobe cannot provide technical support for third-party security providers.

Example

<h3>Decrypt Example</h3> 

<!--- Do the following if the form has been submitted. ---> 
<cfif IsDefined("Form.myString")> 
<cfscript> 
/* GenerateSecretKey does not generate key for the CFMX_COMPAT algorithm, 
so use the key from the form. 
*/ 
if (Form.myAlgorithm EQ "CFMX_COMPAT") 
theKey=Form.MyKey; 
// For all other encryption techniques, generate a secret key. 
else 
theKey=generateSecretKey(Form.myAlgorithm); 
//Encrypt the string 
encrypted=encrypt(Form.myString, theKey, Form.myAlgorithm, 
Form.myEncoding); 
//Decrypt it 
decrypted=decrypt(encrypted, theKey, Form.myAlgorithm, Form.myEncoding); 
</cfscript> 

<!--- Display the values used for encryption and decryption, 
and the results. ---> 
<cfoutput> 
<b>The algorithm:</b> #Form.myAlgorithm#<br> 
<b>The key:</B> #theKey#<br> 
<br> 
<b>The string:</b> #Form.myString# <br> 
<br> 
<b>Encrypted:</b> #encrypted#<br> 
<br> 
<b>Decrypted:</b> #decrypted#<br> 
</cfoutput> 
</cfif> 

<!--- The input form.---> 
<form action="#CGI.SCRIPT_NAME#" method="post"> 
<b>Select the encoding</b><br> 
<select size="1" name="myEncoding"> 
<option selected>UU</option> 
<option>Base64</option> 
<option>Hex</option> 
</select><br> 
<br> 
<b>Select the algorithm</b><br> 
<select size="1" name="myAlgorithm"> 
<option selected>CFMX_COMPAT</option> 
<option>AES</option> 
<option>DES</option> 
<option>DESEDE</option> 
</select><br> 
<br> 
<b>Input your key</b> (used for CFMX_COMPAT encryption only)<br> 
<input type = "Text" name = "myKey" value = "MyKey"><br> 
<br> 
<b>Enter string to encrypt</b><br> 
<textArea name = "myString" cols = "40" rows = "5" WRAP = "VIRTUAL"> 
This string is encrypted (you can replace it with more typing). 
</textArea><br> 
<input type = "Submit" value = "Encrypt my String"> 
</form>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy

Choose your region United States (Change)   Products   Downloads   Learn & Support   Company
Choose your region Close

Americas

Europe, Middle East and Africa

Asia Pacific

  • Brasil
  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Cyprus - English
  • Česká republika
  • Danmark
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Greece - English
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • Malta - English
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • Southeast Asia (Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam) - English
  • 台灣

Commonwealth of Independent States

  • Includes Armenia, Azerbaijan, Belarus, Georgia, Moldova, Kazakhstan, Kyrgyzstan, Tajikistan, Turkmenistan, Ukraine, Uzbekistan

Copyright © 2016 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

AdChoices