如何加密已存储在 GAE 的 blobstore 上的文件?
我正在开发一个应用程序,该应用程序允许用户(发布者)将文件上传到 blobstore,然后该应用程序将 blob 提供给其他用户(如果他们付费)。因为这个 blob 存储在特定的 url 上,所以如果用户知道正确的 url,他们仍然可以下载文件,所以我想用 128 位密钥加密这个文件以防止非法下载。 BlobReader 类文档说:“此接口是只读的:应用程序无法直接修改 Blobstore 值。”
如何在发布者上传和用户下载之间实现加密方法。有没有办法读取 blob、对字节执行某些操作并将新字节保存在新 blob 中?或者类似的解决方案可以完成这项工作?
I am working on an application that allows users (publishers) to upload files to the blobstore, and then this app serves blobs back to other users if they pay for it. Because this blobs are stored on specific urls, users can still download files if they know the correct url, so I want to encrypt this files with 128 bit key to prevent illegal downloads. The BlobReader class documentation says: "This interface is read-only: Blobstore values cannot be modified directly by the application."
How can I implement encryption method somewhere in between the upload from the publishr and the download from a user. Is there a way to read the blob, do something with bytes and save new bytes in a new blob? Or a similar solution that does the job?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 Blobstore Python API 帮助文档,看来服务 blob 取决于您定义的处理程序。难道您不能检查用户是否在该处理程序中进行了身份验证,然后拒绝提供 blob(例如,通过返回错误代码),而不是重写 blob?
According to the Blobstore Python API help documentation, it would appear that serving blobs is dependent on a handler that you define. Can't you check that the user is authenticated in that handler and then refuse to serve the blob (e.g. by returning an error code), rather than rewriting blobs?