.NET Framework Bookmark and Share   
 index > Common Language Runtime > RSACryptoServiceProvider for Siemens card
 

RSACryptoServiceProvider for Siemens card

Hi bobcary,
Hi Yadab Das!


I've got a similar problem like bobcary.
It occours when creating an instance of the RSACryptoServiceProvider-Class.




string containername = "Kraemer Sebastian Wolfgang's Encryption ID";

CspParameters cspp = new CspParameters(1, "Siemens Card API CSP", containername );

RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cspp);<br/><br/>



The third line throws the error: Ungültiger Typ angegeben (sorry for the german error text... set invalid type..?)

The "Siemens Card API CSP" does work. It contains two containers. Each container does contain a public an a private key.


It would be very pleasant if you or anybody else could help me to understand why this error occours or help me to solve it.


Best regards,
Sebastian
Sebastian_ger1986

Sebastian, can you please paste the full exception with call stack here?

-Karel

Karel Zikmund
Hi, every body. I have the same problem!

I think HiPath SIcurity Card API v3.1.013 is responsible for the exception. I started loging services of the API and in the csp.log file we can find 5556:6140 12:02:53 Debug: Algorithm = CALG_RSA_KEYX
5556:6140 12:02:53 Error: Exception 0x8009000A at D:\arbeit\code\scary\cspcore\csp_cp.c(677)
5556:6140 12:02:53 Info: Return: 0x8009000A

My stack trace is as follows:
at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
at System.Security.Cryptography.Utils._GetKeyParameter(SafeKeyHandle hKey, UInt32 paramID)
at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle)
at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair()
at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)
at System.Security.Cryptography.RSACryptoServiceProvider..ctor(CspParameters parameters)
at SignXML.SimpleXMLSigner.ChooseCertificateAndSignXML(String aFileName, String aSignedXMLFileName) in C:\Users\sjordanov.KONTRAX\Desktop\SignXML\SignXML\SimpleXMLSigner.cs:line 86
at SignXML.SimpleXMLSigner.btnSign_Click(Object sender, EventArgs e) in C:\Users\sjordanov.KONTRAX\Desktop\SignXML\SignXML\SimpleXMLSigner.cs:line 146
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at SignXML.Program.Main() in C:\Users\sjordanov.KONTRAX\Desktop\SignXML\SignXML\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


When I use another card API (charismatics) there are no exceptions and my application is working.

Please help me solve this issue. Thanks in advance.

Best regards,

Stefan Jordanov
Stefan.Jordanov

You can use google to search for other answers

Custom Search

More Threads

• Implementing an Existing COM Interface in Managed Code which RETURNS an Array of COM Structures
• The error code 5000
• Question about Marshal.GetDelegateForFunctionPointer
• Is there a way to get/access permon measures via a .net api, via C#?
• asp.net clearcase required permission cannot be acquired error
• How to prevent code refactoring?
• DPAPI C# problem - Provider DLL could not be found exception
• How to pass arguments to VB.NEt Windows Application (exe file)?
• Marshal Function pointer from C# to C++
• Calling UnManaged Function Pointers from VB.NET