Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Decrypts the string using the supplied key and returns a LONG BINARY value.
DECRYPT( string-expression, key [, algorithm ] )
algorithm : 'AES' | 'AES256' | 'AES_FIPS' | 'AES256_FIPS'
string-expression The string to be decrypted. Binary values can also be passed to this function. This parameter is case sensitive, even in case-insensitive databases.
key The encryption key (string) required to decrypt the string-expression. This must be the same encryption key that was used to encrypt the string-expression to obtain the original value that was encrypted. This parameter is case sensitive, even in case-insensitive databases.
For strongly encrypted databases, be sure to store a copy of the key in a safe location. If you lose the encryption key there is no way to access the data, even with the assistance of technical support. The database must be discarded and you must create a new database.
algorithm This optional parameter specifies the algorithm originally used to encrypt the string-expression.
For more information about the supported encryption algorithms, see ENCRYPT function [String].
You can use the DECRYPT function to decrypt a string-expression that was encrypted with the ENCRYPT function. This function returns a LONG BINARY value with the same number of bytes as the input string.
To successfully decrypt a string-expression, you must use the same encryption key that was used to encrypt the data. If you specify an incorrect encryption key, an error is generated. A lost key will result in inaccessible data, from which there is no recovery.
FIPS is not available on all platforms. For a list of supported platforms, see http://www.sybase.com/detail?id=1061806.
SQL/2003 Vendor extension.
The following example decrypts a user's password from the user_info table. The CAST function is used to convert the password back to a CHAR data type because the DECRYPT function converts values to the LONG BINARY data type, which is unreadable.
SELECT CAST( DECRYPT( user_pwd, '8U3dkA' ) AS CHAR(100) ) FROM user_info;
|Discuss this page in DocCommentXchange.
Send feedback about this page using email.
|Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|