forked from I2P_Developers/i2p.i2p
Utils: Allow absolute path to certs in I2PSSLSocketFactory
This commit is contained in:
@ -237,7 +237,7 @@ public class I2PSSLSocketFactory {
|
||||
private final I2PAppContext _context;
|
||||
|
||||
/**
|
||||
* @param relativeCertPath e.g. "certificates/i2cp"
|
||||
* @param relativeCertPath e.g. "certificates/i2cp"; as of 0.9.41, may be absolute
|
||||
* @since 0.9.9 was static
|
||||
*/
|
||||
public I2PSSLSocketFactory(I2PAppContext context, boolean loadSystemCerts, String relativeCertPath)
|
||||
@ -468,7 +468,10 @@ public class I2PSSLSocketFactory {
|
||||
|
||||
/**
|
||||
* Loads certs from
|
||||
* the ~/.i2p/certificates/ and $I2P/certificates/ directories.
|
||||
* the ~/.i2p/certificates/ and $I2P/certificates/ directories,
|
||||
* or from the absolute path given.
|
||||
*
|
||||
* @param relativeCertPath e.g. "certificates/i2cp"; as of 0.9.41, may be absolute
|
||||
*/
|
||||
private static SSLSocketFactory initSSLContext(I2PAppContext context, boolean loadSystemCerts, String relativeCertPath)
|
||||
throws GeneralSecurityException {
|
||||
@ -487,7 +490,10 @@ public class I2PSSLSocketFactory {
|
||||
}
|
||||
}
|
||||
|
||||
File dir = new File(context.getConfigDir(), relativeCertPath);
|
||||
File dir = new File(relativeCertPath);
|
||||
boolean wasAbsolute = dir.isAbsolute();
|
||||
if (!wasAbsolute)
|
||||
dir = new File(context.getConfigDir(), relativeCertPath);
|
||||
int adds = KeyStoreUtil.addCerts(dir, ks);
|
||||
int totalAdds = adds;
|
||||
if (adds > 0) {
|
||||
@ -495,7 +501,9 @@ public class I2PSSLSocketFactory {
|
||||
log.info("Loaded " + adds + " trusted certificates from " + dir.getAbsolutePath());
|
||||
}
|
||||
|
||||
File dir2 = new File(context.getBaseDir(), relativeCertPath);
|
||||
File dir2;
|
||||
if (!wasAbsolute) {
|
||||
dir2 = new File(context.getBaseDir(), relativeCertPath);
|
||||
if (!dir.getAbsolutePath().equals(dir2.getAbsolutePath())) {
|
||||
adds = KeyStoreUtil.addCerts(dir2, ks);
|
||||
totalAdds += adds;
|
||||
@ -504,6 +512,10 @@ public class I2PSSLSocketFactory {
|
||||
log.info("Loaded " + adds + " trusted certificates from " + dir.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// for logging below
|
||||
dir2 = dir;
|
||||
}
|
||||
if (totalAdds > 0 || loadSystemCerts) {
|
||||
if (log.shouldLog(Log.INFO))
|
||||
log.info("Loaded total of " + totalAdds + " new trusted certificates");
|
||||
|
18
history.txt
18
history.txt
@ -1,3 +1,21 @@
|
||||
2019-05-11 zzz
|
||||
* Utils: Allow absolute path to certs in I2PSSLSocketFactory
|
||||
|
||||
2019-05-10 zzz
|
||||
* NetDB: Store Meta LS2 to floodfills (proposal #123)
|
||||
|
||||
2019-05-09 zzz
|
||||
* Console:
|
||||
- Delay plugin update check until router is ready
|
||||
- Remove plugin install success message (ticket #2494)
|
||||
* Transport: Start first GeoIP lookup when netdb is ready
|
||||
* Wrapper:
|
||||
- Add support for armv7 and aarch64 (ticket #2308)
|
||||
- Update to 3.5.39
|
||||
|
||||
2019-05-08 zzz
|
||||
* Utils: Auto-generate su3 output file for extract if not specified
|
||||
|
||||
* 2019-05-07 0.9.40 released
|
||||
|
||||
2019-05-02 zzz
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 1;
|
||||
public final static long BUILD = 2;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
Reference in New Issue
Block a user