Rev 1119 | Rev 1219 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1119 | Rev 1130 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | 41 | ||
42 | /** |
42 | /** |
43 | * This function converts A1*#, A2#, A3# hashes to Crypt compatible hashes. |
43 | * This function converts A1*#, A2#, A3# hashes to Crypt compatible hashes. |
44 | * @param string $authkey is old database field value "authkey" |
44 | * @param string $authkey is old database field value "authkey" |
45 | * @param string $salt is old database field value "salt" |
45 | * @param string $salt is old database field value "salt" |
46 | * @returns New authkey field (Crypt compatible hash) |
46 | * @returns string New authkey field (Crypt compatible hash) |
47 | */ |
47 | */ |
48 | function vts_crypt_convert_from_old_oidplus($authkey, $salt) { |
48 | function vts_crypt_convert_from_old_oidplus(string $authkey, string $salt): string { |
49 | if (preg_match('@^A1([abcd])#(.+):(.+)$@', $authkey, $m)) { |
49 | if (preg_match('@^A1([abcd])#(.+):(.+)$@', $authkey, $m)) { |
50 | // A1a#hashalgo:X with X being H(salt+password) in hex- or rfc4648-base64-notation |
50 | // A1a#hashalgo:X with X being H(salt+password) in hex- or rfc4648-base64-notation |
51 | // A1b#hashalgo:X with X being H(password+salt) in hex- or rfc4648-base64-notation |
51 | // A1b#hashalgo:X with X being H(password+salt) in hex- or rfc4648-base64-notation |
52 | // A1c#hashalgo:X with X being H(salt+password+salt) in hex- or rfc4648-base64-notation |
52 | // A1c#hashalgo:X with X being H(salt+password+salt) in hex- or rfc4648-base64-notation |
53 | // A1d#hashalgo:X with X being H_HMAC(password,salt) in hex- or rfc4648-base64-notation |
53 | // A1d#hashalgo:X with X being H_HMAC(password,salt) in hex- or rfc4648-base64-notation |
Line 85... | Line 85... | ||
85 | * This function will be called by OIDplusDatabaseConnection.class.php at method afterConnect(). |
85 | * This function will be called by OIDplusDatabaseConnection.class.php at method afterConnect(). |
86 | * @param OIDplusDatabaseConnection $db is the OIDplusDatabaseConnection class |
86 | * @param OIDplusDatabaseConnection $db is the OIDplusDatabaseConnection class |
87 | * @return int new version set |
87 | * @return int new version set |
88 | * @throws \ViaThinkSoft\OIDplus\OIDplusException |
88 | * @throws \ViaThinkSoft\OIDplus\OIDplusException |
89 | */ |
89 | */ |
90 | function oidplus_dbupdate_1002(OIDplusDatabaseConnection $db) { |
90 | function oidplus_dbupdate_1002(OIDplusDatabaseConnection $db): int { |
91 | if ($db->transaction_supported()) $db->transaction_begin(); |
91 | if ($db->transaction_supported()) $db->transaction_begin(); |
92 | 92 | ||
93 | if ($db->getSlang()->id() == 'mssql') { |
93 | if ($db->getSlang()->id() == 'mssql') { |
94 | $db->query("alter table ###ra alter column [authkey] [varchar](250) NULL;"); |
94 | $db->query("alter table ###ra alter column [authkey] [varchar](250) NULL;"); |
95 | oidplus_dbupdate_1002_migrate_ra_passwords($db); |
95 | oidplus_dbupdate_1002_migrate_ra_passwords($db); |