Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2013-06-24 12:17:27 +0400
committerPeter Dettman <peter.dettman@bouncycastle.org>2013-06-24 12:17:27 +0400
commita0c220585584564fac843c8ffb2834c953c93f03 (patch)
treef6f633c2b1872a2cf07593734a128cc00e3dd95f /core/src/main/java/org/bouncycastle/crypto/tls/DTLSServerProtocol.java
parent9b0e6058a3a5b3116e58dad65069ff881d4b597a (diff)
Refactor to use receiveMessageBody when expected type known
Diffstat (limited to 'core/src/main/java/org/bouncycastle/crypto/tls/DTLSServerProtocol.java')
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/tls/DTLSServerProtocol.java28
1 files changed, 5 insertions, 23 deletions
diff --git a/core/src/main/java/org/bouncycastle/crypto/tls/DTLSServerProtocol.java b/core/src/main/java/org/bouncycastle/crypto/tls/DTLSServerProtocol.java
index b05120e5..d0ed9e9a 100644
--- a/core/src/main/java/org/bouncycastle/crypto/tls/DTLSServerProtocol.java
+++ b/core/src/main/java/org/bouncycastle/crypto/tls/DTLSServerProtocol.java
@@ -248,32 +248,14 @@ public class DTLSServerProtocol
if (expectCertificateVerifyMessage(state))
{
byte[] certificateVerifyHash = handshake.getCurrentHash();
- clientMessage = handshake.receiveMessage();
-
- if (clientMessage.getType() == HandshakeType.certificate_verify)
- {
- processCertificateVerify(state, clientMessage.getBody(), certificateVerifyHash);
- }
- else
- {
- throw new TlsFatalAlert(AlertDescription.unexpected_message);
- }
+ byte[] certificateVerifyBody = handshake.receiveMessageBody(HandshakeType.certificate_verify);
+ processCertificateVerify(state, certificateVerifyBody, certificateVerifyHash);
}
// NOTE: Calculated exclusive of the actual Finished message from the client
- byte[] clientFinishedHash = handshake.getCurrentHash();
- clientMessage = handshake.receiveMessage();
-
- if (clientMessage.getType() == HandshakeType.finished)
- {
- byte[] expectedClientVerifyData = TlsUtils.calculateVerifyData(state.serverContext, "client finished",
- clientFinishedHash);
- processFinished(clientMessage.getBody(), expectedClientVerifyData);
- }
- else
- {
- throw new TlsFatalAlert(AlertDescription.unexpected_message);
- }
+ byte[] expectedClientVerifyData = TlsUtils.calculateVerifyData(state.serverContext, "client finished",
+ handshake.getCurrentHash());
+ processFinished(handshake.receiveMessageBody(HandshakeType.finished), expectedClientVerifyData);
if (state.expectSessionTicket)
{