@@ -74,9 +74,9 @@ protected function calculateAgreementKey(JWK $private_key, JWK $public_key): str
7474 throw new InvalidArgumentException ('Invalid key parameter "crv" ' );
7575 }
7676 switch ($ crv ) {
77- case 'P-256 ' :
78- case 'P-384 ' :
79- case 'P-521 ' :
77+ case 'P-256 ' :
78+ case 'P-384 ' :
79+ case 'P-521 ' :
8080 $ curve = $ this ->getCurve ($ crv );
8181 if (function_exists ('openssl_pkey_derive ' )) {
8282 try {
@@ -115,7 +115,7 @@ protected function calculateAgreementKey(JWK $private_key, JWK $public_key): str
115115
116116 return $ this ->convertDecToBin (EcDH::computeSharedKey ($ curve , $ pub_key , $ priv_key ));
117117
118- case 'X25519 ' :
118+ case 'X25519 ' :
119119 $ this ->checkSodiumExtensionIsAvailable ();
120120 $ x = $ public_key ->get ('x ' );
121121 if (! is_string ($ x )) {
@@ -130,7 +130,7 @@ protected function calculateAgreementKey(JWK $private_key, JWK $public_key): str
130130
131131 return sodium_crypto_scalarmult ($ sKey , $ recipientPublickey );
132132
133- default :
133+ default :
134134 throw new InvalidArgumentException (sprintf ('The curve "%s" is not supported ' , $ crv ));
135135 }
136136 }
@@ -212,19 +212,19 @@ private function checkKey(JWK $key, bool $is_private): void
212212 throw new InvalidArgumentException ('Invalid key parameter "crv" ' );
213213 }
214214 switch ($ crv ) {
215- case 'P-256 ' :
216- case 'P-384 ' :
217- case 'P-521 ' :
215+ case 'P-256 ' :
216+ case 'P-384 ' :
217+ case 'P-521 ' :
218218 if (! $ key ->has ('y ' )) {
219219 throw new InvalidArgumentException ('The key parameter "y" is missing. ' );
220220 }
221221
222222 break ;
223223
224- case 'X25519 ' :
224+ case 'X25519 ' :
225225 break ;
226226
227- default :
227+ default :
228228 throw new InvalidArgumentException (sprintf ('The curve "%s" is not supported ' , $ crv ));
229229 }
230230 if ($ is_private === true && ! $ key ->has ('d ' )) {
@@ -279,14 +279,14 @@ private function createOKPKey(string $curve): JWK
279279 $ this ->checkSodiumExtensionIsAvailable ();
280280
281281 switch ($ curve ) {
282- case 'X25519 ' :
282+ case 'X25519 ' :
283283 $ keyPair = sodium_crypto_box_keypair ();
284284 $ d = sodium_crypto_box_secretkey ($ keyPair );
285285 $ x = sodium_crypto_box_publickey ($ keyPair );
286286
287287 break ;
288288
289- case 'Ed25519 ' :
289+ case 'Ed25519 ' :
290290 $ keyPair = sodium_crypto_sign_keypair ();
291291 $ secret = sodium_crypto_sign_secretkey ($ keyPair );
292292 $ secretLength = mb_strlen ($ secret , '8bit ' );
@@ -295,7 +295,7 @@ private function createOKPKey(string $curve): JWK
295295
296296 break ;
297297
298- default :
298+ default :
299299 throw new InvalidArgumentException (sprintf ('Unsupported "%s" curve ' , $ curve ));
300300 }
301301
0 commit comments