当前位置: 首页>>代码示例>>Python>>正文


Python GnuPG.import_keys方法代码示例

本文整理汇总了Python中mailpile.crypto.gpgi.GnuPG.import_keys方法的典型用法代码示例。如果您正苦于以下问题:Python GnuPG.import_keys方法的具体用法?Python GnuPG.import_keys怎么用?Python GnuPG.import_keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mailpile.crypto.gpgi.GnuPG的用法示例。


在下文中一共展示了GnuPG.import_keys方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _import_key

# 需要导入模块: from mailpile.crypto.gpgi import GnuPG [as 别名]
# 或者: from mailpile.crypto.gpgi.GnuPG import import_keys [as 别名]
 def _import_key(self, result, keytype):
     if keytype == "openpgp":
         g = GnuPG(self.config)
         res = g.import_keys(result[keytype])
         if len(res["updated"]):
             self._managed_keys_add(result["address"], keytype)
         return res
     else:
         # We currently only support OpenPGP keys
         return False
开发者ID:WebSpider,项目名称:Mailpile,代码行数:12,代码来源:nicknym.py

示例2: command

# 需要导入模块: from mailpile.crypto.gpgi import GnuPG [as 别名]
# 或者: from mailpile.crypto.gpgi.GnuPG import import_keys [as 别名]
 def command(self):
     key_data = ""
     if len(self.args) != 0:
         key_file = self.data.get("key_file", self.args[0])
         with  open(key_file) as file:
             key_data = file.read()
     if "key_data" in self.data:
         key_data = self.data.get("key_data")
     elif "key_file" in self.data:
         pass
     g = GnuPG()
     return g.import_keys(key_data)
开发者ID:AndreasDriesen,项目名称:Mailpile,代码行数:14,代码来源:crypto_utils.py

示例3: _import_key

# 需要导入模块: from mailpile.crypto.gpgi import GnuPG [as 别名]
# 或者: from mailpile.crypto.gpgi.GnuPG import import_keys [as 别名]
 def _import_key(self, result, keytype):
     if keytype == "openpgp":
         g = GnuPG()
         if self.config:
             g.passphrase = self.config.gnupg_passphrase.get_reader()
         res = g.import_keys(result[keytype])
         if len(res["updated"]):
             self._managed_keys_add(result["address"], keytype)
         return res
     else:
         # We currently only support OpenPGP keys
         return False
开发者ID:Ayzak,项目名称:Mailpile,代码行数:14,代码来源:nicknym.py

示例4: _getkey

# 需要导入模块: from mailpile.crypto.gpgi import GnuPG [as 别名]
# 或者: from mailpile.crypto.gpgi.GnuPG import import_keys [as 别名]
 def _getkey(self, key):
     if key["fingerprint"] and not key["url"]:
         g = GnuPG()
         res = g.recv_key(key["fingerprint"])
     elif key["url"]:
         r = urllib2.urlopen(key["url"])
         result = r.readlines()
         start = 0
         end = len(result)
         # Hack to deal with possible HTML results from keyservers:
         for i in range(len(result)):
             if result[i].startswith("-----BEGIN PGP"):
                 start = i
             elif result[i].startswith("-----END PGP"):
                 end = i
         result = "".join(result[start:end])
         g = GnuPG()
         res = g.import_keys(result)
         return res
     else:
         raise ValueError("Need a fingerprint or a URL")
开发者ID:lieblingswelt,项目名称:Mailpile,代码行数:23,代码来源:dnspka.py

示例5: _getkey

# 需要导入模块: from mailpile.crypto.gpgi import GnuPG [as 别名]
# 或者: from mailpile.crypto.gpgi.GnuPG import import_keys [as 别名]
	def _getkey(self, entry):
		pkaver = None
		fingerprint = None
		url = None

		for stmt in entry.split(";"):
			key, value = stmt.split("=", 1)
			if key == "v":
				pkaver = value
			elif key == "fpr":
				fingerprint = value
			elif key == "uri":
				url = value

		if pkaver != "pka1":
			raise ValueError("We only know how to deal with pka version 1")

		if fingerprint and not url:
			g = GnuPG()
			res = g.recv_key(fingerprint)
		elif url:
			r = urllib2.urlopen(url)
			result = r.readlines()
			start = 0
			end = len(result)
			# Hack to deal with possible HTML results from keyservers:
			for i in range(len(result)):
				if result[i].startswith("-----BEGIN PGP"):
					start = i
				elif result[i].startswith("-----END PGP"):
					end = i
			result = "".join(result[start:end])
			g = GnuPG()
			res = g.import_keys(result)
			return res
		else:
			raise ValueError("Need a fingerprint or a URL")
开发者ID:AndreasDriesen,项目名称:Mailpile,代码行数:39,代码来源:dnspka.py


注:本文中的mailpile.crypto.gpgi.GnuPG.import_keys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。