我已经用尽了我的谷歌搜索选项......
我们正在使用 System Center Orchestrator 在多个系统中自动创建用户。我们有一个第三方销售点应用程序,它以他们的应用程序可以读取的加密格式将用户密码存储在数据库中。对于我们自动插入用户数据库,我们需要能够插入加密密码以供应用程序识别。
他们不会向我们提供他们遵循的加密方法,而是创建了一个 DLL 供我们使用,用 Delphi 编写。它接受一个在 XML 包装器中传递的字符串,然后返回一个带有加密密码字符串的 XML 响应。
从 System Center Orchestrator 的角度来看,使用此 DLL 的最佳方式是什么,请记住我自己或实现此功能的系统工程师以前从未做过类似的事情。
任何建议都非常感谢。
编辑
一个字符串将被传递给包含以下格式的 XML 的可执行文件
<passwordEncryptionRequest>
<passwordIn>?</passwordIn>
<connectionDetails>
<serverName>?</serverName>
<serverInstance>?</serverInstance>
<userName>?</userName>
<connectionPassword>?</connectionPassword>
</connectionDetails>
</passwordEncryptionRequest>
将从包含以下格式的 XML 的可执行文件返回一个字符串
<passwordEncryptionResponse>
<passwordOut>?</passwordOut>
<passwordEncryptionErrorResponse>
<errorDescription>?</errorDescription>
</passwordEncryptionErrorResponse>
</passwordEncryptionResponse>
供应商回到我身边并提供了一些示例代码。
函数声明是(Delphi):
function EncryptPassword(inputString: PWideChar; var outputString: PWideChar): wordbool; export; stdCall;
使用示例(c#):
[DllImport("PasswordEncrypt.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]
private static extern bool EncryptPassword(string inputString, ref string outputString);
public FormTestEncryption()
{
InitializeComponent();
}
private void buttonTest_Click(object sender, EventArgs e)
{
string outputString = string.Empty;
string inputString = string.Format(
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<passwordEncryptionRequest>" +
"<passwordIn>{0}</passwordIn>" +
"<connectionDetails>" +
"<serverName>{1}</serverName>" +
"<serverInstance>{2}</serverInstance>" +
"<userName>{3}</userName>" +
"<connectionPassword>{4}</connectionPassword>" +
"</connectionDetails>" +
"</passwordEncryptionRequest>",
textPassword.Text, textServer.Text, textInstance.Text, textDBUser.Text, textDBPassword.Text);
textOutput.Clear();
bool result = EncryptPassword(inputString, ref outputString);
textOutput.Text = outputString;
}
编辑 2:在实现了建议的定义和调用之后,我实际上得到了一个返回字符串,但是只有当我启用本机代码调试并继续通过两个断点时。堆栈跟踪是;
ntdll.dll!_RtlReportCriticalFailure@8() Unknown
ntdll.dll!_RtlpReportHeapFailure@4() Unknown
ntdll.dll!_RtlpLogHeapFailure@24() Unknown
ntdll.dll!_RtlFreeHeap@12() Unknown
ole32.dll!76f96e6a() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for ole32.dll]
[External Code]
WindowsFormsApplication2.exe!WindowsFormsApplication2.Form1.button1_Click(object sender, System.EventArgs e) Line 52 C#
[External Code]
WindowsFormsApplication2.exe!WindowsFormsApplication2.Program.Main() Line 20 C#
[External Code]
看到它现在实际上正确地实现了第 3 方 dll(我检查了返回的字符串并且很好),我已将其标记为已回答。我现在将尝试解决这些其他问题:)
谢谢大家的意见,感谢您的帮助。
问候,丹