VeraCrypt 加密个人隐私(便携式 )
1、1、VeraCrypt 可以做什么?
a)加密文件
b)加密移动存储
c)加密系统分区
这里主要做,便携式 VeraCrypt 加密个人隐私
2、安装 VeraCrypt version 1.17
https://veracrypt.codeplex.com/ 下载 VeraCrypt version 1.17
便携式 Veracryp (portable VeraCrypt)不能加载系统分区和系统驱动
VeraCrypt Format-x64.exe 64位下面的加密
VeraCrypt Format.exe
VeraCrypt.exe 解密
使用方法与TrueCrypt 类似




2、 加密testA为 X盘符
新建文件 D:\_tmp\testA (注意没有.txt)
创建文件加密

3、选择标准加密方式

4、选择testA 提示文件已经存在要替换吗?(选择是(Y))
选择algorithm即加密算法和hash加密算法 (如果安全行要求不高选择默认即可)


5、1)设置自己要给定此加密的文件的空间大小。可以根据自己的情况设置。如果设置的空间约定,在格式化加密文件的时间越长。
这里做测试用选择8G。
2)设置密码 假定密码123456
选择是否保存单文件>4G。(根据个人情况设置)



6、1)格式化加密文件 提示文件删除testA重新加密并替换testA 选择是
加密完成后2个加密文件的大小变成了8G



7、测试加密(加载)分区的可用性
1)win+R 打开运行 输入cmd
2)echo %date:~0,4%%date:~5,2%%date:~8,2% %time% >X:/test.txt
3)cat X:/test.txt 或到u盘看有没有此文件


1、Python的通过命令加载和卸载VeraCrypt分区
1)配置 VeraCrypt 路径
2)配置加密文件的位置和盘符映射关系
3)加载命令为python run1pmtc.py 输入 start 输入密码 123456
3)卸载命令为python run1pmtc.py 输入stop

2、加载分区(X,Y) python run1pmtc.py





3、卸载分区(X,Y) python run1pmtc.py


4、全部源码
```python
#!D:\appsoft\python\python.exe
# -* - coding: UTF-8 -* -
import msvcrt,os,time
# ###############################################################
# ###########下面的是自定义配置区域##############################
# VeraCrypt.exe的位置
Cmdpath="E:\_tmp\VeraCrypt\VeraCrypt.exe"
# 加密文件的目录
Vospath="D:\_tmp\\"
# 分区和加密的文件对应关系
Local_V_DISK={"X":"testA","Y":"testB"}
# ############上面的是自定义配置区域##############################
# ################################################################
# # ##########下面的不要修改######################################
# def begin ######################################################
def getType():
return input("加载或卸载自定义分区(start,stop):")
def pwd_input():
chars = []
while True:
try:
newChar = msvcrt.getch().decode(encoding="utf-8")
except:
return input("你很可能不是在cmd命令行下运行,密码输入将不能隐藏:")
if newChar in '\r\n': # 如果是换行,则输入结束
break
elif newChar == '\b': # 如果是退格,则删除密码末尾一位并且删除一个星号
if chars:
del chars[-1]
msvcrt.putch('\b'.encode(encoding='utf-8')) # 光标回退一格
msvcrt.putch( ' '.encode(encoding='utf-8')) # 输出一个空格覆盖原来的星号
msvcrt.putch('\b'.encode(encoding='utf-8')) # 光标回退一格准备接受新的输入
else:
chars.append(newChar)
msvcrt.putch('*'.encode(encoding='utf-8')) # 显示为星号
return (''.join(chars) )
def startVeraCrypt(pwd):
global Local_V_DISK,Cmdpath,Vospath
for k in Local_V_DISK:
# print(k,'---',Local_V_DISK[k])
time.sleep(1)
os.system("cmd /c "+Cmdpath+" /v "+Vospath+Local_V_DISK[k]+" /a /l "+k+" /e /q /p "+pwd)
print('......加载成功!')
def stopVeraCrypt():
global Local_V_DISK,Cmdpath
for k in Local_V_DISK:
os.system("cmd /c "+Cmdpath+" /q /d "+k)
print('......卸载成功!!')
# def end ##############################################################
_t=getType()
_tpwd=''
print("您输入的类型:",_t,"\n")
if _t=='start':
print("请输入密码:")
_tpwd=pwd_input()
startVeraCrypt(_tpwd)
elif _t=='stop':
stopVeraCrypt()
else:
print('参数错误')
print("\r\n")
print("\r\n")
print("\r\n")
os.system('pause')
# print("\n密码是:{0}".format(pwd))
```