INNER CODE UNIT · Python
decap_secret
open-quantum-safe/liboqs-python · oqs/oqs.py:537
def decap_secret(self, ciphertext: Union[int, bytes]) -> bytes:
"""
Decapsulate the ciphertext and returns the secret.
:param ciphertext: the ciphertext received from the peer.
"""
c_ciphertext = ct.create_string_buffer(
ciphertext,
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_decaps(
self._kem,
ct.byref(shared_secret),
c_ciphertext,
self.secret_key,