Package pyhsm :: Module hmac_cmd :: Class YHSM_Cmd_HMAC_SHA1_Write
[frames] | no frames]

Class YHSM_Cmd_HMAC_SHA1_Write

cmd.YHSM_Cmd --+
               |
              YHSM_Cmd_HMAC_SHA1_Write

Calculate HMAC SHA1 using a key_handle in the YubiHSM.

Set final=False to not get a hash generated for the initial request.

Set to_buffer=True to get the SHA1 stored into the internal buffer, for use in some other cryptographic operation.

Instance Methods
 
__init__(self, stick, key_handle, data, flags=None, final=True, to_buffer=False)
The base class for all YSM_ commands.
 
next(self, data, final=False, to_buffer=False)
Add more input to the HMAC SHA1.
 
get_hash(self)
Get the HMAC-SHA1 that has been calculated this far.
 
__repr__(self)
 
parse_result(self, data)
This function is intended to be overridden by sub-classes that implements commands that should not just return the data read from the YubiHSM.

Inherited from cmd.YHSM_Cmd: execute

Class Variables
  status = None
  result = None

Inherited from cmd.YHSM_Cmd: executed, response_status

Method Details

__init__(self, stick, key_handle, data, flags=None, final=True, to_buffer=False)
(Constructor)

 

The base class for all YSM_ commands.

Parameters:
  • stick - Reference to a YubiHSM
  • command - The YSM_xxx command defined in pyhsm.defines.
  • payload - a packed C struct, represented as a Python string
Overrides: cmd.YHSM_Cmd.__init__
(inherited documentation)

parse_result(self, data)

 

This function is intended to be overridden by sub-classes that implements commands that should not just return the data read from the YubiHSM.

Overrides: cmd.YHSM_Cmd.parse_result
(inherited documentation)