From 767476ea510ecbbc0eb5e8e5cf06055225754147 Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 18 Jul 2016 14:39:35 +0000 Subject: [PATCH] SU3File: Also look in config dir for signer certificate --- core/java/src/net/i2p/crypto/SU3File.java | 21 +++++++++++++++++-- history.txt | 3 +++ .../src/net/i2p/router/RouterVersion.java | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/core/java/src/net/i2p/crypto/SU3File.java b/core/java/src/net/i2p/crypto/SU3File.java index 78e30d875..abe954af6 100644 --- a/core/java/src/net/i2p/crypto/SU3File.java +++ b/core/java/src/net/i2p/crypto/SU3File.java @@ -314,6 +314,7 @@ public class SU3File { if (_certFile != null) { _signerPubkey = loadKey(_certFile); } else { + // look in both install dir and config dir for the signer cert KeyRing ring = new DirKeyRing(new File(_context.getBaseDir(), "certificates")); try { _signerPubkey = ring.getKey(_signer, _contentType.getName(), _sigType); @@ -322,8 +323,24 @@ public class SU3File { ioe.initCause(gse); throw ioe; } - if (_signerPubkey == null) - throw new IOException("unknown signer: " + _signer + " for content type: " + _contentType.getName()); + if (_signerPubkey == null) { + boolean diff = true; + try { + diff = !_context.getBaseDir().getCanonicalPath().equals(_context.getConfigDir().getCanonicalPath()); + } catch (IOException ioe) {} + if (diff) { + ring = new DirKeyRing(new File(_context.getConfigDir(), "certificates")); + try { + _signerPubkey = ring.getKey(_signer, _contentType.getName(), _sigType); + } catch (GeneralSecurityException gse) { + IOException ioe = new IOException("keystore error"); + ioe.initCause(gse); + throw ioe; + } + } + if (_signerPubkey == null) + throw new IOException("unknown signer: " + _signer + " for content type: " + _contentType.getName()); + } } } _headerVerified = true; diff --git a/history.txt b/history.txt index ecf453fd8..d73cdb92a 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,6 @@ +2016-07-18 zzz + * SU3File: Also look in config dir for signer certificate + 2016-07-16 zzz * I2CP Client: Handle disconnect properly if received before first LS * Streaming: Kill accept() when session disconnects diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index f6e6df3a5..4e28a2c8d 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -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 = 4; + public final static long BUILD = 5; /** for example "-test" */ public final static String EXTRA = "";