Skip to content

Commit

Permalink
pk: raise exception when trying to use ECDSA with Curve25519 and Curv…
Browse files Browse the repository at this point in the history
…e448

ECDSA does not support Curve25519 or Curve448.
  • Loading branch information
isombyt authored and Synss committed Jun 18, 2022
1 parent f597b56 commit d5b4f7f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/mbedtls/pk.pyx
Expand Up @@ -691,6 +691,13 @@ cdef class ECC(CipherBase):
cdef mbedtls_ecp_keypair* ecp = _pk.mbedtls_pk_ec(self._ctx)
return not _pk.mbedtls_ecp_is_zero(&ecp.Q)

def sign(self,
const unsigned char[:] message not None,
digestmod=None):
if self._curve in (Curve.CURVE25519, Curve.CURVE448):
raise ValueError("ECDSA does not support Curve25519 or Curve448.")
return super().sign(message, digestmod)

def generate(self):
"""Generate an EC keypair.
Expand Down

0 comments on commit d5b4f7f

Please sign in to comment.