Methods and apparatus for generating a private-public key pair, for encrypting a message for transmission through an unsecure communication medium (30), and for decrypting the message are disclosed. The methods are based on the well-known McEliece
cryptosystem or on its Niederreiter variant. More general transformation matrices Q are used in place of permutation matrices, possibly together with an appropriate selection of the intentional error vectors. The transformation matrices Q are non-singular n×n matrices having the form Q=R+T, where the matrix R is a rank-z matrix and the matrix T is some other matrix rendering Q non-singular. The new Q matrices, though at least potentially being dense, have a limited
propagation effect on the intentional error vectors for the authorized
receiver. The use of this kind of matrices allows to better disguise the private key into the public one, without yielding any further error
propagation effect. Based on this family of Q matrices, the presently proposed
cryptosystem enables the use of different families of codes than Goppa codes, such as RS codes, by ensuring increased public key security.