View Issue Details

IDProjectCategoryView StatusLast Update
0008813ADK-Xojo-V4RBRBDB APIpublic2020-07-10 14:56
ReporterDeltaworXAssigned ToIvan Smahin 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformALLOSALLOS VersionALL
Product Version 
Target VersionFixed in Version10.4.x 
Summary0008813: RDBD API - Missing encryption in VRBDatabase
DescriptionTrying to encrypt a VRBDatabase with "DB.Encrypt ( "key12345" )" results in an error message: Type "VRBDataBase" has no member namend "Encrypt"

Same with "DB.UseEncryptionKey( "key12345" )": Type "VRBDataBase" has no member namend "UserEncryptionKey"

Looks like encryption is completly missing in RDBD API.
TagsNo tags attached.

Activities

Ruslan Zasukhin

Ruslan Zasukhin

2020-06-15 10:39

administrator   ~0011329

Hi,

RBDB is weak API actually, and it is a common set of API for different DBs,
Most V4RB developers prefer to use native Valentina API, which has a lot more classes and functions.

Not sure, but as far as I remember, exists way switch from VRBDatabase class to VDatabase class,
then you will be able to use those missing methods.
Ruslan Zasukhin

Ruslan Zasukhin

2020-06-15 10:42

administrator   ~0011330

This is that bridge:

  Constructor( inRbDbDatabase as VRBDataBase )
DeltaworX

DeltaworX

2020-06-20 11:29

reporter   ~0011338

Hi,

any examples or documentation on how to use that bridge to encrypt and open an encrypted VRBDatabase?
Ruslan Zasukhin

Ruslan Zasukhin

2020-06-20 12:10

administrator   ~0011339

Frankly saying we never did promise that RBDB way will work with Encryption.
so it needs to be investigated.

With encryption the main point was to set keys BEFORE db is opened or created.
Please check our Native Valentina API examples on encryption to see rules.

dim rbdb as VRBdatabase = new VRBDatabase ...
dim vdb as VDatabase = new VDatabase( rbdb )

vdb.setKey( "abcd" )

rbdb.open() .create()

this is not exact and correct code, just an idea ...
DeltaworX

DeltaworX

2020-06-25 09:07

reporter   ~0011340

Using the bridge I am able to encypt and access an encrypted local database. Encypting a remote database also works fine. But i am not able to connect to an encrypted remote database. Error indicates the given encryption key is wrong, but it is okay, tested multiple times via VStudio Pro. (ERROR: 0x61502 Specified encryption key is wrong.)

VLog shows that the given encryption key is used for VDatabase (instance = 105553145565696), not the bridged VRBDatabase (database = 140704610410464):

Database_UseEncryptionKey...
    PARAM: inDatabase = 105553145565696
    PARAM: inKey = "<ENCRYPTION_KEY>"
    PARAM: inForData = 3
return

Did I miss something? Do you have a solution / workaround for this problem?

----------------

DB is a property of type "VRBDatabase

#####
xojo code to connect to oem VServer:

DB = New VRBDataBase
// connect to oem server - Xojo RBDB API
DB.Host = 127.0.0.1
DB.UserName = "sa"
DB.Password = "sa"
DB.ConnectionTimeout = 10
DB.Port = 15434
DB.PortSSL = 15434
DB.EmbeddedSerial = "<EMBEDDED_SERIAL_NO>"
  DB.useSSL
DB.databaseName = "database.vdb"

Var encDB As VDatabase = New VDatabase( DB )
encDB.UseEncryptionKey( "<ENCRYPTION_KEY>" )

mIsConnected = DB.Connect


#####
Valentina VLog:

Valentina_SetDebugLevel...
    PARAM: inLevel = 3
return

RBDB_Valentina_Database_Constructor...
return database = 140704610410464

RBDB_Valentina_Database_SetConnectionTimeout...
return

RBDB_Valentina_Database_SetPort...
return

RBDB_Valentina_Database_SetPortSSL...
return

RBDB_Valentina_Database_SetEmbSerial...
return

RBDB_Valentina_Database_UseSSL...
return

Database_Ctor...
    PARAM: instance = 105553145565696
return

Database_Ctor_FromRBDB...
    PARAM: instance = 105553145565696
    PARAM: inRbDbDatabase = 140704610410464
return

Database_UseEncryptionKey...
    PARAM: inDatabase = 105553145565696
    PARAM: inKey = "<ENCRYPTION_KEY>"
    PARAM: inForData = 3
return

RBDB_Valentina_Database_Connect...
RBDB_Valentina_Database_Connect_Remote...
    PARAM: host = "<IP_ADDRESS>"
    PARAM: db_name = "database.vdb"
    PARAM: user = "sa"
    PARAM: password = "sa"
    PARAM: Port = 15434
ERROR: 0x61502 Specified encryption key is wrong.

return res = 0

ERROR: 0x61502 Specified encryption key is wrong.

return res = 0
Ruslan Zasukhin

Ruslan Zasukhin

2020-06-25 10:32

administrator   ~0011341

We will be able to check this 2-3 days later, I think.
Ruslan Zasukhin

Ruslan Zasukhin

2020-06-25 10:34

administrator   ~0011342

the point.

for client-server it is important UTF8 or UTF16 go into keys and actually into all strings.

Also let's check if you do both
  Valentina.Init()
   Valentina.InitClient()

or only InitClient()?
Ruslan Zasukhin

Ruslan Zasukhin

2020-06-25 10:35

administrator   ~0011343

Also, I wonder if you have to try to run our Example about encryption to that vserver ?

Does it work fine?
DeltaworX

DeltaworX

2020-06-25 11:44

reporter   ~0011344

Valentina Setup is done correct - remote database - without encryption - is working fine:

Valentina.Init(10000000, "<MAC_SERIAL>", "<WIN_SERIAL>", "<LINUX_SERIAL>")
If Valentina.CacheSize = 0 Then
  MsgBox ("Critical error: Valentina was not initialized!")
End If
If Preferences.dbClient = "Remote" Then
  Valentina.InitClient(10485760)
End If

--------

Initially I did not specify UTF8 or UTF16 in:

Var encDB As VDatabase = New VDatabase( DB )
encDB.UseEncryptionKey( "<ENCRYPTION_KEY>" )

but even encoding the key as UTF8 or UTF16 does not make any change, both result in the same error: ERROR: 0x61502 Specified encryption key is wrong.

---

Encrypting on VServer is working, the reamining problem is connecting to an encrypted VRBDatabase.
DeltaworX

DeltaworX

2020-07-08 06:50

reporter   ~0011360

Any news on this topic?
Ivan Smahin

Ivan Smahin

2020-07-10 08:27

manager   ~0011362

It will be fixed nearest days.
After this - you should not use that "bridge" for useEncription neither for local nor for remote dbs

It would be something like this one:
...
db.StructureEncryptionKey = "456"
db.DataEncryptionKey = "123"

if db.Connect then ...

Issue History

Date Modified Username Field Change
2020-06-15 10:03 DeltaworX New Issue
2020-06-15 10:39 Ruslan Zasukhin Note Added: 0011329
2020-06-15 10:42 Ruslan Zasukhin Note Added: 0011330
2020-06-20 11:29 DeltaworX Note Added: 0011338
2020-06-20 12:10 Ruslan Zasukhin Note Added: 0011339
2020-06-25 09:07 DeltaworX Note Added: 0011340
2020-06-25 10:32 Ruslan Zasukhin Assigned To => Ivan Smahin
2020-06-25 10:32 Ruslan Zasukhin Status new => assigned
2020-06-25 10:32 Ruslan Zasukhin Note Added: 0011341
2020-06-25 10:34 Ruslan Zasukhin Note Added: 0011342
2020-06-25 10:35 Ruslan Zasukhin Note Added: 0011343
2020-06-25 11:44 DeltaworX Note Added: 0011344
2020-07-08 06:50 DeltaworX Note Added: 0011360
2020-07-10 08:27 Ivan Smahin Note Added: 0011362
2020-07-10 14:56 Ivan Smahin Status assigned => resolved
2020-07-10 14:56 Ivan Smahin Resolution open => fixed
2020-07-10 14:56 Ivan Smahin Fixed in Version => 10.4.x