Closed yogeshmahajan closed 9 years ago
There is encryptKey option. If false
, key is not encrypted.
Hi,
Thanks for your reply, but I think we are missing something, because
encryptKey: false
is not working for me. i.e. store key ID are still getting encrypted. I created new sample app with new database and put some values in db as below
Is there is any way to retrieve these encrypted key ID which is used in db.get() method or we can directly use these ID to retrieve our encrypted data. my sampleapp code is as below.
please check and tell either I am missing something or not.
thanks
thanks and regards
yogesh
Hi,
Thanks for the bug report. The issue has been fixed in rel 1.1.3. Please see demo app for detail.
Kyaw
Hi,
Thanks for your time and solution.
thanks and regards
yogesh
Hi,
I am using ydn.db encryption in my application and it is properly working for a single data value which is retrieved by given record key using db.get() method.
[image: Inline image 1]
But when we need to process bulk data which is not possible in current scenario of ydn.db encryption.
[image: Inline image 2]
If there is any way to retrieve all values from store using db.values or other equivalent function in decrypted format without using any loop and in single call, please suggest.
thanks and regards
yogesh
If keys is not encrypted, it is possible to retrieve all records. I will do when I have time.
thanks,
If it is possible to retrieve all decrypted values in single call please inform us, we are waiting your reply .
thanks and regards,
Yogesh
thanks and regards
yogesh
On Wed, Jun 24, 2015 at 4:49 AM, Kyaw Tun notifications@github.com wrote:
If keys is not encrypted, it is possible to retrieve all records. I will do when I have time.
— Reply to this email directly or view it on GitHub https://github.com/yathit/ydn-db/issues/59#issuecomment-114670117.
Currently, it is not possible. I have to separate crypto module from database module for more flexible use case like this. Please subscribe premium subscription if you need urgent. I will do.
HI,
I am currently subscribe your premium subscription. we need solution urgently. will you please close it as early as possible.
thanks and regards
yogesh
Hi @yogeshmahajan I may not finish today, but will be ready tomorrow with example app.
I am afraid, you have to change your code a lot since encryption have to be done out side of ydn-db, to support that feature. You will also know that it is better decouple from ydn-db.
Hi,
thanks for your response.
be free to finish your work and please try to decrypt data in bulk at a time in single call.
It is urgent, please try to finish as early as possible.
thanks and regards,
Yogesh
Please use ydn.crypto.Cipher the newly build rel 1.2.1. See the example there.
Since encryption and decryption are in synchronous, you can decrypt in bulk. For example you can use db.values
and then decrypt them in one line.
Hi,
please provide example link
thanks and regards
yogesh
Example:
var options = {
method: 'rc4',
secrets: [{
name: 'aaaa',
key: 'aYHF6vfuGHpfWS*eRLrPQxZjSó~É5c6HjCscqDqRtZasp¡JWSMGaW'
}]
};
var cipher = new ydn.crypto.Cipher(options);
db.put('store', messages.map(function(msg) {
return cipher.encrypt(msg);
}));
db.values('store').done(function(packages) {
return packages.map(function(obj) {
return cipher.decrypt(obj);
});
});
Note: ydn.crypto.Cipher
supported since rel 1.2.1.
HI,
I tried your example in sample app. but it look like i am missing something can you please provide proper link of example. [image: Inline image 1] [image: Inline image 3]
thanks and regards
yogesh
Hi,
we checked your link, but you did data decryption using db.get() method using a loop.
but it is not so useful for us. we need bulk data which we can easily retrieve from db.values() method.
db.values('store').done(function(packages) { return packages.map(function(obj) { return cipher.decrypt(obj); }); });
thank and regards,
Yogesh
Please, If it is possible, try to retrieve bulk data using db.values() or any other but without using loop such as your example
The example is not using a loop.
But, your example does use loop. But you can easily avoid it by using
db.values('todo', keys);
Notice that, in the above example, values
method accept list of keys.
To make easier for this kind of use case, I have update in rel 1.2.2 such that key is not optional in encrypt and decrypt. Please see example again.
Hi,
I am just debugging your example code in my side. It is not mine.
we tried your suggestion of above
db.values('todo', keys);
but it also seems not working for me. because it returns back with encrypted values which we wont want.
please try to decrypt bulk data in single call.
thanks and regards yogesh
Hi @yogeshmahajan You just need to decrypt them, like
db.values('store', keys).done(function(packages) {
return packages.map(function(obj) {
return cipher.decrypt(obj);
});
}).done(function(objs) {
console.log('query by keys', objs);
});
It is not single line, but the code is not bloated. I have updated the example too.
I will NOT be integrating encryption to database query, the values
method, because values
method is very complex one. It is not related to encryption/decryption. You will find debugging in this way is better.
Hi, I am using encrypted ydn.db in my application which contains multiple table with number of records. It is working properly with single key in my application, but I can retrieve decrypted values only when, I knew the ID. My problem is that there is number of dynamic ID against which data get stored and currently there no provision to handle these ID. So, there is any way to access all decrypted values from encrypted db without caring ID. Or there is any provision to create relation between encrypted db and non-encrypted ID.
I am trying something like that,
db.put('mytable', { Data: ‘Some Data Here’},'ID').then(function (key) { console.log(key); }, function (e) { console.log(e.stack); });
storing my data properly in encrypted format,
db.values('mytable').then(function (key) { console.log(key); }, function (e) { console.error(e.stack); })
displaying all data in encrypted format and
db.get('mytable','ID').then(function (key) { console.log(key); }, function (e) { console.error(e.stack); })
for above solution, where ID is dynamically generated; there any easy solution to maintain these ID to retrieve db values.
Thanks