This project is read-only.

EWS JAVA Certificate Validation -Sample

Jun 14, 2012 at 12:49 PM

Can anyone please some sample code for Certificate Validation with EWS and JAVA.

Coordinator
Jun 23, 2012 at 4:54 PM

Sorry, don't have a sample for that.  Certificate verification is handled outside of the EWS Managed API in the .NET world.  I think you'll have to look outside of the EWS Java API as well.  There are some open Java libraries for certificate verification you can use.

Jun 26, 2012 at 9:46 AM

I have tried this but not working:

 

public static TrustManager getTrustManager () {
		try {
			File f = new File("ctest.pfx");
			FileInputStream is = new FileInputStream(f);
			KeyStore ks = KeyStore.getInstance("PKCS12");
			String p = "pass@123";
			ks.load(is, p.toCharArray());
			
			TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
			tmf.init(ks);
			
			TrustManager tms[] = tmf.getTrustManagers();
			
			return tms[0];
		} catch (Exception ex) {
			ex.printStackTrace();
			return null;
		}
	}

 And then:

 ClientCertificateCredentials credentials = new ClientCertificateCredentials(TMImpl.getTrustManager());

It is throwing error:

- NTLM authentication scheme selected

- No credentials available for NTLM <any realm>@Host:port

microsoft.exchange.webservices.data.HttpErrorException

 

: The remote server returned an error: (401)Unauthorized

Any idea what I am doing wrong in here?