software steht so weit.

jetzt build + docker build und testen
This commit is contained in:
br committed 2026-10-02 13:25:34 +02:00
1 parent 42f0c0accb
commit ca6cdcca63
90 files changed
+10298 -480

No files matched your search

+21
View File
@@ -104,3 +104,24 @@ func DecodePublicKey(s string) (ed25519.PublicKey, error) {
}
return ed25519.PublicKey(b), nil
}
// rotationVersion trennt Rotationsnachweise von anderen Signaturen.
const rotationVersion = "SULTAN-ROTATE-V1\n"
func rotationMessage(nodeID string, pub ed25519.PublicKey) []byte {
return []byte(rotationVersion + nodeID + "\n" + EncodePublicKey(pub))
}
// RotationProof beweist beim Schlüsselwechsel (rotate_key) den Besitz des
// neuen Schlüssels; der Nachweis ist an die Knoten-ID gebunden.
func RotationProof(nodeID string, newKey ed25519.PrivateKey) string {
pub := newKey.Public().(ed25519.PublicKey)
return base64.StdEncoding.EncodeToString(ed25519.Sign(newKey, rotationMessage(nodeID, pub)))
}
// VerifyRotationProof prüft einen RotationProof.
func VerifyRotationProof(nodeID string, pub ed25519.PublicKey, proof string) bool {
sig, err := base64.StdEncoding.DecodeString(proof)
return err == nil && len(sig) == ed25519.SignatureSize && len(pub) == ed25519.PublicKeySize &&
ed25519.Verify(pub, rotationMessage(nodeID, pub), sig)
}