• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Crypt_RSA类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Crypt_RSA的典型用法代码示例。如果您正苦于以下问题:PHP Crypt_RSA类的具体用法?PHP Crypt_RSA怎么用?PHP Crypt_RSA使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Crypt_RSA类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: Exec

 public function Exec($command)
 {
     $engine = $this->session->getSpooler();
     if (!isset($engine[0]['shell'])) {
         print "?!";
         exit;
     }
     $shell = $engine[0]['shell'];
     $host = $shell['host'];
     $user = $shell['user'];
     $password = $shell['password'];
     $method = 'CURL';
     set_include_path(get_include_path() . PATH_SEPARATOR . '../vendor/phpseclib');
     include 'Net/SSH2.php';
     include 'Crypt/RSA.php';
     $ssh = new \Net_SSH2($host);
     if (1) {
         $key = new \Crypt_RSA();
         $ret = $key->loadKey("-----BEGIN RSA PRIVATE KEY-----\nMIICWgIBAAKBgQCzRy01HoHIzBJJb/D8A/eTV3qiZxy0NIR97NE14rJblnJZT5Kg\noP2DvIRzlB0msL5cHQJ/qXYAoemHRDKqNZuj89+MYsBeZqNu3/DXdZLq9XJ8e2rb\nsGrDjHvCHEDWL0JIRFnRacem55+XsUsKTIs4tbcD6adMPIYJSQQ7oB/8AQIBIwKB\ngB67vptkUMNWLwVGY9NuZPSv6SMnnoVK1OJjHIzlCKH8iKGYnMsUSLd/ZynBnpjr\nGVGekrbMl+LZ7YTnHqDV/WxGoWEc3xiHE8/HwZwQZxP92K70inz8+6dGEagsrSqO\nQkdAPR/+qen7uQ9yXqj7WAoNFicPJ2cpo8kuEW33KywzAkEA4yH4jf0uNBFDUkR6\ni9DQC5bsgEloVezWnCsm6eIm5o5SGKPZ6Rpro/h3pq5qvPmCtjrZFnK0Dab9xkFr\n/F9lkwJBAMoQMqxYdnPz74Bto99o0PZrk2ikROwXR9eURi3B4bWGq9+mvN3OEQdE\n8JofGyq60LMlnFAkE7v49fYHziyaFJsCQHTPpGZHsVybKe/LcjlG0WULyhYXH7cp\nWG2SiQqRkFlQgf4LH5xz/Nf8IEcX3x9bv5DrEI8zrQ5V4Zko9bT93HcCQQCEyNDX\np9jP2tCWOWuwEa3jwwkY4PoXfQNTJuxJ9G/AbnDyDnwcup15zje1vKtz2dmaS+pg\njLyC1s2Ea4d8ZUC9AkAeUr/N+011K2zGTjxZnAFY/Ow348bomzddiJYAYA+76exV\n3wUYsjeDxqq8Km93+iMQ8DDNZIvoVcfYQW9BfDlf\n-----END RSA PRIVATE KEY-----   ");
         if (!$ret) {
             echo "loadKey failed\n";
             print "<pre>" . $ssh->getLog() . '</pre>';
             exit;
         }
     } elseif (isset($shell['password'])) {
         $key = $shell['password'];
     } else {
         $key = '';
         // ?! possible ?
     }
     if (!$ssh->login($user, $key)) {
         exit("Login Failed ({$user})");
     }
     return $ssh->exec("system '{$command}'");
 }
开发者ID:AriiPortal,项目名称:I5Bundle,代码行数:35,代码来源:AriiExec.php


示例2: RSADecrypt

function RSADecrypt($ciphertext, $privateKey)
{
    $rsad = new Crypt_RSA();
    $rsad->loadKey($privateKey);
    $rsad->setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1);
    return $rsad->decrypt(hex2bin($ciphertext));
}
开发者ID:abcdlzy,项目名称:webshell-manager,代码行数:7,代码来源:common.php


示例3: login

 /**
  * Log user in
  */
 function login()
 {
     $params = $this->request->get('params', false);
     if ($params) {
         $rsa = new Crypt_RSA();
         $my_pub_key = ConfigOptions::getValue('frosso_auth_my_pub_key');
         $my_pri_key = ConfigOptions::getValue('frosso_auth_my_pri_key');
         $rsa->loadKey($my_pri_key);
         $decrypted_params = $rsa->decrypt($params);
         if ($decrypted_params) {
             list($email, $token, $timestamp) = explode(';', $decrypted_params);
             if ($email && $token && $timestamp) {
                 if ($token == ConfigOptions::getValue('frosso_auth_my_pri_token') && time() - 60 * 10 < $timestamp && $timestamp < time() + 60 * 10) {
                     Authentication::useProvider('FrossoProvider', false);
                     Authentication::getProvider()->initialize(array('sid_prefix' => AngieApplication::getName(), 'secret_key' => AngieApplication::getAdapter()->getUniqueKey()));
                     Authentication::getProvider()->authenticate($email);
                 } else {
                     $this->response->forbidden();
                 }
                 // token non valido
             } else {
                 $this->response->badRequest(array('message' => 'Parametri non '));
             }
             // parametri non validi
         } else {
             $this->response->badRequest(array('message' => 'Parametri non validi'));
         }
     } else {
         $this->response->badRequest(array('message' => 'Parametri non settati'));
     }
     // parametri non settati
 }
开发者ID:NaszvadiG,项目名称:ACModules,代码行数:35,代码来源:FrossoAuthController.class.php


示例4: downloadTheme

 public function downloadTheme($name, $url, $signature)
 {
     $model = Model::instance();
     //download theme
     $net = new \Ip\Internal\NetHelper();
     $themeTempFilename = $net->downloadFile($url, ipFile('file/secure/tmp/'), $name . '.zip');
     if (!$themeTempFilename) {
         throw new \Ip\Exception('Theme file download failed.');
     }
     $archivePath = ipFile('file/secure/tmp/' . $themeTempFilename);
     //check signature
     $fileMd5 = md5_file($archivePath);
     $rsa = new \Crypt_RSA();
     $rsa->loadKey($this->publicKey);
     $rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
     $verified = $rsa->verify($fileMd5, base64_decode($signature));
     if (!$verified) {
         throw new \Ip\Exception('Theme signature verification failed.');
     }
     //extract
     $helper = Helper::instance();
     $secureTmpDir = ipFile('file/secure/tmp/');
     $tmpExtractedDir = \Ip\Internal\File\Functions::genUnoccupiedName($name, $secureTmpDir);
     \Ip\Internal\Helper\Zip::extract($secureTmpDir . $themeTempFilename, $secureTmpDir . $tmpExtractedDir);
     unlink($archivePath);
     //install
     $extractedDir = $helper->getFirstDir($secureTmpDir . $tmpExtractedDir);
     $installDir = $model->getThemeInstallDir();
     $newThemeDir = \Ip\Internal\File\Functions::genUnoccupiedName($name, $installDir);
     rename($secureTmpDir . $tmpExtractedDir . '/' . $extractedDir, $installDir . $newThemeDir);
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:31,代码来源:ThemeDownloader.php


示例5: connect

 public function connect($test = false)
 {
     if (!$this->connection or $test) {
         $server = $this->server;
         require_once 'Crypt/RSA.php';
         require_once 'Net/SFTP.php';
         $this->connection = new \Net_SFTP($server['host'], $server['port'], 10);
         $logged_in = false;
         if (isset($server['sftp_key'])) {
             $key = new \Crypt_RSA();
             if (isset($server['pass']) && !empty($server['pass'])) {
                 $key->setPassword($server['pass']);
             }
             $key->loadKey(file_get_contents($server['sftp_key']));
             $logged_in = $this->connection->login($server['user'], $key);
             if (!$logged_in) {
                 Helpers::error("Could not login to {$this->host}. It may be because the key requires a passphrase, which you need to specify it as the 'pass' attribute.");
             }
         } else {
             $logged_in = $this->connection->login($server['user'], $server['pass']);
             if (!$logged_in) {
                 Helpers::error("Could not login to {$this->host}");
             }
         }
         if (!$this->connection->chdir($server['path'])) {
             Helpers::error("Could not change the directory to {$server['path']} on {$this->host}");
         }
         Helpers::logmessage("Connected to: {$this->host}");
         $this->current_commit = $this->get_file('REVISION', true);
     }
     if ($test) {
         $this->disconnect();
     }
 }
开发者ID:rudraks,项目名称:application,代码行数:34,代码来源:Sftp.php


示例6: generateAndAdd

 function generateAndAdd()
 {
     $rsa = new \Crypt_RSA();
     $rsa->setPublicKeyFormat(CRYPT_RSA_PUBLIC_FORMAT_OPENSSH);
     $this->set($rsa->createKey());
     $this->save();
 }
开发者ID:romaninsh,项目名称:dokku_alt,代码行数:7,代码来源:Access.php


示例7: app_login

 /**
  * app_login
  *
  * @param   string  $server
  *
  * @return	bool
  **/
 public function app_login($server)
 {
     $ftp_id = $this->mod_config['FTP_UserName'];
     $ftp_pass = $this->mod_config['FTP_password'];
     // LOGIN
     //		@define('NET_SFTP_LOGGING', NET_SFTP_LOG_COMPLEX);
     @define('NET_SFTP_LOGGING', NET_SFTP_LOG_SIMPLE);
     $this->Verbose = TRUE;
     //TRUE or FALSE
     $this->LocalEcho = FALSE;
     //$this->Passive(TRUE);
     $key = new Crypt_RSA();
     $key->setPassword($ftp_pass);
     $key->loadKey($this->mod_config['SSH_key']);
     $port = (int) $this->mod_config['SSH_port'];
     //phpseclib
     $this->sftp = new Net_SFTP($server, $port);
     if (!$this->sftp->login($ftp_id, $key)) {
         $this->mes .= "SSH Login Failed<br />\n";
         $this->mes .= $this->getSSH2Errors();
         return false;
     }
     $this->mes .= "PWD:" . $this->sftp->pwd() . "<br />\n";
     $this->mes .= $this->getSSH2Log();
     return true;
 }
开发者ID:nao-pon,项目名称:xupdate,代码行数:33,代码来源:Ssh2.class.php


示例8: deploy

 public function deploy()
 {
     $releaseId = $this->dataBase->startRelease();
     $ssh = new Net_SSH2(SSH_SERVER);
     $key = new Crypt_RSA();
     $key->setPassword(SSH_PASSWORD);
     $key->loadKey(file_get_contents(PATH_TO_PRIVATE_KEY));
     if (!$ssh->login(SSH_LOGIN, $key)) {
         $this->dataBase->logStep($releaseId, 'ssh ' . SSH_SERVER, ['error' => 'Login failed'], 1);
         exit('Login Failed');
     }
     $ssh->enableQuietMode();
     $command = $this->bash->dtLock('sandbox-mercury', 'mercury');
     $output['success'] = $ssh->exec($command);
     $output['error'] = $ssh->getStdError();
     $this->dataBase->logStep($releaseId, $command, $output, $ssh->getExitStatus());
     $command = $this->bash->dtPrep('sandbox-mercury', 'mercury', ["mercury" => "dev"]);
     $output['success'] = $ssh->exec($command);
     $output['error'] = $ssh->getStdError();
     $this->dataBase->logStep($releaseId, $command, $output, $ssh->getExitStatus());
     $command = $this->bash->dtPush('sandbox-mercury', 'mercury');
     $output['success'] = $ssh->exec($command);
     $output['error'] = $ssh->getStdError();
     $this->dataBase->logStep($releaseId, $command, $output, $ssh->getExitStatus());
 }
开发者ID:Warkot,项目名称:Bolt,代码行数:25,代码来源:Release.class.php


示例9: Exec

 public function Exec($shell, $command, $stdin = '')
 {
     $host = $shell['host'];
     $user = $shell['user'];
     $ssh = new \Net_SSH2($host);
     if (isset($shell['key'])) {
         $key = new \Crypt_RSA();
         $ret = $key->loadKey($shell['key']);
         if (!$ret) {
             $this->status = '!KEY';
             echo "loadKey failed\n";
             print "<pre>" . $ssh->getLog() . '</pre>';
             return;
         }
     } elseif (isset($shell['password'])) {
         $key = $shell['password'];
     } else {
         $key = '';
         // ?! possible ?
     }
     if (!@$ssh->login($shell['user'], $key)) {
         $this->status = '!LOGIN';
         print 'Login Failed: ' . $shell['user'];
         print "<pre>" . $ssh->getLog() . '</pre>';
         return;
     }
     $this->status = 'RUNNING';
     if ($stdin == '') {
         return $ssh->exec("{$command}");
     }
     return;
 }
开发者ID:AxelANGENAULT,项目名称:CoreBundle,代码行数:32,代码来源:AriiExec.php


示例10: signNewCert

function signNewCert()
{
    if (!$GLOBALS['isCA']) {
        return false;
    } else {
        $CAPrivKey = new Crypt_RSA();
        $CAPrivKey->loadKey($GLOBALS['CAPrivKeyStr']);
        $CAx509 = new File_X509();
        $CAx509->loadX509($GLOBALS['CAPubX509']);
        //认证证书
        $privKey = new Crypt_RSA();
        $keyArray = $CAPrivKey->createKey($GLOBALS['RSALength']);
        $privKey->loadKey($keyArray['privatekey']);
        $pubKey = new Crypt_RSA();
        $pubKey->loadKey($keyArray['publickey']);
        $pubKey->setPublicKey();
        $subject = new File_X509();
        $subject->setDNProp('id-at-organizationName', $GLOBALS['CAname'] . ' cert');
        $subject->setPublicKey($pubKey);
        $issuer = new File_X509();
        $issuer->setPrivateKey($CAPrivKey);
        $issuer->setDN($CAx509->getDN());
        $x509 = new File_X509();
        $result = $x509->sign($issuer, $subject);
        return array('privateKey' => $privKey->getPrivateKey(), 'publicX509' => $x509->saveX509($result));
    }
}
开发者ID:abcdlzy,项目名称:webshell-manager,代码行数:27,代码来源:CASignCert.php


示例11: rsa

 private function rsa($public_or_private_key, $padding_mode)
 {
     $rsa = new Crypt_RSA();
     $rsa->loadKey($public_or_private_key);
     $rsa->setEncryptionMode($padding_mode);
     return $rsa;
 }
开发者ID:nask0,项目名称:jose,代码行数:7,代码来源:JWE.php


示例12: fetchOpenIdConfig

 protected function fetchOpenIdConfig()
 {
     try {
         $apiClient = $this->getApiClient();
         $config = $apiClient->get('.well-known/openid-configuration');
         $jwkRes = $apiClient->get($config->jwks_uri);
         $jwks = $jwkRes->keys;
         $keys = [];
         $rsa = new \Crypt_RSA();
         foreach ($jwks as $key) {
             //if x509 key is available, we don't need to generate it below.
             if (!empty($key->x_509)) {
                 $keys[$key->kid] = $key->x_509;
                 continue;
             }
             $public = '<RSAKeyValue>
                  <Modulus>' . $this->base64_from_url($key->n) . '</Modulus>
                  <Exponent>' . $this->base64_from_url($key->e) . '</Exponent>
                </RSAKeyValue>';
             $rsa->loadKey($public, CRYPT_RSA_PUBLIC_FORMAT_XML);
             $rsa->setPublicKey();
             $keys[$key->kid] = $rsa->getPublicKey();
         }
         $config->keys = $keys;
         return $config;
     } catch (SSO\Exception\HttpException $e) {
         throw new OpenIdConfigurationException('OpenID configuration can not be fetched', 0, $e);
     }
 }
开发者ID:AlexTsumarov,项目名称:7pass-php-sdk,代码行数:29,代码来源:Configuration.php


示例13: _google_verify_token

function _google_verify_token($public_key, $signature, $signed_data, $sku, $base_url)
{
    $comments = array();
    $error = '';
    $status = 'unknown';
    if (!class_exists('Crypt_RSA')) {
        $comments[] = 'PHPSecLib is not in the PHP path.';
    }
    $purchaseToken = _google_get_product_id($signed_data, $sku);
    if (empty($purchaseToken)) {
        $status = 'invalid';
        $error = 'The SKU is not present in the data.';
    } else {
        $status = 'unverified';
        // unverified until verified
        $comments[] = 'The SKU is present in the data.';
        $comments[] = 'The purchase token is ' . str_replace("--", "-\n-", $purchaseToken);
        // Split any --'s otherwise XML is not well-formed
        // verify the data signature
        if (!class_exists('Crypt_RSA')) {
            $error = 'PHPSecLib is not in the PHP path.';
        } else {
            $rsa = new Crypt_RSA();
            $rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
            $rsa->loadKey("-----BEGIN PUBLIC KEY-----\n" . $public_key . "\n-----END PUBLIC KEY-----");
            if ($rsa->verify($signed_data, base64_decode($signature))) {
                $comments[] = 'verified ok';
                $status = 'OK';
            } else {
                $comments[] = 'verification failed';
            }
        }
    }
    return array('status' => $status, 'comments' => $comments, 'error' => $error);
}
开发者ID:johnedelatorre,项目名称:fusion,代码行数:35,代码来源:pugpig_google.php


示例14: downloadPlugin

 public function downloadPlugin($name, $url, $signature)
 {
     if (is_dir(ipFile("Plugin/{$name}/"))) {
         Service::deactivatePlugin($name);
         Helper::removeDir(ipFile("Plugin/{$name}/"));
     }
     //download plugin
     $net = new \Ip\Internal\NetHelper();
     $pluginTempFilename = $net->downloadFile($url, ipFile('file/secure/tmp/'), $name . '.zip');
     if (!$pluginTempFilename) {
         throw new \Ip\Exception('Plugin file download failed.');
     }
     $archivePath = ipFile('file/secure/tmp/' . $pluginTempFilename);
     //check signature
     $fileMd5 = md5_file($archivePath);
     $rsa = new \Crypt_RSA();
     $rsa->loadKey($this->publicKey);
     $rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
     $verified = $rsa->verify($fileMd5, base64_decode($signature));
     if (!$verified) {
         throw new \Ip\Exception('Plugin signature verification failed.');
     }
     //extract
     $secureTmpDir = ipFile('file/secure/tmp/');
     $tmpExtractedDir = \Ip\Internal\File\Functions::genUnoccupiedName($name, $secureTmpDir);
     \Ip\Internal\Helper\Zip::extract($secureTmpDir . $pluginTempFilename, $secureTmpDir . $tmpExtractedDir);
     unlink($archivePath);
     //install
     $extractedDir = $this->getFirstDir($secureTmpDir . $tmpExtractedDir);
     $installDir = Model::pluginInstallDir();
     $newPluginDir = \Ip\Internal\File\Functions::genUnoccupiedName($name, $installDir);
     rename($secureTmpDir . $tmpExtractedDir . '/' . $extractedDir, $installDir . $newPluginDir);
     Service::activatePlugin($name);
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:34,代码来源:PluginDownloader.php


示例15: connect

 function connect()
 {
     $this->link = new Net_SFTP($this->options['hostname'], $this->options['port']);
     if (!$this->link) {
         $this->errors->add('connect', sprintf(__('Failed to connect to SSH2 Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
         return false;
     }
     if (!$this->keys) {
         if (!$this->link->login($this->options['username'], $this->options['password'])) {
             $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username']));
             return false;
         }
     } else {
         $rsa = new Crypt_RSA();
         if ($this->password) {
             $rsa->setPassword($this->options['password']);
         }
         $rsa->loadKey($this->options['private_key']);
         if (!$this->link->login($this->options['username'], $rsa)) {
             $this->errors->add('auth', sprintf(__('Private key incorrect for %s'), $this->options['username']));
             return false;
         }
     }
     return true;
 }
开发者ID:tlandn,项目名称:akvo-web,代码行数:25,代码来源:class-wp-filesystem-ssh2.php


示例16: server_connect

 public static function server_connect($sServer, $sAPI = 0)
 {
     $sSSH = new Net_SSH2($sServer->sIPAddress);
     if ($sServer->sPassword == 0) {
         $sKey = new Crypt_RSA();
         $sKey->loadKey(file_get_contents('/var/feathur/data/keys/' . $sServer->sKey));
     } else {
         $sKey = file_get_contents('/var/feathur/data/keys' . $sServer->sKey);
     }
     try {
         if (!$sSSH->login($sServer->sUser, $sKey)) {
             if (!empty($sAPI)) {
                 return $sResult = array("result" => 'Unable to connect to the host node, please contact customer service.');
             }
             echo json_encode(array("result" => 'Unable to connect to the host node, please contact customer service.'));
             die;
         } else {
             $sSSH->setTimeout(30);
             return $sSSH;
         }
     } catch (Exception $e) {
         if (!empty($sAPI)) {
             return $sResult = array("result" => 'Unable to connect to the host node, please contact customer service.');
         }
         echo json_encode(array("result" => 'Unable to connect to the host node, please contact customer service.'));
         die;
     }
 }
开发者ID:AstroProfundis,项目名称:Feathur,代码行数:28,代码来源:servers.class.php


示例17: testRawPKCS1Key

 public function testRawPKCS1Key()
 {
     $rsa = new Crypt_RSA();
     $key = 'MIICXAIBAAKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUp' . 'wmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5' . '1s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQABAoGAFijko56+qGyN8M0RVyaRAXz++xTqHBLh' . '3tx4VgMtrQ+WEgCjhoTwo23KMBAuJGSYnRmoBZM3lMfTKevIkAidPExvYCdm5dYq3XToLkkLv5L2' . 'pIIVOFMDG+KESnAFV7l2c+cnzRMW0+b6f8mR1CJzZuxVLL6Q02fvLi55/mbSYxECQQDeAw6fiIQX' . 'GukBI4eMZZt4nscy2o12KyYner3VpoeE+Np2q+Z3pvAMd/aNzQ/W9WaI+NRfcxUJrmfPwIGm63il' . 'AkEAxCL5HQb2bQr4ByorcMWm/hEP2MZzROV73yF41hPsRC9m66KrheO9HPTJuo3/9s5p+sqGxOlF' . 'L0NDt4SkosjgGwJAFklyR1uZ/wPJjj611cdBcztlPdqoxssQGnh85BzCj/u3WqBpE2vjvyyvyI5k' . 'X6zk7S0ljKtt2jny2+00VsBerQJBAJGC1Mg5Oydo5NwD6BiROrPxGo2bpTbu/fhrT8ebHkTz2epl' . 'U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ' . '37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=';
     $key = base64_decode($key);
     $this->assertTrue($rsa->loadKey($key));
 }
开发者ID:yashb,项目名称:generator,代码行数:7,代码来源:LoadKeyTest.php


示例18: connect

 function connect()
 {
     $this->link = new Net_SFTP($this->options['hostname'], $this->options['port']);
     if (!$this->keys) {
         if (!$this->link->login($this->options['username'], $this->options['password'])) {
             if ($this->handle_connect_error()) {
                 return false;
             }
             $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username']));
             return false;
         }
     } else {
         $rsa = new Crypt_RSA();
         if ($this->password) {
             $rsa->setPassword($this->options['password']);
         }
         $rsa->loadKey($this->options['private_key']);
         if (!$this->link->login($this->options['username'], $rsa)) {
             if ($this->handle_connect_error()) {
                 return false;
             }
             $this->errors->add('auth', sprintf(__('Private key incorrect for %s'), $this->options['username']));
             $this->errors->add('auth', __('Make sure that the key you are using is an RSA key and not a DSA key'));
             return false;
         }
     }
     return true;
 }
开发者ID:DanielWildeboer,项目名称:PVNG,代码行数:28,代码来源:class-wp-filesystem-ssh2.php


示例19: createPrivateKey

 public function createPrivateKey($sslCnfPath)
 {
     $rsa = new Crypt_RSA();
     $rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
     $keyPair = $rsa->createKey();
     return array('public' => $keyPair['publickey'], 'private' => $keyPair['privatekey']);
 }
开发者ID:niel,项目名称:spotweb,代码行数:7,代码来源:Services_Signing_Php.php


示例20: createKeys

 protected function createKeys()
 {
     $rsa = new Crypt_RSA();
     $keypair = $rsa->createKey(2048);
     $this['private_key'] = preg_replace("/\r/", "", $keypair['privatekey']);
     $this['public_key'] = preg_replace("/\r/", "", $keypair['publickey']);
 }
开发者ID:Krassmus,项目名称:LehrMarktplatz,代码行数:7,代码来源:LernmarktplatzIdentity.php



注:本文中的Crypt_RSA类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Crypt_Rijndael类代码示例发布时间:2022-05-23
下一篇:
PHP Crypt_Hash类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap