Can a classical system command a general adversarial quantum system to realize arbitrary quantum dynamics? If so, then we could realize the dream of device-independent quantum cryptography: using untrusted quantum devices to establish a shared random key, with security based on the correctness of quantum mechanics. It would also allow for testing whether a claimed quantum computer is truly quantum. Here we report a technique by which a classical system can certify the joint, entangled state of a bipartite quantum system, as well as command the application of specific operators on each subsystem. This is accomplished by showing a strong converse to Tsirelsons optimality result for the Clauser-Horne-Shimony-Holt (CHSH) game: the only way to win many games is if the bipartite state is close to the tensor product of EPR states, and the measurements are the optimal CHSH measurements on successive qubits. This leads directly to a scheme for device-independent quantum key distribution. Control over the state and operators can also be leveraged to create more elaborate protocols for realizing general quantum circuits, and to establish that QMIP = MIP*.