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

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

问题描述

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

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 -> 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 has to 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 乱码.那能解决你的问题吗?

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天全站免登陆