]> git.pld-linux.org Git - packages/php-google-api.git/commitdiff
add support for signing via seclib AC-branch auto/ac/php-google-api-0.6.2-1 auto/th/php-google-api-0.6.2-1
authorElan Ruusamäe <glen@delfi.ee>
Tue, 9 Jul 2013 14:37:17 +0000 (17:37 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Tue, 9 Jul 2013 14:41:39 +0000 (17:41 +0300)
gapi.patch [new file with mode: 0644]
php-google-api.spec

diff --git a/gapi.patch b/gapi.patch
new file mode 100644 (file)
index 0000000..3e4f1a2
--- /dev/null
@@ -0,0 +1,45 @@
+# This patch file was generated by NetBeans IDE
+# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
+# It uses platform neutral UTF-8 encoding.
+# Above lines and this line are ignored by the patching process.
+--- C:/Users/ANDRES/Desktop/google-api-php-client/src/auth/Google_AssertionCredentials.php
++++ D:/xampp/htdocs/delfi/dgs/admin/library/gapi/src/auth/Google_AssertionCredentials.php
+@@ -50,7 +50,8 @@
+       $privateKey,
+       $privateKeyPassword = 'notasecret',
+       $assertionType = 'http://oauth.net/grant_type/jwt/1.0/bearer',
+-      $sub = false) {
++      $sub = false,
++      $signer = null) {
+     $this->serviceAccountName = $serviceAccountName;
+     $this->scopes = is_string($scopes) ? $scopes : implode(' ', $scopes);
+     $this->privateKey = $privateKey;
+@@ -58,6 +59,7 @@
+     $this->assertionType = $assertionType;
+     $this->sub = $sub;
+     $this->prn = $sub;
++    $this->signer = $signer;
+   }
+   public function generateAssertion() {
+@@ -94,8 +96,20 @@
+     );
+     $signingInput = implode('.', $segments);
++
++    if ($this->signer === 'phpseclib') {
++       require_once 'Crypt/RSA.php';
++       $rsa = new Crypt_RSA();
++       $rsa->setPassword($this->privateKeyPassword);
++       $rsa->loadKey($this->privateKey, CRYPT_RSA_PRIVATE_FORMAT_PKCS1);
++       $rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
++       $rsa->setHash('sha256');
++       $signature = $rsa->sign($signingInput);
++    } else {
+     $signer = new Google_P12Signer($this->privateKey, $this->privateKeyPassword);
+     $signature = $signer->sign($signingInput);
++    }
++
+     $segments[] = Google_Utils::urlSafeB64Encode($signature);
+     return implode(".", $segments);
index 2de96d8f39de840dd4fa3668dc72fb489bbc9604..8a278c18af3466a711a97071834742cdce37449a 100644 (file)
@@ -12,6 +12,7 @@ Group:                Development/Languages/PHP
 Source0:       https://google-api-php-client.googlecode.com/files/google-api-php-client-%{version}.tar.gz
 # Source0-md5: 86db4e431096c9c32637842e214c6e26
 Patch0:                php52.patch
+Patch1:                gapi.patch
 URL:           https://code.google.com/p/google-api-php-client/
 BuildRequires: rpm-php-pearprov >= 4.4.2-11
 BuildRequires: rpmbuild(macros) >= 1.461
@@ -23,6 +24,7 @@ Requires:     php-hash
 Requires:      php-json
 Requires:      php-openssl
 Requires:      php-pcre
+Suggests:      php-seclib
 BuildArch:     noarch
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -39,6 +41,7 @@ Latitude on your server.
 %setup -qc
 mv google-api-php-client/* .
 %patch0 -p1
+%patch1 -p8
 
 grep -rl require_once examples | xargs %{__sed} -i -e '
        # fixup paths to source
This page took 0.071089 seconds and 4 git commands to generate.