extractDER function
Implementation
Uint8List extractDER(Uint8List buf) {
final expectedLength = DER_PREFIX.length + KEY_LENGTH;
if (buf.length != expectedLength) {
throw "BLS DER-encoded public key must be $expectedLength bytes long";
}
final prefix = buf.sublist(0, DER_PREFIX.length);
if (!u8aEq(prefix, DER_PREFIX)) {
throw "BLS DER-encoded public key is invalid. Expect the following prefix: $DER_PREFIX, but get $prefix";
}
return buf.sublist(DER_PREFIX.length);
}