Hi, 
 
I'm trying to get android running with ssl (for a long time). 
I have a WCF Service which I want to query from android.(Authentication + 
SSL)
 
 
On this link the following is stated: 
http://android-developers.blogspot.de/2012/03/unifying-key-store-access-in-ics.html
 
 
"A common use of the private key is for SSL client authentication. 
This can be implemented by using an 
*HttpsURLConnection*<http://developer.android.com/reference/javax/net/ssl/HttpsURLConnection.html>with
 a custom 
*X509KeyManager*<http://developer.android.com/reference/javax/net/ssl/X509KeyManager.html>
 
that returns the PrivateKey retrieved from the KeyChain API. 
The open source Email application for ICS uses KeyChain with an *
X509ExtendedKeyManager*<http://developer.android.com/reference/javax/net/ssl/X509ExtendedKeyManager.html>.
 

To learn more, have a look at the source code (in SSLUtils.java)."
 
I tried to use this SSLUtil class. 
 
Here is how I call it: (The response i get is 403 - Forbbiden). I really 
hope you can help me.
 
 private void setHttpsAdvanced*()* *{* HostAuth ht *=* *new* HostAuth*();* 
ht*.*mPort *=* 443*;* ht*.*mClientCertAlias *=* "jensZert"*;* HttpParams 
params *=* getHttpParams*();* MyThreadSafeClientConnManager ccm *=* 
MyThreadSafeClientConnManager *.*newInstance*(*params*,* *true,* 443*);* *
try* *{* ccm*.*registerClientCert*(*getApplicationContext*(),* ht*);* *}* *
catch* *(*CertificateException e*)* *{* e*.*printStackTrace*();* *}* *this.*
httpclient *=* *new* DefaultHttpClient*(*ccm*,* params*);* connectionInfo *=
* *this.*getConnectionInfo*();* *this.*url *=* String*.*format*(*
"%1$s://%2$s/%3$s/%4$s"*,* connectionInfo*.*Protocol*,* connectionInfo*.*
ServerName*,* connectionInfo*.*WebserviceName*,* connectionInfo*.*Path*);* 
httpGet *=* *new* HttpGet*(*url*);* *}* private String 
callTheWebserviceCertificate*()* *{* *this.*setupClient*();* String result *
=* ""*;* HttpResponse response *=* *null;* *try* *{* response *=* *(*
HttpResponse*)* *this.*httpclient*.*execute*(*httpGet*);* result *=* 
EntityUtils*.*toString*(*response*.*getEntity*());* *}* *catch* *(*
ClientProtocolException e*)* *{* e*.*printStackTrace*();* *}* *catch* *(*
IOException e*)* *{* result *=* e*.*getMessage*()* *+* "\n"*;* *for* *(*
StackTraceElement el *:* e*.*getStackTrace*())* *{* result *+=* el*.*
toString*()* *+* "\n"*;* *}* Log*.*d*(*TAG*,* result*);* *}* *return* result
*;* *}*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

-- 
You received this message because you are subscribed to the Google Groups 
"Android Security Discussions" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/android-security-discuss/-/22rX95vqBZMJ.
To post to this group, send email to android-security-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
android-security-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/android-security-discuss?hl=en.

Reply via email to