fromBytes static method
Implementation
static CERTResponseRecord fromBytes({
required String name,
required int ttl,
required Uint8List bytes,
required int offset,
required int length }) {
if (length < 5 || (offset + length) > bytes.length) {
throw FormatException('Invalid CERT record: too short or out of bounds.');
}
final int certType = (bytes[offset] << 8) | bytes[offset + 1];
final int keyTag = (bytes[offset + 2] << 8) | bytes[offset + 3];
final int algorithm = bytes[offset + 4];
final Uint8List certData = bytes.sublist(offset + 5, offset + length);
return CERTResponseRecord(
name: name,
ttl: ttl,
certificateType: certType,
keyTag: keyTag,
algorithm: algorithm,
certificate: certData);
}