summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2017-03-22 23:33:37 +1030
committerPeter Dettman <peter.dettman@bouncycastle.org>2017-03-22 23:33:37 +1030
commit40069ebd6c370109a29b7e2f8ff685d4bc4d038f (patch)
tree67da1e28367099e5ec26384d6523f32e97733579
parentAdd TlsProtocol.CloseInput for use in non-blocking mode (diff)
downloadBouncyCastle.NET-ed25519-40069ebd6c370109a29b7e2f8ff685d4bc4d038f.tar.xz
Records with ContentType.heartbeat should give 'unexpected_message'
- Heartbeat support currently incomplete (never negotiated)
-rw-r--r--crypto/src/crypto/tls/RecordStream.cs2
-rw-r--r--crypto/src/crypto/tls/TlsProtocol.cs28
2 files changed, 13 insertions, 17 deletions
diff --git a/crypto/src/crypto/tls/RecordStream.cs b/crypto/src/crypto/tls/RecordStream.cs
index b1060fd6d..dc66d0df7 100644
--- a/crypto/src/crypto/tls/RecordStream.cs
+++ b/crypto/src/crypto/tls/RecordStream.cs
@@ -359,7 +359,7 @@ namespace Org.BouncyCastle.Crypto.Tls
             case ContentType.alert:
             case ContentType.change_cipher_spec:
             case ContentType.handshake:
-            case ContentType.heartbeat:
+            //case ContentType.heartbeat:
                 break;
             default:
                 throw new TlsFatalAlert(alertDescription);
diff --git a/crypto/src/crypto/tls/TlsProtocol.cs b/crypto/src/crypto/tls/TlsProtocol.cs
index f259812f8..05f06f5ea 100644
--- a/crypto/src/crypto/tls/TlsProtocol.cs
+++ b/crypto/src/crypto/tls/TlsProtocol.cs
@@ -261,23 +261,19 @@ namespace Org.BouncyCastle.Crypto.Tls
                 ProcessHandshake();
                 break;
             }
-            case ContentType.heartbeat:
-            {
-                if (!mAppDataReady)
-                    throw new TlsFatalAlert(AlertDescription.unexpected_message);
-
-                // TODO[RFC 6520]
-    //            mHeartbeatQueue.AddData(buf, offset, len);
-    //            ProcessHeartbeat();
-                break;
-            }
+            //case ContentType.heartbeat:
+            //{
+            //    if (!mAppDataReady)
+            //        throw new TlsFatalAlert(AlertDescription.unexpected_message);
+
+            //    // TODO[RFC 6520]
+            //    //mHeartbeatQueue.AddData(buf, offset, len);
+            //    //ProcessHeartbeat();
+            //    break;
+            //}
             default:
-                /*
-                 * Uh, we don't know this protocol.
-                 * 
-                 * RFC2246 defines on page 13, that we should ignore this.
-                 */
-                break;
+                // Record type should already have been checked
+                throw new TlsFatalAlert(AlertDescription.internal_error);
             }
         }