Package aQute.bnd.url
Class HttpsVerification
- java.lang.Object
-
- aQute.bnd.url.DefaultURLConnectionHandler
-
- aQute.bnd.url.HttpsVerification
-
- All Implemented Interfaces:
Plugin
,RegistryPlugin
,URLConnectionHandler
,Report
,Reporter
public class HttpsVerification extends DefaultURLConnectionHandler
TODO Needs testing Can be used to override default verification of HTTPS.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interface
HttpsVerification.Config
-
Nested classes/interfaces inherited from interface aQute.service.reporter.Report
Report.Location
-
Nested classes/interfaces inherited from interface aQute.service.reporter.Reporter
Reporter.SetLocation
-
-
Field Summary
Fields Modifier and Type Field Description private java.security.cert.X509Certificate[]
certificateChain
private java.lang.String
certificatesPath
private javax.net.ssl.SSLSocketFactory
factory
(package private) static org.slf4j.Logger
logger
private boolean
verify
-
Fields inherited from class aQute.bnd.url.DefaultURLConnectionHandler
registry
-
Fields inherited from interface aQute.bnd.service.url.URLConnectionHandler
MATCH
-
-
Constructor Summary
Constructors Constructor Description HttpsVerification()
HttpsVerification(java.lang.String certificates, boolean hostnameVerify, Reporter reporter)
HttpsVerification(java.security.cert.X509Certificate[] certificateChain, boolean b, Reporter hc)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.util.List<java.security.cert.X509Certificate>
createCertificates(java.lang.String paths)
static void
getCertificates(java.lang.String paths, java.util.List<java.security.cert.X509Certificate> certificates)
void
handle(java.net.URLConnection connection)
Ensure Https verification is disabled or matches given certificatesprivate void
init()
Initialize the SSL Context and factory.void
setProperties(java.util.Map<java.lang.String,java.lang.String> map)
Set the propertiesjava.lang.String
toString()
-
Methods inherited from class aQute.bnd.url.DefaultURLConnectionHandler
addMatcher, error, exception, getErrors, getLocation, getWarnings, isOk, isPedantic, matches, matches, progress, setRegistry, setReporter, trace, warning
-
-
-
-
Constructor Detail
-
HttpsVerification
public HttpsVerification()
-
HttpsVerification
public HttpsVerification(java.lang.String certificates, boolean hostnameVerify, Reporter reporter)
-
HttpsVerification
public HttpsVerification(java.security.cert.X509Certificate[] certificateChain, boolean b, Reporter hc)
-
-
Method Detail
-
init
private void init() throws java.security.NoSuchAlgorithmException, java.security.KeyManagementException, java.io.FileNotFoundException, java.security.cert.CertificateException, java.io.IOException, java.security.InvalidAlgorithmParameterException
Initialize the SSL Context and factory.- Throws:
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
java.io.IOException
java.security.cert.CertificateException
java.io.FileNotFoundException
java.security.InvalidAlgorithmParameterException
-
handle
public void handle(java.net.URLConnection connection) throws java.lang.Exception
Ensure Https verification is disabled or matches given certificates- Specified by:
handle
in interfaceURLConnectionHandler
- Overrides:
handle
in classDefaultURLConnectionHandler
- Parameters:
connection
- The connection to modify- Throws:
java.lang.Exception
-
setProperties
public void setProperties(java.util.Map<java.lang.String,java.lang.String> map) throws java.lang.Exception
Set the properties- Specified by:
setProperties
in interfacePlugin
- Overrides:
setProperties
in classDefaultURLConnectionHandler
- Parameters:
map
- attributes and directives for this plugin's clause- Throws:
java.lang.Exception
-
createCertificates
java.util.List<java.security.cert.X509Certificate> createCertificates(java.lang.String paths) throws java.io.FileNotFoundException, java.security.cert.CertificateException, java.io.IOException
- Throws:
java.io.FileNotFoundException
java.security.cert.CertificateException
java.io.IOException
-
getCertificates
public static void getCertificates(java.lang.String paths, java.util.List<java.security.cert.X509Certificate> certificates) throws java.security.cert.CertificateException, java.io.IOException
- Throws:
java.security.cert.CertificateException
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-