Android - 加密和解密(Android - encryption and decryption)
我正在通过HTTP连接下载XML文件,现在我需要在我的FTP和befaore下载中加密XML我将在任何其他使用之前检查XML签名(或解密)。 我有我的应用程序签名(976个字母和数字的组合),我不知道,我可以使用我的签名字符串来验证我的XML吗? 或私人/公钥解决方案? 但是如何创建密钥以及如何将它们存储在APK中?
谢谢
I am downloading XML file via HTTP connection and now I need to have encrypted XML in my FTP and befaore download I will check XML signature (or decrypt it) before any other use of it. I have got my app signature (combination of 976 letters and numbers) and I don't know, can I use my signature string to verify my XML? Or private/public key solution? But how to create keys and how to store them in APK?
Thanks
原文:https://stackoverflow.com/questions/5740031
最满意答案
您正在用户控制器的索引方法中设置变量
$companies
,但在视图中引用$company
。如果您在视图中引用
$companies
,它应该可以工作。您可以使用
contain
指定要加载的关联数据。$companies = $this->Companies ->find('all', [ 'order' => ['Companies.name' => 'ASC'], 'contain' => ['Users'], ] );
您可以阅读有关在文档中检索数据的更多信息
我认为问题在于您如何尝试访问对象属性。 尝试这样的事情:
foreach ($companies as $company) { $company->users; // each company has many users // if you want to loop over each company's users foreach ($company->users as $user) { //etc } }
You are setting the variable
$companies
in the index method of your users controller, but referencing$company
in the view.It should work if you reference the
$companies
in the view.You can use
contain
to specify what associated data is loaded.$companies = $this->Companies ->find('all', [ 'order' => ['Companies.name' => 'ASC'], 'contain' => ['Users'], ] );
You can read more about retrieving data in the docs
I think that the problem is with how you are trying to access to object properties. Try something like this:
foreach ($companies as $company) { $company->users; // each company has many users // if you want to loop over each company's users foreach ($company->users as $user) { //etc } }
相关问答
更多-
您可以在Connection对象上使用disconnect() 。 $connectionObject->disconnect(); 请参阅: http : //api.cakephp.org/3.2/source-class-Cake.Database.Connection.html#190-198 You can use disconnect() on the Connection object. $connectionObject->disconnect(); See: http://api.ca ...
-
使用独立的CakePHP ORM时,在哪里定义表/实体类?(Where to define table/entity classes when using the standalone CakePHP ORM?)[2022-01-27]
您可能希望在GitHub上创建一个问题,因为可以改进独立使用的文档。 这些约定类似于CakePHP应用程序的约定 当独立使用时,ORM将默认在Model\Table和Model\Entity命名空间中查找表和实体类,并且表类应该使用Table后缀。 因此,使用$locator->get('Articles')将查找\Model\Table\ArticlesTable ,如果存在这样的表类,则相应的实体类将被查找为\Model\Entity\Article 。 这些与在CakePHP应用程序中使用ORM时存在 ... -
cakephp协会如何运作?(How cakephp associations work?)[2022-01-02]
在Profile Model中添加以下关系 var $belongsTo = array( 'User' => array( 'foreignKey' => 'user_id', ), ); 在用户模型中添加此项 var $hasMany = array( 'Profile' => array( 'foreignKey' => 'user_id', )); 在Cont ... -
查看http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html 。 由于客户关系 - > risk_code是“多对一”,我们说“客户属于风险代码”。 所以,你必须以两种不同的方式设置它: 客户端模型 public $belongsTo = array( 'RiskCode' => array( 'className' => 'RiskCode', 'foreignKe ...
-
如果您想使用CakePHP提供的接口和类为Rest数据源创建一个完整的适配器,请查看CakePHP团队为Elastic Search创建数据源的早期实验。 Elastic Search使用Rest API,并且此插件尝试创建类似于CakePHP ORM的类: https://github.com/cakephp/elastic-search 它实现的基本如下: 实现RepositoryInterface的Type类 一个实现了EntityInterface的Document类 一个可以用作集合对象并具有类似 ...
-
这不是可以使用loadModel()加载的“模型”(表),它只是恰好存在于Model\Table命名空间中的类。 首先,我建议你将该类放在其他地方,它不是一个表类,它与模型层松散相关,只提供实用功能,类似于Model\Utility可能是一个更好的地方。 话虽这么说,你只需像任何其他类一样使用它并手动实例化它。 use App\Model\Utility\ViewQuerier; // ... $viewQuerier = new ViewQuerier(); $viewQuerier->checkVi ...
-
好的,不确定这是不是最好的方法,但我再次浏览了文档并重新阅读了所有内容。 它仅在您循环输入时有效, $NewEds = $GetTable->newEntities($this->request->data()); foreach ($NewEds as $NewKey => $NewValues) { $GetTable->save($NewValues); } 似乎如果你已经完成了'加入'表,看起来你不必拥有associated Ok, not sure if this is the best ...
-
我开发的解决方案如下: class BlogEntry extends AppModel { var $hasMany = array( 'Comment' ); function beforeFind( $queryData ) { $this->_bindMostRecentComment(); return $queryData; } function _bindMostRecentComment() { ...
-
您正在用户控制器的索引方法中设置变量$companies ,但在视图中引用$company 。 如果您在视图中引用$companies ,它应该可以工作。 您可以使用contain指定要加载的关联数据。 $companies = $this->Companies ->find('all', [ 'order' => ['Companies.name' => 'ASC'], 'contain' => ['Users'], ] ); ...
-
尝试在select()之后添加autoFields(false) select() 。 代码如下: $Product= $categoryObj->find() ->contain([ 'Product' => function ($q) { return $q ->select(['name', 'url', 'published', 'site_id']) ->autoFields(false ...