@Test public void createSingleKey() { SharedKey sharedKey = encryptor.createSingleKey(); assertThat(sharedKey).isNotNull(); assertThat(sharedKey.getKeyBytes()).hasSize(32); }
@Override public SharedKey createSingleKey() { LOGGER.debug("Generating random key"); final byte[] keyBytes = new byte[sharedKeyLength]; this.secureRandom.nextBytes(keyBytes); final SharedKey key = SharedKey.from(keyBytes); LOGGER.debug("Random key generated"); LOGGER.debug("Generated key with value {}", key); return key; }
EllipticalCurveEncryptor implements Encryptor { @Override public SharedKey createSingleKey() { LOGGER.debug("Generating random key"); final byte[] keyBytes = new byte[sharedKeyLength]; this.secureRandom.nextBytes(keyBytes); final SharedKey key = SharedKey.from(keyBytes); LOGGER.debug("Random key generated"); LOGGER.debug("Generated key with value {}", key); return key; } }
EllipticalCurveEncryptor implements Encryptor { @Override public SharedKey createSingleKey() { LOGGER.debug("Generating random key"); final byte[] keyBytes = new byte[sharedKeyLength]; this.secureRandom.nextBytes(keyBytes); final SharedKey key = SharedKey.from(keyBytes); LOGGER.debug("Random key generated"); LOGGER.debug("Generated key with value {}", key); return key; } EllipticalCurveEncryptor(final String symmetricCipher, final String ellipticCurve);  EllipticalCurveEncryptor(final String symmetricCipher, final String ellipticCurve, int nonceLength, int sharedKeyLength); }
EllipticalCurveEncryptor implements Encryptor { @Override public SharedKey createSingleKey() { LOGGER.debug("Generating random key"); final byte[] keyBytes = new byte[sharedKeyLength]; this.secureRandom.nextBytes(keyBytes); final SharedKey key = SharedKey.from(keyBytes); LOGGER.debug("Random key generated"); LOGGER.debug("Generated key with value {}", key); return key; } 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 SharedKey createSingleKey() { LOGGER.debug("Generating random key"); final byte[] keyBytes = new byte[sharedKeyLength]; this.secureRandom.nextBytes(keyBytes); final SharedKey key = SharedKey.from(keyBytes); LOGGER.debug("Random key generated"); LOGGER.debug("Generated key with value {}", key); return key; } 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();  }