使用充气城堡从缓存中读取文件时出错



使用以下代码:

List<OfflineCommand> l = (List<OfflineCommand>)Storage.getInstance().readObject(
user + apptID + "-offlineCommandsEnc"
);
if (l != null && l.size() > 0) {
flgSuccess = true;
}

public void init(Object context) {
Preferences.setPreferencesLocation("EncryptedPreferences");
Storage.getInstance().deleteStorageFile(Cookie.STORAGE_NAME);
EncryptedStorage.install("***********");
JSONParser.setUseLongs(true);
}

此错误在第一行引发:

[EDT] 0:1:27,628 - 异常:org.bouncycastle.crypto.DataLengthException - 解密中的最后一个块不完整 org.bouncycastle.crypto.DataLengthException:解密中的最后一个块不完整 at org.bouncycastle.crypto.paddings.PpadBufferedBlockCipher.doFinal(PpadBufferedBlockCipher.java:281( at com.codename1.crypto.EncryptedStorage.createInputStream(EncryptedStorage.java:63( at com.codename1.io.Storage.readObject(Storage.java:260( at com.fluency.fluencymobile.server.ServerImpl.verifyActivityExists(ServerImpl.java:709( at com.fluency.fluencymobile.forms.AppointmentForm.lambda$new$4(AppointmentForm.java:512( at com.codename1.ui.util.EventDispatcher.fireActionEvent(EventDispatcher.java:349( at com.codename1.ui.Button.fireActionEvent(Button.java:570( at com.codename1.ui.Button.release(Button.java:604( at com.codename1.ui.Button.pointerRelease(Button.java:708( at com.codename1.ui.Form.pointerRelease(Form.java:3262( at com.codename1.ui.Component.pointerRelease(Component.java:4288( at com.codename1.ui.Display.handleEvent(Display.java:2065( at com.codename1.ui.Display.edtLoopImpl(Display.java:1043( at com.codename1.ui.Display.mainEDTLoop(Display.java:961( at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120( at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176(

你有一个加密的文件系统,在init(Object(方法中激活加密之前,你可能通过静态初始值设定项、推送回调或类似的东西写入或读取。

在执行任何存储访问(无论是读取还是写入(之前,需要确保发生EncryptedStorage.install()

相关内容

  • 没有找到相关文章

最新更新