【发布时间】:2018-11-10 15:05:30
【问题描述】:
当我尝试使用下面的 cmd 在 shell 中解密此文件时:
gpg test.zip.asc
通过后,我在同一文件夹中获得了解密文件"test.zip",但使用 python 脚本我无法获得解密文件。没有发生错误,知道我做错了什么吗?
import gnupg
def testgpg():
print "testgpg function started"
encrypted_file = "test.zip.asc"
passwd = "passwd"
gpg = gnupg.GPG(gnupghome='/home/centos/.gnupg')
try:
print "trying"
gpg.decrypt(encrypted_file, passphrase=passwd)
print "decrypted"
except Exception as e:
print "not decrypted: -->", str(e)
testgpg()
【问题讨论】:
-
您“无法获得”是什么意思?
gpg.decrypt()是否返回任何内容?如果是这样,我怀疑这将是解密的文件。
标签: python encryption gnupg