forked from username/flaskpaste
fix: validate algorithm parameter in PKI methods
This commit is contained in:
@@ -310,6 +310,10 @@ class PKI:
|
||||
if self.has_ca():
|
||||
raise CAExistsError("CA already exists")
|
||||
|
||||
# Validate algorithm (only EC supported for now)
|
||||
if algorithm != "ec":
|
||||
raise PKIError(f"Unsupported algorithm: {algorithm} (only 'ec' supported)")
|
||||
|
||||
# Generate EC key
|
||||
curves = {
|
||||
"secp256r1": ec.SECP256R1(),
|
||||
@@ -532,6 +536,10 @@ class PKI:
|
||||
if days is None:
|
||||
days = self.cert_days
|
||||
|
||||
# Validate algorithm (only EC supported for now)
|
||||
if algorithm != "ec":
|
||||
raise PKIError(f"Unsupported algorithm: {algorithm} (only 'ec' supported)")
|
||||
|
||||
ca_key, ca_cert = self._get_signing_key()
|
||||
assert self._ca_store is not None # narrowing for mypy (validated in _get_signing_key)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user