non so leggere
All checks were successful
Deploy / trigger (push) Successful in 21s

This commit is contained in:
2026-03-31 12:36:02 +02:00
parent 3e5d359282
commit 59f4cd0777
2 changed files with 7 additions and 7 deletions

View File

@@ -14,15 +14,15 @@ public class Seal {
System.out.println("Generazione chiavi RSA per il server web in corso...");
// Cifratura con Cifrario di Cesare
app.post("/seal/caesar/encrypt", ctx -> {
// Cifratura con Cifrario di Vigenere
app.post("/seal/vigenere/encrypt", ctx -> {
}
);
// Decifratura con Cifrario di Vigenere
app.post("/seal/vigenere/encrypt", ctx -> {
// Cifratura con Cifrario di Cesare
app.post("/seal/caesar/encrypt", ctx -> {
RichiestaCesare req = ctx.bodyAsClass(RichiestaCesare.class);
String ciphertext = Caesar.encode(req.plaintext,req.key);
ctx.result(ciphertext);

View File

@@ -5,13 +5,13 @@ async function encrypt() {
if (!plaintext) return alert("Inserisci del testo!");
try {
const risposta = await fetch("/seal/cesare/encrypt", {
const risposta = await fetch("/seal/caesar/encrypt", {
method: "POST", headers: { "Content-Type": "application/json" },
// Invia il testo e la chiave (convertita in numero) al server
body: JSON.stringify({ plaintext: plaintext, key: parseInt(key) })
});
document.getElementById("ciphertext").value = await risposta.text();
} catch (e) { alert("Errore di connessione con le API di Cesare!"); }
} catch (e) { alert("Errore di connessione con le API di caesar!"); }
}
async function decrypt() {
@@ -20,7 +20,7 @@ async function decrypt() {
if (!ciphertext) return alert("Nessun testo da decifrare!");
try {
const res = await fetch("/seal/cesare/decrypt", {
const res = await fetch("/seal/caesar/decrypt", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ testo: ciphertext, chiave: parseInt(key) })
});