Method and apparatus for encrypted optical transmission