- sdk/cpp/doglic.hpp:头文件版验签(自带 bignum/SHA-1/base64,PKCS#1 v1.5 结构 + chunk 解析 + 尾部校验和 + 到期/构建日判定),任何 C++ 产品包含即可用 - backend/internal/doglic:Go 版签发/校验(密钥取自工程 <LicenseManager> 的 base64 属性) - backend/cmd/doglicgen:签发 CLI(-user/-email/-exp/-max-build/-running-time/-hwid/-user-data, 以及 -verify 自检) - backend/cmd/packsigned:以 signed 模式(flags bit1,壳侧跳过整文件 CRC)注入验证壳, 供「先打壳再二次加 DogProtect」的场景测试用
39 lines
908 B
Go
39 lines
908 B
Go
// 临时工具:以 signed 模式(flags bit1,壳侧跳过整文件 CRC)注入验证壳
|
|
// 用法: packsigned <src> <out> <cfg.json>
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"verification-platform-backend/internal/protect"
|
|
)
|
|
|
|
func main() {
|
|
if len(os.Args) != 4 {
|
|
fmt.Fprintln(os.Stderr, "用法: packsigned <src> <out> <cfg.json>")
|
|
os.Exit(2)
|
|
}
|
|
src, err := os.ReadFile(os.Args[1])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
cfg, err := os.ReadFile(os.Args[3])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
arch, err := protect.DetectArch(src)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
out, info, err := protect.PatchSigned(src, cfg, arch, true)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if err := os.WriteFile(os.Args[2], out, 0o644); err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Printf("产物 %s %d 字节 入口 0x%x→0x%x crcVfy=%08x crcFile=%08x\n",
|
|
os.Args[2], info.OutSize, info.EntryOld, info.EntryNew, info.CrcVfy, info.CrcFile)
|
|
}
|