ShortPaddingGenerator extends PaddingVectorGenerator { List<PaddingVector> createBasicMacVectors(CipherSuite suite, ProtocolVersion version) { List<PaddingVector> vectorList = new LinkedList<>(); int macSize = AlgorithmResolver.getMacAlgorithm(version, suite).getSize(); int i = 1; for (ByteArrayXorModification modification : createFlippedModifications(macSize)) { vectorList.add(new TrippleVector("BasicMac-" + modification.getStartPosition() + "-" + ArrayConverter.bytesToHexString(modification.getXor()), "BasicMac" + i, new ByteArrayExplicitValueModification(new byte[DEFAULT_CIPHERTEXT_LENGTH - macSize - DEFAULT_PADDING_LENGTH]), modification, null)); i++; } return vectorList; }  @Override List<PaddingVector> getVectors(CipherSuite suite, ProtocolVersion version);  }
@Test public void testCreateBasicMacVectors() { List<PaddingVector> vectors = generator.createBasicMacVectors(CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, ProtocolVersion.TLS12); assertEquals(3, vectors.size()); int macSize = AlgorithmResolver.getMacAlgorithm(ProtocolVersion.TLS12, CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA).getSize(); VariableModification modification = ((TrippleVector) vectors.get(0)).getCleanModification(); ModifiableByteArray array = new ModifiableByteArray(); array.setModification(modification); byte[] expectedPlain = new byte[ShortPaddingGenerator.DEFAULT_CIPHERTEXT_LENGTH - ShortPaddingGenerator.DEFAULT_PADDING_LENGTH - macSize]; assertArrayEquals(expectedPlain, array.getValue()); }