本文整理汇总了Python中ipaserver.install.ipa_otptoken_import.PSKCDocument.setKey方法的典型用法代码示例。如果您正苦于以下问题:Python PSKCDocument.setKey方法的具体用法?Python PSKCDocument.setKey怎么用?Python PSKCDocument.setKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ipaserver.install.ipa_otptoken_import.PSKCDocument
的用法示例。
在下文中一共展示了PSKCDocument.setKey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_figure7
# 需要导入模块: from ipaserver.install.ipa_otptoken_import import PSKCDocument [as 别名]
# 或者: from ipaserver.install.ipa_otptoken_import.PSKCDocument import setKey [as 别名]
def test_figure7(self):
doc = PSKCDocument(os.path.join(basename, "pskc-figure7.xml"))
assert doc.keyname == 'My Password 1'
doc.setKey(b'qwerty')
assert [(t.id, t.options) for t in doc.getKeyPackages()] == \
[(u'123456', {
'ipatokenotpkey': u'GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ',
'ipatokenvendor': u'TokenVendorAcme',
'ipatokenserial': u'987654321',
'ipatokenotpdigits': 8,
'type': u'hotp'})]
示例2: test_figure6
# 需要导入模块: from ipaserver.install.ipa_otptoken_import import PSKCDocument [as 别名]
# 或者: from ipaserver.install.ipa_otptoken_import.PSKCDocument import setKey [as 别名]
def test_figure6(self):
doc = PSKCDocument(os.path.join(basename, "pskc-figure6.xml"))
assert doc.keyname == 'Pre-shared-key'
doc.setKey(codecs.decode('12345678901234567890123456789012', 'hex'))
assert [(t.id, t.options) for t in doc.getKeyPackages()] == \
[(u'12345678', {
'ipatokenotpkey': u'GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ',
'ipatokenvendor': u'Manufacturer',
'ipatokenserial': u'987654321',
'ipatokenhotpcounter': 0,
'ipatokenotpdigits': 8,
'type': u'hotp'})]
示例3: test_figure7
# 需要导入模块: from ipaserver.install.ipa_otptoken_import import PSKCDocument [as 别名]
# 或者: from ipaserver.install.ipa_otptoken_import.PSKCDocument import setKey [as 别名]
def test_figure7(self):
nss.nss_init_nodb()
try:
doc = PSKCDocument(os.path.join(basename, "pskc-figure7.xml"))
assert doc.keyname == "My Password 1"
doc.setKey("qwerty")
assert [(t.id, t.options) for t in doc.getKeyPackages()] == [
(
u"123456",
{
"ipatokenotpkey": u"GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ",
"ipatokenvendor": u"TokenVendorAcme",
"ipatokenserial": u"987654321",
"ipatokenotpdigits": 8,
"type": u"hotp",
},
)
]
finally:
nss.nss_shutdown()
示例4: test_figure6
# 需要导入模块: from ipaserver.install.ipa_otptoken_import import PSKCDocument [as 别名]
# 或者: from ipaserver.install.ipa_otptoken_import.PSKCDocument import setKey [as 别名]
def test_figure6(self):
nss.nss_init_nodb()
try:
doc = PSKCDocument(os.path.join(basename, "pskc-figure6.xml"))
assert doc.keyname == "Pre-shared-key"
doc.setKey("12345678901234567890123456789012".decode("hex"))
assert [(t.id, t.options) for t in doc.getKeyPackages()] == [
(
u"12345678",
{
"ipatokenotpkey": u"GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ",
"ipatokenvendor": u"Manufacturer",
"ipatokenserial": u"987654321",
"ipatokenhotpcounter": 0,
"ipatokenotpdigits": 8,
"type": u"hotp",
},
)
]
finally:
nss.nss_shutdown()