INNER CODE UNIT · Python

encap_secret

open-quantum-safe/liboqs-python · oqs/oqs.py:510

    def encap_secret(self, public_key: Union[int, bytes]) -> tuple[bytes, bytes]:
        """
        Generate and encapsulates a secret using the provided public key.

        :param public_key: the peer's public key.
        """
        c_public_key = ct.create_string_buffer(
            public_key,
            self._kem.contents.length_public_key,
        )
        ciphertext: ct.Array[ct.c_char] = ct.create_string_buffer(
            self._kem.contents.length_ciphertext,
        )
        shared_secret: ct.Array[ct.c_char] = ct.create_string_buffer(
            self._kem.contents.length_shared_secret,
        )
        rv = native().OQS_KEM_encaps(
            self._kem,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…