Anthony
Anthony

Reputation: 4050

Unable to decrypt/decode key

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

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?

Upvotes: 1

Views: 641

Answers (1)

stormdrain
stormdrain

Reputation: 7895

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

Upvotes: 2

Related Questions