Changeset f049319
- Timestamp:
- May 30, 2019 2:26:11 PM (20 months ago)
- Branches:
- master
- Children:
- aae81a7b
- Parents:
- 6b3896c
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigKeyringHandler.java
r6b3896c rf049319 22 22 private String _key; 23 23 private String _secret; 24 private String[] _revokes; 24 25 private int _mode; 25 26 26 27 @Override 27 28 protected void processForm() { 28 boolean adding = _action.equals(_t("Add key")); 29 if (adding || _action.equals(_t("Delete key"))) { 29 if (_action.equals(_t("Add key"))) { 30 30 if (_peer == null) { 31 31 addFormError(_t("You must enter a destination")); … … 37 37 h = ConvertToHash.getHash(_peer); 38 38 } 39 if (adding) { 39 40 40 byte[] b = null; 41 41 if (_mode == 1 || _mode == 4 || _mode == 5) { … … 167 167 } 168 168 } 169 } else { // Delete 170 if (h != null && h.getData() != null) { 171 if (_context.clientManager().isLocal(h)) { 172 // don't bother translating 173 addFormError("Cannot remove key for local destination. Disable encryption in the Hidden Services Manager."); 174 } else if (_context.keyRing().remove(h) != null) { 175 addFormNotice(_t("Key for {0} removed from keyring", h.toBase32())); 176 } else { 177 addFormNotice(_t("Key for {0} not found in keyring", h.toBase32())); 178 } 169 170 } else if (_action.equals(_t("Delete key")) && _revokes != null) { 171 // these should all be b32s or b33s 172 for (String p : _revokes) { 173 boolean removed = false; 174 if (p.length() == 60) { 175 // don't wait for several seconds for b33 lookup 176 Hash h = ConvertToHash.getHash(p); 177 if (h != null) { 178 if (_context.clientManager().isLocal(h)) { 179 // don't bother translating 180 addFormError("Cannot remove key for local destination. Disable encryption in the Hidden Services Manager."); 181 } else if (_context.keyRing().remove(h) != null) { 182 removed = true; 183 } 184 } 185 } else if (p.length() > 60) { 186 try { 187 BlindData bd = Blinding.decode(_context, p); 188 if (bd != null) { 189 SigningPublicKey spk = bd.getUnblindedPubKey(); 190 removed = _context.netDb().removeBlindData(spk); 191 } 192 } catch (IllegalArgumentException iae) {} 179 193 } else { 180 addFormError(_t("Invalid destination")); 194 addFormError(_t("Invalid destination") + ": " + p); 195 } 196 if (removed) { 197 addFormNotice(_t("Key for {0} removed from keyring", p)); 198 } else { 199 addFormError(_t("Key for {0} not found in keyring", p)); 181 200 } 182 201 } … … 204 223 } catch (NumberFormatException nfe) {} 205 224 } 225 226 /** @since 0.9.41 */ 227 public void setRevokeClient(String[] revokes) { _revokes = revokes; } 206 228 } -
apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigKeyringHelper.java
r6b3896c rf049319 46 46 */ 47 47 private void render(StringBuilder buf, boolean local) { 48 buf.append("\n<table class=\"configtable\"><tr><th align=\"left\">").append(_t("Destination")) 48 buf.append("\n<table class=\"configtable\"><tr>"); 49 if (!local) 50 buf.append("<th align=\"left\">").append(_t("Delete")); 51 buf.append("<th align=\"left\">").append(_t("Destination")) 49 52 .append("<th align=\"left\">").append(_t("Name")); 50 53 if (!local) … … 60 63 continue; 61 64 buf.append("\n<tr><td>"); 62 buf.append(h.toBase32()); 65 String b32 = h.toBase32(); 66 if (!local) 67 buf.append("<input value=\"").append(b32).append("\" type=\"checkbox\" name=\"revokeClient\" class=\"tickbox\"/></td><td>"); 68 buf.append(b32); 63 69 buf.append("</td><td>"); 64 70 Destination dest = _context.netDb().lookupDestinationLocally(h); … … 87 93 for (BlindData bd : bdata) { 88 94 buf.append("\n<tr><td>"); 89 buf.append(bd.toBase32()); 95 String b32 = bd.toBase32(); 96 if (!local) 97 buf.append("<input value=\"").append(b32).append("\" type=\"checkbox\" name=\"revokeClient\" class=\"tickbox\"/></td><td>"); 98 buf.append(b32); 90 99 buf.append("</td><td>"); 91 100 Hash h = bd.getDestHash(); -
apps/routerconsole/jsp/configkeyring.jsp
r6b3896c rf049319 22 22 <%=intl._t("The router keyring is used to decrypt encrypted leaseSets.")%> 23 23 <%=intl._t("The keyring may contain keys for local or remote encrypted destinations.")%></p> 24 <jsp:getProperty name="keyringhelper" property="summary" />25 24 <form action="" method="POST"> 26 25 <input type="hidden" name="nonce" value="<%=pageNonce%>" > 26 <jsp:getProperty name="keyringhelper" property="summary" /> 27 <table id="addkeyring"><tr><td align="right"> 28 <input type="reset" class="cancel" value="<%=intl._t("Cancel")%>" > 29 <input type="submit" name="action" class="delete" value="<%=intl._t("Delete key")%>" > 30 </td></tr></table> 27 31 <h3 class="tabletitle"><%=intl._t("Manual Keyring Addition")%></h3> 28 32 <table id="addkeyring"> … … 49 53 <option title="<%=intl._t("Only clients with the password will be able to connect")%>" value="3"> 50 54 <%=intl._t("Blinded with lookup password")%></option> 51 <option title="<%=intl._t("Only clients with the encryption key will be able to connect")%>" value="4" >55 <option title="<%=intl._t("Only clients with the encryption key will be able to connect")%>" value="4" selected="selected"> 52 56 <%=intl._t("Blinded with shared key")%></option> 53 57 <option title="<%=intl._t("Only clients with the password and key will be able to connect")%>" value="5"> … … 67 71 <td align="right" colspan="2"> 68 72 <input type="reset" class="cancel" value="<%=intl._t("Cancel")%>" > 69 <input type="submit" name="action" class="delete" value="<%=intl._t("Delete key")%>" >70 73 <input type="submit" name="action" class="add" value="<%=intl._t("Add key")%>" > 71 74 </td></tr></table></form></div></body></html> -
router/java/src/net/i2p/router/NetworkDatabaseFacade.java
r6b3896c rf049319 188 188 return null; 189 189 } 190 191 /** 192 * For console ConfigKeyringHelper 193 * @return true if removed 194 * @since 0.9.41 195 */ 196 public boolean removeBlindData(SigningPublicKey spk) { 197 return false; 198 } 190 199 } -
router/java/src/net/i2p/router/networkdb/kademlia/BlindCache.java
r6b3896c rf049319 247 247 List<BlindData> rv = new ArrayList<BlindData>(_cache.size()); 248 248 rv.addAll(_cache.values()); 249 return rv; 250 } 251 252 /** 253 * For console ConfigKeyringHelper. 254 * Persists immediately if removed. 255 * 256 * @param spk the unblinded public key 257 * @return true if removed 258 * @since 0.9.41 259 */ 260 public boolean removeBlindData(SigningPublicKey spk) { 261 boolean rv = false; 262 BlindData bd = _cache.remove(spk); 263 if (bd != null) { 264 rv = true; 265 _reverseCache.remove(bd.getBlindedPubKey()); 266 Hash h = bd.getDestHash(); 267 if (h != null) 268 _hashCache.remove(h); 269 store(); 270 } 249 271 return rv; 250 272 } -
router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java
r6b3896c rf049319 501 501 public List<BlindData> getBlindData() { 502 502 return _blindCache.getData(); 503 } 504 505 /** 506 * For console ConfigKeyringHelper 507 * @param spk the unblinded public key 508 * @return true if removed 509 * @since 0.9.41 510 */ 511 public boolean removeBlindData(SigningPublicKey spk) { 512 return _blindCache.removeBlindData(spk); 503 513 } 504 514
Note: See TracChangeset
for help on using the changeset viewer.