安全地保留数据
我们有一个在 Linux 上运行的 java 应用程序。 当应用程序崩溃并重新启动时,我们需要恢复(持久化)先前运行中存储的非常敏感的信息(全局静态变量)。 不允许使用数据库(不安全)。 同样重要的是,没有人可以在无法察觉的情况下更改此信息(例如覆盖文件等)。
提前致谢
we have a java application running on linux.
when the app crashes and restarted- we need to recover ( persist ) a very sensitive information that was stored in previous run ( global static var ).
no database allowed ( insecure ) .
also it's important that no-one can undetectably change this information ( e.g. override a file etc ).
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了保护数据,您需要对其进行加密。在 CBC 或 CTR 模式下使用 AES-256 和 PKCS7 填充。不要不要将加密密钥存储在您的应用程序中。您可以存储 IV/nonce,因为它不需要安全。
为了确保数据不被更改,请使用带有 SHA-256 的 HMAC。您必须为 HMAC 使用与 AES 不同的密钥。
To secure the data you need to encrypt it. Use AES-256 in CBC or CTR mode with PKCS7 padding. Do not store the encryption key in your application. You can store the IV/nonce as it does not need to be secure.
To ensure that the data is not changed use HMAC, with SHA-256. You must use a different key for the HMAC than you used for AES.
我建议使用 Jasypt。
您可以实现
Externalized
&加密对象流I'd suggest using Jasypt.
you can implement
Externalizable
& encrypt the object stream