Last change
on this file since 1204 was 1204, checked in by bln4, 5 years ago |
auth.KeyList.java -> Settings to store public credentials
auth.secrets.KeyList.java -> Settings to store private credentials
|
File size:
1.3 KB
|
Line | |
---|
1 | package org.expeditee.settings.auth;
|
---|
2 |
|
---|
3 | import java.util.Collection;
|
---|
4 |
|
---|
5 | import org.expeditee.core.Colour;
|
---|
6 | import org.expeditee.gui.Frame;
|
---|
7 | import org.expeditee.gui.FrameIO;
|
---|
8 | import org.expeditee.items.Item;
|
---|
9 | import org.expeditee.items.Text;
|
---|
10 | import org.expeditee.setting.TextSetting;
|
---|
11 | import org.expeditee.settings.UserSettings;
|
---|
12 |
|
---|
13 | public class KeyList {
|
---|
14 |
|
---|
15 | public static final TextSetting PublicKey = new TextSetting("The RSA key used to decrypt things encrypted with your RSA public key.") {
|
---|
16 |
|
---|
17 | @Override
|
---|
18 | public Text generateText() {
|
---|
19 | Text t = new Text("");
|
---|
20 | t.setColor(Colour.BLACK);
|
---|
21 | t.setBackgroundColor(new Colour(0.7F, 0.7F, 0.9F));
|
---|
22 | t.setSize(14);
|
---|
23 | return t;
|
---|
24 | }
|
---|
25 |
|
---|
26 | public boolean setSetting(final Text text) {
|
---|
27 | final String value = text.getText();
|
---|
28 | this._value.setData(value);
|
---|
29 |
|
---|
30 | String profileName = UserSettings.ProfileName.get();
|
---|
31 | int lastNumber = FrameIO.getLastNumber(profileName);
|
---|
32 | for (int i = 1; i <= lastNumber; i++) {
|
---|
33 | Frame frame = FrameIO.LoadFrame(profileName + i);
|
---|
34 | Collection<Item> items = frame.getAllItems();
|
---|
35 | boolean found = false;
|
---|
36 | for (Item item: items) {
|
---|
37 | if (item.getText().compareTo("PublicKey") == 0) {
|
---|
38 | item.setData(this._value.getData());
|
---|
39 | found = true;
|
---|
40 | break;
|
---|
41 | }
|
---|
42 | }
|
---|
43 | if (found) { break; }
|
---|
44 | }
|
---|
45 |
|
---|
46 | return true;
|
---|
47 | };
|
---|
48 | };
|
---|
49 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.