473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Declaring the APIs for DPAPI in C#

I am using the article on Microsoft's site to create a DPAPI library
at:
http://msdn.microsoft.com/library/de...l/secmod21.asp

On the API declarations I am getting on error on the bool right before
the API name. The error is "Expected class, delegate, enum, interface,
or struct"
I'm not a C# wiz and I don't understand how to correct this, or why I
am getting it. Please help. I am getting the same error on all 3
declarations.

Thank you
Kalvin

/* BEGIN CODE */
[DllImport("Crypt32.dll", SetLastError=true,
CharSet=System.Runtime.InteropServices.CharSet.Aut o)]
private static extern bool CryptProtectData(
ref DATA_BLOB pDataIn,
String szDataDescr,
ref DATA_BLOB pOptionalEntropy,
IntPtr pvReserved,
ref CRYPTPROTECT_PROMPTSTRUCT pPromptStruct,
int dwFlags,
ref DATA_BLOB pDataOut);

[DllImport("Crypt32.dll", SetLastError=true,
CharSet=System.Runtime.InteropServices.CharSet.Aut o)]
private static extern bool CryptUnprotectData(
ref DATA_BLOB pDataIn,
String szDataDescr,
ref DATA_BLOB pOptionalEntropy,
IntPtr pvReserved,
ref CRYPTPROTECT_PROMPTSTRUCT pPromptStruct,
int dwFlags,
ref DATA_BLOB pDataOut);

[DllImport("kernel32.dll",
CharSet=System.Runtime.InteropServices.CharSet.Aut o)]
private unsafe static extern int FormatMessage(int dwFlags,
ref IntPtr lpSource,
int dwMessageId,
int dwLanguageId,
ref String lpBuffer, int nSize,
IntPtr *Arguments);

Nov 17 '05 #1
0 1112

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: james | last post by:
I have crated DPAPI libraries and Serviced component running under a specific user. But when i call this serviced component to encrypt a specific username and password(input values) it gives...
1
by: Nicholas Then | last post by:
I have just written a COM object which ties into a roaming user profile so that I may use DPAPI on many machines and have the same encryption and decryption. When I install it on 2 of my servers...
20
by: Ole Hanson | last post by:
I am accessing my database through an interface, to allow future substitution of the physical datastore - hence I would like to declare in my Interface that my DAL-objects implementing the...
1
by: Shaun | last post by:
Hi, I'm trying to implement encryption of connection string using DPAPI User Store. One of the objective is, after reading the connection string from Web.config file, my program has to know if...
2
by: Shaun Ram | last post by:
I am working on using DPAPI user profile store to encrypt a connection string in web.config file, using VB.NET 1. I have a situation here, I would not want the DPAPI User profile to be...
3
by: DazedAndConfused | last post by:
Can anyone point me to a good example of using DPAPI with VB .NET and SQL 2000?
2
by: PurpleServerMonkey | last post by:
At the moment I'm writing a network aware application in C# .Net 2.0 and I'd like to ask the group for advice on how I should store the username and password for the connection. The application...
0
by: pinki | last post by:
Hello I have problem with DPAPI in windows 98. I`m trying to use class SecureString (Framework 2.0.x) in my .net application. I get exception: "SecureString is only supported on Windows 2000...
3
by: michael sorens | last post by:
In the interests of increasing security, I came upon the DPAPI security library available from the GotDotNet user samples repository. What I want to do is create an applications that accesses a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.