Home    XP_CRYPT Online Help Prev Next
How To use XP_CRYPT GUI
Introduction
What is XP_CRYPT
System requirements
Free version limitations
End user license agreement
Installing XP_CRYPT
Installation procedure
Activation
XP_CRYPT API
What's new
Encryption methods overview
Session
xp_crypt_set_var
xp_crypt_get_var
xp_crypt_close_session
xp_crypt_init_session
xp_crypt_set_option
Asymmetric keys
DSA
xp_dsa_free_key
xp_dsa_load_key
xp_dsa_save_key
xp_dsa_generate_couple
RSA
xp_rsa_generate_couple
xp_rsa_generate_pub_key
xp_rsa_load_key
xp_rsa_priv_dec
xp_rsa_pub_enc
xp_rsa_save_key
xp_rsa_free_key
Digital signatures
DSA
xp_dsa_verify
xp_dsa_sign
RSA
xp_rsa_sign
xp_rsa_verify
Hashing
xp_crypt
xp_md5
xp_sha1
Symmetric encryption
AES128
xp_aes128_decrypt
xp_aes128_encrypt
AES
xp_aes_decrypt
xp_aes_encrypt
DESX
xp_desx_decrypt
xp_desx_encrypt
RC4
xp_rc4_decrypt
xp_rc4_encrypt
Triple DES
xp_des3_encrypt
xp_des3_decrypt
Error codes
Tutorial
How to use GUI
Advanced technique (Old)
Table encryption (Old)
Troubleshooting
Troubleshooting overview

xp_aes_encrypt

Encrypts data with the given key by AES algorithm.

Syntax

xp_aes_encrypt  { variable1 [, variable2 , variable3 ...] , key, encrypted_text OUTPUT }

Arguments

variable1 [, variable2 , variable3 ...]

Variables which need to be encrypted

key 

VARCHAR.  The key is represented by a string which consists of characters from 0 to 9 and A, B, C, D, E, F so called 'hexadecimal notation'.The valid lengths of the string are 32, 48 and 64 chars. This involves the encryption with 128, 196 and 256 bit key. Example of 32 chars key - '076541A84BEF792A1234567890D98769' 

clear_text 

VARCHAR or VARBINARY. Variable to hold the encrypted output

Permissions

Execute permissions default to the public role.

Return Code Values

0 - success, or Error code if failed. clear_text IS NOT NULL  (success) or IS NULL (failure)

Example
declare @encrypted varchar (8000)
declare @return_code int

exec xp_aes_encrypt 'test','0123456789ABCDEF0123456789ABCDEF',@encrypted output
exec @return_code = xp_aes_decrypt @a,'0123456789ABCDEF0123456789ABCDEF',@encrypted output
if @return_code != 0
begin
raiserror ('AES encryption failed!',16,10)
end

Browser Based Help. Published by chm2web software.