After-gate attack on a quantum cryptosystem