Hi!
I am trying to make use of the new Enterprise Library application
blocks in the re-write of a legacy system. The rewrite involves being
able to access new C# modules from Delphi and as a result, we have
decided to use COM to allow Delphi to access the C# objects, which
are registered as COM objects.
Here is the code for a C# class that 'wraps' the Enterprise Library
Cryptography application block:
/// <summary>
/// COM wrapper for Enterprise Library Cryptography
Application Block.
/// </summary>
[ClassInterface(ClassInterfaceType.AutoDual)]
public class CorpITCryption
{
public string Encrypt(string aPlainText)
{
return Cryptographer.EncryptSymmetric
("symprovider", aPlainText);
//return "Hello!";
}
public string Decrypt(string aCipherText)
{
return Cryptographer.DecryptSymmetric
("symprovider", aCipherText);
}
}
This library class references the
Microsoft.Practises.EnterpiseLibrary.Security.Cryptography .DLL and
has Register For COM Interop set to True.
Here is the Delphi code that I am using:
procedure TForm1.Button1Click(Sender: TObject);
var
V: Variant;
begin
V:= CreateOleObject('CorpITCOMCryption.CorpITCryption');
edCipher.Text := V.Encrypt(edPlain.Text);
end;
I find that if I try to use other ways of accessing the COM object
(ie by calling Co...Create() ) then I get a class not registered
error in Delphi. The above method seems to work most regularly.
My actual problem is that I get an error in Delphi with the above
version of the C# class library.
The error text is as follows:
There was an error reflecting
type 'Microsoft.Practises.EnterpriseLibrary.Security.Cryptography.Conf
iguration.CryptographySettings'.
If I swap the comments on the Encrypt method and return a basic
string, there is no error at all.
Has it got to do with strong names?
What am I doing wrong? What do I need to do to fix this?
Any help would be most appreciated.
Thanks
John
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Microsofts_C_Sharp/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/