encoding - Active Directory 中 unicodePwd 的正确编码

标签 encoding active-directory

简单来说,Active Directory 中 unicodePwd 属性的正确字符编码是什么? UCS-2? UTF-16?有什么理由选择 UTF-16 而不是 UCS-2?

现在,解释一下:

我在使用 PHP 的 ldap_mod_replace() 设置 Active Directory 中的 unicodePwd 属性时遇到了麻烦,直到我(某种程度上)找到了它的正确格式,即用双引号括起来,并以 UCS-2/UTF-16 Little Endian 编码(如果将其放入 LDIF 文件中,也采用 Base64 编码)。

虽然根本问题得到了解决,但我无法理解这样一个事实:我一直看到互联网上提到的两种编码都是正确的。

我在这里非常迂腐,但是有人能够指出正确的字符编码吗?

最佳答案

正确的字符编码是UTF-16LE。此外,密码必须用双引号引起来。我不确定哪里提到了 UCS-2 编码,我本人从未见过。

示例

用户密码:test
引用密码:“test”
UTF-16LE 表示:

0x22 "
0x00
0x74 t
0x00
0x65 e
0x00
0x73 s
0x00
0x74 t
0x00
0x22 "
0x00

更多详细信息可以在 MSDN 上找到。 .

关于encoding - Active Directory 中 unicodePwd 的正确编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30586604/

相关文章:

powershell - 从AD获取SamAccountName

Powershell 列出非事件帐户

unicode - 什么是 Unicode、UTF-8、UTF-16?

java - "Unmappable character for encoding UTF-8"错误

.net - 如何检测文件的使用权限 (DRM)

Python2/Windows7 : Opening filename that contains a german Umlaut

java - 使用 java 使用另一个 AD 中的用户在 AD 中进行搜索

string - UTF-32 和 UCS-4 有什么区别?

grails - 连接到 Active Directory 并搜索用户

java - 我们如何使用 Java 连接到 Active Directory Server