cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Cheng <christopher.sw.ch...@gmail.com>
Subject Re: How could I encrypt/decrypt REST JSON message with AES/CBC/PKCS5Padding, AES and Base64?
Date Wed, 11 Feb 2015 12:11:14 GMT
Thanks Sergey... You save my day if you do

On Wed, Feb 11, 2015 at 8:06 PM, Sergey Beryozkin <sberyozkin@gmail.com> wrote:
> Hi
>
> On 11/02/15 12:03, Christopher Cheng wrote:
>>
>> This is how I did in POJO. Could somebody help me how to do it with
>> CXF configuration?
>>
>>
>> String password = "1234567890123456";
>> String content = “abcdefghigklmnopqrstuvwxyz0123456789”;
>>
>> byte[] raw = password.getBytes(Charsets.UTF_8);
>> SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
>> Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
>> cipher.init(Cipher.ENCRYPT_MODE, skeySpec, new IvParameterSpec(new
>> byte[16])); // zero IV
>> String encrypted = new
>>
>> String(Base64.encodeBase64(cipher.doFinal(content.getBytes(Charsets.UTF_8))))
>>
> Are you trying to do JWE by any chance ?
> I'll post you a code example shortly, working with a release issue right now
>
> Sergey
>

Mime
View raw message