@@ -38,7 +38,7 @@ public function isProofValid(string $accessToken, string $url, string $wopiTimes
3838 $ proofKeyOld = $ this ->discoveryService ->getProofKeyOld ();
3939
4040 $ key = $ this ->calculateRSAKey ($ proofKey ->getModulus (), $ proofKey ->getExponent ());
41- $ keyOld = $ this ->calculateRSAKey ($ proofKeyOld ->getModulus (), $ proofKey ->getExponent ());
41+ $ keyOld = $ this ->calculateRSAKey ($ proofKeyOld ->getModulus (), $ proofKeyOld ->getExponent ());
4242
4343 $ isValid = ($ this ->verifyKey ($ expected , $ proof , $ key ) ||
4444 $ this ->verifyKey ($ expected , $ proof , $ keyOld ) ||
@@ -97,25 +97,21 @@ private function constructProof(
9797 // Four bytes representing the length, in bytes, of the access token
9898 $ accessTokenLength = pack ('N ' , strlen ($ accessToken ));
9999
100- $ accessToken = utf8_encode ($ accessToken );
101-
102100 // The access token in UTF-8 encoding
103- // $accessToken = mb_convert_encoding($accessToken, 'UTF-8', 'auto');
101+ $ accessToken = mb_convert_encoding ($ accessToken , 'UTF-8 ' , 'auto ' );
104102
105103 // Four bytes representing the length, in bytes, of the URL
106104 $ urlLength = pack ('N ' , strlen ($ url ));
107105
108106 // The UTF-8 encoded URL converted to uppercase
109- //$uppercaseURL= mb_strtoupper(mb_convert_encoding($url, 'UTF-8', 'auto'), 'UTF-8');
110- $ uppercaseURL = utf8_encode (strtoupper ($ url ));
107+ $ uppercaseURL = mb_strtoupper (mb_convert_encoding ($ url , 'UTF-8 ' , 'auto ' ), 'UTF-8 ' );
111108
112109 // Four bytes representing the size, in bytes, of the WOPI timestamp
113110 // Note: The WOPI timestamp should be converted to a long, so this
114111 // is architecture dependant (here we use PHP_INT_SIZE)
115112 $ wopiTimestampSize = pack ('N ' , 8 );
116113
117114 // The WOPI timestamp converted to a long (in PHP we use int)
118- //$wopiTimestamp = (int)$wopiTimeStamp;
119115 $ wopiTimestamp = pack ('J ' , $ wopiTimeStamp );
120116
121117 return sprintf (
0 commit comments