def decrypt_yubikey_otp(self, from_key):
if not re.match(valid_input_from_key, from_key):<EOL><INDENT>self.log_error("<STR_LIT>" % (from_key))<EOL>if self.stats_url:<EOL><INDENT>stats['<STR_LIT>'] += <NUM_LIT:1><EOL><DEDENT>return "<STR_LIT>"<EOL><DEDENT>public_id, _otp = pyhsm.yubikey.split_id_otp(from_key)<EOL>try:<EOL><INDENT>aead = self.aead_backend.load_aead(public_id)<EOL><DEDENT>except Exception as e:<EOL><INDENT>self.log_error(str(e))<EOL>if self.stats_url:<EOL><INDENT>stats['<STR_LIT>'] += <NUM_LIT:1><EOL><DEDENT>return "<STR_LIT>"<EOL><DEDENT>try:<EOL><INDENT>res = pyhsm.yubikey.validate_yubikey_with_aead(<EOL>self.hsm, from_key, aead, aead.key_handle)<EOL>val_res = "<STR_LIT>" %(res.use_ctr, res.ts_low, res.ts_high, res.session_ctr)<EOL>if self.stats_url:<EOL><INDENT>stats['<STR_LIT>'] += <NUM_LIT:1><EOL><DEDENT><DEDENT>except pyhsm.exception.YHSM_Error as e:<EOL><INDENT>self.log_error ("<STR_LIT>" % (from_key, str(e)))<EOL>val_res = "<STR_LIT>"<EOL>if self.stats_url:<EOL><INDENT>stats['<STR_LIT>'] += <NUM_LIT:1><EOL><DEDENT><DEDENT>self.log_message("<STR_LIT>", from_key, val_res)<EOL>return val_res<EOL>
Try to decrypt a YubiKey OTP.

Returns a string starting with either 'OK' or 'ERR' :

'OK counter=ab12 low=dd34 high=2a use=0a'

'ERR Unknown public_id'

on YubiHSM errors (or bad OTP), only 'ERR' is returned.