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


Python GnuPG.recv_key方法代码示例

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


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

示例1: command

# 需要导入模块: from mailpile.crypto.gpgi import GnuPG [as 别名]
# 或者: from mailpile.crypto.gpgi.GnuPG import recv_key [as 别名]
    def command(self):
        keyid = self.data.get("keyid", self.args)
        g = GnuPG()
        res = []
        for key in keyid:
            res.append(g.recv_key(key))

        return res
开发者ID:AndreasDriesen,项目名称:Mailpile,代码行数:10,代码来源:crypto_utils.py

示例2: _getkey

# 需要导入模块: from mailpile.crypto.gpgi import GnuPG [as 别名]
# 或者: from mailpile.crypto.gpgi.GnuPG import recv_key [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

示例3: _getkey

# 需要导入模块: from mailpile.crypto.gpgi import GnuPG [as 别名]
# 或者: from mailpile.crypto.gpgi.GnuPG import recv_key [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

示例4: command

# 需要导入模块: from mailpile.crypto.gpgi import GnuPG [as 别名]
# 或者: from mailpile.crypto.gpgi.GnuPG import recv_key [as 别名]
 def command(self):
     keyid = self.data.get("keyid", self.args[0])
     g = GnuPG()
     return g.recv_key(keyid)
开发者ID:CodJonz,项目名称:Mailpile,代码行数:6,代码来源:crypto_utils.py


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