清除包含加密材料的字节或整数的内容

SecureBytes的Python项目详细描述


[![生成状态](https://travis-ci.com/VidaID/pysecbytes.svg?branch=master)](https://travis-ci.com/VidaID/pysecbytes

##安装:

pip install SecureBytes

##使用:

当前支持清除整数、字符串和字节

from SecureBytes import clearmem, safemem

x = b’data that must be removed’

copy_of_x = x

clearmem(x)

assert(b’data’ not in copy_of_x)

仅在python3中,临时将mem分配器重写为零ram并防止分页:

with safemem():
x = b’data that must be removed’ del x

# x is not in ram

目前,safemem和scanmem在所有python和平台上都不受支持, 使用支持导入safemem、支持扫描mem进行检查

##警告:

  • Do not try to derive from str or bytes… extra copies of your data will be made
  • Clearing strings and bytes also clears all references to them
  • If you choose store sensitive material in a class, and put clearmem in __del__, it will only be cleared when the last reference is freed
  • “safemem” is not yet efficient (TODO), and it only prevents swapping on Windows (TODO)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java从JSP或HTML向servlet发送多个参数   java方法来查看字符是否在字符数组中   使用带有java的MAC地址连接到设备   java如何将csv文件中的数据打印到secondactivity?   java如何从netbean 7.0.1连接到数据库   java考虑所有可能的类值,用于输出测试分割的预测值。   java我的actionListener调用有什么问题   swing在Java中实现粒子过滤器最有效的方法是什么?   java运行。getFontFamily()为返回null。使用apachepoi的docx文件   一个事务中的java领域循环与每个步骤循环中的一个事务   java日期格式与Spring Boot不兼容   java类冲突。处理   java GridBagLayout不工作   java将图像发送到另一个应用程序