diff --git a/src/Encryption.php b/src/Encryption.php index 43ee558a..62ed5365 100644 --- a/src/Encryption.php +++ b/src/Encryption.php @@ -95,7 +95,7 @@ public static function deterministicEncrypt(string $payload, string $userPublicK $localJwk = new JWK([ 'kty' => 'EC', 'crv' => 'P-256', - 'd' => Base64Url::encode($localPrivateKeyObject->getSecret()->toBytes()), + 'd' => Base64Url::encode($localPrivateKeyObject->getSecret()->toBytes(false)), 'x' => Base64Url::encode($localPublicKeyObject[0]), 'y' => Base64Url::encode($localPublicKeyObject[1]), ]); @@ -280,9 +280,9 @@ private static function createLocalKeyObjectUsingPurePhpMethod(): array new JWK([ 'kty' => 'EC', 'crv' => 'P-256', - 'x' => Base64Url::encode(self::addNullPadding($publicKey->getPoint()->getX()->toBytes())), - 'y' => Base64Url::encode(self::addNullPadding($publicKey->getPoint()->getY()->toBytes())), - 'd' => Base64Url::encode(self::addNullPadding($privateKey->getSecret()->toBytes())), + 'x' => Base64Url::encode(self::addNullPadding($publicKey->getPoint()->getX()->toBytes(false))), + 'y' => Base64Url::encode(self::addNullPadding($publicKey->getPoint()->getY()->toBytes(false))), + 'd' => Base64Url::encode(self::addNullPadding($privateKey->getSecret()->toBytes(false))), ]) ]; }