What steps will reproduce the problem?
1.I've this oracle procedure to encrypt data, using AES256, CBC adn PKCS pad
FUNCTION E_Val( pIn IN VARCHAR2) RETURN RAW
IS
G_CHARACTER_SET VARCHAR2(10) := 'AL32UTF8';
G_KEY RAW(32) := UTL_I18N.STRING_TO_RAW('1234567890abcd098765321dcba12345', G_CHARACTER_SET);
G_ENCRYPTION_TYPE PLS_INTEGER := dbms_crypto.encrypt_aes256 +
dbms_crypto.chain_cbc +
dbms_crypto.pad_pkcs5;
vIn RAW(32);
vEncrypted RAW(32);
BEGIN
vIn := utl_i18n.string_to_raw(data => pIn, dst_charset => G_CHARACTER_SET );
vEncrypted := dbms_crypto.encrypt(src => vIn, typ => G_ENCRYPTION_TYPE, key => G_KEY);
RETURN vEncrypted;
END;
2. I can't to decrypt client side by using CriptoJS
var KEY= '1234567890abcd098765321dcba12345';
var key_h = CryptoJS.enc.Hex.parse(KEY); //is not 256 bit, so i try this
one..as follow
var salt = "";
var key256Bits = CryptoJS.PBKDF2(KEY, salt, { keySize: 256/32 });
console.log(key256Bits);
var
encryptedTag='31669845BCFC49DE97D92E5C8FA0B9810C5284CB59560482F1E1697D70FCB800';
//PROVA
console.log('dec toString UTF8--');
var encrypted = {};
encrypted.ciphertext = CryptoJS.enc.Hex.parse(encryptedTag);
//CBC and PKCS are default
var decrypted = CryptoJS.AES.decrypt(encryptedTag, /*key_h */key256Bits,
{ iv: CryptoJS.enc.Hex.parse('0000000000000000000000000000000000000000000000000000000000000000') });
console.log(decrypted.toString(CryptoJS.enc.Utf8));
What is the expected output? What do you see instead?
I expected 'PROVA' as string, but anything appears!
What version of the product are you using? On what operating system?
CryptoJS v3.1.2 - Browser Chrome Version 37.0.2062.124 m on WIN7 64bit
Please provide any additional information below.
this is the oracle decrypt function that works fine
------------------------------------------------------------------------
--Decrypt
------------------------------------------------------------------------
FUNCTION D_Val(pIn IN RAW) RETURN VARCHAR2
IS
G_CHARACTER_SET VARCHAR2(10) := 'AL32UTF8';
G_KEY RAW(32) := UTL_I18N.STRING_TO_RAW('1234567890abcd098765321dcba12345', G_CHARACTER_SET);
G_ENCRYPTION_TYPE PLS_INTEGER := dbms_crypto.encrypt_aes256 +
dbms_crypto.chain_cbc +
dbms_crypto.pad_pkcs5;
vDecrypted RAW(32);
vDecryptedVar VARCHAR2(32);
BEGIN
vDecrypted := dbms_crypto.decrypt(src => pIn, typ => G_ENCRYPTION_TYPE, key => G_KEY);
vDecryptedVar := utl_i18n.raw_to_char(data => vDecrypted, src_charset => G_CHARACTER_SET);
RETURN vDecryptedVar;
END;
Thanks!
Original issue reported on code.google.com by dinobolo...@gmail.com on 15 Oct 2014 at 2:02
Original issue reported on code.google.com by
dinobolo...@gmail.com
on 15 Oct 2014 at 2:02