Files
RemLink/internal/platform/windows/dpapi/dpapi_windows_test.go
T
qsc20001102 142e5dc7d6
ci / Go checks (ubuntu-latest) (push) Has been cancelled
ci / Go checks (windows-latest) (push) Has been cancelled
初版功能完成
2026-08-29 13:12:17 +08:00

28 lines
522 B
Go

//go:build windows
package dpapi
import (
"bytes"
"testing"
)
func TestProtectUnprotect(t *testing.T) {
protector := Protector{}
plain := []byte("RemLink test secret")
protected, err := protector.Protect(plain)
if err != nil {
t.Fatal(err)
}
if bytes.Equal(protected, plain) {
t.Fatal("DPAPI returned plaintext")
}
unprotected, err := protector.Unprotect(protected)
if err != nil {
t.Fatal(err)
}
if !bytes.Equal(unprotected, plain) {
t.Fatalf("unprotected = %q, want %q", unprotected, plain)
}
}