toDER function
Implementation
Uint8List toDER(Uint8List x) {
var i = 0;
while (x[i] == 0) ++i;
if (i == x.length) return ZERO;
x = x.sublist(i);
List<int> combine = List.from(ZERO);
combine.addAll(x);
if (x[0] & 0x80 != 0) return Uint8List.fromList(combine);
return x;
}