fromBytes static method
Implementation
static DNSKEYResponseRecord fromBytes({
required String name,
required int ttl,
required Uint8List bytes,
required int offset,
required int length }) {
if (length < 4 || (offset + length > bytes.length)) {
throw FormatException('Invalid DNSKEY record length.');
}
final int flags = (bytes[offset] << 8) | bytes[offset + 1];
final int protocol = bytes[offset + 2];
final int algorithm = bytes[offset + 3];
final Uint8List publicKey = bytes.sublist(offset + 4, offset + length);
final String base64Key = base64.encode(publicKey);
return DNSKEYResponseRecord(
name: name,
ttl: ttl,
flags: flags,
protocol: protocol,
algorithm: algorithm,
publicKey: publicKey,
base64PublicKey: base64Key);
}