Initial commit: AetherForge Linux (forge-mesh) v0.1.0-dev
Some checks failed
Test / test (push) Has been cancelled
Some checks failed
Test / test (push) Has been cancelled
This commit is contained in:
22
internal/forge/sign_test.go
Normal file
22
internal/forge/sign_test.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package forge
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSignVerify(t *testing.T) {
|
||||
path := t.TempDir() + "/signing.key"
|
||||
kp, err := LoadOrCreateKey(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
data := []byte("forge-mesh artifact")
|
||||
sig := kp.Sign(data)
|
||||
if !Verify(kp.Public, data, sig) {
|
||||
t.Fatal("signature verification failed")
|
||||
}
|
||||
if Verify(kp.Public, []byte("tampered"), sig) {
|
||||
t.Fatal("tampered data should not verify")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user