ecdsa.curves module
- class ecdsa.curves.Curve(name, curve, generator, oid, openssl_name=None)[source]
Bases:
object- static from_der(data, valid_encodings=None)[source]
Decode the curve parameters from DER file.
- Parameters:
data (bytes-like object) – the binary string to decode the parameters from
valid_encodings (set-like object) – set of names of allowed encodings, by default all (set by passing
None), supported ones arenamed_curveandexplicit
- classmethod from_pem(string, valid_encodings=None)[source]
Decode the curve parameters from PEM file.
- Parameters:
string (str) – the text string to decode the parameters from
valid_encodings (set-like object) – set of names of allowed encodings, by default all (set by passing
None), supported ones arenamed_curveandexplicit
- to_der(encoding=None, point_encoding='uncompressed')[source]
Serialise the curve parameters to binary string.
- Parameters:
- Returns:
DER encoded ECParameters structure
- Return type:
- exception ecdsa.curves.UnknownCurveError[source]
Bases:
Exception- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- ecdsa.curves.curve_by_name(name)[source]
Select a curve based on its name.
Returns a
Curveobject with anamename. Note thatnameis case-sensitve.- Parameters:
name (str) – Name of the curve to return, like
NIST256porprime256v1- Raises:
UnknownCurveError – When the name doesn’t match any of the supported curves
- Return type:
- ecdsa.curves.find_curve(oid_curve)[source]
Select a curve based on its OID
- Parameters:
oid_curve (tuple[int,...]) – ASN.1 Object Identifier of the curve to return, like
(1, 2, 840, 10045, 3, 1, 7)forNIST256p.- Raises:
UnknownCurveError – When the oid doesn’t match any of the supported curves
- Return type: