verifyHostKey function

bool verifyHostKey(
  1. Uint8List exH,
  2. int hostkeyType,
  3. Uint8List key,
  4. Uint8List sig,
)

Verifies that key signed exH producing sig.

Implementation

bool verifyHostKey(
    Uint8List exH, int hostkeyType, Uint8List key, Uint8List sig) {
  if (hostkeyType == Key.RSA) {
    return verifyRSASignature(RSAKey()..deserialize(SerializableInput(key)),
        RSASignature()..deserialize(SerializableInput(sig)), exH);
  } else if (Key.ellipticCurveDSA(hostkeyType)) {
    return verifyECDSASignature(
        hostkeyType,
        ECDSAKey()..deserialize(SerializableInput(key)),
        ECDSASignature()..deserialize(SerializableInput(sig)),
        exH);
  } else if (hostkeyType == Key.ED25519) {
    return verifyEd25519Signature(
        Ed25519Key()..deserialize(SerializableInput(key)),
        Ed25519Signature()..deserialize(SerializableInput(sig)),
        exH);
  } else {
    return false;
  }
}