"Not a Pentest" Trust-Anker: Kryptografie schützt eigene Daten. Keine Angriffswerkzeuge.
Moltbot AI Security · Cryptography
Moltbot Cryptography & Encryption Guide
Schwache Verschlüsselung ist kein Schutz. AES-256, RSA-4096, PBKDF2 und Key Rotation sind heute Minimum-Standards.
Was ist Kryptografie? Einfach erklärt
Kryptografie ist wie ein Tresor mit mathematischem Schloss: es verwandelt lesbare Daten in unleserlichen Code, der nur mit dem richtigen Schlüssel wieder geöffnet werden kann. AES-256 verschlüsselt Daten mit 256-Bit-Schlüsseln. RSA-4096 nutzt asymmetrische Schlüssel für sicheren Austausch. Hashing erzeugt Fingerabdrücke von Daten zur Integritätsprüfung. Key Rotation erneuert Schlüssel regelmäßig zur Sicherheit. Ohne starke Kryptografie sind Daten angreifbar für Brute Force, Rainbow Tables und Quantum Computing.
↓ Springe zu Algorithmen und Implementation
Verschlüsselungs-Algorithmen
| Algorithmus | Use Case | Schlüsselgröße | Status |
|---|---|---|---|
| AES-256-GCM | Datenverschlüsselung | 256-bit | Empfohlen |
| ChaCha20-Poly1305 | Mobile/Streaming | 256-bit | Empfohlen |
| RSA-OAEP | Key Exchange | 4096-bit | Empfohlen |
| ECDSA | Digitale Signature | P-256/P-384 | Empfohlen |
| SHA-256 | Hashing | 256-bit | Empfohlen |
| SHA-3 | Hashing (Future) | 256/512-bit | Optional |
AES-256 Implementation
// AES-256-GCM Verschlüsselung für Moltbot
const crypto = require('crypto');
class AESEncryption {
constructor(key) {
this.key = Buffer.from(key, 'hex');
this.algorithm = 'aes-256-gcm';
this.ivLength = 16;
this.tagLength = 16;
}
encrypt(plaintext) {
const iv = crypto.randomBytes(this.ivLength);
const cipher = crypto.createCipher(this.algorithm, this.key, iv);
let encrypted = cipher.update(plaintext, 'utf8', 'hex');
encrypted += cipher.final('hex');
const tag = cipher.getAuthTag();
return {
iv: iv.toString('hex'),
encrypted,
tag: tag.toString('hex')
};
}
decrypt(encryptedData) {
const iv = Buffer.from(encryptedData.iv, 'hex');
const tag = Buffer.from(encryptedData.tag, 'hex');
const decipher = crypto.createDecipher(this.algorithm, this.key, iv);
decipher.setAuthTag(tag);
let decrypted = decipher.update(encryptedData.encrypted, 'hex', 'utf8');
decrypted += decipher.final('utf8');
return decrypted;
}
}
// Key Management
const masterKey = process.env.MASTER_KEY; // 64-hex chars
const encryption = new AESEncryption(masterKey);
// Beispiel: API-Keys verschlüsseln
const apiKey = 'sk_test_4242424242424242';
const encrypted = encryption.encrypt(apiKey);
console.log('Encrypted:', encrypted);RSA Key Management
// RSA-4096 Key Generation und Management
const { generateKeyPair, publicEncrypt, privateDecrypt } = require('crypto');
class RSAKeyManager {
constructor() {
this.keyPair = null;
}
generateKeyPair() {
this.keyPair = crypto.generateKeyPairSync('rsa', {
modulusLength: 4096,
publicKeyEncoding: { type: 'spki', format: 'pem' },
privateKeyEncoding: { type: 'pkcs8', format: 'pem' }
});
return this.keyPair;
}
encryptWithPublicKey(data, publicKey) {
return crypto.publicEncrypt(
{ key: publicKey, padding: crypto.constants.RSA_PKCS1_OAEP_PADDING, oaepHash: 'sha256' },
Buffer.from(data)
).toString('base64');
}
decryptWithPrivateKey(encryptedData, privateKey) {
return crypto.privateDecrypt(
{ key: privateKey, padding: crypto.constants.RSA_PKCS1_OAEP_PADDING, oaepHash: 'sha256' },
Buffer.from(encryptedData, 'base64')
).toString();
}
}
// Key Rotation Schedule
class KeyRotationManager {
constructor(keyManager) {
this.keyManager = keyManager;
this.currentKeyId = 'key-2024-01';
this.keys = new Map();
}
async rotateKeys() {
const newKeyPair = this.keyManager.generateKeyPair();
const newKeyId = 'key-' + new Date().toISOString().slice(0, 7);
// Store new key
this.keys.set(newKeyId, {
publicKey: newKeyPair.publicKey,
privateKey: newKeyPair.privateKey,
createdAt: new Date(),
status: 'active'
});
// Mark old key as deprecated
const oldKey = this.keys.get(this.currentKeyId);
if (oldKey) {
oldKey.status = 'deprecated';
oldKey.deprecatedAt = new Date();
}
this.currentKeyId = newKeyId;
return newKeyId;
}
}Secure Hashing
// Sicheres Hashing mit Salt und Pepper
const crypto = require('crypto');
class SecureHashing {
constructor(pepper) {
this.pepper = Buffer.from(pepper, 'hex');
this.iterations = 100000;
}
hash(password, salt) {
const saltedPassword = Buffer.concat([
Buffer.from(password, 'utf8'),
salt,
this.pepper
]);
return crypto.pbkdf2Sync(
saltedPassword,
salt,
this.iterations,
64,
'sha512'
).toString('hex');
}
verify(password, salt, hash) {
const computedHash = this.hash(password, salt);
return crypto.timingSafeEqual(
Buffer.from(hash, 'hex'),
Buffer.from(computedHash, 'hex')
);
}
generateSalt() {
return crypto.randomBytes(32);
}
}
// Beispiel: User Password Hashing
const pepper = process.env.PEPPER; // 64-hex chars
const hashing = new SecureHashing(pepper);
const password = 'user_password_123';
const salt = hashing.generateSalt();
const hash = hashing.hash(password, salt);
console.log('Hash:', hash);
console.log('Verified:', hashing.verify(password, salt, hash));🔗 Weiterführende Ressourcen
CG
ClawKing Security Team
✓ VerifiedSecurity Research & Engineering · Cryptography Specialists
📅 Veröffentlicht: 28.04.2026🔄 Zuletzt geprüft: 28.04.2026
Dieser Guide basiert auf praktischer Erfahrung mit Kryptografie-Implementierungen für KI-Systeme in Produktionsumgebungen. Die beschriebenen Best Practices sind in echten Deployments erprobt und kontinuierlich verbessert worden.
🔒 Verifiziert von ClawKing Security Team·Alle Informationen fact-checked und peer-reviewed