Method and apparatus for public-key cryptography based on error correcting codes