无法解密/解code键code

2023-09-11 23:42:56 作者:久病自愈

看来,我的消费密钥对Twitter的API 1.1没有被解密在我的codeIgniter控制器在我的Amazon EC2实例(slightly类似这样的问题)因为

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

在我得到了一个无法排除故障时为您验证错误 我的的print_r($设置)声明(见下文)显示unreadeable字符在我解密它此行的事实,浏览器inspite消费者的秘密'CONSUMER_SECRET'=> $这个 - > encrypt->德code($这个 - > config->项目(CONSUMER_SECRET') 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);

注:我保存在加密消费密钥在codeIgniter的配置目录,并设置在config.php我的加密密钥。有趣的是,它工作正常,在WAMP但不是在Amazon EC2上。

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?

推荐答案

codeigniter使用一些标准的加密库和回落,如果他们不具备的。我不认为的mcrypt 可在默认亚马逊的Linux AMI。您可以

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

一)使用备用;刚刚重新加密CONSUMER_SECRET在EC2上,并把它在config

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

b)安装的mcrypt

b) install mcrypt

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