Hi,
[SPA]
Para Encriptar/Desencriptar, a traves de:
? "DBI_ENCRYPT - barneyrubble", dbcrypt->( dbinfo(
DBI_ENCRYPT,"barneyrubble" ) )
¿necesariamente la tabla tiene que abrirse en modo exclusivo?
¿Qué otras funciones de DBINFO requieren el modo exclusivo?
[ENG] By Google
To encrypt / decrypt, through:
? "DBI_ENCRYPT - barneyrubble" dbcrypt-> (dbinfo (DBI_ENCRYPT,
"barneyrubble"))
Necessarily the table has to be opened in exclusive mode?
What other functions require exclusively dbinfo?
TIA
BestRegards
GVS
Alex Strickland escribió:
Hi
I was trying to understand encryption of dbf's and I wrote this test.
I didn't expect the last two lines of output (see end), but perhaps it
is invalid to expect an encrypted file to be encrypted again? If so,
shouldn't:
dbcrypt->( dbinfo( DBI_ENCRYPT, "fredflintstone" ) )
cause an error or return false?
Regards
Alex
#include "dbinfo.ch"
procedure main()
local aStruct := { ;
{ "Name", "C", 20, 0 }, ;
{ "Age", "N", 3, 0 }, ;
{ "Boy", "L", 1, 0 }, ;
{ "Birth", "D", 8, 0 } ;
}
request dbfcdx
rddsetdefault("DBFCDX")
dbcreate("dbcrypt", aStruct)
use dbcrypt
dbcrypt->( dbappend() )
dbcrypt->name := "Fred"
dbcrypt->age := 20
dbcrypt->boy := .t.
dbcrypt->birth := date() - (20 * 365)
? "After create, ", dbcrypt->name, dbcrypt->age, dbcrypt->boy,
dbcrypt->birth
?
? "DBI_ENCRYPT - barneyrubble", dbcrypt->( dbinfo( DBI_ENCRYPT,
"barneyrubble" ) )
? "DBI_ISENCRYPTED", dbcrypt->( dbinfo( DBI_ISENCRYPTED ) )
?
? "After encrypt, ", dbcrypt->name, dbcrypt->age, dbcrypt->boy,
dbcrypt->birth
dbcrypt->( dbclosearea() )
? "Close and reopen"
use dbcrypt
?
? "No password, ", dbcrypt->name, dbcrypt->age, dbcrypt->boy,
dbcrypt->birth
?
dbcrypt->( dbinfo( DBI_PASSWORD, "fredflintstone" ) )
? "Wrong password, ", dbcrypt->name, dbcrypt->age, dbcrypt->boy,
dbcrypt->birth
?
dbcrypt->( dbinfo( DBI_PASSWORD, "barneyrubble" ) )
? "Correct password, ", dbcrypt->name, dbcrypt->age, dbcrypt->boy,
dbcrypt->birth
?
? "DBI_ENCRYPT - fredflintstone", dbcrypt->( dbinfo( DBI_ENCRYPT,
"fredflintstone" ) )
? "DBI_ISENCRYPTED", dbcrypt->( dbinfo( DBI_ISENCRYPTED ) )
?
? "Encrypted again, ", dbcrypt->name, dbcrypt->age, dbcrypt->boy,
dbcrypt->birth
dbcrypt->( dbclosearea() )
? "Close and reopen"
use dbcrypt
?
? "No password, ", dbcrypt->name, dbcrypt->age, dbcrypt->boy,
dbcrypt->birth
?
dbcrypt->( dbinfo( DBI_PASSWORD, "fredflintstone" ) )
? "Correct password, ", dbcrypt->name, dbcrypt->age, dbcrypt->boy,
dbcrypt->birth
?
dbcrypt->( dbinfo( DBI_PASSWORD, "barneyrubble" ) )
? "Wrong password, ", dbcrypt->name, dbcrypt->age, dbcrypt->boy,
dbcrypt->birth
dbcrypt->( dbclosearea() )
return
Output:
C:\Users\Alex\ECR6.4\tests>dbcrypt
After create, Fred 20 .T. 01/25/90
DBI_ENCRYPT - barneyrubble .T.
DBI_ISENCRYPTED .T.
After encrypt, Fred 20 .T. 01/25/90
Close and reopen
No password, c╙]ù☼■╬¿↓f&ë▓╩N_└å/☻ 0 .F. / /
Wrong password, ▬ç╠<H1.h^↑¢æ½e0z►-K♥ 0 .F. / /
Correct password, Fred 20 .T. 01/25/90
DBI_ENCRYPT - fredflintstone .T.
DBI_ISENCRYPTED .T.
Encrypted again, Fred 20 .T. 01/25/90
Close and reopen
No password, c╙]ù☼■╬¿↓f&ë▓╩N_└å/☻ 0 .F. / /
Correct password, ▬ç╠<H1.h^↑¢æ½e0z►-K♥ 0 .F. / /
Wrong password, Fred 20 .T. 01/25/90
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour