Unable to decrypt/decode key

匿名 (未验证) 提交于 2019-12-03 09:18:39

问题:

It appears that my consumer secret key for Twitter API 1.1 is not being decrypted in my CodeIgniter controller on my Amazon EC2 instance (slightly similar to this question) because

  • I got an unable to authenticate you error while troubleshooting
  • and my print_r($settings) statement (see below) displays unreadeable characters for the consumer secret in the browser inspite of the fact that I decrypted it with this line 'consumer_secret' => $this->encrypt->decode($this->config->item('consumer_secret').

my_controller.php

$settings = array(             'oauth_access_token' => $this->config->item('oauth_access_token'),             'oauth_access_token_secret' => $this->config->item('oauth_access_token_secret'),             'consumer_key' => $this->config->item('consumer_key'),             'consumer_secret' => $this->encrypt->decode($this->config->item('consumer_secret'))         );           print_r($settings); 

Note: I saved the encrypted consumer secret key in CodeIgniter's configuration directory and also set my encryption key in config.php. Interestingly, it works fine in WAMP but not in Amazon EC2.

How do I resolve this problem? Should I just save the unencrypted consumer secret key in the configuration file?

回答1:

Codeigniter uses some standard encryption libraries and falls back if they aren't available. I don't think mcrypt is available on the default Amazon Linux AMI. You can

a) use the fallback; just re-encrypt the consumer_secret on ec2 and put it in the config

b) install mcrypt

$ sudo yum install php-mcrypt $ sudo service httpd restart 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!