473,397 Members | 1,960 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,397 software developers and data experts.

Secure WebService Failing

I've struggled with this problem, and it's lack of examples, for a couple of
months now. On several different web applications that we have written, we
need to communicate with a credit card merchant servicer. On one of the
projects a secure connection was made with a WebRequest object and during
the reply, a trust error was received. I can't remember the full details due
to the time it's been since that project.

The most recent project required a secure connection via a web service that
the merchant service provides. I instantiate an instance of the service and
call the method that processes the credit card. No matter what I try to get
around it, I get the same error message:

System.EntryPointNotFoundException: Unable to find an entry point named
EnumerateSecurityPackagesW in DLL security.dll.

The stack trace results in the following:

[EntryPointNotFoundException: Unable to find an entry point named
EnumerateSecurityPackagesW in DLL security.dll.]
System.Net.NativeNTSSPI.EnumerateSecurityPackagesW (Int32& pkgnum, IntPtr&
arrayptr) +0
System.Net.SSPISecureChannelType.EnumerateSecurity Packages(Int32& pkgnum,
IntPtr& arrayptr) +45
System.Net.SSPIWrapper.EnumerateSecurityPackages(S SPIInterface SecModule)
+57
System.Net.SSPIWrapper.GetSupportedSecurityPackage s(SSPIInterface
SecModule) +29
System.Net.SecureChannel..cctor() +41

[TypeInitializationException: The type initializer for
"System.Net.SecureChannel" threw an exception.]
System.Net.SecureChannel..ctor(String hostname, X509CertificateCollection
clientCertificates) +0
System.Net.TlsStream.Handshake(ProtocolToken message) +51

[WebException: The underlying connection was closed: Could not establish
secure channel for SSL/TLS.]
System.Net.HttpWebRequest.CheckFinalStatus() +674
System.Net.HttpWebRequest.EndGetRequestStream(IAsy ncResult asyncResult)
+74
System.Net.HttpWebRequest.GetRequestStream() +132
System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[] parameters) +105

MyApplication.net.eftsecure.va.TRANSACTION_PROCESS ING.BANKCARD_AUTHONLY(Stri
ng M_ID, String M_KEY, String C_NAME, String C_ADDRESS, String C_CITY,
String C_STATE, String C_ZIP, String C_COUNTRY, String C_EMAIL, String
C_CARDNUMBER, String C_EXP, String C_CVV, String T_CUSTOMER_NUMBER, String
T_AMT, String T_SHIPPING, String T_TAX, String T_ORDERNUM, String
C_TELEPHONE, String C_FAX, String C_SHIP_NAME, String C_SHIP_ADDRESS, String
C_SHIP_CITY, String C_SHIP_STATE, String C_SHIP_ZIP, String C_SHIP_COUNTRY)
in c:\inetpub\wwwroot\MyApplication\Web
References\net.eftsecure.va\Reference.vb:140
MyApplication.ConfirmOrder.btnConfirm_Click(Object sender, EventArgs e)
in c:\inetpub\wwwroot\MyApplication\ConfirmOrder.aspx .vb:93
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
stBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1247
I've tried a few things. I created a new class implementing
ICertificatePolicy that just returns True in the CheckValidationResult
method and set the ServicePointManager.CertificatePolicy to a new instance
of that class. I've output the SSL certificate on the server to a CER file
and added it to the web service's client certificates via
ClientCertificates.Add(X509Certificate.CreateFromC ertFile(Server.MapPath("My
ApplicationCert.cer"))). Each of these things were tried separately and
together just before the web service's method is invoked and nothing has
remedied the problem.

Please, help. Any suggestions, questions, ideas or examples will be greatly
appreciated.
Thanks in advance,

--
Matt Sollars
ma**@hypersite.net
-------------------
The Hypersite Network
2002 N. Salisbury Blvd.
Suite C
Salisbury, Maryland 21801
T: 410.749.2000
F: 410.219.3400
http://www.hypersite.net
Nov 17 '05 #1
3 4530
Hi Matt,

The error looks more like a certificate issue. Following are few known
conditions this error may occur.

1) Mismatched Certificate: a certificate is associated with the user ID of
the user who installed the certificate (this is the certificate user);
therefore, the certificate is available only when that user profile is
loaded. ASP.NET will be running under different account. Check the
Certificate in the MMC.

2) Mismatched server name: the server name should be same as the server
name on the certificate. This is most common problem. If the client and
server are on the same box, make sure that you are not using ˇ°localhost?
Please change it to server name.

3) Proxy settings.
Please check the KB article Q307267
<http://support.microsoft.com/default.aspx?scid=kb;en-us;Q307267> and make
sure the certificates are installed properly.

Thanks very much.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ˇ°as isˇ± with no warranties and confers no rights.
Nov 17 '05 #2
Thanks a lot, Tian. I'll look into that. It's probably the user issue. I
guess I'll have to impersonate that user.

Matt
"Tian Min Huang" <ti******@online.microsoft.com> wrote in message
news:e1**************@cpmsftngxa06.phx.gbl...
Hi Matt,

The error looks more like a certificate issue. Following are few known
conditions this error may occur.

1) Mismatched Certificate: a certificate is associated with the user ID of
the user who installed the certificate (this is the certificate user);
therefore, the certificate is available only when that user profile is
loaded. ASP.NET will be running under different account. Check the
Certificate in the MMC.

2) Mismatched server name: the server name should be same as the server
name on the certificate. This is most common problem. If the client and
server are on the same box, make sure that you are not using ˇ°localhost?
Please change it to server name.

3) Proxy settings.
Please check the KB article Q307267
<http://support.microsoft.com/default.aspx?scid=kb;en-us;Q307267> and make
sure the certificates are installed properly.

Thanks very much.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ˇ°as isˇ± with no warranties and confers no rights.

Nov 17 '05 #3
Tim,

I have the same error, but the problem is only on ISP side..any ideas?
Following is a brief description of my problem...

I have an aspx page, code for which I am including in mail. This page
works only for a few hours a day. It is inconsistent code does NOT
change but the page stops working. This page works fine on localhost
(at all
times) however at my ISP it is a different story. It works randomly ,
as best I can figure out it works for a few hours every day. Nothing is
consistent and it works in a random fashion. It appears to be some kind
of
sever specific issue at my ISP. Is anyone else having similar problems?
ISP (webhost4life) has not been of much help. Why does this page find
the entry point every so often and then does not find it?

Error Message that is reported

Unable to find an entry point named EnumerateSecurityPackagesW in DLL
security.dll.

It fails on the following line of code

Dim postData As Stream = oHttp.GetRequestStream()

Following is the stack trace output

[EntryPointNotFoundException: Unable to find an entry point named
EnumerateSecurityPackagesW in DLL security.dll.]
System.Net.NativeNTSSPI.EnumerateSecurityPackagesW (Int32& pkgnum,
IntPtr&
arrayptr) +0
System.Net.SSPISecureChannelType.EnumerateSecurity Packages(Int32&
pkgnum,
IntPtr& arrayptr) +45
System.Net.SSPIWrapper.EnumerateSecurityPackages(S SPIInterface
SecModule)
+57
System.Net.SSPIWrapper.GetSupportedSecurityPackage s(SSPIInterface
SecModule) +29
System.Net.SecureChannel..cctor() +41

[TypeInitializationException: The type initializer for
"System.Net.SecureChannel" threw an exception.]
System.Net.SecureChannel..ctor(String hostname,
X509CertificateCollection
clientCertificates) +0
System.Net.TlsStream.Handshake(ProtocolToken message) +51

[WebException: The underlying connection was closed: Could not establish
secure channel for SSL/TLS.]
System.Net.HttpWebRequest.CheckFinalStatus() +676
System.Net.HttpWebRequest.EndGetRequestStream(IAsy ncResult
asyncResult)
+75
System.Net.HttpWebRequest.GetRequestStream() +132
ASP.test_aspx.Page_Load(Object sender, EventArgs e) in
c:\webhost4life_aspnet\cincospa\aspx\test.aspx:37
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
__________________________________________________ __________
Complete code for this aspx page
__________________________________________________ __________

<%@ Page Debug="true" Language="vb" AutoEventWireup="false"%>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Web.HttpRequest" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>test</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

<script language="vb" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' 'Put user code to initialize the page here

' ' Create Web Request
Dim url As String = "https://secure.authorize.net/gateway/transact.dll"
Dim params As String = String.Empty

Dim oHttp As HttpWebRequest = CType(WebRequest.Create(Url),
HttpWebRequest)

' Post form variables
params = "x_Version=" & "3.1" & "&x_delim_data=" & "True" + "&x_Login="
&
"userid" & "&x_tran_key=" & "somepwd" _
+ "&x_Amount=" & "1" & "&x_Card_Num=" & "1234567812345678" +
"&x_Exp_Date="
& "1234" + "&x_Type=" + "AUTH_CAPTURE"

oHttp.Method = "POST"

Dim postBuffer() As Byte =
System.Text.Encoding.GetEncoding(1252).GetBytes(Pa rams)
oHttp.ContentLength = postBuffer.Length
Dim postData As Stream = oHttp.GetRequestStream()
postData.Write(postBuffer, 0, postBuffer.Length)
postData.Close()

' Get results
Dim myResponse As HttpWebResponse = CType(oHttp.GetResponse(),
HttpWebResponse)
Dim enc As Encoding = System.Text.Encoding.GetEncoding(1252)

Dim loResponseStream As StreamReader
loResponseStream = New StreamReader(myResponse.GetResponseStream(), enc)
Dim retHtml As String = loResponseStream.ReadToEnd()
myResponse.Close()
loResponseStream.Close()

Response.Write(retHtml)
End Sub

</script>

</form>

</body>
</html>


<b> Munish </b>

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #4

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

Similar topics

6
by: Josh Angolano | last post by:
I have an application that uses webservices with SOAP attachements. In order to pass data to a webservice it uses the ATLSOAP_BLOB datastructre. This application works great on my PC where I have...
2
by: dan | last post by:
hi ng. i have a asp.net application which is client of an asp.net webservice. now i want to configure a custom error page (in case the sewrvice throws an exception) that provides the...
5
by: jb | last post by:
*Please* help --- I'm tearing my hair out. I want to use sessionstate in a webservice, accessed from a client, written in script (JScript, InfoPath). I have written my webservice (C# .NET). I...
5
by: mtv | last post by:
Hi all, I have the following code: ================================ Webservice side: public class MyWS: WebService { private myLib.DataObject curDataObject;
6
by: Sascha Schmidt | last post by:
Hi again! Well, the first part of my "mission" (calling remoting objects from a webservice) is solved. But there's another part: Calling this C#-Webservice from a java client. Is this a...
1
by: jens Jensen | last post by:
Hello , i'm calling a webservice generated with oracle webservice java tools. I'm not able to add a web reference to a .net client the usual way with visual studio 2005. I was therefore...
0
by: newjazzharmony | last post by:
We have both Windows and Linux webservers in our organization. I know that WSE 3.0 allows you to secure a web service with Kerberos such that an authenticated NT user can be recognized by the...
0
by: Rob C | last post by:
I have several methods implemented in a webservice written in C#. The methods execute SQL against a SQL Server 2005 db and returns a Dataset (as XML). I am utilizing the webservice from a VC++...
2
by: =?Utf-8?B?cGF0cmlja2RyZA==?= | last post by:
Hi everyone! I have built a vb6 app that communicates with a web server to get data from an webservice through the internet (not lan). My question/problem is, 1) how could I make this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
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...

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.