test_class.declarator: tmpFolder = new TemporaryFolder()
test_class.modifier: @Rule public
test_class.original_string: @Rule public TemporaryFolder tmpFolder = new TemporaryFolder();
test_class.type: TemporaryFolder
test_class.var_name: tmpFolder
test_class.file: java_src/src/test/java/com/google/crypto/tink/subtle/AesCtrHmacStreamingTest.java
test_class.identifier: AesCtrHmacStreamingTest
test_case.body: @Test
    public void testEncryptLimitedCiphertextChannel() throws Exception {
      int segmentSize = 512;
      int firstSegmentOffset = 0;
      int keySizeInBytes = 16;
      int tagSizeInBytes = 12;
      byte[] ikm =
          TestUtil.hexDecode("000102030405060708090a0b0c0d0e0f00112233445566778899aabbccddeeff");
      AesCtrHmacStreaming ags = new AesCtrHmacStreaming(ikm, "HmacSha256", keySizeInBytes,
          "HmacSha256", tagSizeInBytes, segmentSize, firstSegmentOffset);
  
      int plaintextSize = 1 << 15;
      int maxChunkSize = 100;
      byte[] aad = TestUtil.hexDecode("aabbccddeeff");
      byte[] plaintext = StreamingTestUtil.generatePlaintext(plaintextSize);
      int ciphertextLength = (int) ags.expectedCiphertextSize(plaintextSize);
      ByteBuffer ciphertext = ByteBuffer.allocate(ciphertextLength);
      WritableByteChannel ctChannel = new SeekableByteBufferChannel(ciphertext, maxChunkSize);
      WritableByteChannel encChannel = ags.newEncryptingChannel(ctChannel, aad);
      ByteBuffer plaintextBuffer = ByteBuffer.wrap(plaintext);
      int loops = 0;
      while (plaintextBuffer.remaining() > 0) {
        encChannel.write(plaintextBuffer);
        loops += 1;
        if (loops > 100000) {
          System.out.println(encChannel.toString());
          fail("Too many loops");
        }
      }
      encChannel.close();
      assertFalse(encChannel.isOpen());
      StreamingTestUtil.isValidCiphertext(ags, plaintext, aad, ciphertext.array());
    }
test_case.class_method_signature: AesCtrHmacStreamingTest.testEncryptLimitedCiphertextChannel()
test_case.full_signature: @Test public void testEncryptLimitedCiphertextChannel()
test_case.identifier: testEncryptLimitedCiphertextChannel
test_case.invocations: hexDecode hexDecode generatePlaintext expectedCiphertextSize allocate newEncryptingChannel wrap remaining write println toString fail close assertFalse isOpen isValidCiphertext array
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEncryptLimitedCiphertextChannel()
focal_class.declarator: NONCE_SIZE_IN_BYTES = 16
focal_class.modifier: private static final
focal_class.original_string: private static final int NONCE_SIZE_IN_BYTES = 16;
focal_class.type: int
focal_class.var_name: NONCE_SIZE_IN_BYTES
focal_class.declarator: NONCE_PREFIX_IN_BYTES = 7
focal_class.modifier: private static final
focal_class.original_string: private static final int NONCE_PREFIX_IN_BYTES = 7;
focal_class.type: int
focal_class.var_name: NONCE_PREFIX_IN_BYTES
focal_class.declarator: HMAC_KEY_SIZE_IN_BYTES = 32
focal_class.modifier: private static final
focal_class.original_string: private static final int HMAC_KEY_SIZE_IN_BYTES = 32;
focal_class.type: int
focal_class.var_name: HMAC_KEY_SIZE_IN_BYTES
focal_class.declarator: keySizeInBytes
focal_class.modifier: private final
focal_class.original_string: private final int keySizeInBytes;
focal_class.type: int
focal_class.var_name: keySizeInBytes
focal_class.declarator: tagAlgo
focal_class.modifier: private final
focal_class.original_string: private final String tagAlgo;
focal_class.type: String
focal_class.var_name: tagAlgo
focal_class.declarator: tagSizeInBytes
focal_class.modifier: private final
focal_class.original_string: private final int tagSizeInBytes;
focal_class.type: int
focal_class.var_name: tagSizeInBytes
focal_class.declarator: ciphertextSegmentSize
focal_class.modifier: private final
focal_class.original_string: private final int ciphertextSegmentSize;
focal_class.type: int
focal_class.var_name: ciphertextSegmentSize
focal_class.declarator: plaintextSegmentSize
focal_class.modifier: private final
focal_class.original_string: private final int plaintextSegmentSize;
focal_class.type: int
focal_class.var_name: plaintextSegmentSize
focal_class.declarator: firstSegmentOffset
focal_class.modifier: private final
focal_class.original_string: private final int firstSegmentOffset;
focal_class.type: int
focal_class.var_name: firstSegmentOffset
focal_class.declarator: hkdfAlgo
focal_class.modifier: private final
focal_class.original_string: private final String hkdfAlgo;
focal_class.type: String
focal_class.var_name: hkdfAlgo
focal_class.declarator: ikm
focal_class.modifier: private final
focal_class.original_string: private final byte[] ikm;
focal_class.type: byte[]
focal_class.var_name: ikm
focal_class.file: java_src/src/main/java/com/google/crypto/tink/subtle/AesCtrHmacStreaming.java
focal_class.identifier: AesCtrHmacStreaming
focal_class.class_method_signature: AesCtrHmacStreaming.AesCtrHmacStreaming(
        byte[] ikm,
        String hkdfAlgo,
        int keySizeInBytes,
        String tagAlgo,
        int tagSizeInBytes,
        int ciphertextSegmentSize,
        int firstSegmentOffset)
focal_class.full_signature: public  AesCtrHmacStreaming(
        byte[] ikm,
        String hkdfAlgo,
        int keySizeInBytes,
        String tagAlgo,
        int tagSizeInBytes,
        int ciphertextSegmentSize,
        int firstSegmentOffset)
focal_class.identifier: AesCtrHmacStreaming
focal_class.modifiers: public
focal_class.parameters: (
        byte[] ikm,
        String hkdfAlgo,
        int keySizeInBytes,
        String tagAlgo,
        int tagSizeInBytes,
        int ciphertextSegmentSize,
        int firstSegmentOffset)
focal_class.signature:  AesCtrHmacStreaming(
        byte[] ikm,
        String hkdfAlgo,
        int keySizeInBytes,
        String tagAlgo,
        int tagSizeInBytes,
        int ciphertextSegmentSize,
        int firstSegmentOffset)
focal_class.class_method_signature: AesCtrHmacStreaming.validateParameters(
        int ikmSize,
        int keySizeInBytes,
        String tagAlgo,
        int tagSizeInBytes,
        int ciphertextSegmentSize,
        int firstSegmentOffset)
focal_class.full_signature: private static void validateParameters(
        int ikmSize,
        int keySizeInBytes,
        String tagAlgo,
        int tagSizeInBytes,
        int ciphertextSegmentSize,
        int firstSegmentOffset)
focal_class.identifier: validateParameters
focal_class.modifiers: private static
focal_class.parameters: (
        int ikmSize,
        int keySizeInBytes,
        String tagAlgo,
        int tagSizeInBytes,
        int ciphertextSegmentSize,
        int firstSegmentOffset)
focal_class.return: void
focal_class.signature: void validateParameters(
        int ikmSize,
        int keySizeInBytes,
        String tagAlgo,
        int tagSizeInBytes,
        int ciphertextSegmentSize,
        int firstSegmentOffset)
focal_class.class_method_signature: AesCtrHmacStreaming.newStreamSegmentEncrypter(byte[] aad)
focal_class.full_signature: @Override public AesCtrHmacStreamEncrypter newStreamSegmentEncrypter(byte[] aad)
focal_class.identifier: newStreamSegmentEncrypter
focal_class.modifiers: @Override public
focal_class.parameters: (byte[] aad)
focal_class.return: AesCtrHmacStreamEncrypter
focal_class.signature: AesCtrHmacStreamEncrypter newStreamSegmentEncrypter(byte[] aad)
focal_class.class_method_signature: AesCtrHmacStreaming.newStreamSegmentDecrypter()
focal_class.full_signature: @Override public AesCtrHmacStreamDecrypter newStreamSegmentDecrypter()
focal_class.identifier: newStreamSegmentDecrypter
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: AesCtrHmacStreamDecrypter
focal_class.signature: AesCtrHmacStreamDecrypter newStreamSegmentDecrypter()
focal_class.class_method_signature: AesCtrHmacStreaming.getCiphertextSegmentSize()
focal_class.full_signature: @Override public int getCiphertextSegmentSize()
focal_class.identifier: getCiphertextSegmentSize
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getCiphertextSegmentSize()
focal_class.class_method_signature: AesCtrHmacStreaming.getPlaintextSegmentSize()
focal_class.full_signature: @Override public int getPlaintextSegmentSize()
focal_class.identifier: getPlaintextSegmentSize
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getPlaintextSegmentSize()
focal_class.class_method_signature: AesCtrHmacStreaming.getHeaderLength()
focal_class.full_signature: @Override public int getHeaderLength()
focal_class.identifier: getHeaderLength
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getHeaderLength()
focal_class.class_method_signature: AesCtrHmacStreaming.getCiphertextOffset()
focal_class.full_signature: @Override public int getCiphertextOffset()
focal_class.identifier: getCiphertextOffset
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getCiphertextOffset()
focal_class.class_method_signature: AesCtrHmacStreaming.getCiphertextOverhead()
focal_class.full_signature: @Override public int getCiphertextOverhead()
focal_class.identifier: getCiphertextOverhead
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getCiphertextOverhead()
focal_class.class_method_signature: AesCtrHmacStreaming.getFirstSegmentOffset()
focal_class.full_signature: public int getFirstSegmentOffset()
focal_class.identifier: getFirstSegmentOffset
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getFirstSegmentOffset()
focal_class.class_method_signature: AesCtrHmacStreaming.expectedCiphertextSize(long plaintextSize)
focal_class.full_signature: public long expectedCiphertextSize(long plaintextSize)
focal_class.identifier: expectedCiphertextSize
focal_class.modifiers: public
focal_class.parameters: (long plaintextSize)
focal_class.return: long
focal_class.signature: long expectedCiphertextSize(long plaintextSize)
focal_class.class_method_signature: AesCtrHmacStreaming.cipherInstance()
focal_class.full_signature: private static Cipher cipherInstance()
focal_class.identifier: cipherInstance
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: Cipher
focal_class.signature: Cipher cipherInstance()
focal_class.class_method_signature: AesCtrHmacStreaming.macInstance()
focal_class.full_signature: private Mac macInstance()
focal_class.identifier: macInstance
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Mac
focal_class.signature: Mac macInstance()
focal_class.class_method_signature: AesCtrHmacStreaming.randomSalt()
focal_class.full_signature: private byte[] randomSalt()
focal_class.identifier: randomSalt
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: byte[]
focal_class.signature: byte[] randomSalt()
focal_class.class_method_signature: AesCtrHmacStreaming.nonceForSegment(byte[] prefix, long segmentNr, boolean last)
focal_class.full_signature: private byte[] nonceForSegment(byte[] prefix, long segmentNr, boolean last)
focal_class.identifier: nonceForSegment
focal_class.modifiers: private
focal_class.parameters: (byte[] prefix, long segmentNr, boolean last)
focal_class.return: byte[]
focal_class.signature: byte[] nonceForSegment(byte[] prefix, long segmentNr, boolean last)
focal_class.class_method_signature: AesCtrHmacStreaming.randomNonce()
focal_class.full_signature: private byte[] randomNonce()
focal_class.identifier: randomNonce
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: byte[]
focal_class.signature: byte[] randomNonce()
focal_class.class_method_signature: AesCtrHmacStreaming.deriveKeyMaterial(byte[] salt, byte[] aad)
focal_class.full_signature: private byte[] deriveKeyMaterial(byte[] salt, byte[] aad)
focal_class.identifier: deriveKeyMaterial
focal_class.modifiers: private
focal_class.parameters: (byte[] salt, byte[] aad)
focal_class.return: byte[]
focal_class.signature: byte[] deriveKeyMaterial(byte[] salt, byte[] aad)
focal_class.class_method_signature: AesCtrHmacStreaming.deriveKeySpec(byte[] keyMaterial)
focal_class.full_signature: private SecretKeySpec deriveKeySpec(byte[] keyMaterial)
focal_class.identifier: deriveKeySpec
focal_class.modifiers: private
focal_class.parameters: (byte[] keyMaterial)
focal_class.return: SecretKeySpec
focal_class.signature: SecretKeySpec deriveKeySpec(byte[] keyMaterial)
focal_class.class_method_signature: AesCtrHmacStreaming.deriveHmacKeySpec(byte[] keyMaterial)
focal_class.full_signature: private SecretKeySpec deriveHmacKeySpec(byte[] keyMaterial)
focal_class.identifier: deriveHmacKeySpec
focal_class.modifiers: private
focal_class.parameters: (byte[] keyMaterial)
focal_class.return: SecretKeySpec
focal_class.signature: SecretKeySpec deriveHmacKeySpec(byte[] keyMaterial)
focal_class.superclass: extends NonceBasedStreamingAead
focal_method.body: public long expectedCiphertextSize(long plaintextSize) {
      long offset = getCiphertextOffset();
      long fullSegments = (plaintextSize + offset) / plaintextSegmentSize;
      long ciphertextSize = fullSegments * ciphertextSegmentSize;
      long lastSegmentSize = (plaintextSize + offset) % plaintextSegmentSize;
      if (lastSegmentSize > 0) {
        ciphertextSize += lastSegmentSize + tagSizeInBytes;
      }
      return ciphertextSize;
    }
focal_method.class_method_signature: AesCtrHmacStreaming.expectedCiphertextSize(long plaintextSize)
focal_method.full_signature: public long expectedCiphertextSize(long plaintextSize)
focal_method.identifier: expectedCiphertextSize
focal_method.invocations: getCiphertextOffset
focal_method.modifiers: public
focal_method.parameters: (long plaintextSize)
focal_method.return: long
focal_method.signature: long expectedCiphertextSize(long plaintextSize)