G
Guest
Hello Friends,
I have configured my web service for SSL. Now When I call my web service
using SSL, I get following error when calling it from Pocket PC Application.
I am using .NET CF 2.0 on windows mobile 2003.
I get following two errors
2146762486
2146762481
If i am not wrong first one is for chaining problem and second one is when
computer name does not match with the certificate name or something. I don't
really what all these ( i searched on net and come to know about this).
My question is can i ignore these two errors and simply return true? Will my
communication still on SSL?
My code is...
System.Net.ServicePointManager.CertificatePolicy = New
MyCertificateValidation
Public Class MyCertificateValidation
Implements ICertificatePolicy
' Default policy for certificate validation.
Public Shared DefaultValidate As Boolean = False
Public Function CheckValidationResult(ByVal srvPoint As
ServicePoint, _
ByVal cert As X509Certificate, ByVal request As WebRequest, ByVal
problem As Integer) _
As Boolean Implements ICertificatePolicy.CheckValidationResult
Dim ValidationResult As Boolean = False
Debug.WriteLine(("Certificate Problem with accessing " & _
request.RequestUri.ToString()))
'Debug.Write("Problem code 0x{0:X8},", CInt(problem))
Debug.WriteLine(GetProblemMessage(CType(problem, _
CertificateProblem)))
If problem = -2146762486 Or problem = -2146762481 Or problem = 0
Then
Return True
End If
ValidationResult = DefaultValidate
Return ValidationResult
End Function
Private Function GetProblemMessage(ByVal Problem As
CertificateProblem) As String
Dim ProblemMessage As String = ""
Dim problemList As New CertificateProblem()
Dim ProblemCodeName As String = Problem
If Not (ProblemCodeName Is Nothing) Then
ProblemMessage = ProblemMessage + "-Certificateproblem:" & _
ProblemCodeName
Else
ProblemMessage = "Unknown Certificate Problem"
End If
Return ProblemMessage
End Function
End Class
Public Enum CertificateProblem As Long
CertEXPIRED = 2148204801 ' 0x800B0101
CertVALIDITYPERIODNESTING = 2148204802 ' 0x800B0102
CertROLE = 2148204803 ' 0x800B0103
CertPATHLENCONST = 2148204804 ' 0x800B0104
CertCRITICAL = 2148204805 ' 0x800B0105
CertPURPOSE = 2148204806 ' 0x800B0106
CertISSUERCHAINING = 2148204807 ' 0x800B0107
CertMALFORMED = 2148204808 ' 0x800B0108
CertUNTRUSTEDROOT = 2148204809 ' 0x800B0109
CertCHAINING = 2148204810 ' 0x800B010A
CertREVOKED = 2148204812 ' 0x800B010C
CertUNTRUSTEDTESTROOT = 2148204813 ' 0x800B010D
CertREVOCATION_FAILURE = 2148204814 ' 0x800B010E
CertCN_NO_MATCH = 2148204815 ' 0x800B010F
CertWRONG_USAGE = 2148204816 ' 0x800B0110
CertUNTRUSTEDCA = 2148204818 ' 0x800B0112
End Enum
Please help me.
Thanks,
Viral
I have configured my web service for SSL. Now When I call my web service
using SSL, I get following error when calling it from Pocket PC Application.
I am using .NET CF 2.0 on windows mobile 2003.
I get following two errors
2146762486
2146762481
If i am not wrong first one is for chaining problem and second one is when
computer name does not match with the certificate name or something. I don't
really what all these ( i searched on net and come to know about this).
My question is can i ignore these two errors and simply return true? Will my
communication still on SSL?
My code is...
System.Net.ServicePointManager.CertificatePolicy = New
MyCertificateValidation
Public Class MyCertificateValidation
Implements ICertificatePolicy
' Default policy for certificate validation.
Public Shared DefaultValidate As Boolean = False
Public Function CheckValidationResult(ByVal srvPoint As
ServicePoint, _
ByVal cert As X509Certificate, ByVal request As WebRequest, ByVal
problem As Integer) _
As Boolean Implements ICertificatePolicy.CheckValidationResult
Dim ValidationResult As Boolean = False
Debug.WriteLine(("Certificate Problem with accessing " & _
request.RequestUri.ToString()))
'Debug.Write("Problem code 0x{0:X8},", CInt(problem))
Debug.WriteLine(GetProblemMessage(CType(problem, _
CertificateProblem)))
If problem = -2146762486 Or problem = -2146762481 Or problem = 0
Then
Return True
End If
ValidationResult = DefaultValidate
Return ValidationResult
End Function
Private Function GetProblemMessage(ByVal Problem As
CertificateProblem) As String
Dim ProblemMessage As String = ""
Dim problemList As New CertificateProblem()
Dim ProblemCodeName As String = Problem
If Not (ProblemCodeName Is Nothing) Then
ProblemMessage = ProblemMessage + "-Certificateproblem:" & _
ProblemCodeName
Else
ProblemMessage = "Unknown Certificate Problem"
End If
Return ProblemMessage
End Function
End Class
Public Enum CertificateProblem As Long
CertEXPIRED = 2148204801 ' 0x800B0101
CertVALIDITYPERIODNESTING = 2148204802 ' 0x800B0102
CertROLE = 2148204803 ' 0x800B0103
CertPATHLENCONST = 2148204804 ' 0x800B0104
CertCRITICAL = 2148204805 ' 0x800B0105
CertPURPOSE = 2148204806 ' 0x800B0106
CertISSUERCHAINING = 2148204807 ' 0x800B0107
CertMALFORMED = 2148204808 ' 0x800B0108
CertUNTRUSTEDROOT = 2148204809 ' 0x800B0109
CertCHAINING = 2148204810 ' 0x800B010A
CertREVOKED = 2148204812 ' 0x800B010C
CertUNTRUSTEDTESTROOT = 2148204813 ' 0x800B010D
CertREVOCATION_FAILURE = 2148204814 ' 0x800B010E
CertCN_NO_MATCH = 2148204815 ' 0x800B010F
CertWRONG_USAGE = 2148204816 ' 0x800B0110
CertUNTRUSTEDCA = 2148204818 ' 0x800B0112
End Enum
Please help me.
Thanks,
Viral