|
Перенос пользователей из Cache на DB2
|
|||
---|---|---|---|
#18+
Cache 2012.2.3 Стоит задача: Перенести пользователей с Cache на DB2 с сохранением паролей. Начал копать. В области %SYS есть класс Security.Users, в нем хранятся пользователи с хешем пароля и солью к паролю. Из кода:/// PBKDF2 hashed password for Cache Authentication.<br> /// This is used with a salt function obtained from /// $System.Encryption.GenCryptRand. This property is set by the class when the /// PasswordExternal property is modified. Do not set this property directly.<br> /// To modify the password for a user using objects, get an instance of the object and /// modify the PasswordExternal property:<br> /// i '..Exists(Username,.User,.Status) q Status<br> /// s User.PasswordExternal=Password<br> /// s Status=User.%Save()<br> Property Password As Security.Datatype.Password(MAXLEN = 20); /// Clear text password.<br> /// This property is not stored in permanent storage. It is initially set to /// the value of $c(0). When it is modified, the Password property is updated /// to the PBKDF2 salted hashed value. Property PasswordExternal As %String(MAXLEN = 128, XMLPROJECTION = "NONE") [ InitialExpression = {$c(0)}, Transient ]; /// Salt value for Hashed password from $System.Encryption.GenCryptRand.<br> Property Salt As %Binary(MAXLEN = 8); Пытаюсь воссоздать функцию для получения хеша пароля пользователя так, как это делает Cache:ClassMethod check(userName As %String, password As %String) As %String { zn "%SYS" set user = ##class(Security.Users).%OpenId(userName) w !, "hash = "_$System.Encryption.PBKDF2(password, 1, user.Salt, 20) w !, "db_hash = "_user.Password zn "USER" quit $$$OK } В итоге через портал создаю пользователя test с паролем 12345678, После в терминале: d ##class(User.CheckPass).check("test","12345678") В итоге получаю разные хэши! По какому алгоритму cache генерирует хэш для пароля пользователя? ... |
|||
:
Нравится:
Не нравится:
|
|||
17.03.2015, 07:15 |
|
Перенос пользователей из Cache на DB2
|
|||
---|---|---|---|
#18+
Как то давно хранил так, скорее всего брал хранение каше:Include %sySecurity ... set obj.Salt = $System.Encryption.GenCryptRand($$$CachePWSaltLength) set obj.Password = $System.Encryption.PBKDF2(password,$$$CachePWIterations,obj.Salt,$$$CachePWHashLength) ... |
|||
:
Нравится:
Не нравится:
|
|||
17.03.2015, 08:06 |
|
|
start [/forum/topic.php?fid=39&msg=38906577&tid=1556706]: |
0ms |
get settings: |
10ms |
get forum list: |
12ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
41ms |
get topic data: |
11ms |
get forum data: |
3ms |
get page messages: |
37ms |
get tp. blocked users: |
1ms |
others: | 14ms |
total: | 135ms |
0 / 0 |