def read_crypto_key(key_path):
    """
    Read crypto key from keyczar JSON key file format and return parsed AESKey object.

    :param key_path: Absolute path to file containing crypto key in Keyczar JSON format.
    :type key_path: ``str``

    :rtype: :class:`AESKey`
    """
    with open(key_path, "r") as fp:
        content = fp.read()

    content = json_decode(content)

    try:
        aes_key = AESKey(
            aes_key_string=content["aesKeyString"],
            hmac_key_string=content["hmacKey"]["hmacKeyString"],
            hmac_key_size=content["hmacKey"]["size"],
            mode=content["mode"].upper(),
            size=content["size"],
        )
    except KeyError as e:
        msg = 'Invalid or malformed key file "%s": %s' % (key_path, six.text_type(e))
        raise KeyError(msg)

    return aes_key

    Read crypto key from keyczar JSON key file format and return parsed AESKey object.

    :param key_path: Absolute path to file containing crypto key in Keyczar JSON format.
    :type key_path: ``str``

    :rtype: :class:`AESKey`
    
st2common/st2common/util/crypto.py