Skip to content

Commit

Permalink
Fixes the signed bytes conversion (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
Spomky committed Nov 6, 2020
1 parent eddd95c commit 8911bad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
]);
Expand Down Expand Up @@ -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))),
])
];
}
Expand Down

0 comments on commit 8911bad

Please sign in to comment.