pyecsca.sca.target.ectester module¶
Provides an ECTester target class.
- class KeypairEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
ShiftableFlag
ECTester’s KeyPair type.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class InstructionEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
ECTester’s instruction (INS).
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class KeyBuildEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
ECTester’s key builder type.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class ExportEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
ECTester’s export boolean.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class RunModeEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
ECTester’s run mode.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class KeyEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
ShiftableFlag
ECTester’s key enum.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class AppletBaseEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
ECTester’s JavaCard applet base version.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class KeyClassEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
JavaCard EC-based key class.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class KeyAgreementEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
JavaCard KeyAgreement type values.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class SignatureEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
JavaCard Signature type values.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class TransformationEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
ShiftableFlag
ECTester’s point/value transformation types.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class FormatEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
ECTester’s point format types.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class CurveEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
ECTester’s curve constants.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- class ParameterEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
ShiftableFlag
ECTester’s parameter ids.
- bit_length()[source]¶
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()[source]¶
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length=1, byteorder='big', *, signed=False)[source]¶
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder='big', *, signed=False)[source]¶
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- exception ChunkingException[source]¶
Bases:
Exception
An exception that is raised if an error happened during the chunking process of a large APDU.
- class AllocateKaResponse(resp)[source]¶
Bases:
Response
A response to the KeyAgreement allocation command.
-
resp:
ResponseAPDU
[source]¶
-
resp:
- class AllocateSigResponse(resp)[source]¶
Bases:
Response
A response to the Signature allocation command.
-
resp:
ResponseAPDU
[source]¶
-
resp:
- class AllocateResponse(resp, keypair)[source]¶
Bases:
Response
A response to the KeyPair allocation command.
-
resp:
ResponseAPDU
[source]¶
-
resp:
- class ClearResponse(resp, keypair)[source]¶
Bases:
Response
A response to the Clear key command.
-
resp:
ResponseAPDU
[source]¶
-
resp:
- class SetResponse(resp, keypair)[source]¶
Bases:
Response
A response to the Set command.
-
resp:
ResponseAPDU
[source]¶
-
resp:
- class TransformResponse(resp, keypair)[source]¶
Bases:
Response
A response to the Transform command.
-
resp:
ResponseAPDU
[source]¶
-
resp:
- class GenerateResponse(resp, keypair)[source]¶
Bases:
Response
A response to the Generate command.
-
resp:
ResponseAPDU
[source]¶
-
resp:
- class ExportResponse(resp, keypair, key, params)[source]¶
Bases:
Response
A response to the Export command, contains the exported parameters/values.
-
keypair:
KeypairEnum
[source]¶
-
parameters:
ParameterEnum
[source]¶
-
resp:
ResponseAPDU
[source]¶
-
keypair:
- class ECDHResponse(resp, export)[source]¶
Bases:
Response
A response to the ECDH and ECDH_direct KeyAgreement commands.
-
resp:
ResponseAPDU
[source]¶
-
resp:
- class ECDSAResponse(resp, export)[source]¶
Bases:
Response
A response to the ECDSA and ECDSA sign and ECDSA verify commands.
-
resp:
ResponseAPDU
[source]¶
-
resp:
- class CleanupResponse(resp)[source]¶
Bases:
Response
A response to the Cleanup command.
-
resp:
ResponseAPDU
[source]¶
-
resp:
- class RunModeResponse(resp)[source]¶
Bases:
Response
A response to the Set run mode command.
-
resp:
ResponseAPDU
[source]¶
-
resp:
- class ECTesterTarget[source]¶
Bases:
ISO7816Target
,ABC
Smartcard target which communicates with the ECTester sapplet on smartcards of the JavaCard platform using PCSC.
- connect(protocol=None)[source]¶
Connect to the card.
- Parameters:
protocol¶ (
Optional
[CardProtocol
]) – CardProtocol to use.
- abstract select(aid)[source]¶
Select an applet with
aid
.- Parameters:
aid¶ (
bytes
) – The AID of the applet to select.- Return type:
bool
- Returns:
Whether the selection was successful.
- abstract send_apdu(apdu)[source]¶
Send an APDU to the selected applet.
- Parameters:
apdu¶ (
CommandAPDU
) – The APDU to send.- Return type:
- Returns:
The response.
- select_applet(latest_version=b'033', count_back=10)[source]¶
Select the ECTester applet, with a specified version or older.
- static encode_parameters(params, obj)[source]¶
Encode values from obj into the byte parameters that the ECTester applet expects.
- Return type:
Mapping
[ParameterEnum
,bytes
]
- allocate_ka(ka_type)[source]¶
Send the Allocate KeyAgreement command.
- Parameters:
ka_type¶ (
KeyAgreementEnum
) – Which KeyAgreement type to allocate.- Return type:
- Returns:
The response.
- allocate_sig(sig_type)[source]¶
Send the Allocate Signature command.
- Parameters:
sig_type¶ (
SignatureEnum
) – Which Signature type to allocate.- Return type:
- Returns:
The response.
- allocate(keypair, builder, key_length, key_class)[source]¶
Send the Allocate KeyPair command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to allocate.builder¶ (
KeyBuildEnum
) – Which builder to use to allocate the keypair.key_length¶ (
int
) – Bit-size of the allocated keypair.key_class¶ (
KeyClassEnum
) – Type of the allocated keypair.
- Return type:
- Returns:
The response.
- clear(keypair)[source]¶
Send the Clear key command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to clear.- Return type:
- Returns:
The response.
- set(keypair, curve, params, values=None)[source]¶
Send the Set command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to set values on.curve¶ (
CurveEnum
) – Which pre-set curve to use to set values, or default or external.params¶ (
ParameterEnum
) – Which parameters to set on the keypair.values¶ (
Optional
[Mapping
[ParameterEnum
,bytes
]]) – External values to set on the keypair.
- Return type:
- Returns:
The response.
- transform(keypair, key, params, transformation)[source]¶
Send the Transform command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to transform.params¶ (
ParameterEnum
) – Which parameters to transform.transformation¶ (
TransformationEnum
) – What transformation to apply.
- Return type:
- Returns:
The response.
- generate(keypair)[source]¶
Send the Generate command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to generate.- Return type:
- Returns:
The response.
- export(keypair, key, params)[source]¶
Send the Export command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to export from.params¶ (
ParameterEnum
) – Which parameters to export.
- Return type:
- Returns:
The response, containing the exported parameters.
- ecdh(pubkey, privkey, export, transformation, ka_type)[source]¶
Send the ECDH command.
- Parameters:
pubkey¶ (
KeypairEnum
) – Which keypair to use the pubkey from, in the key-agreement.privkey¶ (
KeypairEnum
) – Which keypair to use the privkey from, in the key-agreement.export¶ (
bool
) – Whether to export the shared secret.transformation¶ (
TransformationEnum
) – The transformation to apply to the pubkey before key-agreement.ka_type¶ (
KeyAgreementEnum
) – The key-agreement type to use.
- Return type:
- Returns:
The response.
- ecdh_direct(privkey, export, transformation, ka_type, pubkey)[source]¶
Send the ECDH direct command.
- Parameters:
privkey¶ (
KeypairEnum
) – Which keypair to use the privkey from, in the key-agreement.export¶ (
bool
) – Whether to export the shared secret.transformation¶ (
TransformationEnum
) – The transformation to apply to the pubkey before key-agreement.ka_type¶ (
KeyAgreementEnum
) – The key-agreement type to use.pubkey¶ (
bytes
) – The raw bytes that will be used as a pubkey in the key-agreement.
- Return type:
- Returns:
The response.
- ecdsa(keypair, export, sig_type, data)[source]¶
Send the ECDSA command.
- Parameters:
keypair¶ (
KeypairEnum
) – The keypair to use.export¶ (
bool
) – Whether to export the signature.sig_type¶ (
SignatureEnum
) – The Signature type to use.data¶ (
bytes
) – The data to sign and verify.
- Return type:
- Returns:
The response.
- ecdsa_sign(keypair, export, sig_type, data)[source]¶
Send the ECDSA sign command.
- Parameters:
keypair¶ (
KeypairEnum
) – The keypair to use to sign.export¶ (
bool
) – Whether to export the signature.sig_type¶ (
SignatureEnum
) – The Signature type to use.data¶ (
bytes
) – The data to sign.
- Return type:
- Returns:
The response.
- ecdsa_verify(keypair, sig_type, sig, data)[source]¶
Send the ECDSA verify command.
- Parameters:
keypair¶ (
KeypairEnum
) – The keypair to use to verify.sig_type¶ (
SignatureEnum
) – The Signature type to use.sig¶ (
bytes
) – The signature to verify.data¶ (
bytes
) – The data.
- Return type:
- Returns:
The response.
- class ECTesterTargetPCSC(reader)[source]¶
Bases:
ECTesterTarget
,PCSCTarget
An ECTester-applet-based target that is connected via a PCSC-compatible reader.
- allocate(keypair, builder, key_length, key_class)[source]¶
Send the Allocate KeyPair command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to allocate.builder¶ (
KeyBuildEnum
) – Which builder to use to allocate the keypair.key_length¶ (
int
) – Bit-size of the allocated keypair.key_class¶ (
KeyClassEnum
) – Type of the allocated keypair.
- Return type:
- Returns:
The response.
- allocate_ka(ka_type)[source]¶
Send the Allocate KeyAgreement command.
- Parameters:
ka_type¶ (
KeyAgreementEnum
) – Which KeyAgreement type to allocate.- Return type:
- Returns:
The response.
- allocate_sig(sig_type)[source]¶
Send the Allocate Signature command.
- Parameters:
sig_type¶ (
SignatureEnum
) – Which Signature type to allocate.- Return type:
- Returns:
The response.
- clear(keypair)[source]¶
Send the Clear key command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to clear.- Return type:
- Returns:
The response.
- connect(protocol=None)[source]¶
Connect to the card.
- Parameters:
protocol¶ (
Optional
[CardProtocol
]) – CardProtocol to use.
- ecdh(pubkey, privkey, export, transformation, ka_type)[source]¶
Send the ECDH command.
- Parameters:
pubkey¶ (
KeypairEnum
) – Which keypair to use the pubkey from, in the key-agreement.privkey¶ (
KeypairEnum
) – Which keypair to use the privkey from, in the key-agreement.export¶ (
bool
) – Whether to export the shared secret.transformation¶ (
TransformationEnum
) – The transformation to apply to the pubkey before key-agreement.ka_type¶ (
KeyAgreementEnum
) – The key-agreement type to use.
- Return type:
- Returns:
The response.
- ecdh_direct(privkey, export, transformation, ka_type, pubkey)[source]¶
Send the ECDH direct command.
- Parameters:
privkey¶ (
KeypairEnum
) – Which keypair to use the privkey from, in the key-agreement.export¶ (
bool
) – Whether to export the shared secret.transformation¶ (
TransformationEnum
) – The transformation to apply to the pubkey before key-agreement.ka_type¶ (
KeyAgreementEnum
) – The key-agreement type to use.pubkey¶ (
bytes
) – The raw bytes that will be used as a pubkey in the key-agreement.
- Return type:
- Returns:
The response.
- ecdsa(keypair, export, sig_type, data)[source]¶
Send the ECDSA command.
- Parameters:
keypair¶ (
KeypairEnum
) – The keypair to use.export¶ (
bool
) – Whether to export the signature.sig_type¶ (
SignatureEnum
) – The Signature type to use.data¶ (
bytes
) – The data to sign and verify.
- Return type:
- Returns:
The response.
- ecdsa_sign(keypair, export, sig_type, data)[source]¶
Send the ECDSA sign command.
- Parameters:
keypair¶ (
KeypairEnum
) – The keypair to use to sign.export¶ (
bool
) – Whether to export the signature.sig_type¶ (
SignatureEnum
) – The Signature type to use.data¶ (
bytes
) – The data to sign.
- Return type:
- Returns:
The response.
- ecdsa_verify(keypair, sig_type, sig, data)[source]¶
Send the ECDSA verify command.
- Parameters:
keypair¶ (
KeypairEnum
) – The keypair to use to verify.sig_type¶ (
SignatureEnum
) – The Signature type to use.sig¶ (
bytes
) – The signature to verify.data¶ (
bytes
) – The data.
- Return type:
- Returns:
The response.
- static encode_parameters(params, obj)[source]¶
Encode values from obj into the byte parameters that the ECTester applet expects.
- Return type:
Mapping
[ParameterEnum
,bytes
]
- export(keypair, key, params)[source]¶
Send the Export command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to export from.params¶ (
ParameterEnum
) – Which parameters to export.
- Return type:
- Returns:
The response, containing the exported parameters.
- generate(keypair)[source]¶
Send the Generate command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to generate.- Return type:
- Returns:
The response.
- select(aid)[source]¶
Select an applet with
aid
.- Parameters:
aid¶ (
bytes
) – The AID of the applet to select.- Return type:
bool
- Returns:
Whether the selection was successful.
- select_applet(latest_version=b'033', count_back=10)[source]¶
Select the ECTester applet, with a specified version or older.
- send_apdu(apdu)[source]¶
Send an APDU to the selected applet.
- Parameters:
apdu¶ (
CommandAPDU
) – The APDU to send.- Return type:
- Returns:
The response.
- set(keypair, curve, params, values=None)[source]¶
Send the Set command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to set values on.curve¶ (
CurveEnum
) – Which pre-set curve to use to set values, or default or external.params¶ (
ParameterEnum
) – Which parameters to set on the keypair.values¶ (
Optional
[Mapping
[ParameterEnum
,bytes
]]) – External values to set on the keypair.
- Return type:
- Returns:
The response.
- transform(keypair, key, params, transformation)[source]¶
Send the Transform command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to transform.params¶ (
ParameterEnum
) – Which parameters to transform.transformation¶ (
TransformationEnum
) – What transformation to apply.
- Return type:
- Returns:
The response.
- class ECTesterTargetLEIA(leia)[source]¶
Bases:
ECTesterTarget
,LEIATarget
An ECTester-applet-based target that is connected via the LEIA board.
- allocate(keypair, builder, key_length, key_class)[source]¶
Send the Allocate KeyPair command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to allocate.builder¶ (
KeyBuildEnum
) – Which builder to use to allocate the keypair.key_length¶ (
int
) – Bit-size of the allocated keypair.key_class¶ (
KeyClassEnum
) – Type of the allocated keypair.
- Return type:
- Returns:
The response.
- allocate_ka(ka_type)[source]¶
Send the Allocate KeyAgreement command.
- Parameters:
ka_type¶ (
KeyAgreementEnum
) – Which KeyAgreement type to allocate.- Return type:
- Returns:
The response.
- allocate_sig(sig_type)[source]¶
Send the Allocate Signature command.
- Parameters:
sig_type¶ (
SignatureEnum
) – Which Signature type to allocate.- Return type:
- Returns:
The response.
- clear(keypair)[source]¶
Send the Clear key command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to clear.- Return type:
- Returns:
The response.
- connect(protocol=None)[source]¶
Connect to the card.
- Parameters:
protocol¶ (
Optional
[CardProtocol
]) – CardProtocol to use.
- ecdh(pubkey, privkey, export, transformation, ka_type)[source]¶
Send the ECDH command.
- Parameters:
pubkey¶ (
KeypairEnum
) – Which keypair to use the pubkey from, in the key-agreement.privkey¶ (
KeypairEnum
) – Which keypair to use the privkey from, in the key-agreement.export¶ (
bool
) – Whether to export the shared secret.transformation¶ (
TransformationEnum
) – The transformation to apply to the pubkey before key-agreement.ka_type¶ (
KeyAgreementEnum
) – The key-agreement type to use.
- Return type:
- Returns:
The response.
- ecdh_direct(privkey, export, transformation, ka_type, pubkey)[source]¶
Send the ECDH direct command.
- Parameters:
privkey¶ (
KeypairEnum
) – Which keypair to use the privkey from, in the key-agreement.export¶ (
bool
) – Whether to export the shared secret.transformation¶ (
TransformationEnum
) – The transformation to apply to the pubkey before key-agreement.ka_type¶ (
KeyAgreementEnum
) – The key-agreement type to use.pubkey¶ (
bytes
) – The raw bytes that will be used as a pubkey in the key-agreement.
- Return type:
- Returns:
The response.
- ecdsa(keypair, export, sig_type, data)[source]¶
Send the ECDSA command.
- Parameters:
keypair¶ (
KeypairEnum
) – The keypair to use.export¶ (
bool
) – Whether to export the signature.sig_type¶ (
SignatureEnum
) – The Signature type to use.data¶ (
bytes
) – The data to sign and verify.
- Return type:
- Returns:
The response.
- ecdsa_sign(keypair, export, sig_type, data)[source]¶
Send the ECDSA sign command.
- Parameters:
keypair¶ (
KeypairEnum
) – The keypair to use to sign.export¶ (
bool
) – Whether to export the signature.sig_type¶ (
SignatureEnum
) – The Signature type to use.data¶ (
bytes
) – The data to sign.
- Return type:
- Returns:
The response.
- ecdsa_verify(keypair, sig_type, sig, data)[source]¶
Send the ECDSA verify command.
- Parameters:
keypair¶ (
KeypairEnum
) – The keypair to use to verify.sig_type¶ (
SignatureEnum
) – The Signature type to use.sig¶ (
bytes
) – The signature to verify.data¶ (
bytes
) – The data.
- Return type:
- Returns:
The response.
- static encode_parameters(params, obj)[source]¶
Encode values from obj into the byte parameters that the ECTester applet expects.
- Return type:
Mapping
[ParameterEnum
,bytes
]
- export(keypair, key, params)[source]¶
Send the Export command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to export from.params¶ (
ParameterEnum
) – Which parameters to export.
- Return type:
- Returns:
The response, containing the exported parameters.
- generate(keypair)[source]¶
Send the Generate command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to generate.- Return type:
- Returns:
The response.
- select(aid)[source]¶
Select an applet with
aid
.- Parameters:
aid¶ (
bytes
) – The AID of the applet to select.- Return type:
bool
- Returns:
Whether the selection was successful.
- select_applet(latest_version=b'033', count_back=10)[source]¶
Select the ECTester applet, with a specified version or older.
- send_apdu(apdu)[source]¶
Send an APDU to the selected applet.
- Parameters:
apdu¶ (
CommandAPDU
) – The APDU to send.- Return type:
- Returns:
The response.
- set(keypair, curve, params, values=None)[source]¶
Send the Set command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to set values on.curve¶ (
CurveEnum
) – Which pre-set curve to use to set values, or default or external.params¶ (
ParameterEnum
) – Which parameters to set on the keypair.values¶ (
Optional
[Mapping
[ParameterEnum
,bytes
]]) – External values to set on the keypair.
- Return type:
- Returns:
The response.
- transform(keypair, key, params, transformation)[source]¶
Send the Transform command.
- Parameters:
keypair¶ (
KeypairEnum
) – Which keypair to transform.params¶ (
ParameterEnum
) – Which parameters to transform.transformation¶ (
TransformationEnum
) – What transformation to apply.
- Return type:
- Returns:
The response.