无法解密/解码密钥 [英] Unable to decrypt/decode key

查看:244
本文介绍了无法解密/解码密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎我的Apple API EC1实例上的CodeIgniter控制器中没有解密Twitter API 1.1的消费者秘密密钥(稍微类似于此问题),因为

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($ settings)声明(见下文)在浏览器中为消费者秘密显示不可访问的字符,因为我用这一行解密了它,事实上,它使用这个行'consumer_secret'=> $ this-> encrypt-> decode($ this-> config-> item('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使用一些标准加密库,如果它们不可用,则会退回。我不认为默认的Amazon Linux AMI上可以使用 mcrypt 。您可以

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)使用回退;只需重新加密ec2上的consumer_secret并将其放在配置中

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

这篇关于无法解密/解码密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆