Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access token to encrypt or not

We store access token in database, it is a random string, it is stored as it is, without encryption.

Is it must be encrypted? Is there some security risks?

like image 320
Romper Avatar asked Mar 11 '17 11:03

Romper


People also ask

Should I encrypt access tokens?

OAuth access tokens and refresh tokens should be encrypted and stored in a secure database. Your application should use a strong encryption standard such as AES. The production encryption keys should not be accessible to database administrators, business analysts, developers, or anyone who does not need them.

Should you encrypt bearer token?

It is best practice to encrypt these tokens in the database. If your database is compromised, an attacker could use the tokens to access any information or actions provided by the 3rd-party services.

Is tokenization better than encryption?

Encryption alone is not a secure solution. Tokenization reduces data theft risk. Tokenization makes PCI compliance easier and more affordable. Implementation is critical to maximizing security and business flexibility.

Does JWT token need to be encrypted?

JWTs can be signed using a secret (with the HMAC algorithm) or a public/private key pair using RSA or ECDSA. Although JWTs can be encrypted to also provide secrecy between parties, we will focus on signed tokens.


1 Answers

It depends on the purpose of these tokens. Access Tokens usually are never stored. They are not random strings, but rather short-lived objects that are issued based on strict requirements (validation) and signed by HMAC and a secret key. All these are measures to make them secure.

If they are just random strings, they do not fulfill any of these measures.

like image 165
Assil Avatar answered Sep 24 '22 00:09

Assil