In me application to windows mobile 2003, i was needed use a certificate conection to webservice. In me Project add a new Item Class and copying the example code from "X509Certificate.CreateFromCertFile Method", but in the code section " X509Certificate.CreateFromCertFile(Certificate)" VS2005 displaying this message "CreateFromCertFile is not a member of System.Security.Criptography.X509certificate.x509certificate". What is the problem
the Compact framework not support this method how can use a certificate in me application
Please help me.
That is the part of the sourcecode
UrlAllz = "https://www.lkxsoftware.com"
If Ramo = "2019" ThenAplicaAllz =
":555/drsw03/" ElseAplicaAllz =
":555/drsw01/" End If a.Url = UrlAllz & AplicaAllz & "servlet/rpcrouter" CertAllz = strAppDir & "\Gec.cer"cert = X509Certificate.CreateFromCertFile(CertAllz)
a.ClientCertificates.Add(cert)

I Have a problems to use a certificate into me code in Windows Mobile 2003
COBOLBeginner
Thanks,
but where i can find documentation about this
my application need connect to the webservices of the partner company with the PFX certificate created from this partner to developments created from others partners.
KingwoodJim
NETCF V2 does not support client authentication on web services/HttpWebRequest through the use of x509 certificates. You may want to consider other means of client authentication, for example, Negotiate(NTLM/Kerberos) or Digest over SSL.
Cheers,
Anthony Wong [MSFT]
Ian Rowland
X509Certificate.CreateFromCertFile is indeed not supported by the compact framework.
Use a FileStream object to read the certificate file into a byte array and then call the constructor X509Certificate(Byte[]).
Tovdb
Thanks, can you send me a web address to see an example in VB I was found examples but always writing in C# and when i translate to VB not run correctly.
entrance80
I'm copy this example from msdn documentation.
Sub Main()
' The path to the certificate.
Dim Certificate As String = "test.pfx"
' Load the certificate into an X509Certificate object.
Dim cert As New X509Certificate(Certificate)
Dim certData As Byte() = cert.Export(X509ContentType.Cert)
Dim newCert As New X509Certificate(certData)
' Get the value.
Dim resultsTrue As String = newCert.ToString(True)
' Display the value to the console.
Console.WriteLine(resultsTrue)
' Get the value.
Dim resultsFalse As String = newCert.ToString(False)
' Display the value to the console.
Console.WriteLine(resultsFalse)
End Sub
When run in an XP application i don't have any problem and can use a function with this code correctly. But when copy this code in an pocket Pc application, in the code "cert As New X509Certificate(Certificate)" appear this error:
"An String Type can't convert in to 1-dimensional array of byte"
And in the code "As Byte() = cert.Export(X509ContentType.Cert)" appear this other error:
"Export isn't a member of System.security.Criptography.X509Certificates.X509certificate"
What is the correctly use in the pocket Pc Application
Thanks
David Ray
This is a good place to start:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/mobilesdk5/html/mob5oriDevelopersReference.asp
Note that you will need to implement the HTTP and WS services together with SSPI client authentication.
Cheers,
Anthony Wong [MSFT]
annerajb
But i have installed in the pocket phone an PFX certificate and run correctly with IE to connect to secure web. when connect appear the list of installed certificates and choose the certificate and connect with service.
when i see the documentation from MSDN to this component X509certificate, i can read the compatibility from this component to the .Net compact framework.
i think that the possibility to use X509certificate(Byte[]) but i don't know because run when in the msdn documentation comment this possibility.
If impossible use an PFX certificate to sign the XML in the windows mobile 2003 that if is possible, how mount this
eqwang
Mr Wong,
I have been reading for days trying to determine how to get a Windows Mobile Device (ANY VERSION) to connect from a Mobile Device to a Web Service using SSL. Is there a MSDN article with example source code that will exhibit how to do it
You say Digest and NTLM/Kerberos will work with SSL I would like to see an example because there is much conflict and confusion on what is and what isnt supported on .NET CF2 even in these newsgroups.
Thanks
Nick
Titu
The .NET Compact Framework V2 does not support using a PFX certificate for client authentication. You may use native code and SSPI in the OS to do x509 client authentication.
Cheers,
Anthony Wong [MSFT]