code: def cmd_fernet(key, decrypt, ttl, i, o):
      
  
      habucfg = loadcfg()
  
      if not key:
          if 'FERNET_KEY' in habucfg:
              key = habucfg['FERNET_KEY']
          else:
              print(ERROR_NOKEY, file=sys.stderr)
              sys.exit(1)
  
      if not ttl:
          ttl=None
  
      cipher = Fernet(key)
  
      data = i.read()
  
      if decrypt:
          try:
              token = cipher.decrypt(data, ttl)
          except Exception as e:
              print("Error decrypting", file=sys.stderr)
              sys.exit(1)
      else:
          token = cipher.encrypt(data)
  
      print(token.decode(), end='')
docs: Fernet cipher.
  
      Uses AES-128-CBC with HMAC
  
      Note: You must use a key to cipher with Fernet.
  
      Use the -k paramenter or set the FERNET_KEY configuration value.
  
      The keys can be generated with the command habu.fernet.genkey
  
      Reference: https://github.com/fernet/spec/blob/master/Spec.md
  
      Example:
  
      \b
      $ "I want to protect this string" | habu.fernet
      gAAAAABbXnCGoCULLuVNRElYTbEcwnek9iq5jBKq9JAN3wiiBUzPqpUgV5oWvnC6xfIA...
  
      \b
      $ echo gAAAAABbXnCGoCULLuVNRElYTbEcwnek9iq5jBKq9JAN3wiiBUzPqpUgV5oWvnC6xfIA... | habu.fernet -d
      I want to protect this string