I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 74743357 authored by zzz's avatar zzz
Browse files

* TrustedUpdate: Preserve default key names even when keys are set

                   in advanced config
parent 1de88909
No related branches found
No related tags found
No related merge requests found
...@@ -160,6 +160,15 @@ riCe6OlAEiNpcc6mMyIYYWFICbrDFTrDR3wXqwc/Jkcx6L5VVWoagpSzbo3yGhc= ...@@ -160,6 +160,15 @@ riCe6OlAEiNpcc6mMyIYYWFICbrDFTrDR3wXqwc/Jkcx6L5VVWoagpSzbo3yGhc=
/** 172 */ /** 172 */
private static final int KEYSIZE_B64_BYTES = 2 + (SigningPublicKey.KEYSIZE_BYTES * 4 / 3); private static final int KEYSIZE_B64_BYTES = 2 + (SigningPublicKey.KEYSIZE_BYTES * 4 / 3);
private static final Map<String, String> DEFAULT_KEYS = new HashMap(4);
static {
//DEFAULT_KEYS.put(DEFAULT_TRUSTED_KEY, "jrandom@mail.i2p");
DEFAULT_KEYS.put(DEFAULT_TRUSTED_KEY2, "zzz@mail.i2p");
//DEFAULT_KEYS.put(DEFAULT_TRUSTED_KEY3, "complication@mail.i2p");
DEFAULT_KEYS.put(DEFAULT_TRUSTED_KEY4, "HungryHobo@mail.i2p");
DEFAULT_KEYS.put(DEFAULT_TRUSTED_KEY5, "killyourtv@mail.i2p");
}
/** /**
* Constructs a new <code>TrustedUpdate</code> with the default global * Constructs a new <code>TrustedUpdate</code> with the default global
* context. * context.
...@@ -184,15 +193,18 @@ riCe6OlAEiNpcc6mMyIYYWFICbrDFTrDR3wXqwc/Jkcx6L5VVWoagpSzbo3yGhc= ...@@ -184,15 +193,18 @@ riCe6OlAEiNpcc6mMyIYYWFICbrDFTrDR3wXqwc/Jkcx6L5VVWoagpSzbo3yGhc=
if ( (propertyTrustedKeys != null) && (propertyTrustedKeys.length() > 0) ) { if ( (propertyTrustedKeys != null) && (propertyTrustedKeys.length() > 0) ) {
StringTokenizer propertyTrustedKeysTokens = new StringTokenizer(propertyTrustedKeys, " ,\r\n"); StringTokenizer propertyTrustedKeysTokens = new StringTokenizer(propertyTrustedKeys, " ,\r\n");
while (propertyTrustedKeysTokens.hasMoreTokens()) while (propertyTrustedKeysTokens.hasMoreTokens()) {
addKey(propertyTrustedKeysTokens.nextToken().trim(), ""); // If a key from the defaults, use the same name
String key = propertyTrustedKeysTokens.nextToken().trim();
String name = DEFAULT_KEYS.get(key);
if (name == null)
name = "";
addKey(key, name);
}
} else { } else {
//addKey(DEFAULT_TRUSTED_KEY, "jrandom@mail.i2p"); for (Map.Entry<String, String> e : DEFAULT_KEYS.entrySet()) {
addKey(DEFAULT_TRUSTED_KEY2, "zzz@mail.i2p"); addKey(e.getKey(), e.getValue());
//addKey(DEFAULT_TRUSTED_KEY3, "complication@mail.i2p"); }
addKey(DEFAULT_TRUSTED_KEY4, "HungryHobo@mail.i2p");
addKey(DEFAULT_TRUSTED_KEY5, "killyourtv@mail.i2p");
} }
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("TrustedUpdate created, trusting " + _trustedKeys.size() + " keys."); _log.debug("TrustedUpdate created, trusting " + _trustedKeys.size() + " keys.");
...@@ -207,6 +219,8 @@ riCe6OlAEiNpcc6mMyIYYWFICbrDFTrDR3wXqwc/Jkcx6L5VVWoagpSzbo3yGhc= ...@@ -207,6 +219,8 @@ riCe6OlAEiNpcc6mMyIYYWFICbrDFTrDR3wXqwc/Jkcx6L5VVWoagpSzbo3yGhc=
* @return true if successful * @return true if successful
*/ */
public boolean addKey(String key, String name) { public boolean addKey(String key, String name) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Adding " + name + ": " + key);
SigningPublicKey signingPublicKey = new SigningPublicKey(); SigningPublicKey signingPublicKey = new SigningPublicKey();
try { try {
// fromBase64() will throw a DFE if length is not right // fromBase64() will throw a DFE if length is not right
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment