initCipher method
Initializes the block cipher used for encrypted transport.
Implementation
BlockCipher initCipher(int cipherId, Uint8List IV, Uint8List key, bool dir) {
BlockCipher cipher = Cipher.cipher(cipherId);
if (tracePrint != null) {
tracePrint('$hostport: ' +
(dir ? 'C->S' : 'S->C') +
' IV = "${hex.encode(IV)}"');
tracePrint('$hostport: ' +
(dir ? 'C->S' : 'S->C') +
' key = "${hex.encode(key)}"');
}
cipher.init(
dir,
ParametersWithIV(
KeyParameter(key), viewUint8List(IV, 0, cipher.blockSize)));
return cipher;
}