ASN1GeneralizedTime.fromBytes constructor
ASN1GeneralizedTime.fromBytes(
- Uint8List bytes
Creates an ASN1GeneralizedTime entity from the given encodedBytes.
Implementation
ASN1GeneralizedTime.fromBytes(Uint8List super.bytes) : super.fromBytes() {
var octets = valueBytes!;
var stringValue = ascii.decode(octets);
var year = stringValue.substring(0, 4);
var month = stringValue.substring(4, 6);
var day = stringValue.substring(6, 8);
var hour = stringValue.substring(8, 10);
var minute = stringValue.substring(10, 12);
var second = stringValue.substring(12, 14);
if (stringValue.length > 14) {
var timeZone = stringValue.substring(14, stringValue.length);
dateTimeValue =
DateTime.parse('$year-$month-$day $hour:$minute:$second$timeZone');
} else {
dateTimeValue = DateTime.parse('$year-$month-$day $hour:$minute:$second');
}
}