Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packet-based enc/dec cipher streams #49896

Merged
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
92a3b34
Polished main
albertzaharovits Nov 30, 2019
d07c05f
First successful tests
albertzaharovits Dec 1, 2019
de603a7
More tests
albertzaharovits Dec 1, 2019
7cc62e0
More tests
albertzaharovits Dec 1, 2019
cbd3c50
BufferOnMarkInputStreamBug
albertzaharovits Dec 1, 2019
9eb9bcf
A few bugs...
albertzaharovits Dec 2, 2019
5919a11
BufferOnMark bug
albertzaharovits Dec 2, 2019
47f6aea
More more more bugs!
albertzaharovits Dec 2, 2019
8263062
Mad tests
albertzaharovits Dec 3, 2019
cf97ba2
Manic testing
albertzaharovits Dec 3, 2019
3c82ba9
BufferOnMarkInputStreamTests completed
albertzaharovits Dec 4, 2019
76d8271
Checkstyle
albertzaharovits Dec 4, 2019
6b30902
Merge branch 'repository-encrypted-client-side' into packet-based-cip…
albertzaharovits Dec 4, 2019
4e9778e
BufferOnMarkInputStream javadocs
albertzaharovits Dec 5, 2019
24d6d27
merge fallout
albertzaharovits Dec 5, 2019
3cd79bd
PrefixInputStream tests
albertzaharovits Dec 5, 2019
c610fe8
WIP
albertzaharovits Dec 5, 2019
e4f8564
CountingInputStreamTests
albertzaharovits Dec 5, 2019
c816c45
Renaming and more javadocs
albertzaharovits Dec 5, 2019
29c484b
Refactor ChainingInputStream
albertzaharovits Dec 5, 2019
db5f58e
Scarce EncryptionPacketsInputStream javadocs
albertzaharovits Dec 6, 2019
d6dc875
ChainingInputStream polishing and tests
albertzaharovits Dec 8, 2019
7cb48f6
ChainingInputStreamTests
albertzaharovits Dec 8, 2019
83e028b
ChainingInputStreamTests without mark/reset
albertzaharovits Dec 9, 2019
26a624f
ChainingInputStreamTests mark/reset
albertzaharovits Dec 9, 2019
aeb6698
More tests
albertzaharovits Dec 9, 2019
2939289
WIP
albertzaharovits Dec 10, 2019
76678a6
DecryptionPacketsInputStream tests
albertzaharovits Dec 10, 2019
f44b97c
Tests done!
albertzaharovits Dec 10, 2019
016164a
More javadocs
albertzaharovits Dec 10, 2019
5b26ff6
Merge branch 'repository-encrypted-client-side' into packet-based-cip…
albertzaharovits Dec 18, 2019
a0751c6
Update x-pack/plugin/repository-encrypted/src/main/java/org/elasticse…
albertzaharovits Dec 23, 2019
92e177f
Update x-pack/plugin/repository-encrypted/src/main/java/org/elasticse…
albertzaharovits Dec 23, 2019
5d9321a
Update x-pack/plugin/repository-encrypted/src/main/java/org/elasticse…
albertzaharovits Dec 23, 2019
c231486
Tim's review WIP
albertzaharovits Dec 25, 2019
bda96b6
ChainingInputStream javadocs
albertzaharovits Dec 25, 2019
cb6006d
Logging on component close
albertzaharovits Dec 25, 2019
fad9eb4
Merge branch 'repository-encrypted-client-side' into packet-based-cip…
albertzaharovits Dec 25, 2019
65f0adb
Nit
albertzaharovits Dec 25, 2019
b40d999
No Randomness in ChainingInputStreamTests
albertzaharovits Dec 26, 2019
cb7bc1c
Update x-pack/plugin/repository-encrypted/src/test/java/org/elasticse…
albertzaharovits Dec 26, 2019
7acaf54
Tim's review WIP before mark/reset review
albertzaharovits Dec 27, 2019
dfeea83
Almost WIP
albertzaharovits Dec 27, 2019
da29e2f
Review complete
albertzaharovits Dec 28, 2019
5e7269b
Update x-pack/plugin/repository-encrypted/src/main/java/org/elasticse…
albertzaharovits Dec 30, 2019
14ee4aa
IV position
albertzaharovits Dec 30, 2019
7ee63c0
Update x-pack/plugin/repository-encrypted/src/main/java/org/elasticse…
albertzaharovits Dec 30, 2019
74f38b2
move mark supported before mark/reset implementations
albertzaharovits Dec 30, 2019
fee2d79
Package-protected instead of protected for final classes
albertzaharovits Dec 30, 2019
eda1fe0
RemainingPrefixByteCount
albertzaharovits Dec 30, 2019
e85aefe
Update x-pack/plugin/repository-encrypted/src/main/java/org/elasticse…
albertzaharovits Dec 30, 2019
8a0773a
no iv instance variable
albertzaharovits Dec 30, 2019
07d7ac8
Nit
albertzaharovits Dec 30, 2019
fd10914
Exception messages
albertzaharovits Dec 30, 2019
2e41d4f
Fix tests with exception names
albertzaharovits Dec 30, 2019
97f5917
Test for reader of fewer bytes
albertzaharovits Dec 30, 2019
4fd6dcc
Adjust counting input stream docs
albertzaharovits Dec 30, 2019
3d1daf4
RingBuffer
albertzaharovits Dec 31, 2019
4fcd49d
WIP
albertzaharovits Dec 31, 2019
9ef136e
WIP
albertzaharovits Dec 31, 2019
cb966b2
More javadoc to the ring buffer inner
albertzaharovits Jan 1, 2020
0f9f77c
Small test polishing
albertzaharovits Jan 1, 2020
08fb26c
Merge branch 'repository-encrypted-client-side' into packet-based-cip…
elasticmachine Jan 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP
  • Loading branch information
albertzaharovits committed Dec 5, 2019
commit c610fe83b3a50f769f6e9496aeacbbb3fcd07eb4
Original file line number Diff line number Diff line change
@@ -10,6 +10,18 @@
import java.io.InputStream;
import java.util.Objects;

/**
* A {@code CountingInputStream} wraps another input stream and counts the number of bytes
* that have been read or skipped. This input stream must be used in place of the wrapped one.
* Bytes replayed following a {@code reset} call are not counted multiple times, i.e. only
albertzaharovits marked this conversation as resolved.
Show resolved Hide resolved
* the bytes that are produced in a single pass, without resets, by the wrapped stream are counted.
* This input stream does no buffering on its own and only supports {@code mark} and
* {@code reset} if the wrapped stream supports it.
* <p>
* If the {@code closeSource} constructor argument is {@code true}, closing this
* stream will also close the wrapped input stream. Apart from closing the wrapped
* stream in this case, the {@code close} method does nothing else.
*/
public final class CountingInputStream extends FilterInputStream {

private long count;
@@ -21,7 +33,7 @@ public final class CountingInputStream extends FilterInputStream {
* Wraps another input stream, counting the number of bytes read.
*
* @param in the input stream to be wrapped
* @param closeSource if closing this stream will propagate to the wrapped stream
* @param closeSource {@code true} if closing this stream will also close the wrapped stream
*/
public CountingInputStream(InputStream in, boolean closeSource) {
super(Objects.requireNonNull(in));
Original file line number Diff line number Diff line change
@@ -18,8 +18,8 @@
* is exhausted when {@code length} bytes have been read or the underlying
* stream is exhausted.
* <p>
* Iff {@code closeSource} constructor argument is {@code true}, closing this
* stream will close the underlying input stream. Any subsequent {@code read},
* If the {@code closeSource} constructor argument is {@code true}, closing this
* stream will also close the underlying input stream. Any subsequent {@code read},
* {@code skip} and {@code available} calls will throw {@code IOException}s.
*/
public final class PrefixInputStream extends FilterInputStream {
albertzaharovits marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

package org.elasticsearch.repositories.encrypted;

import org.elasticsearch.test.ESTestCase;

public class CountingInputStreamTests extends ESTestCase {
}