| 18 | private static final String TRANSFORMATION = "AES/ECB/PKCS5Padding"; |
| 19 | |
| 20 | public void init() { |
| 21 | setLayout(new BorderLayout()); |
| 22 | |
| 23 | Panel inputPanel = new Panel(new GridLayout(3, 2)); |
| 24 | inputPanel.add(new Label("Input:")); |
| 25 | inputField = new TextField(); |
| 26 | inputPanel.add(inputField); |
| 27 | inputPanel.add(new Label("Key:")); |
| 28 | keyField = new TextField(); |
| 29 | inputPanel.add(keyField); |
| 30 | encryptButton = new Button("Encrypt"); |
| 31 | encryptButton.addActionListener(this); |
| 32 | inputPanel.add(encryptButton); |
| 33 | decryptButton = new Button("Decrypt"); |
| 34 | decryptButton.addActionListener(this); |
| 35 | inputPanel.add(decryptButton); |
| 36 | add(inputPanel, BorderLayout.NORTH); |
| 37 | |
| 38 | outputArea = new TextArea(); |
| 39 | outputArea.setEditable(false); |
| 40 | add(outputArea, BorderLayout.CENTER); |
| 41 | |
| 42 | setSize(400, 300); |
| 43 | } |
| 44 | |
| 45 | public void actionPerformed(ActionEvent e) { |
| 46 | String key = keyField.getText(); |