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/s3/Aws/CloudFront/Signer.php +12 -1 1.2.11 → 1.4.2 View file →
@@ -65,8 +65,9 @@
65 65 *
66 66 * @return array The values needed to construct a signed URL or cookie
67 67 * @throws \InvalidArgumentException when not provided either a policy or a
68 68 * resource and a expires
69 + * @throws \RuntimeException when generated signature is empty
69 70 *
70 71 * @link http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-cookies.html
71 72 */
72 73 public function getSignature($resource = null, $expires = null, $policy = null)
@@ -93,9 +94,19 @@
93 94 }
94 95 private function sign($policy)
95 96 {
96 97 $signature = '';
97 - \openssl_sign($policy, $signature, $this->pkHandle);
98 + if (!\openssl_sign($policy, $signature, $this->pkHandle)) {
99 + $errorMessages = [];
100 + while (($newMessage = \openssl_error_string()) !== \false) {
101 + $errorMessages[] = $newMessage;
102 + }
103 + $exceptionMessage = "An error has occurred when signing the policy";
104 + if (\count($errorMessages) > 0) {
105 + $exceptionMessage = \implode("\n", $errorMessages);
106 + }
107 + throw new \RuntimeException($exceptionMessage);
108 + }
98 109 return $signature;
99 110 }
100 111 private function encode($policy)
101 112 {