28 lines
763 B
PHP
28 lines
763 B
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class KeyController extends CI_Controller
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$this->load->library('encryption');
|
|
$this->encryption->initialize(
|
|
array(
|
|
'cipher' => 'aes-256',
|
|
'mode' => 'ctr',
|
|
'key' => '2UFdhHgY5n5Smd5RnD3H8Z6rKJ8j3zra'
|
|
)
|
|
);
|
|
$ciphertext = $this->encryption->encrypt('ctnews^L3wvaMt8GLAatZLE.T' . base64_encode(time()));
|
|
$this->output
|
|
->set_content_type('application/json')
|
|
->set_output(json_encode(['token' => $ciphertext]));
|
|
}
|
|
}
|