Package org.apache.http.conn.ssl
Class TrustSelfSignedStrategy
- java.lang.Object
-
- org.apache.http.conn.ssl.TrustSelfSignedStrategy
-
- All Implemented Interfaces:
TrustStrategy
,TrustStrategy
public class TrustSelfSignedStrategy extends java.lang.Object implements TrustStrategy
A trust strategy that accepts self-signed certificates as trusted. Verification of all other certificates is done by the trust manager configured in the SSL context.- Since:
- 4.1
-
-
Field Summary
Fields Modifier and Type Field Description static TrustSelfSignedStrategy
INSTANCE
-
Constructor Summary
Constructors Constructor Description TrustSelfSignedStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType)
Determines whether the certificate chain can be trusted without consulting the trust manager configured in the actual SSL context.
-
-
-
Field Detail
-
INSTANCE
public static final TrustSelfSignedStrategy INSTANCE
-
-
Method Detail
-
isTrusted
public boolean isTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType) throws java.security.cert.CertificateException
Description copied from interface:TrustStrategy
Determines whether the certificate chain can be trusted without consulting the trust manager configured in the actual SSL context. This method can be used to override the standard JSSE certificate verification process.Please note that, if this method returns
false
, the trust manager configured in the actual SSL context can still clear the certificate as trusted.- Specified by:
isTrusted
in interfaceTrustStrategy
- Parameters:
chain
- the peer certificate chainauthType
- the authentication type based on the client certificate- Returns:
true
if the certificate can be trusted without verification by the trust manager,false
otherwise.- Throws:
java.security.cert.CertificateException
- thrown if the certificate is not trusted or invalid.
-
-