繁体   English   中英

从IBM MobileFirst中的JSONStore检索加密的数据

[英]Retrieve Encrypted data from the JSONStore in IBM MobileFirst

我创建了一个JSONStore并试图收集里面的数据进行加密。 我的理解是,AES加密是通过使用用户名和密码保护集合来完成的。 我通过设置localKeyGen : true成功地做到了这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"}}]}

如何获取加密数据? 如果已经通过使用用户名和密码保护集合的安全性来进行加密。

参考

加密仅用于防止访问JSONStore。

通过使用用户名和密码对它进行初始化,这意味着您已经成功访问​​了它,因此可以看到其中的集合。

如果.init失败,则您将根本无法检索数据。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM