legacy-knowledge-base
公開されました Jul. 2, 2025

データベースに保存されるパスワードの暗号化アルゴリズムを定義する。

written-by

Liferay Support

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

デフォルトでは、Liferayはデータベースに入るパスワードを暗号化します。 デフォルトのアルゴリズムは、6.0および6.1バージョンではSHA-1ですが、バージョン6.2ではPBKDF2WithHmacSHA1/160/128000に変更されています。 暗号化アルゴリズムはportal-ext.propertiesで変更でき、オフにすることも可能です。

このため、6.2にアップグレードして、デフォルトのパスワード暗号化アルゴリズムを使用していた場合、レガシープロパティを古いものに設定する必要があります。

解決

Liferayでは、ユーザーのニーズに合わせて様々な暗号化アルゴリズムを選択することができます。 アルゴリズムは portal-ext.properties の passwords.encryption.algorithm= で選択します。

#
# Set the following encryption algorithm to encrypt passwords. The default
# algorithm is PBKDF2WithHmacSHA1/160/128000, generating 160 bit hashes
# using 128,000 rounds.
#
# It is possible to decrease the rounds value in case of slow production
# hardware, but be aware that 128,000 is the recommended value for 2014
# by OWASP.
#
# If set to NONE, passwords are stored in the database as plain text.
#
#passwords.encryption.algorithm=BCRYPT/10
#passwords.encryption.algorithm=MD2
#passwords.encryption.algorithm=MD5
#passwords.encryption.algorithm=NONE
passwords.encryption.algorithm=PBKDF2WithHmacSHA1/160/128000
#passwords.encryption.algorithm=SHA
#passwords.encryption.algorithm=SHA-256
#passwords.encryption.algorithm=SHA-384
#passwords.encryption.algorithm=SSHA
#passwords.encryption.algorithm=UFC-CRYPT

このプロパティが NONEに設定されている場合、パスワードはプレーンテキストとしてデータベースに保存されます。

6.1以下では、デフォルトの暗号化はSHA(SHA-1)に設定されていました。 これは6.2で、上記のようにPBKDF2WithHmacSHA1/160/128000に変更されました。 6.2へのアップグレード時には、ログイン時にパスワードが新しい暗号化アルゴリズムにアップグレードされるように、以下のプロパティを必ず使用してください:

passwords.encryption.algorithm.legacy=SHA

 

portal.propertiesファイルのスニペットがそうです:

#
# Set the following encryption algorithm to designate the password
# encryption algorithm to migrate from. This is only necessary if
# upgrading from a release prior to 6.2 or if you wish to switch password
# encryption algorithms when there are existing users with passwords in the
# portal.
#
#passwords.encryption.algorithm.legacy=BCRYPT
#passwords.encryption.algorithm.legacy=MD2
#passwords.encryption.algorithm.legacy=MD5
#passwords.encryption.algorithm.legacy=NONE
#passwords.encryption.algorithm.legacy=SHA
#passwords.encryption.algorithm.legacy=SHA-256
#passwords.encryption.algorithm.legacy=SHA-384
#passwords.encryption.algorithm.legacy=SSHA
#passwords.encryption.algorithm.legacy=UFC-CRYPT

追加情報

portal.propertiesで利用可能な完全なパスワードのプロパティを確認してください:

https://docs.liferay.com/portal/6.2/propertiesdoc/portal.properties.html#Passwords

did-this-article-resolve-your-issue

legacy-knowledge-base