Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
jhitchcock
Posts: 14
Registered: ‎06-01-2011
My Device: BlackBerry Q10
Accepted Solution

Issue with encryption on device, Fine on simulator

Morning, 

 

I'm working with encryption, and posting encrypted data to a web service. This works fine on the simulator, however when posting to a login service on the device, I'm getting an 'Invalid Credentials' error, which I suspect is being caused by the encryption not working right. 

 

Im using BlockEncryptor, with PKCS5FormatterEngine and a generated InitializationVector. 

 

BlockEncryptor encryptor = new BlockEncryptor(new PKCS5FormatterEngine(
				new AESCBCEncryptorEngine(new AESKey(
						Base64InputStream.decode(Constants.AES_PRIVATE_KEY)),
						iv)), outputStream);

 

Can anyone think of a reason why this would work in Sim, but not on device? 

 

Thanks

Contributor
jhitchcock
Posts: 14
Registered: ‎06-01-2011
My Device: BlackBerry Q10

Re: Issue with encryption on device, Fine on simulator

I have an update. 

 

I fixed the IV on both device and Sim and compared the posted strings. All matched apart from 'Email' 

 

I then tried encrypting email without the @ sign, and they matched! 

 

Still.. No idea why the device isn't encrypting the @ sign right

Contributor
jhitchcock
Posts: 14
Registered: ‎06-01-2011
My Device: BlackBerry Q10

Re: Issue with encryption on device, Fine on simulator

Ok, Sorted... 

 

Erm... Lets just say be careful with Upper/Lower case.. Apparently they produce different ciphertext :Tt2:

 

 

Yeah.. Lets never speak of this again