MCPcopy Create free account
hub / github.com/darksolopic/PasswordManagerGUI / PasswordManagerGUI

Class PasswordManagerGUI

PasswordManagerGUI.java:16–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected