📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 7.11-8.9

简要来说,当 Elasticsearch 无法使用 PBKDF2 算法进行密码哈希时,就会出现此错误。密码哈希是保护用户数据的关键组成部分。这个问题可能是由于配置错误或不支持的 Java 版本导致的。要解决此问题,您可以尝试将 Java 版本更新到最新版本,确保 PBKDF2 在 Elasticsearch 设置中正确配置,或者检查安全库是否存在任何问题。如果问题仍然存在,考虑使用当前设置支持的其他密码哈希算法。

日志上下文 #

日志 “Error using PBKDF2 for password hashing” 的类名是 Hasher.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance("PBKDF2withHMACSHA512");
PBEKeySpec keySpec = new PBEKeySpec(data.getChars(), salt, cost, PBKDF2_KEY_LENGTH);
result.put(Base64.getEncoder().encodeToString(secretKeyFactory.generateSecret(keySpec).getEncoded()));
return result.array();
} catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
throw new ElasticsearchException("Error using PBKDF2 for password hashing", e);
} catch (Error e) {
// Security Providers might throw a subclass of Error in FIPS 140 mode; if some prerequisite like
// salt; iv; or password length is not met. We catch this because we don't want the JVM to exit.
throw new ElasticsearchException("Error using PBKDF2 implementation from the selected Security Provider", e);
}