def setSoPin(self, soPin): # TODO: we could log the PIN here log.debug('setSoPin()') iv = geturandom(16) enc_soPin = encrypt(soPin, iv) self.LinOtpTokenPinSO = unicode(binascii.hexlify(enc_soPin)) self.LinOtpTokenPinSOIV = unicode(binascii.hexlify(iv))
def setHKey(self, hOtpKey, reset_failcount=True): log.debug('setHKey()') iv = geturandom(16) #bhOtpKey = binascii.unhexlify(hOtpKey) enc_otp_key = encrypt(hOtpKey, iv) self.LinOtpKeyEnc = unicode(binascii.hexlify(enc_otp_key)) self.LinOtpKeyIV = unicode(binascii.hexlify(iv)) self.LinOtpCount = 0 if True == reset_failcount: self.LinOtpFailCount = 0
def setUserPin(self, userPin): log.debug('setUserPin()') iv = geturandom(16) enc_userPin = encrypt(userPin, iv) self.LinOtpTokenPinUser = unicode(binascii.hexlify(enc_userPin)) self.LinOtpTokenPinUserIV = unicode(binascii.hexlify(iv))