Пример #1
0
 /**
  * 获得RSA算法的公钥, 并将私钥记录在Session中
  *
  * 该方法一般用于重要的数据加密, 如登录或注册时的密码加密
  */
 public function getPublicKey()
 {
     $rsa = new RSA();
     $rsa->create();
     $content = array('pubkey' => $rsa->getPublicKey());
     $this->session->set('rsa_private_key', $rsa->getPrivateKey());
     $this->responseJson(200, 'OK', $content)->send();
 }