diff options
Diffstat (limited to 'crypto/src/tls/TlsFatalAlertReceived.cs')
-rw-r--r-- | crypto/src/tls/TlsFatalAlertReceived.cs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/crypto/src/tls/TlsFatalAlertReceived.cs b/crypto/src/tls/TlsFatalAlertReceived.cs index adf71d5b9..4e1a62481 100644 --- a/crypto/src/tls/TlsFatalAlertReceived.cs +++ b/crypto/src/tls/TlsFatalAlertReceived.cs @@ -7,17 +7,27 @@ namespace Org.BouncyCastle.Tls public class TlsFatalAlertReceived : TlsException { - protected readonly short m_alertDescription; + protected readonly byte m_alertDescription; public TlsFatalAlertReceived(short alertDescription) : base(Tls.AlertDescription.GetText(alertDescription)) { - this.m_alertDescription = alertDescription; + if (!TlsUtilities.IsValidUint8(alertDescription)) + throw new ArgumentOutOfRangeException(nameof(alertDescription)); + + m_alertDescription = (byte)alertDescription; } protected TlsFatalAlertReceived(SerializationInfo info, StreamingContext context) : base(info, context) { + m_alertDescription = info.GetByte("alertDescription"); + } + + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + info.AddValue("alertDescription", m_alertDescription); } public virtual short AlertDescription |