Compare commits

..

9 Commits

Author SHA1 Message Date
0e370eb457 new index
All checks were successful
Deploy / trigger (push) Successful in 21s
2026-03-27 23:14:15 +01:00
15e1860105 Merge branch 'main' of https://git.vps.francescomancuso.it/elisabetta/cryptoseals
All checks were successful
Deploy / trigger (push) Successful in 20s
2026-03-27 22:47:52 +01:00
2565f8f04c fixed urls 2026-03-27 22:47:47 +01:00
259296fc0f Fix su pom.xml
All checks were successful
Deploy / trigger (push) Successful in 20s
2026-03-27 22:34:48 +01:00
af5415a6f1 Fix su pom.xml
All checks were successful
Deploy / trigger (push) Successful in 20s
2026-03-27 22:32:54 +01:00
d3ab08e944 Merge branch 'main' of https://git.vps.francescomancuso.it/elisabetta/cryptoseals
All checks were successful
Deploy / trigger (push) Successful in 20s
2026-03-27 22:21:22 +01:00
97387d2867 Quick fix su pom.xml 2026-03-27 22:21:19 +01:00
75698d078f Merge branch 'main' of https://git.vps.francescomancuso.it/elisabetta/cryptoseals
All checks were successful
Deploy / trigger (push) Successful in 19s
2026-03-27 22:18:58 +01:00
c45f4414b1 random 2026-03-27 22:18:54 +01:00
6 changed files with 51 additions and 149 deletions

4
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"maven.view": "hierarchical",
"java.configuration.updateBuildConfiguration": "interactive"
}

View File

@@ -6,7 +6,7 @@
<groupId>com.crypto</groupId> <groupId>com.crypto</groupId>
<artifactId>cryptoseals</artifactId> <artifactId>cryptoseals</artifactId>
<version>1.0.0-SERVER</version> <version>1</version>
<properties> <properties>
<maven.compiler.source>23</maven.compiler.source> <maven.compiler.source>23</maven.compiler.source>
@@ -37,31 +37,27 @@
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>3.5.1</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>shade</goal> <goal>single</goal>
</goals> </goals>
<configuration> <configuration>
<transformers> <archive>
<transformer <manifest>
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>
<mainClass>com.crypto.Seal</mainClass> com.crypto.Seal
</transformer> </mainClass>
</transformers> </manifest>
<filters> </archive>
<filter> <descriptorRefs>
<artifact>*:*</artifact> <descriptorRef>jar-with-dependencies</descriptorRef>
<excludes> </descriptorRefs>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude> <attach>true</attach>
<exclude>META-INF/*.RSA</exclude> <finalName>app</finalName>
</excludes>
</filter>
</filters>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>

View File

@@ -13,7 +13,7 @@ public class Seal {
}).start(8080); }).start(8080);
System.out.println("Generazione chiavi RSA per il server web in corso..."); System.out.println("Generazione chiavi RSA per il server web in corso...");
// Cifratura con Cifrario di Cesare // Cifratura con Cifrario di Cesare
app.post("/seal/caesar/encrypt", ctx -> { app.post("/seal/caesar/encrypt", ctx -> {

View File

@@ -50,7 +50,7 @@
if(!input) return alert("Inserisci del testo!"); if(!input) return alert("Inserisci del testo!");
try { try {
const risposta = await fetch("http://localhost:8080/api/cesare/cifra", { const risposta = await fetch("/seal/cesare/encrypt", {
method: "POST", headers: { "Content-Type": "application/json" }, method: "POST", headers: { "Content-Type": "application/json" },
// Invia il testo e la CHIAVE (convertita in numero) al server // Invia il testo e la CHIAVE (convertita in numero) al server
body: JSON.stringify({ testo: input, chiave: parseInt(chiave) }) body: JSON.stringify({ testo: input, chiave: parseInt(chiave) })
@@ -65,7 +65,7 @@
if(!inputCifrato) return alert("Nessun testo da decifrare!"); if(!inputCifrato) return alert("Nessun testo da decifrare!");
try { try {
const risposta = await fetch("http://localhost:8080/api/cesare/decifra", { const risposta = await fetch("/seal/cesare/decrypt", {
method: "POST", headers: { "Content-Type": "application/json" }, method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ testo: inputCifrato, chiave: parseInt(chiave) }) body: JSON.stringify({ testo: inputCifrato, chiave: parseInt(chiave) })
}); });

View File

@@ -3,8 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CryptoSeals - Motore RSA</title> <title>CryptoSeals - Home</title>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <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"> <link rel="stylesheet" href="style.css">
</head> </head>
@@ -19,139 +18,41 @@
<i class="fa-solid fa-bars"></i> <i class="fa-solid fa-bars"></i>
</div> </div>
<ul class="nav-links" id="nav-links"> <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="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="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> <li><a href="team.html"><i class="fa-solid fa-users"></i> Il Team</a></li>
</ul> </ul>
</nav> </nav>
<div class="container"> <div class="container" style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 60vh;">
<h1>Motore RSA</h1> <h1>Welcome to CryptoSeals</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> <p class="descrizione">
Dive deep, Seal your data. <i class="fa-solid fa-water"></i><br><br>
<div class="crypto-box"> Scegli uno strumento dal menu per iniziare a proteggere i tuoi messaggi!
</p>
<label><i class="fa-solid fa-ruler-horizontal"></i> Dimensione Chiave RSA</label> <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';">
<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="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 che vuoi proteggere..."></textarea>
<button id="btn-encrypt" onclick="encrypt()"><i class="fa-solid fa-lock"></i> Cifra il messaggio</button>
</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>
</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> </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>
</footer>
<script> <script>
// Gestione Menu Mobile
function toggleMenu() { function toggleMenu() {
document.getElementById("nav-links").classList.toggle("active"); document.getElementById("nav-links").classList.toggle("active");
} }
// Anno dinamico Footer
// Configurazione globale per SweetAlert2 in tema dark document.getElementById("year").innerText = new Date().getFullYear();
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("http://localhost:8080/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("http://localhost:8080/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;
}
}
</script> </script>
</body> </body>
</html> </html>

View File

@@ -30,8 +30,9 @@
<select id="keysize"> <select id="keysize">
<option value="512">512 bit (Solo didattico - Veloce)</option> <option value="512">512 bit (Solo didattico - Veloce)</option>
<option value="1024" selected>1024 bit (Test - Bilanciato)</option> <option value="1024" selected>1024 bit (Test - Bilanciato)</option>
<option value="2048">2048 bit (Standard - Lenta da generare)</option> <option value="2048">2048 bit (Standard - Lenta da generare)</option>
<option value="4096">4096 bit (Alta sicurezza - Molto lenta ⏳⏳)</option> <option value="3072">3072 bit (Ottima - Mediamente Lenta)</option>
<option value="4096">4096 bit (Alta sicurezza - Molto lenta)</option>
</select> </select>
<div class="crypto-columns"> <div class="crypto-columns">
@@ -67,7 +68,7 @@
try { try {
// NOTA: Controlla che la rotta nel tuo Java sia corretta (/seal/rsa/encrypt o /api/rsa/cifra) // NOTA: Controlla che la rotta nel tuo Java sia corretta (/seal/rsa/encrypt o /api/rsa/cifra)
const res = await fetch("http://localhost:8080/seal/rsa/encrypt", { const res = await fetch("/seal/rsa/encrypt", {
method: "POST", headers: { "Content-Type": "application/json" }, method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: plaintext, keysize: parseInt(size) }) body: JSON.stringify({ text: plaintext, keysize: parseInt(size) })
}); });