I am making a PGP program for a school class, however I am having some trouble unwrapping and wrapping keys. I am encrypting the text with a random aes key, then wrapping the aes key with the private key from the KeyPair. To decrypt, I am unwrapping the aes key with the public key from the KeyPair, however I am getting the Key is too long for unwrapping error. I checked out this question, but I am pretty sure I am using the correct keys to unwrap and wrap. Here is my code for wrapping and unwrapping
byte[] returnWrappedKey(Key keyToWrap, Key keyForWrapping) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.WRAP_MODE, keyForWrapping);
return cipher.wrap(keyToWrap);
}
Key returnUnwrappedKey(byte[] keyToUnwrap, Key keyForUnwrapping) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchPaddingException, NoSuchAlgorithmException, NoSuchProviderException {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.UNWRAP_MODE, keyForUnwrapping);
return cipher.unwrap(keyToUnwrap, "AES", Cipher.SECRET_KEY);
}
I pass in the public or private keyFor(Un)Wrapping, yet whichever way I do it I get the error. I am using swing to have the user input a key, and .getBytes()
to get the key for unwrapping.
Full code (Not sure if this is helpful)
import org.jetbrains.annotations.*;
import javax.crypto.*;
import javax.swing.*;
import javax.swing.filechooser.*;
import java.awt.*;
import java.awt.datatransfer.*;
import java.io.*;
import java.nio.charset.*;
import java.nio.file.*;
import java.security.*;
import java.security.spec.*;
import java.util.*;
public class run {
/**
* Variable State meaning
* 1: Key is Public
* 2: Key is Private
* 3: Key is not defined as either public or private
*/
static int keyState = 3;
static int AESKeyState = 3;
static byte[] operationBytes;
static PublicKey operationalPubKey;
static PrivateKey operationalPrvKey;
static Key operationalAESKey;
static final gui window = new gui();
static rsaEncryption rsaMethods = new rsaEncryption();
static aesEncryption aesMethods = new aesEncryption();
public static void main(String[] args) {
JFileChooser fileChooser = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory());
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
window.createSignature.addActionListener(e -> {
KeyPair pair = null;
try {
pair = rsaMethods.generateKeyPair();
} catch (NoSuchAlgorithmException noSuchAlgorithmException) {
displayError(noSuchAlgorithmException);
}
assert pair != null;
window.publicKeyOutputArea.setText(rsaMethods.generatePublicKeyString(pair.getPublic()));
window.privateKeyOutputArea.setText(rsaMethods.generatePrivateKeyString(pair.getPrivate()));
});
window.copyPublicKeyToClipboard.addActionListener(e -> rsaMethods.copyDataToClipboard(window.publicKeyOutputArea.getText()));
window.copyPrivateKeyToClipboard.addActionListener(e -> rsaMethods.copyDataToClipboard(window.privateKeyOutputArea.getText()));
window.exportPublicKeyToFile.addActionListener(e -> {
int choice = fileChooser.showOpenDialog(null);
if (choice == JFileChooser.APPROVE_OPTION) {
try {
rsaMethods.exportDataToFile(fileChooser.getSelectedFile(), window.publicKeyOutputArea.getText());
} catch (IOException ioException) {
displayError(ioException);
}
}
});
window.exportPrivateKeyToFile.addActionListener(e -> {
int choice = fileChooser.showOpenDialog(null);
if (choice == JFileChooser.APPROVE_OPTION) {
try {
rsaMethods.exportDataToFile(fileChooser.getSelectedFile(), window.privateKeyOutputArea.getText());
} catch (IOException ioException) {
displayError(ioException);
}
}
});
window.importPublicKeyFromFile.addActionListener(e -> {
PublicKey publicKey = null;
int choice = fileChooser.showOpenDialog(null);
if (choice == JFileChooser.APPROVE_OPTION) {
try {
publicKey = rsaMethods.getPublicKeyFromFile(fileChooser.getSelectedFile());
} catch (NoSuchAlgorithmException | IOException | InvalidKeySpecException noSuchAlgorithmException) {
displayError(noSuchAlgorithmException);
}
}
assert publicKey != null;
window.pasteKeyForOperation.setText(rsaMethods.generatePublicKeyString(publicKey));
keyState = 1;
});
window.importPrivateKeyFromFile.addActionListener(e -> {
PrivateKey privateKey = null;
int choice = fileChooser.showOpenDialog(null);
if (choice == JFileChooser.APPROVE_OPTION) {
try {
privateKey = rsaMethods.getPrivateKeyFromFile(fileChooser.getSelectedFile());
} catch (IOException | NoSuchAlgorithmException | InvalidKeySpecException ioException) {
displayError(ioException);
}
}
assert privateKey != null;
window.pasteKeyForOperation.setText(rsaMethods.generatePrivateKeyString(privateKey));
keyState = 2;
});
window.checkKey.addActionListener(e -> {
if (keyState == 3 && window.pasteKeyForOperation.getText().equals("")) {
JOptionPane.showMessageDialog(null, "You have not input a valid key!");
} else {
if (window.publicKeyPasteSelection.isSelected()) {
try {
operationalPubKey = rsaMethods.getPubKeyFromString(window.pasteKeyForOperation.getText());
} catch (NoSuchAlgorithmException | InvalidKeySpecException noSuchAlgorithmException) {
displayError(noSuchAlgorithmException);
}
keyState = 1;
window.pasteKeyForOperation.setText("");
AESKeyState = 3;
} else if (window.privateKeyPasteSelection.isSelected()) {
try {
operationalPrvKey = rsaMethods.getPrvKeyFromString(window.pasteKeyForOperation.getText());
} catch (NoSuchAlgorithmException | InvalidKeySpecException noSuchAlgorithmException) {
displayError(noSuchAlgorithmException);
}
keyState = 2;
window.pasteKeyForOperation.setText("");
AESKeyState = 3;
}
}
});
window.checkAESKey.addActionListener(e -> {
if (keyState == 3) {
JOptionPane.showMessageDialog(null, "You need to first input a RSA Key and select public or private!");
} else if (Objects.equals(window.pasteKeyForOperation.getText(), "")) {
JOptionPane.showMessageDialog(null, "You have not input a key!");
} else if (keyState == 1) {
try {
operationalAESKey = rsaMethods.returnUnwrappedKey(window.pasteKeyForOperation.getText().getBytes(), operationalPubKey);
} catch (IllegalBlockSizeException | BadPaddingException | InvalidKeyException | NoSuchPaddingException | NoSuchAlgorithmException | NoSuchProviderException ex) {
displayError(ex);
}
AESKeyState = 1;
} else if (keyState == 2) {
try {
operationalAESKey = rsaMethods.returnUnwrappedKey(window.pasteKeyForOperation.getText().getBytes(), operationalPrvKey);
} catch (IllegalBlockSizeException | BadPaddingException | InvalidKeyException | NoSuchPaddingException | NoSuchAlgorithmException | NoSuchProviderException ex) {
displayError(ex);
}
AESKeyState = 2;
}
});
window.operationDataFileImport.addActionListener(e -> {
int choice = fileChooser.showOpenDialog(null);
if (choice == JFileChooser.APPROVE_OPTION) {
window.operationPlainTextInput.setText("Data received from file import");
}
try {
operationBytes = rsaMethods.importDataFromFile(fileChooser.getSelectedFile());
} catch (IOException ioException) {
displayError(ioException);
}
});
window.encryptDataButton.addActionListener(e -> {
if (operationBytes == null) {
operationBytes = window.operationPlainTextInput.getText().getBytes(StandardCharsets.UTF_8);
}
try {
encryptData();
} catch (NoSuchPaddingException | IllegalBlockSizeException | NoSuchAlgorithmException | BadPaddingException | InvalidKeyException | NoSuchProviderException noSuchPaddingException) {
displayError(noSuchPaddingException);
}
});
window.decryptDataButton.addActionListener(e -> {
if (operationBytes == null) {
operationBytes = window.operationPlainTextInput.getText().getBytes(StandardCharsets.UTF_8);
}
try {
decryptData();
} catch (IllegalBlockSizeException | NoSuchPaddingException | BadPaddingException | NoSuchAlgorithmException | InvalidKeyException | NoSuchProviderException illegalBlockSizeException) {
displayError(illegalBlockSizeException);
}
});
window.operationDataFileExport.addActionListener(e -> {
int choice = fileChooser.showOpenDialog(null);
if (choice == JFileChooser.APPROVE_OPTION) {
try {
rsaMethods.exportDataToFile(fileChooser.getSelectedFile(), window.operationPlainTextOutput.getText());
} catch (IOException ioException) {
displayError(ioException);
}
}
});
}
/**
* Sets the plain text output of the operationPlainTextOutput
* panel to the decrypted or encrypted data encoded in
* Base64 using the key input from the user.
*
* @throws IllegalBlockSizeException Throws IllegalBlockSizeException.
* @throws NoSuchPaddingException Throws NoSuchPaddingException.
* @throws BadPaddingException Throws BadPaddingException.
* @throws NoSuchAlgorithmException Throws NoSuchAlgorithmException.
* @throws InvalidKeyException Throws InvalidKeyException.
*/
private static void encryptData() throws NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, NoSuchProviderException {
operationBytes = window.operationPlainTextInput.getText().getBytes();
SecretKey key = aesMethods.returnKey();
window.operationPlainTextOutput.setText(Base64.getEncoder().encodeToString(aesMethods.returnEncryptedData(operationBytes, key)));
if (keyState == 1) {
byte[] bKey = rsaMethods.returnWrappedKey(key, operationalPubKey);
JOptionPane.showMessageDialog(null, "Your AES key (RSA PUB KEY) has been copied to your clipboard!");
rsaMethods.copyDataToClipboard(Base64.getEncoder().encodeToString(bKey));
keyState = 3;
} else if (keyState == 2) {
byte[] bKey = rsaMethods.returnWrappedKey(key, operationalPrvKey);
JOptionPane.showMessageDialog(null, "Your AES key (RSA PRV KEY) has been copied to your clipboard!");
rsaMethods.copyDataToClipboard(Base64.getEncoder().encodeToString(bKey));
keyState = 3;
} else {
JOptionPane.showMessageDialog(null, "You have not input a key!");
}
}
private static void decryptData() throws NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, NoSuchProviderException {
operationBytes = window.operationPlainTextInput.getText().getBytes();
Key key = operationalAESKey;
if (AESKeyState == 1 || AESKeyState == 2) {
window.operationPlainTextOutput.setText(Base64.getEncoder().encodeToString(aesMethods.returnDecryptedData(window.operationPlainTextInput.getText().getBytes(), key)));
} else {
JOptionPane.showMessageDialog(null, "You have not input a AES key!");
}
}
private static void displayError(@NotNull Exception e) {
System.out.println(keyState);
e.printStackTrace();
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
class rsaEncryption {
KeyPair generateKeyPair() throws NoSuchAlgorithmException {
SecureRandom random = new SecureRandom();
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
generator.initialize(2048, random);
return generator.generateKeyPair();
}
PublicKey getPublicKeyFromFile(@NotNull File file) throws NoSuchAlgorithmException, IOException, InvalidKeySpecException {
return KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(Files.readAllBytes(file.toPath())));
}
PrivateKey getPrivateKeyFromFile(@NotNull File file) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
return KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(Files.readAllBytes(file.toPath())));
}
void copyDataToClipboard(String string) {
StringSelection selection = new StringSelection(string);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(selection, null);
}
String generatePrivateKeyString(@NotNull PrivateKey privateKey) {
return Base64.getEncoder().encodeToString(privateKey.getEncoded());
}
String generatePublicKeyString(@NotNull PublicKey publicKey) {
return Base64.getEncoder().encodeToString(publicKey.getEncoded());
}
byte[] returnWrappedKey(Key keyToWrap, Key keyForWrapping) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.WRAP_MODE, keyForWrapping);
return cipher.wrap(keyToWrap);
}
Key returnUnwrappedKey(byte[] keyToUnwrap, Key keyForUnwrapping) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchPaddingException, NoSuchAlgorithmException, NoSuchProviderException {
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.UNWRAP_MODE, keyForUnwrapping);
return cipher.unwrap(keyToUnwrap, "AES", Cipher.SECRET_KEY);
}
byte[] importDataFromFile(File file) throws IOException {
FileInputStream fis = new FileInputStream(file);
return fis.readAllBytes();
}
void exportDataToFile(File file, String string) throws IOException {
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write(string);
writer.flush();
}
PublicKey getPubKeyFromString(String string) throws NoSuchAlgorithmException, InvalidKeySpecException {
byte[] publicKeyBytes = Base64.getDecoder().decode(string);
KeyFactory factory = KeyFactory.getInstance("RSA");
return factory.generatePublic(new X509EncodedKeySpec(publicKeyBytes));
}
PrivateKey getPrvKeyFromString(String string) throws NoSuchAlgorithmException, InvalidKeySpecException {
byte[] privateKeyBytes = Base64.getDecoder().decode(string);
KeyFactory factory = KeyFactory.getInstance("RSA");
return factory.generatePrivate(new PKCS8EncodedKeySpec(privateKeyBytes));
}
}
class aesEncryption {
SecretKey returnKey() throws NoSuchAlgorithmException {
KeyGenerator gen = KeyGenerator.getInstance("AES");
gen.init(new SecureRandom());
return gen.generateKey();
}
byte[] returnEncryptedData(byte[] data, Key key) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, key);
return cipher.doFinal(data);
}
byte[] returnDecryptedData(byte[] data, Key key) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, key);
return cipher.doFinal(data);
}
}
class gui {
public gui() {
initialize();
}
JFrame frame = new JFrame();
JButton createSignature = new JButton("Create!");
JTextArea privateKeyOutputArea = new JTextArea();
JTextArea publicKeyOutputArea = new JTextArea();
JButton exportPublicKeyToFile = new JButton("Export Key to File");
JButton copyPublicKeyToClipboard = new JButton("Copy Key to Clipboard");
JButton exportPrivateKeyToFile = new JButton("Export Key to File");
JButton copyPrivateKeyToClipboard = new JButton("Copy Key to Clipboard");
JButton importPublicKeyFromFile = new JButton("PubKey");
JButton importPrivateKeyFromFile = new JButton("PrvKey");
JRadioButton publicKeyPasteSelection = new JRadioButton("PUBLIC KEY");
JRadioButton privateKeyPasteSelection = new JRadioButton("PRIVATE KEY");
JTextField pasteKeyForOperation = new JTextField();
JTextArea operationPlainTextInput = new JTextArea();
JTextArea operationPlainTextOutput = new JTextArea();
JButton encryptDataButton = new JButton("Encrypt");
JButton decryptDataButton = new JButton("Decrypt");
JButton operationDataFileImport = new JButton("Import Data From File");
JButton operationDataFileExport = new JButton("Export Data To File");
JButton checkKey = new JButton("Check Key");
JButton checkAESKey = new JButton("AES Key");
private void initialize() {
frame.setFont(new Font("Courier New", Font.BOLD, 12));
frame.setTitle("RSA SIGNATURE MANAGER");
frame.setBounds(100, 100, 619, 495);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
JPanel signatureCreationPanel = new JPanel();
signatureCreationPanel.setBackground(Color.DARK_GRAY);
tabbedPane.addTab("Create New Signature", null, signatureCreationPanel, null);
signatureCreationPanel.setLayout(null);
JLabel createNewPgpSignature = new JLabel("Create New PGP Signature");
createNewPgpSignature.setForeground(Color.WHITE);
createNewPgpSignature.setFont(new Font("Courier New", Font.BOLD, 24));
createNewPgpSignature.setBounds(10, 11, 391, 30);
signatureCreationPanel.add(createNewPgpSignature);
createSignature.setBackground(Color.BLACK);
createSignature.setForeground(Color.WHITE);
createSignature.setBounds(379, 17, 188, 23);
signatureCreationPanel.add(createSignature);
JScrollPane scrollPane = new JScrollPane(privateKeyOutputArea);
scrollPane.setBounds(306, 103, 282, 282);
privateKeyOutputArea.setEditable(false);
privateKeyOutputArea.add(new JScrollBar());
privateKeyOutputArea.setLineWrap(true);
privateKeyOutputArea.setFont(new Font("Courier New", Font.PLAIN, 12));
privateKeyOutputArea.setBackground(Color.BLACK);
privateKeyOutputArea.setForeground(Color.WHITE);
signatureCreationPanel.add(scrollPane);
publicKeyOutputArea.setEditable(false);
publicKeyOutputArea.setLineWrap(true);
publicKeyOutputArea.setFont(new Font("Courier New", Font.PLAIN, 12));
publicKeyOutputArea.setBackground(Color.BLACK);
publicKeyOutputArea.setForeground(Color.WHITE);
publicKeyOutputArea.setBounds(10, 103, 286, 282);
signatureCreationPanel.add(publicKeyOutputArea);
exportPublicKeyToFile.setBackground(Color.BLACK);
exportPublicKeyToFile.setForeground(Color.WHITE);
exportPublicKeyToFile.setBounds(10, 396, 136, 23);
signatureCreationPanel.add(exportPublicKeyToFile);
copyPublicKeyToClipboard.setBackground(Color.BLACK);
copyPublicKeyToClipboard.setForeground(Color.WHITE);
copyPublicKeyToClipboard.setBounds(156, 396, 140, 23);
signatureCreationPanel.add(copyPublicKeyToClipboard);
exportPrivateKeyToFile.setBackground(Color.BLACK);
exportPrivateKeyToFile.setForeground(Color.WHITE);
exportPrivateKeyToFile.setBounds(306, 396, 136, 23);
signatureCreationPanel.add(exportPrivateKeyToFile);
copyPrivateKeyToClipboard.setBackground(Color.BLACK);
copyPrivateKeyToClipboard.setForeground(Color.WHITE);
copyPrivateKeyToClipboard.setBounds(448, 396, 140, 23);
signatureCreationPanel.add(copyPrivateKeyToClipboard);
JLabel publicKeyCreationContext = new JLabel("Public Key:");
publicKeyCreationContext.setForeground(Color.WHITE);
publicKeyCreationContext.setFont(new Font("Courier New", Font.BOLD, 16));
publicKeyCreationContext.setBounds(10, 69, 136, 23);
signatureCreationPanel.add(publicKeyCreationContext);
JLabel privateKeyCreationContext = new JLabel("Private Key:");
privateKeyCreationContext.setForeground(Color.WHITE);
privateKeyCreationContext.setFont(new Font("Courier New", Font.BOLD, 16));
privateKeyCreationContext.setBounds(306, 69, 136, 23);
signatureCreationPanel.add(privateKeyCreationContext);
JPanel operationPanel = new JPanel();
operationPanel.setBackground(Color.DARK_GRAY);
tabbedPane.addTab("Encrypt or Decrypt", null, operationPanel, null);
operationPanel.setLayout(null);
importPublicKeyFromFile.setFont(new Font("Courier New", Font.BOLD, 18));
importPublicKeyFromFile.setForeground(Color.WHITE);
importPublicKeyFromFile.setBackground(Color.BLACK);
importPublicKeyFromFile.setBounds(10, 11, 100, 26);
operationPanel.add(importPublicKeyFromFile);
importPrivateKeyFromFile.setFont(new Font("Courier New", Font.BOLD, 18));
importPrivateKeyFromFile.setForeground(Color.WHITE);
importPrivateKeyFromFile.setBackground(Color.BLACK);
importPrivateKeyFromFile.setBounds(120, 11, 100, 26);
operationPanel.add(importPrivateKeyFromFile);
pasteKeyForOperation.setForeground(Color.WHITE);
pasteKeyForOperation.setBackground(Color.BLACK);
pasteKeyForOperation.setToolTipText("Paste Key Here");
pasteKeyForOperation.setFont(new Font("Courier New", Font.PLAIN, 18));
pasteKeyForOperation.setBounds(230, 11, 200, 26);
operationPanel.add(pasteKeyForOperation);
privateKeyPasteSelection.setForeground(Color.WHITE);
privateKeyPasteSelection.setBackground(Color.DARK_GRAY);
privateKeyPasteSelection.setFont(new Font("Courier New", Font.PLAIN, 14));
privateKeyPasteSelection.setBounds(170, 40, 125, 26);
operationPanel.add(privateKeyPasteSelection);
publicKeyPasteSelection.setForeground(Color.WHITE);
publicKeyPasteSelection.setBackground(Color.DARK_GRAY);
publicKeyPasteSelection.setFont(new Font("Courier New", Font.PLAIN, 14));
publicKeyPasteSelection.setBounds(290, 40, 150, 26);
operationPanel.add(publicKeyPasteSelection);
ButtonGroup group = new ButtonGroup();
group.add(privateKeyPasteSelection);
group.add(publicKeyPasteSelection);
checkKey.setBackground(Color.BLACK);
checkKey.setForeground(Color.WHITE);
checkKey.setFont(new Font("Courier New", Font.BOLD, 18));
checkKey.setBounds(440, 11, 140, 26);
operationPanel.add(checkKey);
checkAESKey.setBackground(Color.BLACK);
checkAESKey.setForeground(Color.white);
checkAESKey.setFont(new Font("Courier New", Font.BOLD, 18));
checkAESKey.setBounds(440, 39, 140, 26);
operationPanel.add(checkAESKey);
JScrollPane operationInputScrollPane = new JScrollPane(operationPlainTextInput);
operationInputScrollPane.setBounds(10, 102, 280, 256);
operationPlainTextInput.setLineWrap(true);
operationPlainTextInput.setBackground(Color.BLACK);
operationPlainTextInput.setForeground(Color.WHITE);
operationPanel.add(operationInputScrollPane);
JScrollPane operationOutputScrollPane = new JScrollPane(operationPlainTextOutput);
operationOutputScrollPane.setBounds(308, 102, 280, 256);
operationPlainTextOutput.setLineWrap(true);
operationPlainTextOutput.setEditable(false);
operationPlainTextOutput.setForeground(Color.WHITE);
operationPlainTextOutput.setBackground(Color.BLACK);
operationPanel.add(operationOutputScrollPane);
JLabel whereToPasteDataLabel = new JLabel("Paste data here:");
whereToPasteDataLabel.setForeground(Color.WHITE);
whereToPasteDataLabel.setBackground(Color.BLACK);
whereToPasteDataLabel.setFont(new Font("Courier New", Font.BOLD, 14));
whereToPasteDataLabel.setBounds(20, 78, 142, 14);
operationPanel.add(whereToPasteDataLabel);
JLabel operationOutputLabel = new JLabel("Output in Plaintext:");
operationOutputLabel.setForeground(Color.WHITE);
operationOutputLabel.setFont(new Font("Courier New", Font.BOLD, 14));
operationOutputLabel.setBackground(Color.BLACK);
operationOutputLabel.setBounds(319, 78, 250, 14);
operationPanel.add(operationOutputLabel);
encryptDataButton.setForeground(Color.WHITE);
encryptDataButton.setBackground(Color.BLACK);
encryptDataButton.setBounds(257, 369, 89, 23);
operationPanel.add(encryptDataButton);
decryptDataButton.setForeground(Color.WHITE);
decryptDataButton.setBackground(Color.BLACK);
decryptDataButton.setBounds(257, 396, 89, 23);
operationPanel.add(decryptDataButton);
operationDataFileImport.setForeground(Color.WHITE);
operationDataFileImport.setBackground(Color.BLACK);
operationDataFileImport.setBounds(10, 369, 170, 23);
operationPanel.add(operationDataFileImport);
operationDataFileExport.setForeground(Color.WHITE);
operationDataFileExport.setBackground(Color.BLACK);
operationDataFileExport.setBounds(436, 369, 152, 23);
operationPanel.add(operationDataFileExport);
frame.setVisible(true);
}
}