本文整理汇总了Python中paramiko.DSSKey.load_certificate方法的典型用法代码示例。如果您正苦于以下问题:Python DSSKey.load_certificate方法的具体用法?Python DSSKey.load_certificate怎么用?Python DSSKey.load_certificate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paramiko.DSSKey
的用法示例。
在下文中一共展示了DSSKey.load_certificate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: key
# 需要导入模块: from paramiko import DSSKey [as 别名]
# 或者: from paramiko.DSSKey import load_certificate [as 别名]
def key(self):
"""
:return: a subclass of PKey of the appropriate key type
:rtype: PKey
:raises ValidationError:
"""
# Check if the key pair exists: at least a public or private part of
# the key is required, as well as the key type.
if not self.key_type:
return None
if not self.public_key and not self.private_key:
return None
public_key = None
private_key = None
if self.public_key:
public_key = base64.b64decode(self.public_key)
if self.private_key:
private_key = StringIO(self.private_key)
if self.key_type == 'ssh-dss':
pkey = DSSKey(data=public_key, file_obj=private_key)
elif self.key_type == 'ssh-rsa':
pkey = RSAKey(data=public_key, file_obj=private_key)
elif self.key_type.startswith('ecdsa'):
pkey = ECDSAKey(data=public_key, file_obj=private_key)
elif self.key_type == '[email protected]':
pkey = RSAKey(data=public_key, file_obj=private_key)
pkey.load_certificate(Message(public_key))
else:
raise ValidationError('Unsupported key type: ' + self.key_type)
return pkey