Ask a Question related to ASP.NET Security, Design and Development.
-
jarod tupak via .NET 247 #1
I have the same problem
(Type your message here)
I have the same problem when executing the code below. It returns me a "126" error from kernel32.
Dim sContainer as String = "sample_example_key"
Dim sProvider as String = "myprovider"
If Not (CryptAcquireContext(lHCryptprov, sContainer, sProvider, PROV_RSA_FULL, 0)) Then
MsgBox("Error " & GetLastError.ToString & " during CryptAcquireContext!")
End If
<DllImport("advapi32.dll")> _
Public Shared Function CryptAcquireContext( _
ByRef hProv As Integer, _
ByVal pszContainer As String, _
ByVal pszProvider As String, _
ByVal dwProvType As Integer, _
ByVal dwFlags As Integer) As Boolean
End Function
Private Declare Function GetLastError Lib "kernel32" () As Long
--------------------------------
From: jarod tupak
-----------------------
Posted by a user from .NET 247 ([url]http://www.dotnet247.com/[/url])
<Id>hpmmaqsoTECdogXS0IdzeA==</Id>
jarod tupak via .NET 247 Guest
-
contribute problem - access denied file may not existpermission problem
Recieving the following error message - "access denied file may not exist , or there could be a permission problem" this happened this morning ,... -
Problem playing Quicktime thru .DCR embedded in HTML - pathreferencing problem?
Greetings earthlings and Director heads. Here's the problem: created an HTML file containing shockwave (dcr) movie that calls quicktime movies in... -
Uploading problem = weird warning (was: access denied problem.....)
Hi, I had a problem where my upload form was not working on our production server but was working on two other servers, after checking the... -
#21611 [Opn]: Problem with version_compare() (Was: Problem with pear cli and release numbers)
ID: 21611 Updated by: et@php.net -Summary: Problem with pear cli and release numbers Reported By: jan at horde... -
Problem with Apache Web Server config file and PHP (please give advice on what problem may be me)
HI: Can anyone refer me to someone that can help with the problem below. I installed Apache Web Server on my laptop which has Windows XP. I... -
Chris Rolon #2
Re: I have the same problem
One note: you should declare the Win32 method to get the last win32 error as
follows
<DllImport("advapi32.dll", SetLasetError := true)> _
Public Shared Function CryptAcquireContext( _
ByRef hProv As Integer, _
ByVal pszContainer As String, _
ByVal pszProvider As String, _
ByVal dwProvType As Integer, _
ByVal dwFlags As Integer) As Boolean
End Function
If false is returned, you then call
System.Runtime.InteropServices.GetLastWin32Error() to get the error code.
This will ensure that you get the correct error.
One more thing--why don't you use the managed classes for crypto? They are
much easier to use.
Chris Rolon
"jarod tupak via .NET 247" <anonymous@dotnet247.com> wrote in message
news:#qBcB9OKEHA.1264@TK2MSFTNGP12.phx.gbl..."126" error from kernel32.> (Type your message here)
>
> I have the same problem when executing the code below. It returns me aPROV_RSA_FULL, 0)) Then>
> Dim sContainer as String = "sample_example_key"
> Dim sProvider as String = "myprovider"
> If Not (CryptAcquireContext(lHCryptprov, sContainer, sProvider,CryptAcquireContext!")> MsgBox("Error " & GetLastError.ToString & " during> End If
>
> <DllImport("advapi32.dll")> _
> Public Shared Function CryptAcquireContext( _
> ByRef hProv As Integer, _
> ByVal pszContainer As String, _
> ByVal pszProvider As String, _
> ByVal dwProvType As Integer, _
> ByVal dwFlags As Integer) As Boolean
> End Function
>
> Private Declare Function GetLastError Lib "kernel32" () As Long
>
> --------------------------------
> From: jarod tupak
>
> -----------------------
> Posted by a user from .NET 247 ([url]http://www.dotnet247.com/[/url])
>
> <Id>hpmmaqsoTECdogXS0IdzeA==</Id>
Chris Rolon Guest



Reply With Quote

