RafaelFranckilin 0 Posted August 13, 2019 Report Share Posted August 13, 2019 Eu tenho um programa que vai rodar direto de um pendriver Tô tentando encriptar e decriptar o app.config, mas preciso que funcione em vários computadores alguém pode me ajudar com alguma solução? Link to post Share on other sites
M6 150 Posted August 28, 2019 Report Share Posted August 28, 2019 Podes simplesmente usar o algoritmo do zip para fazer isso por exemplo. Ou seja, uma solução simples é teres o ficheiro zipado (aconselho uma extensão diferente e com senha de acesso) e quando necessitas de o usar, fazes unzip e lês o mesmo. 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar." Link to post Share on other sites
RafaelFranckilin 0 Posted August 28, 2019 Author Report Share Posted August 28, 2019 (edited) Interessante, você pode me ensinar como implementar essa ideia no meu código? atualmente eu tô usando esse código para para encriptar e decriptar, mas eu não sei importar a chave para outros computadores System.Configuration Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 'Encrypt Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) Dim configSection As ConfigurationSection configSection = config.AppSettings If Not (configSection Is Nothing) Then If Not (configSection.ElementInformation.IsLocked) Then configSection.SectionInformation.ProtectSection("rsaProtectedConfigurationProvider") configSection.SectionInformation.ForceSave = True config.Save(ConfigurationSaveMode.Full) End If End If MsgBox("Success!") End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click 'Decrypt Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) Dim configSection As ConfigurationSection configSection = config.AppSettings If Not (configSection Is Nothing) Then If Not (configSection.ElementInformation.IsLocked) Then configSection.SectionInformation.UnprotectSection() configSection.SectionInformation.ForceSave = True config.Save(ConfigurationSaveMode.Full) End If End If MsgBox("Success!") End Sub End Class Edited August 28, 2019 by RafaelFranckilin Link to post Share on other sites
M6 150 Posted August 28, 2019 Report Share Posted August 28, 2019 Se a aplicação é para executar a partir de uma pendrive, eu diria que o código é único à aplicação e não ao computador onde está a ser executado. Quando à ajuda, basicamente é seguires os passos que referi anteriormente: aprende a fazer zip/unzip de um ficheiro dentro da aplicação. 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar." Link to post Share on other sites
RafaelFranckilin 0 Posted August 28, 2019 Author Report Share Posted August 28, 2019 (edited) 52 minutos atrás, M6 disse: Se a aplicação é para executar a partir de uma pendrive, eu diria que o código é único à aplicação e não ao computador onde está a ser executado. o arquivo encriptado em um computador não pode decriptar em outro a não ser que eu exporte as chaves RSA pro outro computador, mas eu não consegui fazer isso, pesquisei vários tutoriais ensinando, mas eu não consegui fazer. 52 minutos atrás, M6 disse: Quando à ajuda, basicamente é seguires os passos que referi anteriormente: aprende a fazer zip/unzip de um ficheiro dentro da aplicação Vou tentar aqui, muito obrigado pela dica. Edited August 28, 2019 by RafaelFranckilin Link to post Share on other sites
M6 150 Posted August 28, 2019 Report Share Posted August 28, 2019 Podes sempre usar um esquema de chaves assimétricas: https://pt.wikipedia.org/wiki/Criptografia_de_chave_pública 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar." Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now