Compare commits
13 Commits
5b02382cf5
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e370eb457 | |||
| 15e1860105 | |||
| 2565f8f04c | |||
| 259296fc0f | |||
| af5415a6f1 | |||
| d3ab08e944 | |||
| 97387d2867 | |||
| 75698d078f | |||
| c45f4414b1 | |||
| e559bd2e58 | |||
| b6c9155b81 | |||
| 19d360b4d6 | |||
| 56214f1b57 |
@@ -12,7 +12,7 @@ jobs:
|
||||
env:
|
||||
REPO_NAME: ${{ gitea.event.repository.name }}
|
||||
REPO_OWNER: ${{ gitea.repository_owner }}
|
||||
ROOT_DIR: "/src"
|
||||
ROOT_DIR: "/backend/src/main/java/com/crypto"
|
||||
TYPE: "java"
|
||||
JOB_TOKEN: ${{ gitea.token }}
|
||||
run: |
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -33,3 +33,5 @@ replay_pid*
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
target/
|
||||
.vscode/
|
||||
4
.vscode/settings.json
vendored
Normal file
4
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"maven.view": "hierarchical",
|
||||
"java.configuration.updateBuildConfiguration": "interactive"
|
||||
}
|
||||
68
backend/pom.xml
Normal file
68
backend/pom.xml
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.crypto</groupId>
|
||||
<artifactId>cryptoseals</artifactId>
|
||||
<version>1</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>23</maven.compiler.source>
|
||||
<maven.compiler.target>23</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.javalin</groupId>
|
||||
<artifactId>javalin</artifactId>
|
||||
<version>6.1.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>2.0.16</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.16.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>
|
||||
com.crypto.Seal
|
||||
</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
|
||||
<attach>true</attach>
|
||||
<finalName>app</finalName>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -13,7 +13,7 @@ public class Seal {
|
||||
}).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
|
||||
app.post("/seal/caesar/encrypt", ctx -> {
|
||||
@@ -50,7 +50,7 @@
|
||||
if(!input) return alert("Inserisci del testo!");
|
||||
|
||||
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" },
|
||||
// Invia il testo e la CHIAVE (convertita in numero) al server
|
||||
body: JSON.stringify({ testo: input, chiave: parseInt(chiave) })
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
if(!inputCifrato) return alert("Nessun testo da decifrare!");
|
||||
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" },
|
||||
body: JSON.stringify({ testo: inputCifrato, chiave: parseInt(chiave) })
|
||||
});
|
||||
58
backend/src/main/resources/get/index.html
Normal file
58
backend/src/main/resources/get/index.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<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>
|
||||
<body>
|
||||
|
||||
<nav class="navbar">
|
||||
<a href="index.html" class="nav-brand">
|
||||
<img src="seal1.png" height="50" alt="🦭" onerror="this.src='https://cdn-icons-png.flaticon.com/512/3063/3063126.png';">
|
||||
CryptoSeals
|
||||
</a>
|
||||
<div class="menu-toggle" onclick="toggleMenu()">
|
||||
<i class="fa-solid fa-bars"></i>
|
||||
</div>
|
||||
<ul class="nav-links" id="nav-links">
|
||||
<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" 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>
|
||||
|
||||
<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>
|
||||
// Gestione Menu Mobile
|
||||
function toggleMenu() {
|
||||
document.getElementById("nav-links").classList.toggle("active");
|
||||
}
|
||||
// Anno dinamico Footer
|
||||
document.getElementById("year").innerText = new Date().getFullYear();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -30,8 +30,9 @@
|
||||
<select id="keysize">
|
||||
<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>
|
||||
<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">
|
||||
@@ -67,7 +68,7 @@
|
||||
|
||||
try {
|
||||
// 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" },
|
||||
body: JSON.stringify({ text: plaintext, keysize: parseInt(size) })
|
||||
});
|
||||
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
@@ -1,157 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
<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>
|
||||
<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>
|
||||
<body>
|
||||
|
||||
<nav class="navbar">
|
||||
<a href="index.html" class="nav-brand">
|
||||
<img src="seal1.png" height="50" alt="🦭" onerror="this.src='https://cdn-icons-png.flaticon.com/512/3063/3063126.png';">
|
||||
CryptoSeals
|
||||
</a>
|
||||
<div class="menu-toggle" onclick="toggleMenu()">
|
||||
<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="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="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>
|
||||
|
||||
<script>
|
||||
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("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>
|
||||
</body>
|
||||
</html>
|
||||
36
src/pom.xml
36
src/pom.xml
@@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.crypto</groupId>
|
||||
<artifactId>cryptoseals</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.javalin</groupId>
|
||||
<artifactId>javalin</artifactId>
|
||||
<version>6.1.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>2.0.16</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.16.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
Reference in New Issue
Block a user