class Jnacl implements Encryptor {

    @Override
    public SharedKey computeSharedKey(final PublicKey publicKey, final PrivateKey privateKey) {
        final byte[] precomputed = new byte[crypto_secretbox_BEFORENMBYTES];

        LOGGER.debug("Computing the shared key for public key {} and private key {}", publicKey, privateKey);
        final int jnaclResult =
                secretBox.cryptoBoxBeforenm(precomputed, publicKey.getKeyBytes(), privateKey.getKeyBytes());

        if (jnaclResult == -1) {
            LOGGER.error("Could not compute the shared key for pub {} and priv {}", publicKey, privateKey);
            throw new EncryptorException("jnacl could not compute the shared key");
        }

        final SharedKey sharedKey = SharedKey.from(precomputed);

        LOGGER.debug("Computed shared key {} for pub {} and priv {}", sharedKey, publicKey, privateKey);

        return sharedKey;
    }

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

}