code: def get_password(hsm, args):
      
      expected_len = 32
      name = 'HSM password'
      if hsm.version.have_key_store_decrypt():
          expected_len = 64
          name = 'master key'
  
      if args.stdin:
          password = sys.stdin.readline()
          while password and password[-1] == '\n':
              password = password[:-1]
      else:
          if args.debug:
              password = raw_input('Enter %s (press enter to skip) (will be echoed) : ' % (name))
          else:
              password = getpass.getpass('Enter %s (press enter to skip) : ' % (name))
  
      if len(password) <= expected_len:
          password = password.decode('hex')
          if not password:
              return None
          return password
      else:
          sys.stderr.write("ERROR: Invalid HSM password (expected max %i chars, got %i)\n" % \
                                (expected_len, len(password)))
          return 1
docs: Get password of correct length for this YubiHSM version.