@Test public void randomNonce() { Nonce nonce = encryptor.randomNonce(); assertThat(nonce).isNotNull(); assertThat(nonce.getNonceBytes()).hasSize(24); }
@Override public Nonce randomNonce() { final byte[] nonceBytes = new byte[nonceLength]; this.secureRandom.nextBytes(nonceBytes); final Nonce nonce = new Nonce(nonceBytes); LOGGER.debug("Generated random nonce {}", nonce); return nonce; }
EllipticalCurveEncryptor implements Encryptor { @Override public Nonce randomNonce() { final byte[] nonceBytes = new byte[nonceLength]; this.secureRandom.nextBytes(nonceBytes); final Nonce nonce = new Nonce(nonceBytes); LOGGER.debug("Generated random nonce {}", nonce); return nonce; } }
EllipticalCurveEncryptor implements Encryptor { @Override public Nonce randomNonce() { final byte[] nonceBytes = new byte[nonceLength]; this.secureRandom.nextBytes(nonceBytes); final Nonce nonce = new Nonce(nonceBytes); LOGGER.debug("Generated random nonce {}", nonce); return nonce; } EllipticalCurveEncryptor(final String symmetricCipher, final String ellipticCurve);  EllipticalCurveEncryptor(final String symmetricCipher, final String ellipticCurve, int nonceLength, int sharedKeyLength); }
EllipticalCurveEncryptor implements Encryptor { @Override public Nonce randomNonce() { final byte[] nonceBytes = new byte[nonceLength]; this.secureRandom.nextBytes(nonceBytes); final Nonce nonce = new Nonce(nonceBytes); LOGGER.debug("Generated random nonce {}", nonce); return nonce; } EllipticalCurveEncryptor(final String symmetricCipher, final String ellipticCurve);  EllipticalCurveEncryptor(final String symmetricCipher, final String ellipticCurve, int nonceLength, int sharedKeyLength); @Override SharedKey computeSharedKey(PublicKey publicKey, PrivateKey privateKey); @Override byte[] seal(byte[] message, Nonce nonce, PublicKey publicKey, PrivateKey privateKey); @Override byte[] open(byte[] cipherText, Nonce nonce, PublicKey publicKey, PrivateKey privateKey); @Override byte[] sealAfterPrecomputation(byte[] message, Nonce nonce, SharedKey sharedKey); @Override byte[] openAfterPrecomputation(byte[] cipherText, Nonce nonce, SharedKey sharedKey); @Override Nonce randomNonce(); @Override KeyPair generateNewKeys(); @Override SharedKey createSingleKey(); }
EllipticalCurveEncryptor implements Encryptor { @Override public Nonce randomNonce() { final byte[] nonceBytes = new byte[nonceLength]; this.secureRandom.nextBytes(nonceBytes); final Nonce nonce = new Nonce(nonceBytes); LOGGER.debug("Generated random nonce {}", nonce); return nonce; } EllipticalCurveEncryptor(final String symmetricCipher, final String ellipticCurve);  EllipticalCurveEncryptor(final String symmetricCipher, final String ellipticCurve, int nonceLength, int sharedKeyLength); @Override SharedKey computeSharedKey(PublicKey publicKey, PrivateKey privateKey); @Override byte[] seal(byte[] message, Nonce nonce, PublicKey publicKey, PrivateKey privateKey); @Override byte[] open(byte[] cipherText, Nonce nonce, PublicKey publicKey, PrivateKey privateKey); @Override byte[] sealAfterPrecomputation(byte[] message, Nonce nonce, SharedKey sharedKey); @Override byte[] openAfterPrecomputation(byte[] cipherText, Nonce nonce, SharedKey sharedKey); @Override Nonce randomNonce(); @Override KeyPair generateNewKeys(); @Override SharedKey createSingleKey();  }