简体   繁体   中英

Python + GPG (edit-key change password)

I'm looking for a gpg Python library that let me change password for my key. I saw python-gnupg but there aren't that function :( Anyone can help me please? If is possibile i wish have also some examples from docs

跨平台方法很困难,但请在此处查看潜在的解决方案: http : //groups.google.com/group/python-gnupg/browse_thread/thread/93ea0b195097ccb1

Python gnupg module already has a method ( GPG._handle_io ) to invoke gpg command and pass input to it and parse output. It may solve the portability issue.

gpg = gnupg.GPG()
result = gnupg.Verify(gpg)
gpg._handle_io(['--command-fd', '0', '--edit-key', keyname], StringIO(u'\n'.join(commands)), result)

commands is your command sequence to execute in edit-key mode. Note, some commands behave little differently when issuing them in --no-tty mode, eg. save command asks a y for confirmation. result is an arbitrary gpg class and needed only to capture the output. See machine-readable output in result.stderr .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM