buildECPublicKeyPacket static method

  1. @visibleForTesting
Uint8List buildECPublicKeyPacket(
  1. BigInt publicKey,
  2. ECCurve curve, [
  3. int? timestamp,
  4. int? type,
])

Implementation

@visibleForTesting
static Uint8List buildECPublicKeyPacket(BigInt publicKey, ECCurve curve,
    [int? timestamp, int? type]) {
  final List<int> encoded = _timestampAndVersion(0x04, timestamp) +
      _curve(curve) +
      _keyMaterial(publicKey);
  type ??= encoded.length >> 8 == 0 ? 0x98 : 0x99;
  return Uint8List.fromList(
      [type] + (type == 0x99 ? _mpi(encoded) : [encoded.length] + encoded));
}