本文整理汇总了Python中privacyidea.lib.tokens.ocra.OCRA.create_data_input方法的典型用法代码示例。如果您正苦于以下问题:Python OCRA.create_data_input方法的具体用法?Python OCRA.create_data_input怎么用?Python OCRA.create_data_input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类privacyidea.lib.tokens.ocra.OCRA
的用法示例。
在下文中一共展示了OCRA.create_data_input方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_08_create_data_input
# 需要导入模块: from privacyidea.lib.tokens.ocra import OCRA [as 别名]
# 或者: from privacyidea.lib.tokens.ocra.OCRA import create_data_input [as 别名]
def test_08_create_data_input(self):
# The ocrasuite is stored as a unicode in the webui. As it is used for
# the OCRA datainput, it must be internally converted to a string.
ocrasuite = u"OCRA-1:HOTP-SHA1-6:QN10"
question = "1344454126"
ocra_object = OCRA(ocrasuite, binascii.unhexlify(KEY20))
r = ocra_object.create_data_input(question)
# create data_input with missing counter
ocrasuite = u"OCRA-1:HOTP-SHA1-6:C-QN10"
ocra_object=OCRA(ocrasuite, binascii.unhexlify(KEY20))
self.assertRaises(Exception, ocra_object.create_data_input, question)
# create data_input with missing PIN
ocrasuite = u"OCRA-1:HOTP-SHA1-6:QN10-PSHA1"
ocra_object=OCRA(ocrasuite, binascii.unhexlify(KEY20))
self.assertRaises(Exception, ocra_object.create_data_input, question)
# create data_input with missing Timesteps
ocrasuite = u"OCRA-1:HOTP-SHA1-6:QN10-T1M"
ocra_object=OCRA(ocrasuite, binascii.unhexlify(KEY20))
self.assertRaises(Exception, ocra_object.create_data_input, question)
ocrasuite = u"OCRA-1:HOTP-SHA1-8:QH40"
dTAN = "83507112 ~320,00~1399458665_G6HNVF"
question = binascii.hexlify(hashlib.sha1(dTAN).digest())
ocra_object = OCRA(ocrasuite, binascii.unhexlify(KEY20))
r = ocra_object.create_data_input(question)
self.assertEqual(len(r), 128 + len(ocrasuite) + 1)
示例2: test_08_create_data_input
# 需要导入模块: from privacyidea.lib.tokens.ocra import OCRA [as 别名]
# 或者: from privacyidea.lib.tokens.ocra.OCRA import create_data_input [as 别名]
def test_08_create_data_input(self):
# The ocrasuite is stored as a unicode in the webui. As it is used for
# the OCRA datainput, it must be internally converted to a string.
ocrasuite = u"OCRA-1:HOTP-SHA1-6:QN10"
question = "1344454126"
ocra_object = OCRA(ocrasuite, binascii.unhexlify(KEY20))
r = ocra_object.create_data_input(question)
# create data_input with missing counter
ocrasuite = u"OCRA-1:HOTP-SHA1-6:C-QN10"
ocra_object=OCRA(ocrasuite, binascii.unhexlify(KEY20))
self.assertRaises(Exception, ocra_object.create_data_input, question)
# create data_input with missing PIN
ocrasuite = u"OCRA-1:HOTP-SHA1-6:QN10-PSHA1"
ocra_object=OCRA(ocrasuite, binascii.unhexlify(KEY20))
self.assertRaises(Exception, ocra_object.create_data_input, question)
# create data_input with missing Timesteps
ocrasuite = u"OCRA-1:HOTP-SHA1-6:QN10-T1M"
ocra_object=OCRA(ocrasuite, binascii.unhexlify(KEY20))
self.assertRaises(Exception, ocra_object.create_data_input, question)