Skip to content
Snippets Groups Projects
Commit 33dfd4dc authored by bontric's avatar bontric
Browse files

Use readTag function in PrivateMailboxSession

parent 179bec39
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -23,6 +23,7 @@ import java.io.InputStream;
import java.net.ProtocolException;
import java.util.concurrent.Executor;
import java.util.logging.Logger;
import java.util.stream.Stream;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING;
......@@ -113,25 +114,10 @@ public class PrivateMailboxSession extends AbstractMailboxSession {
MailboxRequestTake takeRequest = (MailboxRequestTake) request;
InputStream in = new ByteArrayInputStream(
takeRequest.getEncryptedSyncStream());
byte[] tag = new byte[TAG_LENGTH];
StreamContext ctx;
try {
// read tag from input stream
int offset = 0;
while (offset < tag.length) {
int read = in.read(tag, offset, tag.length - offset);
if (read == -1) throw new EOFException();
offset += read;
}
ctx =
keyManager.getStreamContext(MailboxConstants.ID, tag);
if (ctx == null) {
throw new ProtocolException(
"Received stream with unrecognisable tag");
}
StreamContext ctx = readTag(in);
InputStream reader =
streamReaderFactory.createStreamReader(in, ctx);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment