This commit is contained in:
2025-09-22 20:45:54 +02:00
parent 6defd74ca8
commit e09bc18900
5 changed files with 355 additions and 0 deletions

65
templates/index.html Normal file
View File

@@ -0,0 +1,65 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>PGP Keygenerator (Go)</title>
<style>
body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Inter,sans-serif;max-width:960px;margin:2rem auto;padding:0 1rem;color:#0f172a}
header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem}
.card{border:1px solid #e2e8f0;border-radius:14px;padding:1rem 1.25rem;box-shadow:0 1px 2px rgba(0,0,0,0.04)}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:1rem;align-items:start}
label{font-size:.9rem;color:#334155;display:block;margin-bottom:0.25rem}
input, select{box-sizing:border-box;display:block;width:100%;padding:0.6rem 0.7rem;border-radius:10px;border:1px solid #cbd5e1}
select{background:#fff}
textarea{width:100%;min-height:9rem;border-radius:10px;border:1px solid #cbd5e1;padding:.6rem .7rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;box-sizing:border-box}
button{background:#0ea5e9;color:white;border:none;border-radius:12px;padding:.75rem 1rem;font-weight:600;cursor:pointer}
button:hover{background:#0284c7}
small.muted{color:#64748b;display:block;margin-top:0.25rem}
.footer{margin-top:2rem;color:#64748b;font-size:.9rem}
.row{display:flex;gap:1rem;flex-wrap:wrap;align-items:center}
</style>
</head>
<body>
<header>
<h1>🔐 PGP Keygenerator</h1>
<a href="https://www.openpgp.org/" target="_blank" rel="noopener">OpenPGP</a>
</header>
<form class="card" method="post" action="/generate" autocomplete="off">
<div class="grid">
<div>
<label for="name">Name</label>
<input id="name" name="name" placeholder="Max Mustermann" required />
</div>
<div>
<label for="email">EMail</label>
<input id="email" name="email" type="email" placeholder="max@example.org" required />
</div>
<div>
<label for="comment">Kommentar (optional)</label>
<input id="comment" name="comment" placeholder="z.B. LaptopKey" />
</div>
<div>
<label for="rsabits">RSASchlüssellänge</label>
<select id="rsabits" name="rsabits">
<option value="2048">2048</option>
<option value="3072">3072</option>
<option value="4096" selected>4096</option>
</select>
</div>
<div style="grid-column:1/-1">
<label for="passphrase">Passphrase (empfohlen)</label>
<input id="passphrase" name="passphrase" type="password" placeholder="••••••••" />
<small class="muted">Wird zum Verschlüsseln des privaten Schlüssels verwendet.</small>
</div>
</div>
<div style="margin-top:1rem" class="row">
<button type="submit">Schlüssel erzeugen</button>
<small class="muted">Die Erzeugung erfolgt serverseitig nur lokal auf diesem Host. Schlüssel werden nicht gespeichert.</small>
</div>
</form>
<p class="footer">Hinweis: Für maximale Sicherheit sollten PGPSchlüssel auf einem vertrauenswürdigen, isolierten System erzeugt werden. Dieses Tool ist zu Demo/Entwicklungszwecken gedacht.</p>
</body>
</html>

65
templates/result.html Normal file
View File

@@ -0,0 +1,65 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>PGP Schlüssel Ergebnis</title>
<style>
body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Inter,sans-serif;max-width:960px;margin:2rem auto;padding:0 1rem;color:#0f172a}
.card{border:1px solid #e2e8f0;border-radius:14px;padding:1rem 1.25rem;box-shadow:0 1px 2px rgba(0,0,0,0.04);margin-bottom:1rem}
textarea{width:100%;min-height:12rem;border-radius:10px;border:1px solid #cbd5e1;padding:.6rem .7rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.row{display:flex;gap:.75rem;flex-wrap:wrap}
button{background:#0ea5e9;color:white;border:none;border-radius:12px;padding:.6rem .8rem;font-weight:600;cursor:pointer}
button:hover{background:#0284c7}
.muted{color:#64748b}
</style>
</head>
<body>
<header style="display:flex;justify-content:space-between;align-items:center">
<h1>✅ Schlüssel erzeugt</h1>
<a href="/">Neuen Schlüssel erzeugen</a>
</header>
<div class="card">
<div><strong>Fingerprint:</strong> {{.Fingerprint}}</div>
<div><strong>Erstellt:</strong> {{.Created.Format "2006-01-02 15:04:05"}}</div>
<div class="muted">User ID: {{.Name}} {{if .Comment}}({{.Comment}}){{end}} &lt;{{.Email}}&gt; • RSA {{.RSABits}}</div>
</div>
<div class="card">
<h2>Öffentlicher Schlüssel</h2>
<textarea id="pub" readonly>{{.PublicArmored}}</textarea>
<div class="row" style="margin-top:.5rem">
<button onclick="copy('#pub')">Kopieren</button>
<button onclick="download('#pub','public.asc')">Als Datei speichern</button>
</div>
</div>
<div class="card">
<h2>Privater Schlüssel (geheim halten!)</h2>
<textarea id="priv" readonly>{{.PrivateArmored}}</textarea>
<div class="row" style="margin-top:.5rem">
<button onclick="copy('#priv')">Kopieren</button>
<button onclick="download('#priv','private.asc')">Als Datei speichern</button>
</div>
<p class="muted">Verwahren Sie den privaten Schlüssel sicher. Teilen Sie ihn niemals. Nutzen Sie eine starke Passphrase.</p>
</div>
<script>
async function copy(sel){
const el=document.querySelector(sel);
el.select(); el.setSelectionRange(0, 999999);
await navigator.clipboard.writeText(el.value);
alert('In die Zwischenablage kopiert.');
}
function download(sel, filename){
const text = document.querySelector(sel).value;
const blob = new Blob([text], {type:'text/plain'});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url; a.download = filename; a.click();
URL.revokeObjectURL(url);
}
</script>
</body>
</html>