PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/sdk/google/google/cloud-storage/src/EncryptionTrait.php +9 -9 1.2.11 → 1.4.2 View file →
@@ -14,12 +14,12 @@
14 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 15 * See the License for the specific language governing permissions and
16 16 * limitations under the License.
17 17 */
18 -namespace Dudlewebs\WPMCS\Google\Cloud\Storage;
18 +namespace Dudlewebs\WPMCS\GCP\Google\Cloud\Storage;
19 19
20 -use Dudlewebs\WPMCS\phpseclib\Crypt\RSA as RSA2;
21 -use Dudlewebs\WPMCS\phpseclib3\Crypt\RSA as RSA3;
20 +use Dudlewebs\WPMCS\GCP\phpseclib\Crypt\RSA as RSA2;
21 +use Dudlewebs\WPMCS\GCP\phpseclib3\Crypt\RSA as RSA3;
22 22 /**
23 23 * Trait which provides helper methods for customer-supplied encryption.
24 24 */
25 25 trait EncryptionTrait
@@ -74,10 +74,10 @@
74 74 {
75 75 if ($key) {
76 76 $headerNames = $useCopySourceHeaders ? $this->copySourceEncryptionHeaderNames : $this->encryptionHeaderNames;
77 77 if (!$keySHA256) {
78 - $decodedKey = base64_decode($key);
79 - $keySHA256 = base64_encode(hash('SHA256', $decodedKey, \true));
78 + $decodedKey = \base64_decode($key);
79 + $keySHA256 = \base64_encode(\hash('SHA256', $decodedKey, \true));
80 80 }
81 81 return [$headerNames['algorithm'] => 'AES256', $headerNames['key'] => $key, $headerNames['keySHA256'] => $keySHA256];
82 82 }
83 83 return [];
@@ -97,20 +97,20 @@
97 97 */
98 98 protected function signString($privateKey, $data, $forceOpenssl = \false)
99 99 {
100 100 $signature = '';
101 - if (class_exists(RSA3::class) && !$forceOpenssl) {
101 + if (\class_exists(RSA3::class) && !$forceOpenssl) {
102 102 $rsa = RSA3::loadPrivateKey($privateKey);
103 103 $rsa = $rsa->withPadding(RSA3::SIGNATURE_PKCS1)->withHash('sha256');
104 104 $signature = $rsa->sign($data);
105 - } elseif (class_exists(RSA2::class) && !$forceOpenssl) {
105 + } elseif (\class_exists(RSA2::class) && !$forceOpenssl) {
106 106 $rsa = new RSA2();
107 107 $rsa->loadKey($privateKey);
108 108 $rsa->setSignatureMode(RSA2::SIGNATURE_PKCS1);
109 109 $rsa->setHash('sha256');
110 110 $signature = $rsa->sign($data);
111 - } elseif (extension_loaded('openssl')) {
112 - openssl_sign($data, $signature, $privateKey, 'sha256WithRSAEncryption');
111 + } elseif (\extension_loaded('openssl')) {
112 + \openssl_sign($data, $signature, $privateKey, 'sha256WithRSAEncryption');
113 113 } else {
114 114 // @codeCoverageIgnoreStart
115 115 throw new \RuntimeException('OpenSSL is not installed.');
116 116 }