verifyClientEvidenceMessage method

  1. @override
bool verifyClientEvidenceMessage(
  1. BigInt clientM1
)
override

Authenticates the received client evidence message M1 and saves it only if correct. To be called after calculating the secret S. @param clientM1 the client side generated evidence message @return A boolean indicating if the client message M1 was the expected one. @throws CryptoException

Implementation

@override
bool verifyClientEvidenceMessage(BigInt clientM1) {
  // Verify pre-requirements
  if (A == null || B == null || S == null) {
    throw Exception(
        'Impossible to compute and verify M1: some data are missing from the previous operations (A,B,S)');
  }

  // Compute the own client evidence message 'M1'
  var computedM1 = SRP6Util.calculateM1(digest, N, A, B, S);
  if (computedM1.compareTo(clientM1) == 0) {
    M1 = clientM1;
    return true;
  }
  return false;
}