Here's my sample code.

--- SNIP ---

[DllImport("lib\\libeay32.dll")]
public static extern IntPtr EVP_MD_CTX_create();

[DllImport("lib\\libeay32.dll")]
public static extern IntPtr EVP_md5();

[DllImport("lib\\libeay32.dll")]
public static extern int EVP_DigestInit_ex(IntPtr digestContext, IntPtr 
digestType, IntPtr engine);

[DllImport("lib\\libeay32.dll")]
public static extern int EVP_DigestUpdate(IntPtr digestContext, String 
messageText, int messageLength);

[DllImport("lib\\libeay32.dll")]
public static extern int EVP_DigestFinal_ex(IntPtr digestContext, IntPtr 
digestValue, IntPtr digestLength);

[...]

IntPtr digestContext = new IntPtr();
IntPtr digestType = new IntPtr();
IntPtr digestValue = new IntPtr();
String messageText = "Hello world!";

/* Setup MD5 context */
digestContext = EVP_MD_CTX_create();
digestType = EVP_md5();
/* Context setup successful */
if (EVP_DigestInit_ex(digestContext, digestType, IntPtr.Zero) == 1)
{
  /* Perform hashing */
        if (EVP_DigestUpdate(digestContext, messageText, messageText.Length) == 
1)
  {
    /* Hashing successful */
                if (EVP_DigestFinal_ex(digestContext, digestValue, IntPtr.Zero) 
== 1)
  }
  else
  {
    /* Something went wrong */
  }
}
else
{
  /* Something went wrong */
}

[...]

--- SNIP ---

> Hello,
>
> I've been using OpenSSL for quite a time but now it's time
> for me to integrate some functionality into my own
> application (C#). That is: decrypting with a private key and
> building hashsums. As far as I understood I need the
> libeay32.dll to achieve this. However I cannot find something
> like an API documentiation which describes how to call
> OpenSSL functions from this DLL.
>
> Could someone assist me in this?
>
> Sincerely,
> Robert
>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to