utils.cloud: factorization & better handling of password handshakes