static bool isSignedWithKey_verbose; // TODO: replace fullTrim with something else!! static boolean isSignedWithKey(S signed, S key) { try { L lines = toLines(signed); S sigLine = lines.get(lines.size()-1); S text = fromLines(lines.subList(0, lines.size()-1)); S sig = dropPrefixMandatory("sig: ", sigLine); ret PKI.verifySignature(PKI.publicKeyFromString(key), PKI.signatureFromString(sig), toUtf8(text)); } catch (RuntimeException e) { if (isSignedWithKey_verbose) printStackTrace(e); ret false; } }