encodeBls12381PublicKeySpki static method
SubjectPublicKeyInfo for a BLS12-381 G2 public key, matching the
exact DER shape DFINITY/Internet Computer uses for root/subnet keys:
SEQUENCE { SEQUENCE { OID id-ic-bls12-381, OID curve }, BIT STRING(point) }.
point is normally the 96-byte compressed G2 point, but any length
is accepted since the wrapper itself doesn't fix one.
Implementation
static BuBytes encodeBls12381PublicKeySpki(List<int> point) {
final algId = DerUtils.derSequence([
...DerUtils.derOid(Oids.icBls12381),
...DerUtils.derOid(Oids.icBls12381G2),
]);
return BuBytes(
DerUtils.derSequence([...algId, ...DerUtils.derBitString(point.asBytes)]),
);
}