fix: use compat getattr for not_valid_after/before_utc to support cryptography v41
This commit is contained in:
+3
-3
@@ -91,7 +91,7 @@ def generate_self_signed(
|
|||||||
.sign(private_key, hashes.SHA256())
|
.sign(private_key, hashes.SHA256())
|
||||||
)
|
)
|
||||||
|
|
||||||
expires = cert.not_valid_after_utc # type: ignore[attr-defined]
|
expires = getattr(cert, "not_valid_after_utc", cert.not_valid_after)
|
||||||
|
|
||||||
# Write key PEM — create file with restricted permissions before writing
|
# Write key PEM — create file with restricted permissions before writing
|
||||||
key_pem = private_key.private_bytes(
|
key_pem = private_key.private_bytes(
|
||||||
@@ -154,8 +154,8 @@ def get_cert_info(cert_path) -> dict | None:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"expires": cert.not_valid_after_utc, # type: ignore[attr-defined]
|
"expires": getattr(cert, "not_valid_after_utc", cert.not_valid_after),
|
||||||
"not_before": cert.not_valid_before_utc, # type: ignore[attr-defined]
|
"not_before": getattr(cert, "not_valid_before_utc", cert.not_valid_before),
|
||||||
"hostnames": hostnames,
|
"hostnames": hostnames,
|
||||||
"serial": cert.serial_number,
|
"serial": cert.serial_number,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user