Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 9a466331

Přidáno uživatelem Michal Seják před téměř 4 roky(ů)

Re #8705 - `verify_key` bugfix - added check whether the passed PEM is an actual key

Zobrazit rozdíly:

src/services/cryptography.py
461 461
        :return: True if the condition is fulfilled, else False
462 462
        """
463 463
        if passphrase is None:
464
            return re.search(GUARANTEED_SUBSTRING_OF_ENCRYPTED_KEYS, key) is None
464
            if re.search(GUARANTEED_SUBSTRING_OF_ENCRYPTED_KEYS, key) is not None:
465
                return False
466
            else:
467
                try:
468
                    with TemporaryFile("tested_key.pem", key) as f:
469
                        ret = self.__run_for_output(["rsa", "-in", f, "-inform", "PEM"])
470
                    return ret.startswith(KEY_PREFIX)
471
                except CryptographyException:
472
                    return False
465 473
        else:
466 474
            if re.search(GUARANTEED_SUBSTRING_OF_ENCRYPTED_KEYS, key) is None:
467 475
                return False

Také k dispozici: Unified diff