pyecsca.ec.signature module

class pyecsca.ec.signature.SignatureResult(r, s, data=None, digest=None, nonce=None, privkey=None, pubkey=None)[source]

Bases: object

An ECDSA signature result (r, s).

static from_DER(data)[source]

Load an ECDSA signature from ASN.1 DER data.

Return type:SignatureResult
to_DER()[source]

Output this signature into ASN.1 DER.

Return type:bytes
class pyecsca.ec.signature.Signature(mult, add=None, pubkey=None, privkey=None, hash_algo=None)[source]

Bases: object

An EC based signature primitive. (ECDSA)

can_sign

Whether this instance can sign (has a private key).

Return type:bool
can_verify

Whether this instance can verify (has a public key and add formula).

Return type:bool
sign_data(data, nonce=None)[source]

Sign data.

Return type:SignatureResult
sign_hash(digest, nonce=None)[source]

Sign already hashed data.

Return type:SignatureResult
verify_data(signature, data)[source]

Verify data.

Return type:bool
verify_hash(signature, digest)[source]

Verify already hashed data.

Return type:bool
class pyecsca.ec.signature.ECDSA_NONE(mult, add=None, pubkey=None, privkey=None)[source]

Bases: pyecsca.ec.signature.Signature

ECDSA with raw message input.

class pyecsca.ec.signature.ECDSA_SHA1(mult, add=None, pubkey=None, privkey=None)[source]

Bases: pyecsca.ec.signature.Signature

ECDSA with SHA1.

class pyecsca.ec.signature.ECDSA_SHA224(mult, add=None, pubkey=None, privkey=None)[source]

Bases: pyecsca.ec.signature.Signature

ECDSA with SHA224.

class pyecsca.ec.signature.ECDSA_SHA256(mult, add=None, pubkey=None, privkey=None)[source]

Bases: pyecsca.ec.signature.Signature

ECDSA with SHA256.

class pyecsca.ec.signature.ECDSA_SHA384(mult, add=None, pubkey=None, privkey=None)[source]

Bases: pyecsca.ec.signature.Signature

ECDSA with SHA384.

class pyecsca.ec.signature.ECDSA_SHA512(mult, add=None, pubkey=None, privkey=None)[source]

Bases: pyecsca.ec.signature.Signature

ECDSA with SHA512.