buildRSAPublicKeyPacket static method

  1. @visibleForTesting
Uint8List buildRSAPublicKeyPacket(
  1. List<int> modulus,
  2. List<int> exponent, [
  3. @visibleForTesting int? timestamp,
  4. @visibleForTesting int? type,
])

Implementation

@visibleForTesting
static Uint8List buildRSAPublicKeyPacket(
    List<int> modulus, List<int> exponent,
    [@visibleForTesting int? timestamp, @visibleForTesting int? type]) {
  final List<int> encoded =
      _timestampAndVersion(0x04, timestamp) + _mpi(modulus) + _mpi(exponent);
  type ??= encoded.length >> 8 == 0 ? 0x98 : 0x99;
  return Uint8List.fromList(
      [type] + (type == 0x99 ? _mpi(encoded) : [encoded.length] + encoded));
}