COSE Curves
Overview
All CoseCurve
classes have a fullname, identifier, curve_obj, key_type, and size attribute. The full list with COSE
curves and their identifiers can be found at the IANA registry.
>>> from pycose.keys.curves import Ed25519
>>> from pycose.keys import OKPKey
>>> key = OKPKey.generate_key(crv=Ed25519)
>>> key.crv.fullname
'ED25519'
>>> key.crv.identifier
6
>>> key.crv.curve_obj
<class 'cryptography.hazmat.primitives.asymmetric.ed25519.Ed25519PrivateKey'>
>>> key.crv.key_type
<class 'pycose.keys.keytype.KtyOKP'>
>>> key.crv.size
32
API
- class pycose.keys.curves.Reserved
- Attributes:
identifier 0
fullname RESERVED
curve_obj None
key_type None
size 0
- class pycose.keys.curves.P256
Curve NIST P-256
- Attributes:
identifier 1
fullname P_256
curve_obj SECP256R1 from the cryptography package
key_type KtyEC2
size 32
- class pycose.keys.curves.P384
Curve NIST P-384
- Attributes:
identifier 2
fullname P_384
curve_obj SECP384R1 from the cryptography package
key_type KtyEC2
size 48
- class pycose.keys.curves.P521
Curve NIST P-521
- Attributes:
identifier 3
fullname P_521
curve_obj SECP521R1 from the cryptography package
key_type KtyEC2
size 66
- class pycose.keys.curves.X25519
Curve25519 for the Diffie-Hellman function (X25519)
- Attributes:
identifier 4
fullname X25519
curve_obj X25519PrivateKey from the cryptography package
key_type KtyOKP
size 32
- class pycose.keys.curves.X448
Curve448 for the Diffie-Hellman function (X448)
- Attributes:
identifier 5
fullname X448
curve_obj X25519PrivateKey from the cryptography package
key_type KtyOKP
size 57
- class pycose.keys.curves.Ed25519
Curve25519 for the EdDSA algorithm (Ed25519)
- Attributes:
identifier 6
fullname ED25519
curve_obj Ed25519PrivateKey from the cryptography package
key_type KtyOKP
size 32
- class pycose.keys.curves.Ed448
Curve448 for the EdDSA algorithm (Ed448)
- Attributes:
identifier 7
fullname ED448
curve_obj Ed448PrivateKey from the cryptography package
key_type KtyOKP
size 57
- class pycose.keys.curves.SECP256K1
Curve secp256k1
- Attributes:
identifier 8
fullname SECP256K1
curve_obj SECP256K1 from the cryptography package
key_type KtyEC2
size 32