public byte[] decrypt(byte[] nonce, byte[] ciphertext) { checkLength(nonce, NONCE_BYTES); byte[] ct = prependZeros(BOXZERO_BYTES, ciphertext); byte[] message = new byte[ct.length]; isValid(sodium().crypto_box_curve25519xsalsa20poly1305_open(message, ct, message.length, nonce, publicKey, privateKey), "Decryption failed. Ciphertext failed verification."); return removeZeros(ZERO_BYTES, message); }
public byte[] decrypt(byte[] nonce, byte[] ciphertext) { checkLength(nonce, NONCE_BYTES); byte[] ct = prependZeros(BOXZERO_BYTES, ciphertext); byte[] message = new byte[ct.length]; isValid(sodium().crypto_box_curve25519xsalsa20poly1305_open(message, ct, message.length, nonce, publicKey, privateKey), "Decryption failed. Ciphertext failed verification."); return removeZeros(ZERO_BYTES, message); }