def _calc_rsa_length(rsa_bit: int) -> int:
    """
    Calculates the length of the RSA key.

    :param rsa_bit: indicates how many bits of rsa
    :return: returns the length of the rsa key. If -1 means an error.
    """
    if rsa_bit == 4096:
        length = 684
    elif rsa_bit == 3072:
        length = 512
    elif rsa_bit == 2048:
        length = 344
    elif rsa_bit == 1024:
        length = 172
    else:
        length = -1
    return length