INNER CODE UNIT · Python
export_secret_key
open-quantum-safe/liboqs-python · oqs/oqs.py:506
def export_secret_key(self) -> bytes:
"""Export the secret key."""
return bytes(self.secret_key)
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(