gpt4 book ai didi

coldfusion - 在 ColdFusion 中验证 DotNetNuke 用户

转载 作者:行者123 更新时间:2023-12-04 00:47:00 25 4
gpt4 key购买 nike

有没有什么方法可以使用 DNN 登录来验证来自其他网络应用程序的用户?

我们有一个使用 DNN 的主站点,用户登录信息存储在 asp 网络成员表中。根据我一直在阅读的内容,密码是使用机器 key 加密然后加盐的。我看到此信息在哪里,但似乎无法使用此方法正确加密密码。

我正在尝试在我们的 DNN 站点所在的同一台服务器上使用 Coldfusion 网络应用程序,但它无法正常工作。你会认为它会与 ColdFusion 加密功能一起前进:

    Encrypt(passwordstring, key [, algorithm, encoding, IVorSalt, iterations])

无论我尝试什么,我都不会得到匹配的值。

非常感谢任何帮助、见解或为我指明正确的方向!

最佳答案

(编辑:原始答案并非在所有情况下都有效。经过大幅修改...)

据我所知,DNN 默认使用“SHA1”散列。跟帖 @barnyr发布显示它只是散列连接的盐和密码,但有一些曲折。

鉴于 CF9 的 Hash函数不接受二进制(在 CF11 中支持),我认为单独使用 native CF 函数无法复制结果。相反,我建议将字符串解码为二进制,然后直接使用 java:

代码:

<cfscript>
thePassword = "DT!@12";
base64Salt = "+muo6gAmjvvyy5doTdjyaA==";

// extract bytes of the salt and password
saltBytes = binaryDecode(base64Salt, "base64");
passBytes = charsetDecode(thePassword, "UTF-16LE" );

// next combine the bytes. note, the returned arrays are immutable,
// so we cannot use the standard CF tricks to merge them
ArrayUtils = createObject("java", "org.apache.commons.lang.ArrayUtils");
dataBytes = ArrayUtils.addAll( saltBytes, passBytes );

// hash binary using java
MessageDigest = createObject("java", "java.security.MessageDigest").getInstance("SHA-1");
MessageDigest.update(dataBytes);
theBase64Hash = binaryEncode(MessageDigest.digest(), "base64");

WriteOutput("theBase64Hash= "& theBase64Hash &"<br/>");
</cfscript>


差异演示:

<cfscript>
theEncoding = "UTF-16LE";
thePassword = "DT!@12";
base64Salt = "+muo6gAmjvvyy5doTdjyaA==";

// extract the bytes SEPARATELY
saltBytes = binaryDecode(base64Salt, "base64");
passBytes = charsetDecode(thePassword, theEncoding );
ArrayUtils = createObject("java", "org.apache.commons.lang.ArrayUtils");
separateBytes = ArrayUtils.addAll( saltBytes, passBytes );

// concatenate first, THEN extract the bytes
theSalt = charsetEncode( binaryDecode(base64Salt, "base64"), theEncoding );
concatenatedBytes = charsetDecode( theSalt & thePassword, theEncoding );

// these are the raw bytes BEFORE hashing
WriteOutput("separateBytes= "& arrayToList(separateBytes, "|") &"<br>");
WriteOutput("concatenatedBytes"& arrayToList(concatenatedBytes, "|") );
</cfscript>


结果:

separateBytes     = -6|107|-88|-22|0|38|-114|-5|-14|-53|-105|104|77|-40|-14|104|68|0|84|0|33|0|64|0|49|0|50|0
concatenatedBytes = -6|107|-88|-22|0|38|-114|-5|-14|-53|-105|104|-3|-1|68|0|84|0|33|0|64|0|49|0|50|0


关于coldfusion - 在 ColdFusion 中验证 DotNetNuke 用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12524877/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com