raw property
Returns the key's raw bytes
Implementation
@override
Uint8List get raw {
try {
// Get the point Q from the public key
final q = _key.Q!;
// Get the x and y coordinates as bytes
final x = q.x!.toBigInteger()!;
final y = q.y!.toBigInteger()!;
// Create a simple ASN.1 sequence with the x and y coordinates
final asn1Sequence = pc.ASN1Sequence();
asn1Sequence.add(pc.ASN1Integer(x));
asn1Sequence.add(pc.ASN1Integer(y));
return Uint8List.fromList(asn1Sequence.encode());
} catch (e) {
throw ECDSAKeyException('Failed to encode ECDSA public key: ${e.toString()}');
}
}