Ferra
Ferra
Explore posts from servers
JCHJava Community | Help. Code. Learn.
Created by Ferra on 1/6/2025 in #java-help
how do i use automatic module names in vscode?
No description
15 replies
JCHJava Community | Help. Code. Learn.
Created by Ferra on 1/5/2025 in #java-help
imported classes not accessable
No description
4 replies
CDCloudflare Developers
Created by Ferra on 11/12/2024 in #general-help
The error 521
I am trying to make a service available using nginx proxy manager, however if I use flexible encryption mode, I get too many redirect error, and if I use full, I get the error 521 In flexible, I can see the default nginx welcome website, however if I try and make an proxy host to the service, it says too many redirects.
11 replies
CDCloudflare Developers
Created by Ferra on 10/17/2024 in #general-help
i dont password
i made an account with the sign in with google on the cloudflare website, and it did not have me make a password, however to change anything about the account I need to have a password, which I did not get
3 replies
JCHJava Community | Help. Code. Learn.
Created by Ferra on 8/5/2024 in #java-help
the decryption does not
any attempt to decrypt just causes an illegalArguementException
package com.ferra;

import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
public class AES {
static Cipher cipher;
static SecretKey secretKey;

public static void createSecretKey() {
KeyGenerator keyGenerator;
try {
keyGenerator = KeyGenerator.getInstance("AES");
keyGenerator.init(128); // block size is 128bits
secretKey = keyGenerator.generateKey();
cipher = Cipher.getInstance("AES");
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
globalErrorHandler errorHandler = new globalErrorHandler();
errorHandler.uncaughtException(Thread.currentThread(), e);
}
}
public static SecretKey getSecretKey() {
return secretKey;
}
public static void setSecretKey(String key) {
byte[] keyByte = Base64.getDecoder().decode(key);
secretKey = new SecretKeySpec(keyByte, 0, keyByte.length, "AES");

}
public static String encrypt(String plainText)
throws Exception {
byte[] plainTextByte = plainText.getBytes();
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
byte[] encryptedByte = cipher.doFinal(plainTextByte);
Base64.Encoder encoder = Base64.getEncoder();
String encryptedText = encoder.encodeToString(encryptedByte);
return encryptedText;
}
public static String decrypt(String encryptedText)
throws Exception {
Base64.Decoder decoder = Base64.getDecoder();
byte[] encryptedTextByte = decoder.decode(encryptedText);
cipher.init(Cipher.DECRYPT_MODE, secretKey);
byte[] decryptedByte = cipher.doFinal(encryptedTextByte);
String decryptedText = new String(decryptedByte);
return decryptedText;
}
}
package com.ferra;

import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
public class AES {
static Cipher cipher;
static SecretKey secretKey;

public static void createSecretKey() {
KeyGenerator keyGenerator;
try {
keyGenerator = KeyGenerator.getInstance("AES");
keyGenerator.init(128); // block size is 128bits
secretKey = keyGenerator.generateKey();
cipher = Cipher.getInstance("AES");
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
globalErrorHandler errorHandler = new globalErrorHandler();
errorHandler.uncaughtException(Thread.currentThread(), e);
}
}
public static SecretKey getSecretKey() {
return secretKey;
}
public static void setSecretKey(String key) {
byte[] keyByte = Base64.getDecoder().decode(key);
secretKey = new SecretKeySpec(keyByte, 0, keyByte.length, "AES");

}
public static String encrypt(String plainText)
throws Exception {
byte[] plainTextByte = plainText.getBytes();
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
byte[] encryptedByte = cipher.doFinal(plainTextByte);
Base64.Encoder encoder = Base64.getEncoder();
String encryptedText = encoder.encodeToString(encryptedByte);
return encryptedText;
}
public static String decrypt(String encryptedText)
throws Exception {
Base64.Decoder decoder = Base64.getDecoder();
byte[] encryptedTextByte = decoder.decode(encryptedText);
cipher.init(Cipher.DECRYPT_MODE, secretKey);
byte[] decryptedByte = cipher.doFinal(encryptedTextByte);
String decryptedText = new String(decryptedByte);
return decryptedText;
}
}
9 replies
JCHJava Community | Help. Code. Learn.
Created by Ferra on 7/12/2024 in #java-help
the JTable does it not appear?
No description
5 replies
JCHJava Community | Help. Code. Learn.
Created by Ferra on 7/10/2024 in #java-help
The buttons
The buttons act more like checkboxes, and dont actually print anything out how can i fix them? I can see its because of the checkbox in
table.getColumn("Button").setCellEditor(new ButtonEditor(new JCheckBox()));
table.getColumn("Button").setCellEditor(new ButtonEditor(new JCheckBox()));
but i dont see anything else that could work
4 replies
JCHJava Community | Help. Code. Learn.
Created by Ferra on 7/6/2024 in #java-help
how can button the java swing table?
i am trying to put a button inside a jswing table, so that the last slot runs some code how can i do that?
7 replies