MCPcopy Index your code
hub / github.com/darksolopic/PasswordManagerGUI / PasswordDecryptManagerGUI

Class PasswordDecryptManagerGUI

PasswordDecryptManagerGUI.java:17–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15import java.nio.charset.StandardCharsets;
16
17public class PasswordDecryptManagerGUI extends JFrame implements ActionListener {
18
19 private static final String SECRET_KEY_ALGORITHM = "AES";
20 private static final String CIPHER_ALGORITHM = "AES/CBC/PKCS5Padding";
21 private static final int KEY_LENGTH = 256;
22 private static final int SALT_LENGTH = 16;
23 private static final int ITERATIONS = 65536;
24 private static final int IV_LENGTH = 16;
25 private static final String ENCRYPTED_PASSWORD_FILE = "encrypted_password.txt";
26
27 private JTextField masterPasswordField, encryptedPasswordField, decryptedPasswordField;
28
29 public PasswordDecryptManagerGUI() {
30 setTitle("Password Manager");
31 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
32 setSize(500, 300);
33 setLocationRelativeTo(null);
34
35 JPanel mainPanel = new JPanel();
36 mainPanel.setLayout(new GridLayout(4, 2, 10, 10));
37 mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
38
39 Font labelFont = new Font("Arial", Font.PLAIN, 16); // Adjust the font size as needed
40 Font textFieldFont = new Font("Arial", Font.PLAIN, 16); // Adjust the font size as needed
41
42 JLabel masterPasswordLabel = new JLabel("Master Password:");
43 masterPasswordLabel.setFont(labelFont);
44 masterPasswordField = new JPasswordField();
45 masterPasswordField.setFont(textFieldFont);
46
47
48 JLabel encryptedPasswordLabel = new JLabel("Encrypted Password:");
49 encryptedPasswordLabel.setFont(labelFont);
50 encryptedPasswordField = new JTextField();
51 encryptedPasswordField.setFont(textFieldFont);
52
53
54 JLabel decryptedPasswordLabel = new JLabel("Decrypted Password:");
55 decryptedPasswordLabel.setFont(labelFont);
56 decryptedPasswordField = new JTextField();
57 decryptedPasswordField.setEditable(false);
58 decryptedPasswordField.setFont(textFieldFont);
59
60 JButton decryptButton = new JButton("Decrypt");
61
62 decryptButton.addActionListener(this);
63
64 mainPanel.add(masterPasswordLabel);
65 mainPanel.add(masterPasswordField);
66 mainPanel.add(encryptedPasswordLabel);
67 mainPanel.add(encryptedPasswordField);
68 mainPanel.add(decryptedPasswordLabel);
69 mainPanel.add(decryptedPasswordField);
70 mainPanel.add(decryptButton);
71
72 setContentPane(mainPanel);
73 setVisible(true);
74 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected