Encrypting cookies in PHP

后端 未结 5 2138
梦谈多话
梦谈多话 2021-01-11 15:48

How can i encrypt and later decrypt a value of a cookie in PHP (how secure will the encryption be )

5条回答
  •  我在风中等你
    2021-01-11 16:16

    I am in full agreement with the other answers: If the data is truly sensitive it should be stored server side in a session, not in a cookie.

    As far as ways to encrypt cookie contents, the Suhosin PHP extension provides the ability to transparently encrypt all cookies. If you have the ability to install PHp extensions this may or may not be easier for you than writing your own encryption scheme.

提交回复
热议问题