php - 使用 blowfish 加密验证 MySQL

标签 php mysql authentication webdav virtualhost

我将我的用户名和密码存储在一个带有 blowfish 加密的 mysql 数据库中。 在 php 中,我可以像这样加密密码:

crypt($pwd, _SALT_)

哪里$pwd = 'userpwd'_SALT_ = $2a$07...

我正在寻找一种在 VirtualHost 中使用用户表的方法 mod_auth_mysql .我知道 md5 可以使用 Auth_MySQL_Encryption_Types PHP_MD5但我宁愿留在河豚。

如何告诉 mysql_auth 使用河豚?我在哪里输入盐?

编辑:

这里的基本问题是我必须在虚拟主机文件中的关键字之间使用“_”。所以它看起来像:

<Location /webdav>
AuthType Basic
AuthName "jst-development"
AuthUserFile /dev/null
AuthBasicAuthoritative Off
Auth_MySQL on
Auth_MySQL_Authoritative on
Auth_MySQL_DB user
Auth_MySQL_User user
...

而不是[取自http://modauthmysql.sourceforge.net/CONFIGURE ]

AuthMySQLDB authdata
AuthMySQLUserTable user_info
AuthMySQLGroupField user_group

阻止 apache 提示语法。谁能告诉我为什么或告诉我 AuthMySQLSaltField <> 的“_”语法

//编辑 2: 版本:libapache2-mod-auth-mysql (4.3.9-13ubuntu1)

//编辑 3: 服务器版本:Apache/2.2.14 (Ubuntu) 使用不带“_”的“官方语法”时的确切错误: 无效命令“AuthMySQLDB”,可能拼写错误或由未包含在服务器配置中的模块定义

最佳答案

使用

AuthMySQLPwEncryption crypt

http://modauthmysql.sourceforge.net/CONFIGURE

AuthMySQLPwEncryption none | crypt | scrambled | md5 | aes | sha1
  The encryption type used for the passwords in AuthMySQLPasswordField:
    none: not encrypted (plain text)
    crypt: UNIX crypt() encryption
    scrambled: MySQL PASSWORD encryption
    md5: MD5 hashing
    aes: Advanced Encryption Standard (AES) encryption
    sha1: Secure Hash Algorihm (SHA1)

  WARNING: When using aes encryption, the password field MUST be a BLOB type
  (i.e.  TINYBLOB).  MySQL will strip trailing x'20' characters (blanks), EVEN
  IF THE COLUMN TYPE IS BINARY!

AuthMySQLSaltField <> | <string> | mysql_column_name

  Contains information on the salt field to be used for crypt and aes
  encryption methods.  It can contain one of the following:
    <>: password itself is the salt field (use with crypt() only)
    <string>: "string" as the salt field
    mysql_column_name: the salt is take from the mysql_column_name field in the
      same row as the password

  This field is required for aes encryption, optional for crypt encryption.
  It is ignored for all other encryption types.

关于php - 使用 blowfish 加密验证 MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9761642/

相关文章:

php - 如何使用 php 将订单历史记录存储在数据库中?

php - 查询数据库表中整行的最佳实践? (MySQL/CodeIgniter)

authentication - WP 8.1全局事件身份验证失败

javascript - node.js connect-auth 应用程序?示例(用户注册/用户/ session 管理)

php - MySQL中 'updating'行的正确方法

php - MySQL WHERE ORDER BY 插入

php - PDO 在 Mysql 中插入多个复选框值

java - Hibernate 查询生成器抛出 MySQLSyntaxErrorException

javascript - 使用 Ajax 时,变量应该如何从 JavaScript 传递到 PHP?

c# - 如何从 cookie 中检索 OpenID Connect 身份 token