Re: CryptEncrypt fails on pocket pc (c#)
From: Pieter Philippaerts (Pieter_at_nospam.mentalis.org)
Date: 10/26/03
- Next message: Anatoly: "Re: CryptEncrypt fails on pocket pc (c#)"
- Previous message: Anatoly: "CryptEncrypt fails on pocket pc (c#)"
- In reply to: Anatoly: "CryptEncrypt fails on pocket pc (c#)"
- Next in thread: Anatoly: "Re: CryptEncrypt fails on pocket pc (c#)"
- Reply: Anatoly: "Re: CryptEncrypt fails on pocket pc (c#)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sun, 26 Oct 2003 01:57:17 +0200
"Anatoly" <wiretransfers@yahoo.com> wrote in message
> I am testing out some encryption on pocket pc with C#.net, (see below
code)
> it executes through Generating the key, but fails when trying to actually
> encrypt data with it.
Your definition of CryptEncrypt is wrong. Try this:
[DllImport(CryptDll)]
public static extern bool CryptEncrypt(IntPtr hKey, IntPtr hHash, int Final,
uint dwFlags, byte[] pbData, ref uint pdwDataLen, uint dwBufLen);
There's a difference between 'bool' and 'BOOL' in C. Like in C#, bool is a
1-byte variable and BOOL is a 4-byte variable. The CryptEncrypt uses the
4-byte type and you declared it as a 1-byte type. This corrupts the
parameters on the stack, and hence the error.
Regards,
Pieter Philippaerts
Managed SSL/TLS: http://www.mentalis.org/go.php?sl
- Next message: Anatoly: "Re: CryptEncrypt fails on pocket pc (c#)"
- Previous message: Anatoly: "CryptEncrypt fails on pocket pc (c#)"
- In reply to: Anatoly: "CryptEncrypt fails on pocket pc (c#)"
- Next in thread: Anatoly: "Re: CryptEncrypt fails on pocket pc (c#)"
- Reply: Anatoly: "Re: CryptEncrypt fails on pocket pc (c#)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|