LoginSignup
0
0

More than 5 years have passed since last update.

pyme備忘録

Last updated at Posted at 2017-02-16

pyme

GPGmeの情報が少ないため備忘録代わりに。

インストール

まず、Ubuntu 16.04では最新のpymeを入れようとすると1.7以上でないと怒られます。

最新のリポジトリ(zesty 1.7)は対応しているっぽいですが、16.*では1.6止まりのようです。
http://packages.ubuntu.com/search?keywords=libgpgme11

GPGme1.8をインストールの四苦八苦はGPGme with Qt5を参照下さい。

Context

何をするにもまずContextを作ります。

import gpg
ctx = gpg.Context()

Contextは以下のメンバを持ちます。

  • armor
  • card_edit
  • decrypt
  • decrypt_verify
  • delete
  • edit
  • encrypt
  • encrypt_sign
  • export
  • genkey
  • get_key
  • import_
  • include_certs
  • keylist
  • keylist_mode
  • passphrase_cb
  • progress_cb
  • protocol
  • set_engine_info
  • set_locale
  • sign
  • signers
  • textmode
  • verify

homedir

gpgコマンドの--homedirオプションに相当するものはengine_infoで扱います。

# protocol, filename, home_dir
ctx.set_engine_info(gpg.constants.PROTOCOL_OpenPGP, None, ".")

tupleでしか引数を受け取ってくれないのが少し不便です。

  • protocol
  • filename
  • home_dir

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0