Encryption 在IBM MobileFirst中从JSONStore检索加密数据
我创建了一个JSONStore,并试图对集合中的数据进行加密。 我的理解是AES加密是通过使用用户名和密码保护集合来完成的;我通过设置Encryption 在IBM MobileFirst中从JSONStore检索加密数据,encryption,ibm-mobilefirst,jsonstore,Encryption,Ibm Mobilefirst,Jsonstore,我创建了一个JSONStore,并试图对集合中的数据进行加密。 我的理解是AES加密是通过使用用户名和密码保护集合来完成的;我通过设置localKeyGen:true成功地做到了这一点 然而,我仍然得到了纯文本作为回应 JSONStore var collectionName = 'people'; // Object that defines all the collections. var collections = { // Object that defines the 'pe
localKeyGen:true
成功地做到了这一点
然而,我仍然得到了纯文本作为回应
JSONStore
var collectionName = 'people';
// Object that defines all the collections.
var collections = {
// Object that defines the 'people' collection.
people : {
// Object that defines the Search Fields for the 'people' collection.
searchFields : {name: 'string', age: 'integer'}
}
};
// Optional options object.
var options = {
// Optional username, default 'jsonstore'.
username : 'carlos',
// Optional password, default no password.
password : '123',
// Optional local key generation flag, default false.
localKeyGen : true
};
WL.JSONStore.init(collections, options)
.then(function () {
// Data to add, you probably want to get
// this data from a network call (e.g. Worklight Adapter).
var data = [{name: 'carlos', age: 10}];
// Optional options for add.
var addOptions = {
// Mark data as dirty (true = yes, false = no), default true.
markDirty: true
};
// Get an accessor to the people collection and add data.
return WL.JSONStore.get(collectionName).add(data, addOptions);
})
.then(function (numberOfDocumentsAdded) {
// Add was successful.
})
.fail(function (errorObject) {
// Handle failure for any of the previous JSONStore operations (init, add).
});
{"collection":{"name":"people","username":"carlos","searchFields":{"name":"string","age":"integer","_id":"number"},"additionalSearchFields":{},"promise":{}},"docs":[{"_id":1,"json":{"age":10,"name":"carlos"}}]}
响应
var collectionName = 'people';
// Object that defines all the collections.
var collections = {
// Object that defines the 'people' collection.
people : {
// Object that defines the Search Fields for the 'people' collection.
searchFields : {name: 'string', age: 'integer'}
}
};
// Optional options object.
var options = {
// Optional username, default 'jsonstore'.
username : 'carlos',
// Optional password, default no password.
password : '123',
// Optional local key generation flag, default false.
localKeyGen : true
};
WL.JSONStore.init(collections, options)
.then(function () {
// Data to add, you probably want to get
// this data from a network call (e.g. Worklight Adapter).
var data = [{name: 'carlos', age: 10}];
// Optional options for add.
var addOptions = {
// Mark data as dirty (true = yes, false = no), default true.
markDirty: true
};
// Get an accessor to the people collection and add data.
return WL.JSONStore.get(collectionName).add(data, addOptions);
})
.then(function (numberOfDocumentsAdded) {
// Add was successful.
})
.fail(function (errorObject) {
// Handle failure for any of the previous JSONStore operations (init, add).
});
{"collection":{"name":"people","username":"carlos","searchFields":{"name":"string","age":"integer","_id":"number"},"additionalSearchFields":{},"promise":{}},"docs":[{"_id":1,"json":{"age":10,"name":"carlos"}}]}
如何检索加密数据?如果已通过使用用户名和密码保护集合来进行加密
参考资料
如果.init失败,您将无法从一开始检索数据。这是否意味着安全机制仅限于通过用户名和密码保护JSONStore。我们不能用AES加密这些存储中的数据吗。还有一个问题,加密是否也在第一时间通过密码进行,它是否使用了IBMWorklight工具包中已经包含的SQLCipher?集合,数据,是加密的。好的,我们可以通过任何方式查看加密的集合/数据吗?你能帮我完成我之前的查询@IdanAdar吗