ECDSA test vectors¶
Test vectors for ECDSA.
- exception crypto_condor.vectors.ECDSA.EcdsaParametersError¶
Bases:
Exception
Exception for parameter errors.
- exception crypto_condor.vectors.ECDSA.EcdsaVectorsError¶
Bases:
Exception
Exception for errors when loading or parsing vectors.
- enum crypto_condor.vectors.ECDSA.Curve(value)¶
Bases:
StrEnum
Defines all supported curves.
- Member Type:
str
Valid values are as follows:
- SECP192R1 = <Curve.SECP192R1: 'secp192r1'>¶
- SECP224R1 = <Curve.SECP224R1: 'secp224r1'>¶
- SECP256R1 = <Curve.SECP256R1: 'secp256r1'>¶
- SECP384R1 = <Curve.SECP384R1: 'secp384r1'>¶
- SECP521R1 = <Curve.SECP521R1: 'secp521r1'>¶
- SECP256K1 = <Curve.SECP256K1: 'secp256k1'>¶
- BRAINPOOLP224R1 = <Curve.BRAINPOOLP224R1: 'brainpoolP224r1'>¶
- BRAINPOOLP256R1 = <Curve.BRAINPOOLP256R1: 'brainpoolP256r1'>¶
- SECT283R1 = <Curve.SECT283R1: 'sect283r1'>¶
- SECT409R1 = <Curve.SECT409R1: 'sect409r1'>¶
- SECT571R1 = <Curve.SECT571R1: 'sect571r1'>¶
The
Enum
and its members also have the following methods:- classmethod from_name(name)¶
Matches a curve name to its corresponding enum.
- Parameters:
name (str) – The name of the curve.
- Returns:
The corresponding
EcdsaCurve
.- Raises:
ValueError – If the curve is not supported or the name not recognized.
- get_nist_name()¶
Returns the curve name used in NIST test vectors.
None is returned if there are no NIST vectors that use this curve.
- get_wycheproof_name()¶
Returns the curve name used in Wycheproof test vectors.
None is returned if there are no Wycheproof vectors that use this curve.
- get_curve_instance()¶
Returns an instance of the corresponding curve.
Curves come from the
cryptography.hazmat.primitives.asymmetric.ec
module.
- class crypto_condor.vectors.ECDSA.EcdsaSigGenVectors(curve, hash_function, nist)¶
Bases:
object
ECDSA signature generation test vectors.
Do not instantiate directly, use
load()
to get test vectors for a given curve and hash function.- Parameters:
- classmethod load(curve, hash_function)¶
Loads ECDSA SigGen test vectors.
- Parameters:
- Returns:
An
EcdsaSigGenVectors
instance with the corresponding test vectors.
- class crypto_condor.vectors.ECDSA.EcdsaSigVerVectors(curve, hash_function, nist, wycheproof)¶
Bases:
object
A class to group ECDSA test vectors for signature verification.
Do not instantiate directly, use
load()
to load the corresponding test vectors.- Parameters:
parameters – The parameters to get test vectors for.
nist_vectors – An instance of loaded NIST vectors if they exist for the given parameters, None otherwise.
wycheproof_vectors – An instance of loaded Wycheproof vectors if they exist for the given parameters, None otherwise.
- classmethod load(curve, hash_function, *, compliance=True, resilience=True)¶
Loads ECDSA SigVer test vectors.
- Parameters:
- Keyword Arguments:
compliance – Whether to load compliance test vectors.
resilience – Whether to load resilience test vectors.
- Returns:
An
EcdsaSigVerVectors
instance with the corresponding test vectors.
- enum crypto_condor.vectors.ECDSA.EcdsaVectorType(value)¶
Bases:
StrEnum
Defines the different types of test vectors available.
- Member Type:
str
Valid values are as follows:
- SIGVER = <EcdsaVectorType.SIGVER: 'sigver'>¶
- SIGGEN = <EcdsaVectorType.SIGGEN: 'siggen'>¶
- class crypto_condor.vectors.ECDSA.EcdsaWycheproofGroup¶
Bases:
TypedDict
Represents a Wycheproof ECDSA test group.
- class crypto_condor.vectors.ECDSA.EcdsaWycheproofKey¶
Bases:
TypedDict
Represents a Wycheproof ECDSA key.
ECDSA test groups share a key which is provided in different formats. This format contains the curve used and the coordinates.
- class crypto_condor.vectors.ECDSA.EcdsaWycheproofTest¶
Bases:
TypedDict
Represents a single Wycheproof ECDSA test.
- class crypto_condor.vectors.ECDSA.EcdsaWycheproofVectors¶
Bases:
TypedDict
Represents a Wycheproof file of ECDSA test vectors.
Note that some fields are missing as they are not used by crypto-condor.
- enum crypto_condor.vectors.ECDSA.Hash(value)¶
Bases:
StrEnum
Defines all supported hash functions.
- Member Type:
str
Valid values are as follows:
- SHA_256 = <Hash.SHA_256: 'SHA-256'>¶
- SHA_384 = <Hash.SHA_384: 'SHA-384'>¶
- SHA_512 = <Hash.SHA_512: 'SHA-512'>¶
- SHA3_256 = <Hash.SHA3_256: 'SHA3-256'>¶
- SHA3_384 = <Hash.SHA3_384: 'SHA3-384'>¶
- SHA3_512 = <Hash.SHA3_512: 'SHA3-512'>¶
The
Enum
and its members also have the following methods:- classmethod from_name(name)¶
Matches a hash function name to its corresponding enum.
- Parameters:
name (str) – The name of the hash function.
- Returns:
The corresponding
EcdsaHash
.- Raises:
ValueError – If the hash function is not supported or the name not recognized.
- get_nist_name()¶
Returns the hash function name used in NIST test vectors.
None is returned if there are no NIST vectors that use this hash function.
- get_wycheproof_name()¶
Returns the hash function name used in Wycheproof test vectors.
None is returned if there are no Wycheproof vectors that use this hash function.
- get_hash_instance()¶
Returns an instance of the corresponding hash function.
Hash functions come from
cryptography.hazmat.primitives.hashes
module.