pyecsca.ec.key_agreement module¶
Provides an implementation of ECDH (Elliptic Curve Diffie-Hellman) and XDH (X25519, X448).
- class ECDHAction(params, hash_algo, privkey, pubkey)[source]¶
Bases:
ResultAction
ECDH key exchange.
-
params:
DomainParameters
[source]¶
-
params:
- class XDHAction(params, privkey, pubkey)[source]¶
Bases:
ResultAction
XDH key exchange.
-
params:
DomainParameters
[source]¶
-
params:
- class KeyAgreement[source]¶
Bases:
ABC
An abstract EC-based key agreement.
- class XDH(mult, params, pubkey, privkey, bits, bytes)[source]¶
Bases:
KeyAgreement
- class X25519(mult, pubkey, privkey)[source]¶
Bases:
XDH
X25519 (or Curve25519) from [RFC7748].
Warning
You need to clear the top bit of the point coordinate (pubkey) before converting to a point.
- class X448(mult, pubkey, privkey)[source]¶
Bases:
XDH
X448 (or Curve448) from [RFC7748].
- class ECDH(mult, params, pubkey, privkey, hash_algo=None)[source]¶
Bases:
KeyAgreement
EC based key agreement primitive (ECDH).
-
params:
DomainParameters
[source]¶
-
params:
- class ECDH_NONE(mult, params, pubkey, privkey)[source]¶
Bases:
ECDH
Raw x-coordinate ECDH.
- perform()[source]¶
Perform the key agreement operation.
- Return type:
bytes
- Returns:
The shared secret.
- perform_raw()[source]¶
Perform the scalar-multiplication of the key agreement.
- Return type:
- Returns:
The shared point.
-
params:
DomainParameters
[source]¶
- class ECDH_SHA1(mult, params, pubkey, privkey)[source]¶
Bases:
ECDH
ECDH with SHA1 of x-coordinate.
- perform()[source]¶
Perform the key agreement operation.
- Return type:
bytes
- Returns:
The shared secret.
- perform_raw()[source]¶
Perform the scalar-multiplication of the key agreement.
- Return type:
- Returns:
The shared point.
-
params:
DomainParameters
[source]¶
- class ECDH_SHA224(mult, params, pubkey, privkey)[source]¶
Bases:
ECDH
ECDH with SHA224 of x-coordinate.
- perform()[source]¶
Perform the key agreement operation.
- Return type:
bytes
- Returns:
The shared secret.
- perform_raw()[source]¶
Perform the scalar-multiplication of the key agreement.
- Return type:
- Returns:
The shared point.
-
params:
DomainParameters
[source]¶
- class ECDH_SHA256(mult, params, pubkey, privkey)[source]¶
Bases:
ECDH
ECDH with SHA256 of x-coordinate.
- perform()[source]¶
Perform the key agreement operation.
- Return type:
bytes
- Returns:
The shared secret.
- perform_raw()[source]¶
Perform the scalar-multiplication of the key agreement.
- Return type:
- Returns:
The shared point.
-
params:
DomainParameters
[source]¶
- class ECDH_SHA384(mult, params, pubkey, privkey)[source]¶
Bases:
ECDH
ECDH with SHA384 of x-coordinate.
- perform()[source]¶
Perform the key agreement operation.
- Return type:
bytes
- Returns:
The shared secret.
- perform_raw()[source]¶
Perform the scalar-multiplication of the key agreement.
- Return type:
- Returns:
The shared point.
-
params:
DomainParameters
[source]¶
- class ECDH_SHA512(mult, params, pubkey, privkey)[source]¶
Bases:
ECDH
ECDH with SHA512 of x-coordinate.
- perform()[source]¶
Perform the key agreement operation.
- Return type:
bytes
- Returns:
The shared secret.
- perform_raw()[source]¶
Perform the scalar-multiplication of the key agreement.
- Return type:
- Returns:
The shared point.
-
params:
DomainParameters
[source]¶