paragonie / paserk-php

PHP Implementation of PASERK
Other
12 stars 1 forks source link

PKEv3.php seal/unseal using pk as hex string, not binary #12

Closed kennt closed 1 year ago

kennt commented 1 year ago

I've been trying to implement the paserk sealing code for C++ and have noticed that the paserk-php v3 seal/unseal code is using $pk_compressed as a hex string (rather than binary). In the code from PKEv3.php (around line 171) below, shouldn't $pk_compressed = $pk_obj->toString(); be $pk_compressed = Hex::decode($pk_obj->toString());


        $pk_compressed = $pk_obj->toString();

        // Step 2:
        $Ak = hash(
            'sha384',
            PKE::DOMAIN_SEPARATION_AUTH . $header . $xk . $eph_pk_compressed . $pk_compressed,
            true
        );
kennt commented 1 year ago

I've changed my code to use the hex string, and all of the k3.seal.json test-vectors now pass. At this point, it may be easier to update the spec rather than the code/tests.

paragonie-security commented 1 year ago

At this point, it may be easier to update the spec rather than the code/tests.

Nope. We'll fix the code and test vectors.