/** * This is used to perform the read part of the negotiation. The * read part is where the other side sends information where it * is consumed and is used to determine what action to take. * Typically it is the SSL engine that determines what action is * to be taken depending on the data send from the other side. * * @param count this is the number of times a read can repeat * * @return the next action that should be taken by the handshake */ private PhaseType read(int count) throws IOException { while(count > 0) { SSLEngineResult result = engine.unwrap(input, output); HandshakeStatus status = result.getHandshakeStatus(); switch(status) { case NOT_HANDSHAKING: return COMMIT; case NEED_WRAP: return PRODUCE; case FINISHED: case NEED_UNWRAP: return read(count-1); case NEED_TASK: execute(); } } return CONSUME; }
/** * This is used to perform the write part of the negotiation. The * read part is where the this sends information to the other side * and the other side interprets the data and determines what action * to take. After a write the negotiation typically completes or * waits for the next response from the other side. * * @param count this is the number of times a read can repeat * * @return the next action that should be taken by the handshake */ private PhaseType write(int count) throws IOException { while(count > 0) { SSLEngineResult result = engine.wrap(empty, output); HandshakeStatus status = result.getHandshakeStatus(); switch(status) { case NOT_HANDSHAKING: case FINISHED: case NEED_UNWRAP: return PRODUCE; case NEED_WRAP: return write(count-1); case NEED_TASK: execute(); } } return PRODUCE; }
/** * This is used to perform the write part of the negotiation. The * read part is where the this sends information to the other side * and the other side interprets the data and determines what action * to take. After a write the negotiation typically completes or * waits for the next response from the other side. * * @param count this is the number of times a read can repeat * * @return the next action that should be taken by the handshake */ private Status write(int count) throws IOException { while(count > 0) { SSLEngineResult result = engine.wrap(empty, output); HandshakeStatus status = result.getHandshakeStatus(); switch(status) { case NOT_HANDSHAKING: case FINISHED: case NEED_UNWRAP: return PRODUCE; case NEED_WRAP: return write(count-1); case NEED_TASK: execute(); } } return PRODUCE; }
/** * This is used to perform the write part of the negotiation. The * read part is where the this sends information to the other side * and the other side interprets the data and determines what action * to take. After a write the negotiation typically completes or * waits for the next response from the other side. * * @param count this is the number of times a read can repeat * * @return the next action that should be taken by the handshake */ private PhaseType write(int count) throws IOException { while(count > 0) { SSLEngineResult result = engine.wrap(empty, output); HandshakeStatus status = result.getHandshakeStatus(); switch(status) { case NOT_HANDSHAKING: case FINISHED: case NEED_UNWRAP: return PRODUCE; case NEED_WRAP: return write(count-1); case NEED_TASK: execute(); } } return PRODUCE; }
/** * This is used to perform the read part of the negotiation. The * read part is where the other side sends information where it * is consumed and is used to determine what action to take. * Typically it is the SSL engine that determines what action is * to be taken depending on the data send from the other side. * * @param count this is the number of times a read can repeat * * @return the next action that should be taken by the handshake */ private Status read(int count) throws IOException { while(count > 0) { SSLEngineResult result = engine.unwrap(input, output); HandshakeStatus status = result.getHandshakeStatus(); switch(status) { case NOT_HANDSHAKING: return COMMIT; case NEED_WRAP: return PRODUCE; case FINISHED: case NEED_UNWRAP: return read(count-1); case NEED_TASK: execute(); } } return CONSUME; }
/** * This is used to perform the read part of the negotiation. The * read part is where the other side sends information where it * is consumed and is used to determine what action to take. * Typically it is the SSL engine that determines what action is * to be taken depending on the data send from the other side. * * @param count this is the number of times a read can repeat * * @return the next action that should be taken by the handshake */ private PhaseType read(int count) throws IOException { while(count > 0) { SSLEngineResult result = engine.unwrap(input, output); HandshakeStatus status = result.getHandshakeStatus(); switch(status) { case NOT_HANDSHAKING: return COMMIT; case NEED_WRAP: return PRODUCE; case FINISHED: case NEED_UNWRAP: return read(count-1); case NEED_TASK: execute(); } } return CONSUME; }