我有一个实现ZNode的客户端,它使用aspnet_Membership表来存储密码。该表包含一个加密的密码,即密码salt,并且使用的是2的"PasswordFormat“。从我收集的信息来看,"2”是一个可恢复的加密密码。
ColdFusion服务器是BlueDragon 9 Alpha。如果你不知道BD,不用担心,ColdFusion支持的任何东西“应该”都可以工作,我也有CF10来测试它。
如果你知道更好的方法,我洗耳恭听。此外,我需要能够检查登录的用户名/密码。
在查看Web.config文件时,ZnodeMembershipProvider是"System.Web.Security.SqlMembershipProvider“类型。
machineKey条目如下所示:(去掉两个键值)
<machineKey decryption="AES"
decryptionKey="[64 character string]"
validation="SHA1"
validationKey="[128 character string]"/>如果我尝试这样做:
Encrypt('myPassword', '[64 character string]', 'AES', 'Base64')它显示“指定的密钥不是此算法的有效大小”。
我对加密或.NET不是很了解。提前谢谢。
发布于 2013-08-16 01:08:59
我相信.NET密码表使用的是Triple-DES,而不是AES。试试这个吧。
Encrypt('myPassword', '[64 character string]', '3DES', 'Base64')发布于 2013-08-16 01:35:42
我写的这个关于DNN (Dot Net Nuke) authentication的答案应该能起到作用。(假设ACF和BD之间没有差异)。本质上,.NET和CF处理加密方式几乎没有区别。主要区别是:
UTF-16LE UTF-8。在ACF中,这意味着您必须使用encryptBinary而不是encrypt。(我对OBD不太确定)。CBC mode (requires IV)ECB (no IV required)如果另一个链接失效,下面是完整的示例。虽然它使用3DES,但AES的基本概念是相同的。注意:在Java中,较大的密钥大小(即192,256) are only available if the Sun Unlimited Strength Jurisdiction Policy Files are installed。
3DES示例:
// sample valus
plainPassword = "password12345";
base64Salt = "x7le6CBSEvsFeqklvLbMUw==";
hexDecryptKey = "303132333435363738393031323334353637383930313233";
// first extract the bytes of the salt and password
saltBytes = binaryDecode(base64Salt, "base64");
passBytes = charsetDecode(plainPassword, "UTF-16LE" );
// next combine the bytes. note, the returned arrays are immutable,
// so we cannot use the standard CF tricks to merge them
// NOTE: If BlueDragon does not include "org.apache.commons...."
// just loop through the arrays and merge them manually
ArrayUtils = createObject("java", "org.apache.commons.lang.ArrayUtils");
dataBytes = ArrayUtils.addAll( saltBytes, passBytes );
// convert DNN hex key to base64 for ColdFusion
base64Key = binaryEncode(binaryDecode( hexDecryptKey, "hex"), "base64");
// create an IV and intialize it with all zeroes
// block size: 16 => AES, 8=> DES or TripleDES
blockSize = 8;
iv = javacast("byte[]", listToArray(repeatString("0,", blocksize)));
// encrypt using CBC mode
bytes = encryptBinary(dataBytes, base64Key, "DESede/CBC/PKCS5Padding", iv);
// result: WBAnoV+7cLVI95LwVQhtysHb5/pjqVG35nP5Zdu7T/Cn94Sd8v1Vk9zpjQSFGSkv
WriteOutput("encrypted password="& binaryEncode( bytes, "base64" ));https://stackoverflow.com/questions/18257046
复制相似问题