1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-24 19:47:58 +01:00

Fix TLSUtils.AcceptAllTrustManager

Should not throw an Exception, but instead return a zero-sized
array. Also add some javadoc.
This commit is contained in:
Florian Schmaus 2014-07-09 09:42:31 +02:00
parent bdf9a75c4f
commit b0825f73fd

View file

@ -78,7 +78,8 @@ public class TLSUtils {
/** /**
* Accept all SSL/TLS certificates. * Accept all SSL/TLS certificates.
* <p> * <p>
* <b>Warning</b> Use with care. Only use this method if you understand the implications. * <b>Warning</b> Use with care. This method make the Connection use
* {@link AcceptAllTrustManager}. Only use this method if you understand the implications.
* </p> * </p>
* *
* @param conf * @param conf
@ -134,6 +135,14 @@ public class TLSUtils {
} }
} }
/**
* A {@link X509TrustManager} that <b>doesn't validate</b> X.509 certificates.
* <p>
* Connections that use this TrustManager will just be encrypted, without any guarantee that the
* counter part is actually the intended one. Man-in-the-Middle attacks will be possible, since
* any certificate presented by the attacker will be considered valid.
* </p>
*/
public static class AcceptAllTrustManager implements X509TrustManager { public static class AcceptAllTrustManager implements X509TrustManager {
@Override @Override
@ -150,7 +159,7 @@ public class TLSUtils {
@Override @Override
public X509Certificate[] getAcceptedIssuers() { public X509Certificate[] getAcceptedIssuers() {
throw new UnsupportedOperationException(); return new X509Certificate[0];
} }
} }
} }