isDerPublicKey function

bool isDerPublicKey(
  1. Uint8List pub,
  2. Uint8List oid
)

Implementation

bool isDerPublicKey(Uint8List pub, Uint8List oid) {
  final oidLength = oid.length;
  if (!pub.sublist(0, oidLength).eq(oid)) {
    return false;
  } else {
    try {
      return bytesWrapDer(bytesUnwrapDer(pub, oid), oid).eq(pub);
    } catch (e) {
      return false;
    }
  }
}