pyecsca.ec.key_agreement module

Provides an implementation of ECDH (Elliptic Curve Diffie-Hellman).

class ECDHAction(params, hash_algo, privkey, pubkey)[source]

Bases: ResultAction

ECDH key exchange.

params: DomainParameters
hash_algo: Optional[Any]
privkey: Mod
pubkey: Point
exit(result)
property result: Any
inside: bool
class KeyAgreement(mult, params, pubkey, privkey, hash_algo=None)[source]

Bases: object

EC based key agreement primitive (ECDH).

mult: ScalarMultiplier
params: DomainParameters
pubkey: Point
privkey: Mod
hash_algo: Optional[Any]
perform_raw()[source]

Perform the scalar-multiplication of the key agreement.

Return type:

Point

Returns:

The shared point.

perform()[source]

Perform the key agreement operation.

Return type:

bytes

Returns:

The shared secret.

class ECDH_NONE(mult, params, pubkey, privkey)[source]

Bases: KeyAgreement

Raw x-coordinate ECDH.

perform()

Perform the key agreement operation.

Return type:

bytes

Returns:

The shared secret.

perform_raw()

Perform the scalar-multiplication of the key agreement.

Return type:

Point

Returns:

The shared point.

mult: ScalarMultiplier
params: DomainParameters
pubkey: Point
privkey: Mod
hash_algo: Optional[Any]
class ECDH_SHA1(mult, params, pubkey, privkey)[source]

Bases: KeyAgreement

ECDH with SHA1 of x-coordinate.

perform()

Perform the key agreement operation.

Return type:

bytes

Returns:

The shared secret.

perform_raw()

Perform the scalar-multiplication of the key agreement.

Return type:

Point

Returns:

The shared point.

mult: ScalarMultiplier
params: DomainParameters
pubkey: Point
privkey: Mod
hash_algo: Optional[Any]
class ECDH_SHA224(mult, params, pubkey, privkey)[source]

Bases: KeyAgreement

ECDH with SHA224 of x-coordinate.

perform()

Perform the key agreement operation.

Return type:

bytes

Returns:

The shared secret.

perform_raw()

Perform the scalar-multiplication of the key agreement.

Return type:

Point

Returns:

The shared point.

mult: ScalarMultiplier
params: DomainParameters
pubkey: Point
privkey: Mod
hash_algo: Optional[Any]
class ECDH_SHA256(mult, params, pubkey, privkey)[source]

Bases: KeyAgreement

ECDH with SHA256 of x-coordinate.

perform()

Perform the key agreement operation.

Return type:

bytes

Returns:

The shared secret.

perform_raw()

Perform the scalar-multiplication of the key agreement.

Return type:

Point

Returns:

The shared point.

mult: ScalarMultiplier
params: DomainParameters
pubkey: Point
privkey: Mod
hash_algo: Optional[Any]
class ECDH_SHA384(mult, params, pubkey, privkey)[source]

Bases: KeyAgreement

ECDH with SHA384 of x-coordinate.

perform()

Perform the key agreement operation.

Return type:

bytes

Returns:

The shared secret.

perform_raw()

Perform the scalar-multiplication of the key agreement.

Return type:

Point

Returns:

The shared point.

mult: ScalarMultiplier
params: DomainParameters
pubkey: Point
privkey: Mod
hash_algo: Optional[Any]
class ECDH_SHA512(mult, params, pubkey, privkey)[source]

Bases: KeyAgreement

ECDH with SHA512 of x-coordinate.

perform()

Perform the key agreement operation.

Return type:

bytes

Returns:

The shared secret.

perform_raw()

Perform the scalar-multiplication of the key agreement.

Return type:

Point

Returns:

The shared point.

mult: ScalarMultiplier
params: DomainParameters
pubkey: Point
privkey: Mod
hash_algo: Optional[Any]