473,832 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to enum CSPs in C#?

Hi:
I'm trying to write a web page by using c# under dotnet framwork. My target
is lets the user to choose a csp to get a certificate from CA. But, I only
know how to enum providers by cryptoapi like: CryptEnumProvid ers(...).
Who can tell me how to enum csps by using C#?
thanks
Nov 17 '05 #1
6 4622
There is no reason you cannot use the existing CryptEnumProvid ers() call,
you’d just need to P/Invoke it and lucky for you, recently Nicholas Paldino
posted a C# signature for it over on
http://pinvoke.net/default.aspx/adva...Providers.html

Brendan
"mRbEn" wrote:
Hi:
I'm trying to write a web page by using c# under dotnet framwork. My target
is lets the user to choose a csp to get a certificate from CA. But, I only
know how to enum providers by cryptoapi like: CryptEnumProvid ers(...).
Who can tell me how to enum csps by using C#?
thanks

Nov 17 '05 #2
Brendan,

That's pretty funky. How did you know it was me who posted it? =)

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Brendan Grant" <gr****@NOSPAMd ahat.com> wrote in message
news:51******** *************** ***********@mic rosoft.com...
There is no reason you cannot use the existing CryptEnumProvid ers() call,
you'd just need to P/Invoke it and lucky for you, recently Nicholas
Paldino
posted a C# signature for it over on
http://pinvoke.net/default.aspx/adva...Providers.html

Brendan
"mRbEn" wrote:
Hi:
I'm trying to write a web page by using c# under dotnet framwork. My
target
is lets the user to choose a csp to get a certificate from CA. But, I
only
know how to enum providers by cryptoapi like: CryptEnumProvid ers(...).
Who can tell me how to enum csps by using C#?
thanks

Nov 17 '05 #3
thanks!

"Brendan Grant" <gr****@NOSPAMd ahat.com> дÈëÓʼþ
news:51******** *************** ***********@mic rosoft.com...
There is no reason you cannot use the existing CryptEnumProvid ers() call,
you¡¯d just need to P/Invoke it and lucky for you, recently Nicholas Paldino posted a C# signature for it over on
http://pinvoke.net/default.aspx/adva...Providers.html

Brendan
"mRbEn" wrote:
Hi:
I'm trying to write a web page by using c# under dotnet framwork. My target is lets the user to choose a csp to get a certificate from CA. But, I only know how to enum providers by cryptoapi like: CryptEnumProvid ers(...).
Who can tell me how to enum csps by using C#?
thanks

Nov 17 '05 #4
one more question!
When I call the cryptenumprovid ers in my C# project. I got an error it's
said that the module could not be found. Why can't my project load
advapi32.dll and find the module CryptEnumProvid ers ? !!!

"mRbEn" <mr********@126 .com> дÈëÓʼþ
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
thanks!

"Brendan Grant" <gr****@NOSPAMd ahat.com> дÈëÓʼþ
news:51******** *************** ***********@mic rosoft.com...
There is no reason you cannot use the existing CryptEnumProvid ers() call,
you¡¯d just need to P/Invoke it and lucky for you, recently Nicholas

Paldino
posted a C# signature for it over on
http://pinvoke.net/default.aspx/adva...Providers.html

Brendan
"mRbEn" wrote:
Hi:
I'm trying to write a web page by using c# under dotnet framwork. My

target is lets the user to choose a csp to get a certificate from CA. But, I only know how to enum providers by cryptoapi like: CryptEnumProvid ers(...).
Who can tell me how to enum csps by using C#?
thanks


Nov 17 '05 #5
mRbEn,

What does the declaration in your code look like? You arent setting a
reference to advapi32.dll, are you?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"mRbEn" <mr********@126 .com> wrote in message
news:eW******** *****@TK2MSFTNG P12.phx.gbl...
one more question!
When I call the cryptenumprovid ers in my C# project. I got an error it's
said that the module could not be found. Why can't my project load
advapi32.dll and find the module CryptEnumProvid ers ? !!!

"mRbEn" <mr********@126 .com> дÈëÓʼþ
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
thanks!

"Brendan Grant" <gr****@NOSPAMd ahat.com> дÈëÓʼþ
news:51******** *************** ***********@mic rosoft.com...
> There is no reason you cannot use the existing CryptEnumProvid ers() call, > you¡¯d just need to P/Invoke it and lucky for you, recently Nicholas

Paldino
> posted a C# signature for it over on
> http://pinvoke.net/default.aspx/adva...Providers.html
>
> Brendan
>
>
> "mRbEn" wrote:
>
> > Hi:
> > I'm trying to write a web page by using c# under dotnet framwork. My

target
> > is lets the user to choose a csp to get a certificate from CA. But, I

only
> > know how to enum providers by cryptoapi like:
> > CryptEnumProvid ers(...).
> > Who can tell me how to enum csps by using C#?
> > thanks
> >
> >
> >



Nov 17 '05 #6
I do think so, too. But I don't know how to reference to it.It's seemed I
can't reference to it by using the reference windows in my project.
BTW, APIs imported from User32 and Kenerl32 are worked well.

[DllImport("user 32.dll", EntryPoint="Mes sageBox")]
public static extern int MsgBox(int hWnd, String text, String caption,
uint type);
above is right.

[DllImport("Adva pi32", EntryPoint="Cry ptEnumProviders W",
SetLastError=tr ue, ExactSpelling=t rue,
CharSet=CharSet .Auto)]
static extern bool CryptEnumProvid ers(
[MarshalAs(Unman agedType.U4)] int dwIndex,
[MarshalAs(Unman agedType.U4)] ref int pdwReserved,
[MarshalAs(Unman agedType.U4)] int dwFlags,
[MarshalAs(Unman agedType.U4)] ref int pdwProvType,
StringBuilder pszProvName,
[MarshalAs(Unman agedType.U4)] ref int pcbProvName);
above is wrong.
errcode=126 ERROR_MOD_NOT_F OUND
The specified module could not be found.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> дÈëÓʼþ
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
mRbEn,

What does the declaration in your code look like? You arent setting a
reference to advapi32.dll, are you?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"mRbEn" <mr********@126 .com> wrote in message
news:eW******** *****@TK2MSFTNG P12.phx.gbl...
one more question!
When I call the cryptenumprovid ers in my C# project. I got an error it's
said that the module could not be found. Why can't my project load
advapi32.dll and find the module CryptEnumProvid ers ? !!!

"mRbEn" <mr********@126 .com> дÈëÓʼþ
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
thanks!

"Brendan Grant" <gr****@NOSPAMd ahat.com> дÈëÓʼþ
news:51******** *************** ***********@mic rosoft.com...
> There is no reason you cannot use the existing CryptEnumProvid ers()

call,
> you¡¯d just need to P/Invoke it and lucky for you, recently Nicholas
Paldino
> posted a C# signature for it over on
> http://pinvoke.net/default.aspx/adva...Providers.html
>
> Brendan
>
>
> "mRbEn" wrote:
>
> > Hi:
> > I'm trying to write a web page by using c# under dotnet framwork. My target
> > is lets the user to choose a csp to get a certificate from CA. But, I only
> > know how to enum providers by cryptoapi like:
> > CryptEnumProvid ers(...).
> > Who can tell me how to enum csps by using C#?
> > thanks
> >
> >
> >



Nov 17 '05 #7

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

Similar topics

20
4859
by: Glenn Venzke | last post by:
I'm writing a class with a method that will accept 1 of 3 items listed in an enum. Is it possible to pass the item name without the enum name in your calling statement? EXAMPLE: public enum EnumName FirstValue = 1 SecondValue = 2 ThirdValue = 3
21
4612
by: Andreas Huber | last post by:
Hi there Spending half an hour searching through the archive I haven't found a rationale for the following behavior. using System; // note the missing Flags attribute enum Color {
31
3629
by: Michael C | last post by:
If a class inherits from another class, say Form inherits from control, then I can assign the Form to a variable of type Control without needing an explicit conversion, eg Form1 f = new Form1(); Control c = f; An enum value inherits from int but it doesn't get implicitly converted: HorizontalAlignment h = HorizontalAlignment.Center;
18
11379
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I have created an enum list like this: enum myEnum : int { This = 2, That, NewVal = 10, LastItm
2
3403
by: Dennis | last post by:
I have an enum as follows: Public Enum myData FirstData = 6 SecondData = 7 end enum Is there anyway that I can return the Enum names by their value, i.e., I want to input 6 into a function and return the name "FirstData"
13
12397
by: Don | last post by:
How do I get an Enum's type using only the Enum name? e.g. Dim enumType as System.Type Dim enumName as String = "MyEnum" enumType = ???(enumName)
1
2463
by: Randy | last post by:
Hi, I downloaded and tried the ENUM++ code from CUJ http://www.cuj.com/documents/s=8470/cujboost0306besser/ but can't even get it to compile (see following). I have also downloaded and installed the boost library. This is using gcc under FC3.
2
2121
by: Randy | last post by:
Hi, I downloaded and tried the ENUM++ code from CUJ http://www.cuj.com/documents/s=8470/cujboost0306besser/ but can't even get it to compile (see following). I have also downloaded and installed the boost library. This is using gcc under FC3.
34
11213
by: Steven Nagy | last post by:
So I was needing some extra power from my enums and implemented the typesafe enum pattern. And it got me to thinking... why should I EVER use standard enums? There's now a nice little code snippet that I wrote today that gives me an instant implementation of the pattern. I could easily just always use such an implementation instead of a standard enum, so I wanted to know what you experts all thought. Is there a case for standard enums?
0
9794
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10780
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10497
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9319
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7753
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4420
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3077
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.