C# Class NetMQ.Security.V0_1.RecordLayer

The RecordLayer class represents the "Record Layer" within the SSL/TLS protocol layers. This is underneath the Handshake Layer, and above the Transport Layer.
See http://technet.microsoft.com/en-us/library/cc781476(v=ws.10).aspx
Inheritance: IDisposable
ファイルを表示 Open project: NetMQ/NetMQ3-x Class Usage Examples

Public Methods

Method Description
DecryptMessage ( ContentType contentType, NetMQMessage cipherMessage ) : NetMQMessage

Return a new NetMQMessage that contains the decrypted content of the give message.

Dispose ( ) : void

Dispose of all contained resources.

EncryptMessage ( ContentType contentType, NetMQMessage plainMessage ) : NetMQMessage
InitalizeCipherSuite ( ) : void
RecordLayer ( byte protocolVersion ) : System

Create a new RecordLayer object with the given protocol-version.

ValidateBytes ( ContentType contentType, ulong seqNum, int frameIndex, byte plainBytes, byte mac, byte padding ) : void

Check the given arguments and throw a NetMQSecurityException if something is amiss.

Private Methods

Method Description
CheckReplayAttack ( ulong seqNumber ) : bool
DecryptBytes ( ICryptoTransform decryptor, byte cipherBytes, byte &plainBytes, byte &mac, byte &padding ) : void
EncryptBytes ( ICryptoTransform encryptor, ContentType contentType, ulong seqNum, int frameIndex, byte plainBytes ) : byte[]
GenerateIV ( ICryptoTransform encryptor, byte seqNumBytes ) : byte[]

Create and return an Initialization Vector (IV) using a given sequence-number and encryptor.

GenerateKeys ( byte &clientMAC, byte &serverMAC, byte &clientEncryptionKey, byte &serverEncryptionKey ) : void
GetAndIncreaseSequneceNumber ( ) : ulong

Increment and return the sequence-number.

Method Details

DecryptMessage() public method

Return a new NetMQMessage that contains the decrypted content of the give message.
: Cipher message must have at least 2 frames, iv and sequence number. : Message already handled or very old message, might be under replay attack. : Frames were removed from the encrypted message.
public DecryptMessage ( ContentType contentType, NetMQMessage cipherMessage ) : NetMQMessage
contentType ContentType This identifies the type of content: ChangeCipherSpec, Handshake, or ApplicationData.
cipherMessage NetMQMessage the message to decrypt
return NetMQMessage

Dispose() public method

Dispose of all contained resources.
public Dispose ( ) : void
return void

EncryptMessage() public method

public EncryptMessage ( ContentType contentType, NetMQMessage plainMessage ) : NetMQMessage
contentType ContentType This identifies the type of content: ChangeCipherSpec, Handshake, or ApplicationData.
plainMessage NetMQMessage The unencrypted form of the message to be encrypted.
return NetMQMessage

InitalizeCipherSuite() public method

public InitalizeCipherSuite ( ) : void
return void

RecordLayer() public method

Create a new RecordLayer object with the given protocol-version.
public RecordLayer ( byte protocolVersion ) : System
protocolVersion byte a 2-element byte-array that denotes the version of this protocol
return System

ValidateBytes() public method

Check the given arguments and throw a NetMQSecurityException if something is amiss.
: MAC does not match message.
public ValidateBytes ( ContentType contentType, ulong seqNum, int frameIndex, byte plainBytes, byte mac, byte padding ) : void
contentType ContentType This identifies the type of content: ChangeCipherSpec, Handshake, or ApplicationData.
seqNum ulong
frameIndex int
plainBytes byte
mac byte
padding byte
return void