簡體   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