def to_json(self):
        """
        Return JSON representation of this key which is fully compatible with keyczar JSON key
        file format.

        :rtype: ``str``
        """
        data = {
            "hmacKey": {
                "hmacKeyString": self.hmac_key_string,
                "size": self.hmac_key_size,
            },
            "aesKeyString": self.aes_key_string,
            "mode": self.mode.upper(),
            "size": int(self.size),
        }
        return json_encode(data)

        Return JSON representation of this key which is fully compatible with keyczar JSON key
        file format.

        :rtype: ``str``
        
st2common/st2common/util/crypto.py