Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Changelog
actually dropping support, however we strongly encourage all users to upgrade
their Python, as Python 2.6 no longer receives support from the Python core
team.
* Add support for the
:class:`~cryptography.hazmat.primitives.asymmetric.ec.SECP256K1` elliptic
curve.
* Fixed compilation when using an OpenSSL which was compiled with the
``no-comp`` (``OPENSSL_NO_COMP``) option.
* Support :attr:`~cryptography.hazmat.primitives.serialization.Encoding.DER`
Expand Down
8 changes: 8 additions & 0 deletions docs/hazmat/primitives/asymmetric/ec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ All named curves are providers of :class:`EllipticCurve`.

SECG curve ``secp192r1``. Also called NIST P-192.


.. class:: SECP256K1

.. versionadded:: 0.9

SECG curve ``secp256k1``.


Key Interfaces
~~~~~~~~~~~~~~

Expand Down
7 changes: 7 additions & 0 deletions src/cryptography/hazmat/primitives/asymmetric/ec.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ class SECP256R1(object):
key_size = 256


@utils.register_interface(EllipticCurve)
class SECP256K1(object):
name = "secp256k1"
key_size = 256


@utils.register_interface(EllipticCurve)
class SECP224R1(object):
name = "secp224r1"
Expand All @@ -222,6 +228,7 @@ class SECP192R1(object):
"secp256r1": SECP256R1,
"secp384r1": SECP384R1,
"secp521r1": SECP521R1,
"secp256k1": SECP256K1,

"sect163k1": SECT163K1,
"sect233k1": SECT233K1,
Expand Down
15 changes: 11 additions & 4 deletions tests/hazmat/primitives/test_ec.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,17 @@ def test_load_invalid_ec_key_from_numbers(self, backend):

@pytest.mark.parametrize(
"vector",
load_vectors_from_file(
os.path.join(
"asymmetric", "ECDSA", "FIPS_186-3", "SigGen.txt"),
load_fips_ecdsa_signing_vectors
itertools.chain(
load_vectors_from_file(
os.path.join(
"asymmetric", "ECDSA", "FIPS_186-3", "SigGen.txt"),
load_fips_ecdsa_signing_vectors
),
load_vectors_from_file(
os.path.join(
"asymmetric", "ECDSA", "SECP256K1", "SigGen.txt"),
load_fips_ecdsa_signing_vectors
),
)
)
def test_signatures(self, backend, vector):
Expand Down