Since 2010, when I signed up for this forum, I've been studying about and looking for a way to protect cryptographic keys inside executables or libraries. Along the way I learned that it is impossible to protect absolutely because keys are clean parameters for cryptographic functions and methods, so there will always be risks. From then on, my focus has become reducing the attack surface to a minimum, and I'm close to completing my task.
I created a component that I call AppShield. The functions of it add some things that the already known UniqueInstance, OnGuard, StrHolder and others do (not only them, not all of them). I preferred not to reuse the code of the referred ones to facilitate my understanding on the interaction of pieces of code and the operation as a single piece. I only extract the idea of each one, since ideas are not subject to licensing or patents. However, most of my component is made up of functions and methods of encryption, compression, xor, key derivation, message authentication, hash/checksum, execution of protected SQL code (SQLite/SQLCipher pragmas key/rekey for example), prevention against SQL Injection, protection of strings and texts. The protections embrace the execution time, design time, distribution time and loading time.
Many here in the forum contributed to my work, I will thank them again later. I received very good suggestions, like using hardlocks/dongles. I implanted the suggestions that were possible for me, but hardlocks/dongles involve costs, so I could use this alternative only when my other projects, which demand this one, start to give me a financial return.
Although it has been eight years of my effort, I do not mind opening the code, but due to the impossibility of absolute protection, I fear that knowledge about the code will be a map to circumvent the mechanisms that would theoretically reduce the attack surface. So the big question is: release the code would increase or decrease the safety of my component?
Please convince me of something because I am very hesitant.
=== Now in Brazilian Portuguese ===
Desde 2010, quando me inscrevi neste fórum, venho estudando sobre e procurando por uma forma de proteger chaves criptográficas dentro de executáveis ou bibliotecas. No caminho aprendi que é impossível proteger absolutamente porque as chaves são parâmetros limpos para as funções e métodos de criptografia, então sempre haverá riscos. Daí em diante, meu foco se tornou reduzir a superfície de ataque ao mínimo, e estou próximo de concluir minha tarefa.
Criei um componente que denomino como AppShield. As funções dele agregam algumas coisas que os já conhecidos UniqueInstance, OnGuard, StrHolder e outros fazem (não apenas elas, nem todas elas). Preferi não reaproveitar o código dos referidos para facilitar o meu entendimento sobre a interação dos pedaçoes de código e o funcionamento como uma peça única. Extraí apenas a idéia de cada um, já que idéias não estão sujeitas a licenciamento ou patentes. Todavia, a maior parte do meu componente é composta por funções e métodos de criptografia, compressão, xor, derivação de chave, autenticação de mensagens, hash/checksum, execução de código SQL protegido (pragmas key/rekey do SQLite/SQLCipher por exemplo), prevenção contra SQL Injection, proteção de strings e textos. As proteções abragem o tempo de execução, tempo de design, tempo de distribuição e tempo de carregamento.
Muitos aqui do fórum contribuíram com o meu trabalho, eu irei adradecê-los novamente depois. Recebi sugestões muito boas, como utilizar hardlocks/dongles. Eu implantei as sugestões que eram possíveis pra mim, mas hardlocks/dongles envolvem custos, então eu poderia utilizar essa alternativa apenas quando meus outros projetos, quais demandam este, começarem a me dar retorno financeiro.
Embora tenham sido oito anos do meu esforço, não me importo em abrir o código, mas devido à impossibilidade de proteger de forma absoluta, temo que o conhecimento sobre o código venha a ser um mapa para contornar os mecanismos que teoricamente reduziriam a superficie de ataque. Então, a grande questão é: liberar o código fonte aumentaria ou diminuiria a segurança do meu componente?
Por favor, convençam-me de alguma coisa porque estou muito indeciso.