setUserData method
void
setUserData({})
Sets standard extension tags used in the AES Crypt file format.
Extension tags available:
createdBy
is a developer-defined text string that identifies the software
product, manufacturer, or other useful information (such as software version).
createdOn
indicates the date that the file was created.
The format of the date string is YYYY-MM-DD.
createdAt
indicates the time that the file was created. The format of the date string
is in 24-hour format like HH:MM:SS (e.g, 21:15:04). The time zone is UTC.
Implementation
void setUserData(
{String createdBy = 'Dart aes_crypt library',
String createdOn = '',
String createdAt = ''}) {
String key;
_userdata = {};
if (createdBy.isNotEmpty) {
key = 'CREATED_BY';
_userdata![key] = createdBy.toUtf8Bytes();
if (key.length + _userdata![key]!.length + 1 > 255) {
throw AesCryptArgumentError(
'User data \'$key\' is too long. Total length should not exceed 255 bytes.');
}
}
if (createdOn.isNotEmpty) {
key = 'CREATED_DATE';
_userdata![key] = createdOn.toUtf8Bytes();
if (key.length + _userdata![key]!.length + 1 > 255) {
throw AesCryptArgumentError(
'User data \'$key\' is too long. Total length should not exceed 255 bytes.');
}
}
if (createdAt.isNotEmpty) {
key = 'CREATED_TIME';
_userdata![key] = createdAt.toUtf8Bytes();
if (key.length + _userdata![key]!.length + 1 > 255) {
throw AesCryptArgumentError(
'User data \'$key\' is too long. Total length should not exceed 255 bytes.');
}
}
}