* Makefile: Added new targets for running the tests. Now the generated
[mono.git] / mcs / class / Mono.Security / Mono.Security.Protocol.Tls / ServerRecordProtocol.cs
index 57c7970afdaa04a1e15446aa07549d47daf9aa7e..4b958674bbab55e4b5d2fb561479e6f951224d53 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 using System;
+using System.Globalization;
 using System.IO;
 
 using Mono.Security.Protocol.Tls.Handshake;
@@ -48,6 +49,7 @@ namespace Mono.Security.Protocol.Tls
                {
                        // Create the record message
                        HandshakeMessage msg = this.createServerHandshakeMessage(type);
+                       msg.Process();
                        
                        // Write record
                        this.SendRecord(msg.ContentType, msg.EncodeMessage());
@@ -63,6 +65,15 @@ namespace Mono.Security.Protocol.Tls
 
                #region Handshake Processing Methods
 
+               protected override void ProcessChangeCipherSpec()
+               {
+                       // Reset sequence numbers
+                       this.context.ReadSequenceNumber = 0;
+
+                       // Make the pending state to be the current state
+                       this.context.IsActual = true;
+               }
+
                protected override void ProcessHandshakeMessage(TlsStream handMsg)
                {
                        HandshakeType           handshakeType   = (HandshakeType)handMsg.ReadByte();
@@ -77,6 +88,7 @@ namespace Mono.Security.Protocol.Tls
 
                        // Create and process the server message
                        message = this.createClientHandshakeMessage(handshakeType, data);
+                       message.Process();
 
                        // Update the last handshake message
                        this.Context.LastHandshakeMsg = handshakeType;
@@ -113,7 +125,11 @@ namespace Mono.Security.Protocol.Tls
                                        return new TlsClientFinished(this.context, buffer);
 
                                default:
-                                       throw this.context.CreateException("Unknown server handshake message received ({0})", type.ToString());
+                                       throw new TlsException(
+                                               AlertDescription.UnexpectedMessage,
+                                               String.Format(CultureInfo.CurrentUICulture,
+                                                       "Unknown server handshake message received ({0})", 
+                                                       type.ToString()));
                        }
                }