protected ProcessRecord ( byte protocol, byte buf, int offset, int len ) : void | ||
protocol | byte | |
buf | byte | |
offset | int | |
len | int | |
return | void |
internal virtual bool ReadRecord() { byte[] recordHeader = TlsUtilities.ReadAllOrNothing(5, mInput); if (recordHeader == null) { return(false); } byte type = TlsUtilities.ReadUint8(recordHeader, 0); /* * RFC 5246 6. If a TLS implementation receives an unexpected record type, it MUST send an * unexpected_message alert. */ CheckType(type, AlertDescription.unexpected_message); if (!mRestrictReadVersion) { int version = TlsUtilities.ReadVersionRaw(recordHeader, 1); if ((version & 0xffffff00) != 0x0300) { throw new TlsFatalAlert(AlertDescription.illegal_parameter); } } else { ProtocolVersion version = TlsUtilities.ReadVersion(recordHeader, 1); if (mReadVersion == null) { mReadVersion = version; } else if (!version.Equals(mReadVersion)) { throw new TlsFatalAlert(AlertDescription.illegal_parameter); } } int length = TlsUtilities.ReadUint16(recordHeader, 3); byte[] plaintext = DecodeAndVerify(type, mInput, length); mHandler.ProcessRecord(type, plaintext, 0, plaintext.Length); return(true); }
internal virtual bool ReadRecord() { byte[] array = TlsUtilities.ReadAllOrNothing(5, mInput); if (array == null) { return(false); } byte b = TlsUtilities.ReadUint8(array, 0); CheckType(b, 10); if (!mRestrictReadVersion) { int num = TlsUtilities.ReadVersionRaw(array, 1); if ((num & 4294967040u) != 768) { throw new TlsFatalAlert(47); } } else { ProtocolVersion protocolVersion = TlsUtilities.ReadVersion(array, 1); if (mReadVersion == null) { mReadVersion = protocolVersion; } else if (!protocolVersion.Equals(mReadVersion)) { throw new TlsFatalAlert(47); } } int len = TlsUtilities.ReadUint16(array, 3); byte[] array2 = DecodeAndVerify(b, mInput, len); mHandler.ProcessRecord(b, array2, 0, array2.Length); return(true); }