@Test public void nonceContainsRandomData() { this.kalium.randomNonce(); verify(this.sodium).randombytes(any(byte[].class), anyInt()); }
@Override public Nonce randomNonce() { final byte[] nonceBytes = new byte[CRYPTO_BOX_CURVE25519XSALSA20POLY1305_NONCEBYTES]; this.sodium.randombytes(nonceBytes, nonceBytes.length); final Nonce nonce = new Nonce(nonceBytes); LOGGER.debug("Generated random nonce {}", nonce); return nonce; }
Kalium implements Encryptor { @Override public Nonce randomNonce() { final byte[] nonceBytes = new byte[CRYPTO_BOX_CURVE25519XSALSA20POLY1305_NONCEBYTES]; this.sodium.randombytes(nonceBytes, nonceBytes.length); final Nonce nonce = new Nonce(nonceBytes); LOGGER.debug("Generated random nonce {}", nonce); return nonce; } }
Kalium implements Encryptor { @Override public Nonce randomNonce() { final byte[] nonceBytes = new byte[CRYPTO_BOX_CURVE25519XSALSA20POLY1305_NONCEBYTES]; this.sodium.randombytes(nonceBytes, nonceBytes.length); final Nonce nonce = new Nonce(nonceBytes); LOGGER.debug("Generated random nonce {}", nonce); return nonce; } Kalium(final NaCl.Sodium sodium); }
Kalium implements Encryptor { @Override public Nonce randomNonce() { final byte[] nonceBytes = new byte[CRYPTO_BOX_CURVE25519XSALSA20POLY1305_NONCEBYTES]; this.sodium.randombytes(nonceBytes, nonceBytes.length); final Nonce nonce = new Nonce(nonceBytes); LOGGER.debug("Generated random nonce {}", nonce); return nonce; } Kalium(final NaCl.Sodium sodium); @Override SharedKey computeSharedKey(final PublicKey publicKey, final PrivateKey privateKey); @Override byte[] seal(
            final byte[] message, final Nonce nonce, final PublicKey publicKey, final PrivateKey privateKey); @Override byte[] open(
            final byte[] cipherText, final Nonce nonce, final PublicKey publicKey, final PrivateKey privateKey); @Override byte[] sealAfterPrecomputation(final byte[] message, final Nonce nonce, final SharedKey sharedKey); @Override byte[] openAfterPrecomputation(final byte[] encryptedPayload, final Nonce nonce, final SharedKey sharedKey); @Override Nonce randomNonce(); @Override KeyPair generateNewKeys(); @Override SharedKey createSingleKey(); }
Kalium implements Encryptor { @Override public Nonce randomNonce() { final byte[] nonceBytes = new byte[CRYPTO_BOX_CURVE25519XSALSA20POLY1305_NONCEBYTES]; this.sodium.randombytes(nonceBytes, nonceBytes.length); final Nonce nonce = new Nonce(nonceBytes); LOGGER.debug("Generated random nonce {}", nonce); return nonce; } Kalium(final NaCl.Sodium sodium); @Override SharedKey computeSharedKey(final PublicKey publicKey, final PrivateKey privateKey); @Override byte[] seal(
            final byte[] message, final Nonce nonce, final PublicKey publicKey, final PrivateKey privateKey); @Override byte[] open(
            final byte[] cipherText, final Nonce nonce, final PublicKey publicKey, final PrivateKey privateKey); @Override byte[] sealAfterPrecomputation(final byte[] message, final Nonce nonce, final SharedKey sharedKey); @Override byte[] openAfterPrecomputation(final byte[] encryptedPayload, final Nonce nonce, final SharedKey sharedKey); @Override Nonce randomNonce(); @Override KeyPair generateNewKeys(); @Override SharedKey createSingleKey();  }