本文整理匯總了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)