@Test public void testEncryptTLS12AEADEncrypthThenMac() throws NoSuchAlgorithmException, CryptoException { context.setSelectedProtocolVersion(ProtocolVersion.TLS12); context.setSelectedCipherSuite(CipherSuite.TLS_RSA_WITH_AES_128_GCM_SHA256); context.addNegotiatedExtension(ExtensionType.ENCRYPT_THEN_MAC); context.setMasterSecret(ArrayConverter.hexStringToByteArray("")); record.setCleanProtocolMessageBytes(ArrayConverter.hexStringToByteArray("080000020000")); record.setContentMessageType(ProtocolMessageType.HANDSHAKE); recordCipher = new RecordAEADCipher(context, KeySetGenerator.generateKeySet(context)); encryptor = new RecordEncryptor(recordCipher, context); encryptor.encrypt(record); }
@Override public void encrypt(BlobRecord record) { LOGGER.debug("Encrypting BlobRecord"); RecordCipher recordCipher = getRecordMostRecentCipher(); try { recordCipher.encrypt(record); } catch (CryptoException ex) { LOGGER.warn("Could not encrypt BlobRecord. Using NullCipher", ex); try { nullCipher.encrypt(record); } catch (CryptoException ex1) { LOGGER.error("Could not encrypt with NullCipher", ex1); } } context.increaseWriteSequenceNumber(); }
RecordEncryptor extends Encryptor { @Override public void encrypt(BlobRecord record) { LOGGER.debug("Encrypting BlobRecord"); RecordCipher recordCipher = getRecordMostRecentCipher(); try { recordCipher.encrypt(record); } catch (CryptoException ex) { LOGGER.warn("Could not encrypt BlobRecord. Using NullCipher", ex); try { nullCipher.encrypt(record); } catch (CryptoException ex1) { LOGGER.error("Could not encrypt with NullCipher", ex1); } } context.increaseWriteSequenceNumber(); } }
RecordEncryptor extends Encryptor { @Override public void encrypt(BlobRecord record) { LOGGER.debug("Encrypting BlobRecord"); RecordCipher recordCipher = getRecordMostRecentCipher(); try { recordCipher.encrypt(record); } catch (CryptoException ex) { LOGGER.warn("Could not encrypt BlobRecord. Using NullCipher", ex); try { nullCipher.encrypt(record); } catch (CryptoException ex1) { LOGGER.error("Could not encrypt with NullCipher", ex1); } } context.increaseWriteSequenceNumber(); } RecordEncryptor(RecordCipher recordCipher, TlsContext context); }
RecordEncryptor extends Encryptor { @Override public void encrypt(BlobRecord record) { LOGGER.debug("Encrypting BlobRecord"); RecordCipher recordCipher = getRecordMostRecentCipher(); try { recordCipher.encrypt(record); } catch (CryptoException ex) { LOGGER.warn("Could not encrypt BlobRecord. Using NullCipher", ex); try { nullCipher.encrypt(record); } catch (CryptoException ex1) { LOGGER.error("Could not encrypt with NullCipher", ex1); } } context.increaseWriteSequenceNumber(); } RecordEncryptor(RecordCipher recordCipher, TlsContext context); @Override void encrypt(BlobRecord record); @Override void encrypt(Record record); }
RecordEncryptor extends Encryptor { @Override public void encrypt(BlobRecord record) { LOGGER.debug("Encrypting BlobRecord"); RecordCipher recordCipher = getRecordMostRecentCipher(); try { recordCipher.encrypt(record); } catch (CryptoException ex) { LOGGER.warn("Could not encrypt BlobRecord. Using NullCipher", ex); try { nullCipher.encrypt(record); } catch (CryptoException ex1) { LOGGER.error("Could not encrypt with NullCipher", ex1); } } context.increaseWriteSequenceNumber(); } RecordEncryptor(RecordCipher recordCipher, TlsContext context); @Override void encrypt(BlobRecord record); @Override void encrypt(Record record);  }