expectedFrameLength method

  1. @override
int? expectedFrameLength(
  1. List<int> buffer
)
override

Implementation

@override
int? expectedFrameLength(List<int> buffer) {
  if (buffer.length < _cipher.blockSize) {
    return null;
  }

  final _SshAesCtrCipher probeCipher = _cipher.copy();
  final Uint8List firstBlock = probeCipher.transform(
    Uint8List.fromList(buffer.sublist(0, _cipher.blockSize)),
  );
  final int packetLength = _readUint32(firstBlock, 0);
  return packetLength + 4 + _macLength;
}