Encriptación DBF

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

arroya2
Posts: 172
Joined: Thu Aug 06, 2009 7:16 am

Encriptación DBF

Post by arroya2 »

Saludos a Todos.

Me gustaría saber como encriptar y desencriptar una DBF y realizar su mantenimiento de forma transparente.

Muchas Gracias
Rafael Pérez
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Encriptación DBF

Post by sudip »

Hello,

Please check following commands:

Code: Select all

      ENCODE [ FROM < file > ] ON < key >
            FIELDS <fields,...>
            [ PASSWORD <password> ]
            [ FOR <ForExpression> ]
            [ WHILE <WhileExpression> ]
            [ ALL ]

      ENCODE <file1> TO <file2> [ PASSWORD <password> ] [ DELETE ] 

      ENCODE FILE <file> [ PASSWORD <password> ]
 
and

Code: Select all

      DECODE [FROM <(file)>] ON <key>
            FIELDS <fields,...>
            [ PASSWORD <password> ]
            [ FOR <for> ]
            [ WHILE <while> ]
            [ ALL ]

      DECODE <file1> TO <file2> [ PASSWORD <password>] [DELETE]

      DECODE FILE <file> [ PASSWORD <password> ]
 
With best regards.
Sudip
With best regards,
Sudip
arroya2
Posts: 172
Joined: Thu Aug 06, 2009 7:16 am

Re: Encriptación DBF

Post by arroya2 »

Gracias Sudip.

Lo que yo pretendo es trabajar con una base de datos encriptada y que me aparezcan los datos en pantalla desencriptados y que cuando yo cree un nuevo registro o modifique alguno existente, el usuario vea los datos desencriptados y el programa los almacene encriptados.

Lo que quiero decir es que el programa trabaje con la base de datos encriptada pero ofrezca los datos en pantalla desencriptados. Los indices se deben crear y mantener como si la base de datos estuviese desencriptada.

Saludos
Rafael Pérez
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Encriptación DBF

Post by sudip »

Hola Fafael,

Comandos de esperanza que funcione para usted. Busqué algunas muestras. Pero no pude encontrar uno.

Si tienes cualquier problema, por favor dígame. Voy a crear un ejemplo para usted. :)

Una cosa más, para entorno multi-usuario, puede que tenga que cuidar para algunas cuestiones. ;)

Lo siento por mi mal español.

Con mis mejores deseos.

Sudip
With best regards,
Sudip
User avatar
Vanguarda
Posts: 543
Joined: Wed Feb 11, 2009 10:56 am
Location: Americana - SP
Contact:

Re: Encriptación DBF

Post by Vanguarda »

hi friends,

Rafael Pérez, you can use (too) the "Crypto Library for MiniGUI" created for Grigory Filatov.

See the source in "c:\hmg\SOURCE\CRYPT"
In file h_crypt.prg you will find the functions that have on this lib.

I hope help you.

with best regards,
--
Paulo Sérgio Durço (Vanguarda)


http://hmglights.wordpress.com/
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Encriptación DBF

Post by mustafa »

Hola arroya2
Aqui te dejo un ejemplo como encriptar y desencriptar un fichero Dbf
He probado distintos encriptados y este veo que es muy interesante
puesto que se pueden encriptar , todos los campos: Númerico, Caracter,
Fecha, Logico y Memo , otros encriptadores no aceptan todos los
campos.
*-----------------------------------------------------*
Para encriptar la sentencia es:
AcripA:= (Form_1.Texto_01a.value)
criptA := Cript ( AcripA , CHR(077)+CHR(085)+CHR(083)+CHR(084)+CHR(065) ) //<---- "MUSTA")
tambien puede ser asi:
criptA := Cript ( AcripA , "MUSTA") // Clave <---- "MUSTA")

Para desencriptar la sentencia es:
DeCript ( CODE , CHR(077)+CHR(085)+CHR(083)+CHR(084)+CHR(065) ) / // Clave <---- "MUSTA")
tambien puede ser asi:
DeCript ( CODE , "MUSTA" ) // Clave <---- "MUSTA")
*--------------------------------------*
Solo encuentro un Error que no se como subsanar, una vez la base de datos Dbf
Desencriptada, en en campo Caracter, aparte de la letras que se han introducido cuando
se creó el registro se agregan códigos ASCII que no he podido eliminar incluso añadiendo
REPLICATE(CHR(176),25) , no hace ningun efecto.

Si alguien puede revisar dicha anomalia seria interesante.
Un Saludo
*--------------- Google --------------------------*
Hello arroya2
Here I leave an example as encrypt and decrypt a file Dbf
I tried different encrypted and this is very interesting to see that
since it can encrypt all fields: number, Character,
Date, Logico and Memo, other encryption can not accept all
fields.
*------------------------------------------------- ----*
To encrypt the statement is:
AcripA: = (Form_1.Texto_01a.value)
crypt = crypt (AcripA, CHR (077) + CHR (085) + CHR (083) + CHR (084) + CHR (065)) // Key <---- "MUSTA")
can also be like this:
crypt = crypt (AcripA, "MUSTA") // Key <---- "MUSTA")

To decrypt the statement is:
Decrypts (CODE, CHR (077) + CHR (085) + CHR (083) + CHR (084) + CHR (065)) // Key <---- "MUSTA")

can also be like this:
Decrypts (CODE, "MUSTA") // Key <---- "MUSTA")
*--------------------------------------*
Just find a mistake, not as a remedy, once the database Dbf
Decrypted in Character field apart from the lyrics that have been introduced when
the record was created ASCII codes are added I could not remove even adding
REPLICATE (CHR (176), 25), does not make any effect.

If anyone can review that would be interesting anomaly.

Greeting
Mustafa
Attachments
Encrip.jpg
Encrip.jpg (33.84 KiB) Viewed 9012 times
Encriptado_Elguille.zip
(738.17 KiB) Downloaded 532 times
gvaronas
Posts: 109
Joined: Wed Aug 06, 2008 5:21 pm

Re: Encriptación DBF

Post by gvaronas »

Hola Rafael, puedes investigar con DBINFO, yo hago esto:

* Pongo PSW y cierra tabla encriptada
User->(DBINFO( DBI_ENCRYPT,"psw"))
User->(DBCLOSEAREA())
/*
? "Imprime Datos sin encriptar:", User->Usr_Nomb, User->Usr_Pass
* Abrio Tabla, ahora la encripta
? "pONGO psw:", User->(DBINFO( DBI_ENCRYPT,"diegogabriel"))
*User->(dbinfo( DBI_ENCRYPT,"barneyrubble" ) )
? User->(DBINFO(DBI_ISENCRYPTED))
* Agrega Usuario admin
User->(DBAPPEND())
User->Usr_Nomb := "admin1"
User->Usr_Pass := "xxxx"
? "Imprime Datos despues de encriptar:", User->Usr_Nomb, User->Usr_Pass
User->(DBCLOSEAREA())
* Pongo PSW para abrir tabla
User->(DBINFO( DBI_PASSWORD,"psw"))

Espero te sirva.

Salu2,
GVS
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Encriptación DBF

Post by mustafa »

Password inicio
Aqui te dejo con el mismo sistema de Encriptado
la Clave inicial es : admin
admin
es igual que sea en Mayuscula o Minuscula
para empezar solo poner admin admin luego
con Newclave hacer la nueva clave si
se olvida la nueva clave si borraras
control.mem se volverá a generar automatica
la nueva Clave admin admin procedemos
hacer el cambio de clave y se volverá a
grabar el fichero control.mem

AlControl.mem es el contador de los
intentos que se permiten para entrar
el Password Correcto.

*--------------- Google -----------------------*
Startup Password
Here I leave with the same encryption system

The initial key is: admin
admin
As it is case sensitive
to start then just put admin admin
Newclave do with password if
forget the new password if you delete
control.mem automatically rebuilds the
the new admin password admin proceed
to change key and re-
save the file control.mem

AlControl.mem is the meter of the
attempts that are allowed to enter
the Password Correct.

Greeting
Mustafa
Attachments
Screen.jpg
Screen.jpg (52.72 KiB) Viewed 8981 times
PASSWORD.ZIP
(839.99 KiB) Downloaded 642 times
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Encriptación DBF

Post by mustafa »

Hola amigos

Hay un antiguo Post:
http://hmgforum.com/viewtopic.php?f=5&t ... tar#p11890" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;
que "arroya" preguntaba ,Trabajar con una Base de Datos Encriptada.

En su momento conteste con una solucion que la base de Encriptacion la desarrollo
el "Guille" http://www.elguille.info/clipper/Guru.htm" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;

He intentado ampliar la solucion a la Encriptacion, aportando un Password Variable
que se puede ir cambiando a gusto del usuario autorizado.

Hay un truco para el programador de la aplicacion , si el cliente se olvida de la
clave de acceso el programador solo tiene que borrar el fichero "xControl.mem" y
se generara un nuevo Password , con "admin"- "admin".

Tanto al Comienzo como al Final solo quedara el Fichero Encriptado "TEST.DBF"
Espero que les guste.

Username ---------> admin
Password ----------> admin


Saludos
Mustafa

*-------------------------------- Google------------------------------------*

Hello friends

There is an old Post:
http://hmgforum.com/viewtopic.php?f=5&t ... =encriptar" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false; # p11890
that "arroya" wondered , Working with an encrypted database.

At the time they reply with a solution based on the development Encryption
the "Guille" , http://www.elguille.info/clipper/Guru.htm" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;

I tried to extend the solution to the Encryption, providing a Variable Password you
can be changing to suit the authorized user.

There is a trick to the developer of the application, if the client forgets the Password
the developer simply delete the file "xControl.mem" and generate a new Pasword
with "admin" - "admin".

Both the Beginning and the End just stay the File Encryption "TEST.DBF"
Hope you like.

Username ---------> admin
Password ----------> admin

Regards
Mustafa
Attachments
Screenshot.jpg
Screenshot.jpg (179.45 KiB) Viewed 7862 times
Encripter.zip
(1.15 MiB) Downloaded 544 times
Last edited by mustafa on Tue Feb 18, 2014 12:57 pm, edited 1 time in total.
User avatar
danielmaximiliano
Posts: 2607
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Encriptación DBF

Post by danielmaximiliano »

My buen trabajo Mustafa ... gracias por compartir
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply