Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Fri, 18 Jul 2008 06:16:15 -0700,    group: microsoft.public.dotnet.security        back       


pinvoke CryptSetKeyParam not working?   
Hi,
  I'm trying to use AES encryption from the win32 cryptoAPIs using pinvoke.  
My C# code pinvoke signature reads like this:
        [DllImport("advapi32.dll", SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool CryptSetKeyParam(IntPtr hKey, uint 
dwParam, byte[] pbData, uint dwFlags);
and then I setup CryptGetKeyParam

        [DllImport("advapi32.dll", SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool CryptGetKeyParam(IntPtr hKey, uint 
dwParam, byte[] pbData, ref uint pdwDataLen, uint dwFlags);


Are these signatures right?  When I call CryptSetKeyParam to set the 
initialization vector and then immediately call CryptGetKeyParam, I get back 
all zeros for the initV instead of the value I supplied previously.
date: Fri, 18 Jul 2008 06:16:15 -0700   author:   David Moore am

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us