new index
All checks were successful
Deploy / trigger (push) Successful in 21s

This commit is contained in:
2026-03-27 23:14:15 +01:00
parent 15e1860105
commit 0e370eb457
2 changed files with 25 additions and 125 deletions

View File

@@ -3,8 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CryptoSeals - Motore RSA</title>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<title>CryptoSeals - Home</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="style.css">
</head>
@@ -19,140 +18,41 @@
<i class="fa-solid fa-bars"></i>
</div>
<ul class="nav-links" id="nav-links">
<li><a href="rsa.html" class="active"><i class="fa-solid fa-key"></i> RSA</a></li>
<li><a href="rsa.html"><i class="fa-solid fa-key"></i> RSA</a></li>
<li><a href="cesare.html"><i class="fa-solid fa-arrow-right-arrow-left"></i> Cesare</a></li>
<li><a href="vigenere.html"><i class="fa-solid fa-table"></i> Vigenère</a></li>
<li><a href="team.html"><i class="fa-solid fa-users"></i> Il Team</a></li>
</ul>
</nav>
<div class="container">
<h1>Motore RSA</h1>
<p class="descrizione">Cifra e decifra i tuoi messaggi con lo standard di sicurezza a chiave pubblica. Scegli la dimensione delle chiavi, scrivi e lascia fare alle foche.</p>
<div class="crypto-box">
<label><i class="fa-solid fa-ruler-horizontal"></i> Dimensione Chiave RSA</label>
<select id="keysize" style="margin-top: 5px; margin-bottom: 20px;">
<option value="512">512 bit (Solo didattico - Veloce)</option>
<option value="1024" selected>1024 bit (Test - Bilanciato)</option>
<option value="2048">2048 bit (Standard - Lenta da generare)</option>
<option value="3072">3072 bit (Ottima - Mediamente Lenta)</option>
<option value="4096">4096 bit (Alta sicurezza - Molto lenta)</option>
</select>
<div class="crypto-columns">
<div class="crypto-col">
<label><i class="fa-solid fa-pen"></i> Testo in chiaro</label>
<textarea id="plaintext" placeholder="Scrivi il messaggio segreto da decifrare..."></textarea>
<button id="btn-encrypt" onclick="encrypt()"><i class="fa-solid fa-lock"></i> Cifra il messaggio</button>
<div class="container" style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 60vh;">
<h1>Welcome to CryptoSeals</h1>
<p class="descrizione">
Dive deep, Seal your data. <i class="fa-solid fa-water"></i><br><br>
Scegli uno strumento dal menu per iniziare a proteggere i tuoi messaggi!
</p>
<img src="seal1.png" alt="Mascotte CryptoSeals" style="max-width: 250px; border-radius: 20px; box-shadow: 0 10px 30px rgba(16, 185, 129, 0.2);" onerror="this.src='https://cdn-icons-png.flaticon.com/512/3063/3063126.png';">
</div>
<div class="crypto-col">
<label><i class="fa-solid fa-barcode"></i> Testo Cifrato (Base64)</label>
<textarea id="ciphertext" placeholder="Il testo protetto apparirà qui..."></textarea>
<button id="btn-decrypt" class="btn-green" onclick="decrypt()"><i class="fa-solid fa-unlock-keyhole"></i> Decifra il messaggio</button>
</div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320" style="margin-bottom: -5px;">
<path fill="#0b0f19" fill-opacity="1" d="M0,160L48,170.7C96,181,192,203,288,208C384,213,480,203,576,176C672,149,768,107,864,117.3C960,128,1056,192,1152,213.3C1248,235,1344,213,1392,202.7L1440,192L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path>
</svg>
<footer>
<div class="copyright">
<a href="/privacy-policy/">Privacy Policy</a> |
<a href="#"><i class="fa-brands fa-github"></i> GitHub</a> <br><br>
© <span id="year"></span> CryptoSeals Team
</div>
<div style="margin-top: 35px;">
<label><i class="fa-solid fa-check-double"></i> Risultato finale decifrato</label>
<textarea id="decodedtext" readonly placeholder="Il messaggio originale apparirà qui dopo la decifratura..." style="height: 100px; background-color: rgba(16, 185, 129, 0.1); border-color: var(--accent-green); color: var(--accent-green);"></textarea>
</div>
</div>
</div>
</footer>
<script>
// Gestione Menu Mobile
function toggleMenu() {
document.getElementById("nav-links").classList.toggle("active");
}
// Configurazione globale per SweetAlert2 in tema dark
const Toast = Swal.mixin({
background: '#1f2937',
color: '#f3f4f6',
confirmButtonColor: '#10b981'
});
async function encrypt() {
const plaintext = document.getElementById("plaintext").value;
const size = document.getElementById("keysize").value;
const btn = document.getElementById("btn-encrypt");
if(!plaintext) {
return Toast.fire({ icon: "warning", title: "Attenzione", text: "Per favore, inserisci del testo da cifrare." });
}
// Stato di caricamento UI
btn.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i> Cifratura in corso...';
btn.disabled = true;
try {
const res = await fetch("/seal/rsa/encrypt", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: plaintext, keysize: parseInt(size) })
});
if(!res.ok) throw new Error("Errore Server");
document.getElementById("ciphertext").value = await res.text();
Toast.fire({
icon: 'success',
title: 'Completato!',
text: 'Il messaggio è stato cifrato con successo.',
timer: 2000,
showConfirmButton: false
});
} catch (e) {
Toast.fire({ icon: "error", title: "Errore di connessione", text: "Impossibile connettersi al server Javalin. Controlla che sia avviato!" });
} finally {
// Ripristino bottone
btn.innerHTML = '<i class="fa-solid fa-lock"></i> Cifra il messaggio';
btn.disabled = false;
}
}
async function decrypt() {
const input = document.getElementById("ciphertext").value;
const btn = document.getElementById("btn-decrypt");
if(!input) {
return Toast.fire({ icon: "warning", title: "Attenzione", text: "Non c'è nessun testo cifrato da decodificare." });
}
// Stato di caricamento UI
btn.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i> Decifratura in corso...';
btn.disabled = true;
try {
const res = await fetch("/seal/rsa/decrypt", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: input })
});
if(!res.ok) throw new Error("Errore Server");
document.getElementById("decodedtext").value = await res.text();
Toast.fire({
icon: 'success',
title: 'Decifrato!',
text: 'Messaggio originale recuperato.',
timer: 2000,
showConfirmButton: false
});
} catch (e) {
Toast.fire({ icon: "error", title: "Errore", text: "Impossibile decifrare. Il testo potrebbe essere corrotto o il server offline." });
} finally {
// Ripristino bottone
btn.innerHTML = '<i class="fa-solid fa-unlock-keyhole"></i> Decifra il messaggio';
btn.disabled = false;
}
}
// Anno dinamico Footer
document.getElementById("year").innerText = new Date().getFullYear();
</script>
</body>
</html>

View File

@@ -84,7 +84,7 @@
try {
// NOTA: Controlla che la rotta nel tuo Java sia corretta (/seal/rsa/decrypt o /api/rsa/decifra)
const res = await fetch("/seal/rsa/decrypt", {
const res = await fetch("http://localhost:8080/seal/rsa/decrypt", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: input })
});