ECC Operations
Elliptic Curve Cryptography (ECC) operations for the TROPIC01 chip.
ECC operations module for TROPIC01 secure element.
This module provides structured classes for ECC key information and signature objects, replacing the tuple-based API.
- Main exports:
EccKeyInfo: Information about keys in secure slots
EcdsaSignature: ECDSA signature from P256 curve
EddsaSignature: EdDSA signature from Ed25519 curve
Example:
from tropicsquare import TropicSquare
from tropicsquare.ecc import EccKeyInfo, EcdsaSignature
from tropicsquare.constants.ecc import ECC_CURVE_ED25519
ts = TropicSquare(transport)
ts.start_secure_session(...)
# Read key information
key_info = ts.ecc_key_read(0)
if key_info.curve == ECC_CURVE_ED25519:
print("Ed25519 key")
print(key_info.public_key.hex())
# Create signature
signature = ts.ecdsa_sign(1, message_hash)
print(signature.r.hex())
- class tropicsquare.ecc.EccKeyInfo(curve, origin, public_key)[source]
Bases:
objectECC key information from secure key slot.
Represents the public key and metadata stored in a TROPIC01 ECC key slot, as returned by ecc_key_read().
- Parameters:
Example:
key_info = ts.ecc_key_read(0) if key_info.curve == ECC_CURVE_ED25519: print("Ed25519 key") print(key_info.public_key.hex())
- to_dict()[source]
Convert key information to dictionary.
- Returns:
Dictionary with curve, origin, and public_key fields
- Return type:
Example:
{ 'curve': 1, 'origin': 0, 'public_key': '04a1b2c3...' }
Supported Curves
P-256 (NIST P-256 / secp256r1) - ECDSA signatures
Ed25519 - EdDSA signatures
See Also
Signature Classes - Signature classes
ECC Constants - ECC constants
UAP Cryptographic Operations - ECC access control