Changeset 47c64c2e
- Timestamp:
- May 23, 2019 1:22:29 PM (22 months ago)
- Branches:
- master
- Children:
- 2abd59e
- Parents:
- 7bdfd07
- Location:
- apps/i2ptunnel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/TunnelConfig.java
r7bdfd07 r47c64c2e 656 656 config.setProperty(OPT + p, _otherOptions.get(p)); 657 657 } 658 659 switch (_encryptMode) { 660 case 0: // none 661 default: 662 config.remove(OPT + "i2cp.leaseSetSecret"); 663 if ("5".equals(config.get(OPT + "i2cp.leaseSetType"))) 664 config.remove(OPT + "i2cp.leaseSetType"); 665 break; 666 667 case 1: // LS1 668 config.remove(OPT + "i2cp.leaseSetType"); 669 config.remove(OPT + "i2cp.leaseSetSecret"); 670 config.remove(OPT + "i2cp.leaseSetAuthType"); 671 break; 672 673 case 2: // blinded 674 config.put(OPT + "i2cp.leaseSetType", "5"); 675 config.remove(OPT + "i2cp.leaseSetSecret"); 676 config.remove(OPT + "i2cp.leaseSetAuthType"); 677 break; 678 679 case 3: // blinded + secret 680 config.put(OPT + "i2cp.leaseSetType", "5"); 681 config.remove(OPT + "i2cp.leaseSetAuthType"); 682 break; 683 684 case 4: // blinded, shared key (implicit PSK) 685 config.put(OPT + "i2cp.leaseSetType", "5"); 686 config.remove(OPT + "i2cp.leaseSetSecret"); 687 config.put(OPT + "i2cp.leaseSetAuthType", "2"); 688 break; 689 690 case 5: // blinded, secret, shared key (implicit PSK) 691 config.put(OPT + "i2cp.leaseSetType", "5"); 692 config.put(OPT + "i2cp.leaseSetAuthType", "2"); 693 break; 694 695 case 6: // blinded, per-client PSK 696 config.put(OPT + "i2cp.leaseSetType", "5"); 697 config.remove(OPT + "i2cp.leaseSetSecret"); 698 config.put(OPT + "i2cp.leaseSetAuthType", "2"); 699 break; 700 701 case 7: // blinded, secret, per-client PSK 702 config.put(OPT + "i2cp.leaseSetType", "5"); 703 config.put(OPT + "i2cp.leaseSetAuthType", "2"); 704 break; 705 706 case 8: // blinded, per-client DH 707 config.put(OPT + "i2cp.leaseSetType", "5"); 708 config.remove(OPT + "i2cp.leaseSetSecret"); 709 config.put(OPT + "i2cp.leaseSetAuthType", "1"); 710 break; 711 712 case 9: // blinded, secret, per-client DH 713 config.put(OPT + "i2cp.leaseSetType", "5"); 714 config.put(OPT + "i2cp.leaseSetAuthType", "1"); 715 break; 716 717 case 10: // none (LS2) 718 config.put(OPT + "i2cp.leaseSetType", "3"); 719 config.remove(OPT + "i2cp.leaseSetSecret"); 720 config.remove(OPT + "i2cp.leaseSetAuthType"); 721 break; 722 723 } 658 processEncryptMode(config); 724 659 } 725 660 … … 845 780 846 781 return config; 782 } 783 784 /** 785 * Servers only. 786 * @since 0.9.41 pulled out from getConfig() above 787 */ 788 private void processEncryptMode(Properties config) { 789 switch (_encryptMode) { 790 case 0: // none 791 default: 792 config.remove(OPT + "i2cp.leaseSetSecret"); 793 config.remove(OPT + "i2cp.leaseSetType"); 794 config.remove(OPT + "i2cp.leaseSetKey"); 795 config.remove(OPT + "i2cp.leaseSetPrivKey"); 796 break; 797 798 case 10: // none (LS2) 799 config.put(OPT + "i2cp.leaseSetType", "3"); 800 config.remove(OPT + "i2cp.leaseSetSecret"); 801 config.remove(OPT + "i2cp.leaseSetAuthType"); 802 config.remove(OPT + "i2cp.leaseSetKey"); 803 config.remove(OPT + "i2cp.leaseSetPrivKey"); 804 break; 805 806 case 1: // encrypted LS1 807 addLeaseSetPrivKey(config, false); 808 config.remove(OPT + "i2cp.leaseSetSecret"); 809 config.remove(OPT + "i2cp.leaseSetAuthType"); 810 break; 811 812 case 2: // blinded 813 config.put(OPT + "i2cp.leaseSetType", "5"); 814 config.remove(OPT + "i2cp.leaseSetSecret"); 815 config.remove(OPT + "i2cp.leaseSetAuthType"); 816 config.remove(OPT + "i2cp.leaseSetKey"); 817 config.remove(OPT + "i2cp.leaseSetPrivKey"); 818 break; 819 820 case 3: // blinded + secret 821 config.put(OPT + "i2cp.leaseSetType", "5"); 822 config.remove(OPT + "i2cp.leaseSetAuthType"); 823 config.remove(OPT + "i2cp.leaseSetKey"); 824 config.remove(OPT + "i2cp.leaseSetPrivKey"); 825 break; 826 827 case 4: // blinded, shared key (implicit PSK) 828 addLeaseSetPrivKey(config, true); 829 config.remove(OPT + "i2cp.leaseSetSecret"); 830 config.put(OPT + "i2cp.leaseSetAuthType", "2"); 831 break; 832 833 case 5: // blinded, secret, shared key (implicit PSK) 834 addLeaseSetPrivKey(config, true); 835 config.put(OPT + "i2cp.leaseSetAuthType", "2"); 836 break; 837 838 case 6: // blinded, per-client PSK 839 addLeaseSetPrivKey(config, true); 840 config.remove(OPT + "i2cp.leaseSetSecret"); 841 config.put(OPT + "i2cp.leaseSetAuthType", "2"); 842 break; 843 844 case 7: // blinded, secret, per-client PSK 845 addLeaseSetPrivKey(config, true); 846 config.put(OPT + "i2cp.leaseSetAuthType", "2"); 847 break; 848 849 case 8: // blinded, per-client DH 850 addLeaseSetPrivKey(config, true); 851 config.remove(OPT + "i2cp.leaseSetSecret"); 852 config.put(OPT + "i2cp.leaseSetAuthType", "1"); 853 break; 854 855 case 9: // blinded, secret, per-client DH 856 addLeaseSetPrivKey(config, true); 857 config.put(OPT + "i2cp.leaseSetAuthType", "1"); 858 break; 859 860 } 861 } 862 863 /** 864 * Servers only. 865 * Also sets/clears i2cp.leaseSetType 866 * @since 0.9.41 867 */ 868 private void addLeaseSetPrivKey(Properties config, boolean isBlinded) { 869 // LS1 is AES, blinded is X25519, both are 32 random bytes. 870 // we always store in i2cp.leaseSetKey where the UI can find it. 871 // if blinded, we also store in i2cp.leaseSetPrivKey 872 String opt = OPT + "i2cp.leaseSetKey"; 873 String bopt = OPT + "i2cp.leaseSetPrivKey"; 874 String b64 = config.getProperty(opt); 875 if (b64 == null) { 876 byte[] data = new byte[32]; 877 _context.random().nextBytes(data); 878 b64 = Base64.encode(data); 879 config.setProperty(opt, b64); 880 } 881 if (isBlinded) { 882 config.setProperty(bopt, b64); 883 config.put(OPT + "i2cp.leaseSetType", "5"); 884 } else { 885 config.remove(bopt); 886 config.remove(OPT + "i2cp.leaseSetType"); 887 } 847 888 } 848 889 -
apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java
r7bdfd07 r47c64c2e 21 21 import net.i2p.app.Outproxy; 22 22 import net.i2p.crypto.Blinding; 23 import net.i2p.data.Base64; 23 24 import net.i2p.data.Certificate; 24 25 import net.i2p.data.DataHelper; … … 1286 1287 byte[] data = new byte[SessionKey.KEYSIZE_BYTES]; 1287 1288 _context.random().nextBytes(data); 1288 S essionKey sk = new SessionKey(data);1289 setEncryptKey( sk.toBase64());1289 String b64 = Base64.encode(data); 1290 setEncryptKey(b64); 1290 1291 setEncrypt(""); 1291 1292 saveChanges(); 1292 return "New Leaseset Encryption Key: " + sk.toBase64();1293 return "New Leaseset Encryption Key: " + b64; 1293 1294 } 1294 1295 -
apps/i2ptunnel/jsp/editServer.jsi
r7bdfd07 r47c64c2e 488 488 <b><%=intl._t("Encryption Key")%></b> 489 489 </td><td> 490 <b><%=intl._t("Generate New Key")%></b> (<%=intl._t("Tunnel must be stopped first")%>)491 </td>492 </tr><tr>493 <td>494 <textarea rows="1" style="height: 3em;" cols="44" id="leasesetKey" name="encryptKey" title="<%=intl._t("Encryption key required to access this service")%>" wrap="off" spellcheck="false"><%=editBean.getEncryptKey(curTunnel)%></textarea>495 </td><td>496 <button class="control" type="submit" name="action" value="Generate" title="<%=intl._t("Generate new encryption key")%>"><%=intl._t("Generate")%></button>497 </td>498 </tr>499 490 <% 500 491 if (allowBlinding && editBean.isAdvanced()) { 501 492 %> 502 <tr>503 <td>504 493 <b><%=intl._t("Optional lookup password")%>:</b> 494 <% 495 } // allowBlinding 496 %> 497 </td> 498 </tr><tr> 499 <td> 500 <textarea rows="1" style="height: 3em;" cols="44" id="leasesetKey" name="encryptKey" title="<%=intl._t("Encryption key required to access this service")%>" wrap="off" readonly="readonly"><%=editBean.getEncryptKey(curTunnel)%></textarea> 501 </td><td> 502 <% 503 if (allowBlinding && editBean.isAdvanced()) { 504 %> 505 505 <input type="password" name="nofilter_blindedPassword" title="<%=intl._t("Set password required to access this service")%>" value="<%=editBean.getBlindedPassword(curTunnel)%>" class="freetext password" /> 506 </td><td> </td>507 </tr>508 506 <% 509 507 } // allowBlinding 508 %> 509 </td> 510 </tr> 511 <% 510 512 } // !isOffline 511 513 %>
Note: See TracChangeset
for help on using the changeset viewer.