matchAsymmetricKeys static method

bool matchAsymmetricKeys(
  1. SignKey sKey,
  2. VerifyKey pKey
)

Verifies that an asymmetric key pair (sign/verify) are a matching pair.

Tests if the private (signing) key can sign the PROMISE data, and the public (verification) key can successfully verify that signature.

@param sKey - Private/signing key to test

@param pKey - Public/verification key to test

@return True if keys are a valid matching pair, false otherwise

Implementation

static bool matchAsymmetricKeys(SignKey sKey, VerifyKey pKey) {
  // verify with signature
  Uint8List signature = sKey.sign(PROMISE);
  return pKey.verify(PROMISE, signature);
}