VerifactuMidAPI/test/check_password.py

26 lines
706 B
Python

import sys
from cryptography.hazmat.primitives.serialization import pkcs12
from cryptography.hazmat.backends import default_backend
# Try multiple password variants
passwords = [
"Mecedora12@",
"MECEDORA12@",
"mecedora12@",
"53950250R",
"1752317947215",
"MECEDORA12",
]
cert_path = r"D:\Importante\53950250R_JOSEP VICENT_MESTRE__1752317947215 - copia.p12"
for pw in passwords:
try:
with open(cert_path, "rb") as f:
pkcs12.load_key_and_certificates(f.read(), pw.encode(), default_backend())
print(f"OK: Password is '{pw}'")
sys.exit(0)
except Exception as e:
print(f"FAIL: '{pw}' - {e}")
print("None of the passwords worked!")