msxml3.dll error '80072f0c' A certificate is required to complete client authentication

感情迁移 提交于 2019-12-11 01:58:54

问题


I've installed the paypal api certificate and given private key access to the proper identities using winhttpcertcfg. I've exhausted all of the "known fixes" found on various forums and continue to get this error. I'm running the lastest msxml versions.

Using the paypal code example I get the error

msxml3.dll error '80072f0c' A certificate is required to complete client authentication

The error is constant whether using 3.0, 4.0 or 6.0 versions of MSXML2.ServerXMLHTTP, and I receive the same error when trying to utilize the REST Api.

The code I am testing the connection with is as follows.

<%
Dim vrequest, strPayPalCert
Dim payPalURL, payPalUser, payPalAppID, payPalPassword, payPalClientID, payPalSecret

Const SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS = 13056
Const SXH_OPTION_SELECT_CLIENT_SSL_CERT = 3

payPalURL      = "https://api.sandbox.paypal.com" 
payPalUser     = "xx_user_xx"
payPalAppID    = "APP-80W284485P519543T"
payPalPassword = "xx_password_xx"
payPalClientID = "xx_client_id_xx"
payPalSecret   = "xx_secret_xx"

Const paypal_request_format = "JSON"
Const paypal_response_format = "JSON"

strPayPalCert = "paypal_cert_name"

vrequest = vrequest & "&actionType=" & "PAY"
vrequest = vrequest & "&cancelUrl= cancelUrl.asp"
vrequest = vrequest & "&clientDetails.ipAddress=" &  Request.ServerVariables("LOCAL_ADDR") 
vrequest = vrequest & "&clientDetails.partnerName=MySite" 
vrequest = vrequest & "&currencyCode=USD" 
vrequest = vrequest & "&feesPayer=0.00"
vrequest = vrequest & "&receiverList.receiver(0).email=receiver@paypal.com" 
vrequest = vrequest & "&receiverList.receiver(0).amount=1.00" 
vrequest = vrequest & "&requestEnvelope.errorLanguage=" &  "en_US"
vrequest = vrequest & "&requestEnvelope.detailLevel=" &  "ReturnAll"
vrequest = vrequest & "&returnUrl=returnURL.asp"

If not isobject(vXMLHttp) Then
  Set vXMLHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
End If

vXMLHttp.setOption(2) = SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS

' This throws certificate error due to space
vXMLHttp.setOption(3) = "LOCAL_MACHINE\My\ " & strPayPalCert


'This works
vXMLHttp.setOption(3) = "LOCAL_MACHINE\My\" & strPayPalCert

strURL = "https://svcs.sandbox.paypal.com/AdaptivePayments/Pay"
vXMLHttp.open "POST", strURL, false  

vXMLHttp.setRequestHeader "X-PAYPAL-SECURITY-USERID", payPalUser
vXMLHttp.setRequestHeader "X-PAYPAL-SECURITY-PASSWORD", payPalPassword
vXMLHttp.setRequestHeader "X-PAYPAL-REQUEST-DATA-FORMAT", paypal_request_format
vXMLHttp.setRequestHeader "X-PAYPAL-RESPONSE-DATA-FORMAT", paypal_response_format
vXMLHttp.setRequestHeader "X-PAYPAL-APPLICATION-ID", payPalAppID

vXMLHttp.Send vrequest
vXMLHttp.waitForResponse 5 

strResponse = vXMLHttp.responseText  

Set RegularExpressionObject = nothing
Set vXMLHttp = nothing

arrList = split(strResponse, chr(38))

For each item in arrList
   Response.Write(item & "<br />" )
Next

strTemp =  arrList(4)
arrList =  split(strTemp, chr(61))
Response.Write("<br><br>Now you need to redirect user to paypal server to complete transaction using following URL:<br>")
Response.Write("https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=" &arrList(1))

%>

EDITED TO SHOW SOLUTION


回答1:


Certificate authentication doesn't work in Classic ASP. Try using an external library (like cURL) for doing HTTPS requests.



来源:https://stackoverflow.com/questions/18719807/msxml3-dll-error-80072f0c-a-certificate-is-required-to-complete-client-authent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!