Robust Protocols for Securely Expanding Randomness and Distributing Keys Using Untrusted Quantum Devices