original_string: protected function _rsaSha1($request, $credentials)
      {
          if (!function_exists('openssl_pkey_get_private')) {
              throw new RuntimeException('RSA-SHA1 signature method requires the OpenSSL extension.');
          }
  
          $nonce = isset($credentials['nonce']) ? $credentials['nonce'] : bin2hex(Security::randomBytes(16));
          $timestamp = isset($credentials['timestamp']) ? $credentials['timestamp'] : time();
          $values = [
              'oauth_version' => '1.0',
              'oauth_nonce' => $nonce,
              'oauth_timestamp' => $timestamp,
              'oauth_signature_method' => 'RSA-SHA1',
              'oauth_consumer_key' => $credentials['consumerKey'],
          ];
          if (isset($credentials['consumerSecret'])) {
              $values['oauth_consumer_secret'] = $credentials['consumerSecret'];
          }
          if (isset($credentials['token'])) {
              $values['oauth_token'] = $credentials['token'];
          }
          if (isset($credentials['tokenSecret'])) {
              $values['oauth_token_secret'] = $credentials['tokenSecret'];
          }
          $baseString = $this->baseString($request, $values);
  
          if (isset($credentials['realm'])) {
              $values['oauth_realm'] = $credentials['realm'];
          }
  
          if (is_resource($credentials['privateKey'])) {
              $resource = $credentials['privateKey'];
              $privateKey = stream_get_contents($resource);
              rewind($resource);
              $credentials['privateKey'] = $privateKey;
          }
  
          $credentials += [
              'privateKeyPassphrase' => null,
          ];
          if (is_resource($credentials['privateKeyPassphrase'])) {
              $resource = $credentials['privateKeyPassphrase'];
              $passphrase = stream_get_line($resource, 0, PHP_EOL);
              rewind($resource);
              $credentials['privateKeyPassphrase'] = $passphrase;
          }
          $privateKey = openssl_pkey_get_private($credentials['privateKey'], $credentials['privateKeyPassphrase']);
          $signature = '';
          openssl_sign($baseString, $signature, $privateKey);
          openssl_free_key($privateKey);
  
          $values['oauth_signature'] = base64_encode($signature);
  
          return $this->_buildAuth($values);
      }
code: protected function _rsaSha1($request, $credentials)
      {
          if (!function_exists('openssl_pkey_get_private')) {
              throw new RuntimeException('RSA-SHA1 signature method requires the OpenSSL extension.');
          }
  
          $nonce = isset($credentials['nonce']) ? $credentials['nonce'] : bin2hex(Security::randomBytes(16));
          $timestamp = isset($credentials['timestamp']) ? $credentials['timestamp'] : time();
          $values = [
              'oauth_version' => '1.0',
              'oauth_nonce' => $nonce,
              'oauth_timestamp' => $timestamp,
              'oauth_signature_method' => 'RSA-SHA1',
              'oauth_consumer_key' => $credentials['consumerKey'],
          ];
          if (isset($credentials['consumerSecret'])) {
              $values['oauth_consumer_secret'] = $credentials['consumerSecret'];
          }
          if (isset($credentials['token'])) {
              $values['oauth_token'] = $credentials['token'];
          }
          if (isset($credentials['tokenSecret'])) {
              $values['oauth_token_secret'] = $credentials['tokenSecret'];
          }
          $baseString = $this->baseString($request, $values);
  
          if (isset($credentials['realm'])) {
              $values['oauth_realm'] = $credentials['realm'];
          }
  
          if (is_resource($credentials['privateKey'])) {
              $resource = $credentials['privateKey'];
              $privateKey = stream_get_contents($resource);
              rewind($resource);
              $credentials['privateKey'] = $privateKey;
          }
  
          $credentials += [
              'privateKeyPassphrase' => null,
          ];
          if (is_resource($credentials['privateKeyPassphrase'])) {
              $resource = $credentials['privateKeyPassphrase'];
              $passphrase = stream_get_line($resource, 0, PHP_EOL);
              rewind($resource);
              $credentials['privateKeyPassphrase'] = $passphrase;
          }
          $privateKey = openssl_pkey_get_private($credentials['privateKey'], $credentials['privateKeyPassphrase']);
          $signature = '';
          openssl_sign($baseString, $signature, $privateKey);
          openssl_free_key($privateKey);
  
          $values['oauth_signature'] = base64_encode($signature);
  
          return $this->_buildAuth($values);
      }
code_tokens: protected function _rsaSha1 ( $ request , $ credentials ) { if ( ! function_exists ( 'openssl_pkey_get_private' ) ) { throw new RuntimeException ( 'RSA-SHA1 signature method requires the OpenSSL extension.' ) ; } $ nonce = isset ( $ credentials [ 'nonce' ] ) ? $ credentials [ 'nonce' ] : bin2hex ( Security :: randomBytes ( 16 ) ) ; $ timestamp = isset ( $ credentials [ 'timestamp' ] ) ? $ credentials [ 'timestamp' ] : time ( ) ; $ values = [ 'oauth_version' => '1.0' , 'oauth_nonce' => $ nonce , 'oauth_timestamp' => $ timestamp , 'oauth_signature_method' => 'RSA-SHA1' , 'oauth_consumer_key' => $ credentials [ 'consumerKey' ] , ] ; if ( isset ( $ credentials [ 'consumerSecret' ] ) ) { $ values [ 'oauth_consumer_secret' ] = $ credentials [ 'consumerSecret' ] ; } if ( isset ( $ credentials [ 'token' ] ) ) { $ values [ 'oauth_token' ] = $ credentials [ 'token' ] ; } if ( isset ( $ credentials [ 'tokenSecret' ] ) ) { $ values [ 'oauth_token_secret' ] = $ credentials [ 'tokenSecret' ] ; } $ baseString = $ this -> baseString ( $ request , $ values ) ; if ( isset ( $ credentials [ 'realm' ] ) ) { $ values [ 'oauth_realm' ] = $ credentials [ 'realm' ] ; } if ( is_resource ( $ credentials [ 'privateKey' ] ) ) { $ resource = $ credentials [ 'privateKey' ] ; $ privateKey = stream_get_contents ( $ resource ) ; rewind ( $ resource ) ; $ credentials [ 'privateKey' ] = $ privateKey ; } $ credentials += [ 'privateKeyPassphrase' => null , ] ; if ( is_resource ( $ credentials [ 'privateKeyPassphrase' ] ) ) { $ resource = $ credentials [ 'privateKeyPassphrase' ] ; $ passphrase = stream_get_line ( $ resource , 0 , PHP_EOL ) ; rewind ( $ resource ) ; $ credentials [ 'privateKeyPassphrase' ] = $ passphrase ; } $ privateKey = openssl_pkey_get_private ( $ credentials [ 'privateKey' ] , $ credentials [ 'privateKeyPassphrase' ] ) ; $ signature = '' ; openssl_sign ( $ baseString , $ signature , $ privateKey ) ; openssl_free_key ( $ privateKey ) ; $ values [ 'oauth_signature' ] = base64_encode ( $ signature ) ; return $ this -> _buildAuth ( $ values ) ; }
docstring: Use RSA-SHA1 signing.
  
  This method is suitable for plain HTTP or HTTPS.
  
  @param \Cake\Http\Client\Request $request The request object.
  @param array $credentials Authentication credentials.
  @return string
  
  @throws \RuntimeException
docstring_tokens: Use RSA - SHA1 signing .