ECDSASignature.fromBytes constructor

ECDSASignature.fromBytes(
  1. List<int> bytes,
  2. ProjectiveECCPoint generator
)

Implementation

factory ECDSASignature.fromBytes(
    List<int> bytes, ProjectiveECCPoint generator) {
  if (bytes.length != generator.curve.baselen * 2) {
    throw ArgumentException(
        "incorrect signatureBytes length ${bytes.length}");
  }
  final r = BigintUtils.fromBytes(bytes.sublist(0, generator.curve.baselen));
  final s = BigintUtils.fromBytes(
      bytes.sublist(generator.curve.baselen, generator.curve.baselen * 2));
  return ECDSASignature(r, s);
}