从 Delphi XE 访问 Delphi Prism 类库
我需要在 Delphi XE 中访问这个 Delphi Prism 类库中的方法“Auth”:
namespace ClassLibrary1;
interface
uses
System,
System.IO,
System.Security.Cryptography,
System.Runtime.InteropServices,
System.Text;
type
ConsoleApp = public class
private
class method hashMe(input: string): string;
class method Encrypt(clearText: string; Password: string; Salt: array of byte; iteration: Integer): string;
class method Encrypt(clearData: array of byte; Key: array of byte; IV: array of byte): array of byte;
class method Encrypt(clearData: array of byte; Password: string; Salt: array of byte; iteration: integer): array of byte;
class method Decrypt(cipherText: string; Password: string; Salt: array of byte; iterations: Integer): string;
class method Decrypt(cipherData: array of byte; Password: string; Salt: array of byte; iterations: integer): array of byte;
class method Decrypt(cipherData: array of byte; Key: array of byte; IV: array of byte): array of byte;
protected
public
[UnmanagedExport('Auth')]
class method Auth(userName: String; userPassword: String): String;
end;
implementation
[...]
使用 CrossTalk 非常容易,但 CrossTalk 非常昂贵,并且此代码适用于宠物项目。有什么简单的方法可以做到这一点吗?
TIA
I need to access in Delphi XE the method "Auth" from this Delphi Prism class library:
namespace ClassLibrary1;
interface
uses
System,
System.IO,
System.Security.Cryptography,
System.Runtime.InteropServices,
System.Text;
type
ConsoleApp = public class
private
class method hashMe(input: string): string;
class method Encrypt(clearText: string; Password: string; Salt: array of byte; iteration: Integer): string;
class method Encrypt(clearData: array of byte; Key: array of byte; IV: array of byte): array of byte;
class method Encrypt(clearData: array of byte; Password: string; Salt: array of byte; iteration: integer): array of byte;
class method Decrypt(cipherText: string; Password: string; Salt: array of byte; iterations: Integer): string;
class method Decrypt(cipherData: array of byte; Password: string; Salt: array of byte; iterations: integer): array of byte;
class method Decrypt(cipherData: array of byte; Key: array of byte; IV: array of byte): array of byte;
protected
public
[UnmanagedExport('Auth')]
class method Auth(userName: String; userPassword: String): String;
end;
implementation
[...]
This is very easy with CrossTalk, but CrossTalk is very expensive and this code is for a pet project. Any easy way to do this?
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
但在非托管/win32 代码中返回 PAnsiChar 并不是一个好主意。谁来释放绳子?
But returning a PAnsiChar is not really a good idea in unmanaged/win32 code. Who is going to free the string?