extractDER function
Implementation
Uint8List extractDER(Uint8List buf) {
final expectedLength = _derPrefix.length + _keyLength;
if (buf.length != expectedLength) {
throw RangeError.value(
buf.length,
'Expected $expectedLength-bytes long but got ${buf.length}.',
);
}
final prefix = buf.sublist(0, _derPrefix.length);
if (!u8aEq(prefix, _derPrefix)) {
throw StateError('Expected prefix $_derPrefix but got $prefix.');
}
return buf.sublist(_derPrefix.length);
}