{"id":34847701,"url":"https://github.com/mugomes/mgprotect","last_synced_at":"2026-01-13T20:50:46.006Z","repository":{"id":330459732,"uuid":"1122816487","full_name":"mugomes/mgprotect","owner":"mugomes","description":"MGProtect é uma biblioteca em Go para proteção de software via serial e validação de licença.","archived":false,"fork":false,"pushed_at":"2025-12-25T18:13:06.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-27T03:04:43.479Z","etag":null,"topics":["licensing","protection","software"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mugomes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-25T15:18:22.000Z","updated_at":"2025-12-25T18:13:09.000Z","dependencies_parsed_at":"2025-12-27T03:05:01.898Z","dependency_job_id":null,"html_url":"https://github.com/mugomes/mgprotect","commit_stats":null,"previous_names":["mugomes/mgprotect"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mugomes/mgprotect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugomes%2Fmgprotect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugomes%2Fmgprotect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugomes%2Fmgprotect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugomes%2Fmgprotect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mugomes","download_url":"https://codeload.github.com/mugomes/mgprotect/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugomes%2Fmgprotect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28400230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["licensing","protection","software"],"created_at":"2025-12-25T18:53:12.793Z","updated_at":"2026-01-13T20:50:46.001Z","avatar_url":"https://github.com/mugomes.png","language":"Go","funding_links":["https://github.com/sponsors/mugomes"],"categories":[],"sub_categories":[],"readme":"# MGProtect\n\nMGProtect é uma biblioteca em Go para proteção de software via serial e validação de licença. Ela permite criar sistemas de licenciamento seguros que verificam:\n\n- Serial válido\n- Produto e versão correta\n- Integridade e assinatura digital\n- Máquina específica (via hash do hardware)\n\n**Importante:** Para usar MGProtect corretamente, você precisa gerar previamente a chave pública, a chave interna e o serial utilizando a ferramenta [MGProtectedGenerator](https://www.mugomes.com.br/p/mgprotectedgenerator.html). Esta ferramenta garante que os dados de licença sejam assinados e criptografados de forma compatível com MGProtect.\n\n## Funcionalidades Principais\n\n- Validação de serial usando ed25519\n- Validação de licença por máquina\n- Assinatura HMAC de dados locais\n- Suporte a múltiplas versões de produto\n\n## Instalação\n\n`go get github.com/mugomes/mgprotect`\n\n## Exemplo de Uso\n\n```\npackage main\n\nimport (\n    \"crypto/ed25519\"\n    \"fmt\"\n    \"mugomes/mgprotect\"\n)\n\nfunc main() {\n    // Inicializa a proteção\n    mgp := mgprotect.New()\n\n    // Configura produto, versão e chaves geradas pelo mggenerator\n    mgp.SetProductID(0x01)\n    mgp.SetMajorVersion(1)\n    \n    // pubKey deve vir do mggenerator\n    mgp.SetPublicKey(ed25519.PublicKey{valorporvirgula})\n\n    // Chave interna para HMAC\n    mgp.SetInternalKey([]byte(\"SUA_CHAVE_INTERNA_DO_MGGENERATOR\"))\n\n    // Chave de criptografia do serial\n    mgp.SetK(\"SUA_CHAVE_K_DO_MGGENERATOR\")\n\n    // Validar um serial fornecido pelo usuário\n    serial := \"digite o serial aqui\"\n    result := mgp.Validate(serial)\n\n    switch result {\n    case 1:\n        fmt.Println(\"Serial válido!\")\n    case mgprotect.ERRO_SERIAL_INVALIDO:\n        fmt.Println(\"Serial inválido\")\n    case mgprotect.ERRO_CHECKSUM_INVALIDO:\n        fmt.Println(\"Checksum inválido\")\n    case mgprotect.ERRO_PRODUTO_INVALIDO:\n        fmt.Println(\"Produto inválido\")\n    case mgprotect.ERRO_LICENCA_NAO_VALIDA_PARA_VERSAO:\n        fmt.Println(\"Licença não válida para esta versão\")\n    case mgprotect.ERRO_ASSINATURA_INVALIDA:\n        fmt.Println(\"Assinatura inválida\")\n    }\n}\n```\n\nPara inicialização do software você pode usar o validador dessa forma:\n\n```\n// Salva a licença no arquivo\nerr := mgp.SaveLicense(licensePath, serial)\nif err != nil {\n    fmt.Println(\"Erro ao salvar licença:\", err)\n    return\n}\nfmt.Println(\"Licença salva com sucesso!\")\n\n// Agora podemos carregar e validar a licença\nif mgp.LoadAndValidate(licensePath) {\n    fmt.Println(\"Licença válida!\")\n} else {\n    fmt.Println(\"Licença inválida ou não corresponde a esta máquina\")\n}\n```\n\nA biblioteca pode ser usada em projetos comerciais ou pessoais, mas o uso seguro requer a geração correta das chaves e serial via [MGProtectedGenerator](https://www.mugomes.com.br/p/mgprotectedgenerator.html).\n\n## Information\n\n - [Page MGProtect](https://www.mugomes.com.br/p/mgprotect.html)\n\n## Requirement\n\n - Go 1.25.5\n\n## Support\n\n- GitHub: https://github.com/sponsors/mugomes\n- More: https://www.mugomes.com.br/p/apoie.html\n\n## License\n\nCopyright (c) 2025 Murilo Gomes Julio\n\nLicensed under the [MIT](https://github.com/mugomes/mgprotect/blob/main/LICENSE) license.\n\nAll contributions to the MGProtect are subject to this license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmugomes%2Fmgprotect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmugomes%2Fmgprotect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmugomes%2Fmgprotect/lists"}