创建加密的日志文件 [英] Creating an encrypted log file

查看:134
本文介绍了创建加密的日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个客户端应用程序,需要创建用户活动的日志,但由于各种原因,此日志不可读取。

I am creating a client side application which needs to create a log of the user activity but for various reasons this log must not be human readable.

目前为我的开发我正在创建一个纯文本日志,看起来像这样:

Currently for my development I am creating a plain text log which looks something like this:

12/03/2009 08:34:21 - >用户'Bob'登录
12/03/2009 08:34:28 - >导航到配置页
12/03/2009 08:34:32 - >选项x更改为y

12/03/2009 08:34:21 -> User 'Bob' logged in 12/03/2009 08:34:28 -> Navigated to config page 12/03/2009 08:34:32 -> Option x changed to y

当我部署我的应用程序时,日志不能是纯文本,所以所有文本都必须加密。这似乎不是直接实现,因为我需要日志文件动态更新,因为每个条目被添加。我正在考虑的方法是创建一个二进制文件,隔离加密每个日志条目,然后将其附加到二进制文件中,每个条目之间具有一些适当的划分。

When I deploy my application the log must not be in plain text, so all text must be encrypted. This doesn't appear to be straightforward to achieve as I need the log file to dynamically update as each entry is added. The approach I was thinking about was to create a binary file, encrypt each log entry in isolation and then append it to the binary file with some suitable demarcation between each entry.

有谁知道这个问题的任何常见方法,我确定必须有一个更好的解决方案!

Does anyone know of any common approaches to this problem, I'm sure there must be a better solution!

推荐答案

这不是真的是我的事情,我会承认,容易,但不能单独加密每个条目,然后将其附加到日志文件?如果你不加密时间戳,你可以很容易地找到你正在寻找的条目,并在需要的时候解密它们。

This is not really my thing, I'll admit that readily, but can't you encrypt each entry individually and then append it to the logfile? If you that refrain from encrypting the timestamp, you can easily find entries your are looking for and decrypt those when needed.

我的观点主要是将个别的加密条目附加到文件不一定需要二进制文件附加到二进制文件。加密(例如)gpg将产生可附加到ascii文件的ascii garble。会解决你的问题吗?

My point being mainly that appending individual encrypted entries to a file does not necessarily need to be binary entries appended to a binary file. Encryption with (for example) gpg will yield ascii garble that can be appended to an ascii file. Would that solve you problem?

这篇关于创建加密的日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆