How do I solve EncryptedStorage error when I make a https request?

Viewed 21

I try to encrypt my secure data with EncryptedStorage described in EncryptedStorage

I add the code below EncryptedStorage.install("weejgrieqjgewgjwerrgjerwgmwe 9");

It shows error messages when my program makes a https request.

org.bouncycastle.crypto.DataLengthException: last block incomplete in decryption

[Network Thread] 0:0:0,2 - Exception: org.bouncycastle.crypto.DataLengthException - last block incomplete in decryption [Network Thread] 0:0:0,648 - Exception: org.bouncycastle.crypto.DataLengthException - last block incomplete in decryption [Network Thread] 0:0:0,749 - Exception: org.bouncycastle.crypto.DataLengthException - last block incomplete in decryption [Network Thread] 0:0:1,252 - Exception: org.bouncycastle.crypto.DataLengthException - last block incomplete in decryption at org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher.doFinal(PaddedBufferedBlockCipher.java:281) at com.codename1.crypto.EncryptedStorage.createInputStream(EncryptedStorage.java:63) at com.codename1.io.Storage.readObject(Storage.java:265) at com.codename1.impl.CodenameOneImplementation.getCookiesForURL(CodenameOneImplementation.java:4700) at com.codename1.io.ConnectionRequest.performOperationComplete(ConnectionRequest.java:830) at com.codename1.io.NetworkManager$NetworkThread.run(NetworkManager.java:341)

How do I solve this problem?

1 Answers

The cookies file isn't encrypted. I'm assuming it was written before you applied the encryption everything.

So just before applying the encryption delete the cookies file:

deleteStorageFile("Cookies");
Related