encryptFile method
Encrypts file content in bytes format.
Provide cipherKey
to override Keyset.cipherKey.
If keyset
is not provided, then it tries to obtain a keyset using
name.
If that fails, then it uses the default keyset.
If that fails as well, then it will throw InvariantException.
Implementation
List<int> encryptFile(List<int> bytes,
{CipherKey? cipherKey, Keyset? keyset, String? using}) {
if (cipherKey != null) {
return _core.crypto.encryptFileData(cipherKey, bytes);
}
keyset ??= _core.keysets[using];
return keyset.cipherKey == _core.keysets.defaultKeyset.cipherKey
? _core.crypto.encrypt(bytes)
: _core.crypto.encryptFileData(keyset.cipherKey!, bytes);
}