class Jnacl implements Encryptor {

    @Override
    public byte[] openAfterPrecomputation(final byte[] cipherText, final Nonce nonce, final SharedKey sharedKey) {
        LOGGER.debug(
                "Opening message using nonce {} and shared key {}", nonce, sharedKey);

        final byte[] paddedInput = pad(cipherText, crypto_secretbox_BOXZEROBYTES);
        final byte[] paddedOutput = new byte[paddedInput.length];

        final int jnaclResult =
                secretBox.cryptoBoxOpenAfternm(
                        paddedOutput, paddedInput, paddedInput.length, nonce.getNonceBytes(), sharedKey.getKeyBytes());

        if (jnaclResult == -1) {
            LOGGER.error("Could not open sealed payload using shared key {}", sharedKey);
            throw new EncryptorException("jnacl could not open the payload using the shared key");
        }

        LOGGER.debug("Opened sealed payload for shared key {}", sharedKey);
        LOGGER.debug(
                "Opened payload using nonce {} and shared key {}",
                nonce,
                sharedKey);

        return extract(paddedOutput, crypto_secretbox_ZEROBYTES);
    }

    public  Jnacl(final SecureRandom secureRandom, final SecretBox secretBox);

}