Package pyhsm :: Module cmd :: Class YHSM_Cmd

[frames] | no frames]

# Class YHSM_Cmd

Known Subclasses:
  - aead_cmd.YHSM_AEAD_Cmd
  - , aead_cmd.YHSM_Cmd_AEAD_Decrypt_Cmp
  - , aes_ecb_cmd.YHSM_Cmd_AES_ECB
  - , basic_cmd.YHSM_Cmd_Echo
  - , basic_cmd.YHSM_Cmd_HSM_Unlock
  - , basic_cmd.YHSM_Cmd_Key_Storage_Unlock
  - , basic_cmd.YHSM_Cmd_Key_Store_Decrypt
  - , basic_cmd.YHSM_Cmd_Nonce_Get
  - , basic_cmd.YHSM_Cmd_Random
  - , basic_cmd.YHSM_Cmd_Random_Reseed
  - , basic_cmd.YHSM_Cmd_System_Info
  - , basic_cmd.YHSM_Cmd_Temp_Key_Load
  - , buffer_cmd.YHSM_Cmd_Buffer_Load
  - , buffer_cmd.YHSM_Cmd_Buffer_Random_Load
  - , db_cmd.YHSM_Cmd_DB_Validate_OTP
  - , db_cmd.YHSM_Cmd_DB_YubiKey_Store
  - , debug_cmd.YHSM_Cmd_Monitor_Exit
  - , hmac_cmd.YHSM_Cmd_HMAC_SHA1_Write

Base class for YubiHSM commands.

Instance Methods

__init__(self, stick, command, payload=`'````'`) The base class for all YSM_ commands. |

execute(self, read_response=True) Write command to HSM and read response. |

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. |

Class Variables
| executed = `False`
| response_status = `None`

Method Details

### __init__(self, stick, command, payload=`'````'`)
(Constructor)

The base class for all YSM_ commands.

Parameters:
  - `stick` (pyhsm.stick.YHSM_Stick) - Reference to a YubiHSM
  - `command` (integer) - The YSM_xxx command defined in pyhsm.defines.
  - `payload` (string) - a packed C struct, represented as a Python string

### execute(self, read_response=True)

Write command to HSM and read response.

Parameters:
  - `read_response` (bool) - Whether to expect a response or not.