C# Class NetMQ.Security.V0_1.SecureChannel

Inheritance: ISecureChannel
Mostra file Open project: NetMQ/NetMQ3-x Class Usage Examples

Private Properties

Property Type Description
InternalEncryptAndWrapMessage NetMQMessage
OnCipherSuiteChangeFromHandshakeLayer void

Public Methods

Method Description
DecryptApplicationMessage ( [ cipherMessage ) : NetMQMessage

Decrypt the given NetMQMessage, the first frame of which is assumed to contain the protocol version.

Dispose ( ) : void

Release any contained resources of this SecureChannel object.

This disposes of the handshake-layer and the record-layer.

EncryptApplicationMessage ( [ plainMessage ) : NetMQMessage

Encrypt the given NetMQMessage, wrapping it's content as application-data and preficing it with the encryption protocol.

ProcessMessage ( NetMQMessage incomingMessage, IList outgoingMesssages ) : bool

Process handshake and change cipher suite messages. This method should be called for every incoming message until the method returns true. You cannot encrypt or decrypt messages until the method return true. Each call to the method may include outgoing messages that need to be sent to the other peer.

Note: Within this library, this method is ONLY called from within the unit-tests.

SecureChannel ( ConnectionEnd connectionEnd ) : System

Create a new SecureChannel with the given ConnectionEnd.

SetVerifyCertificate ( VerifyCertificateDelegate verifyCertificate ) : void

Assign the delegate to use to verify the X.509 certificate.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Release any contained resources of this SecureChannel object.

This disposes of the handshake-layer and the record-layer.

Private Methods

Method Description
InternalEncryptAndWrapMessage ( ContentType contentType, NetMQMessage plainMessage ) : NetMQMessage
OnCipherSuiteChangeFromHandshakeLayer ( object sender, EventArgs e ) : void

Method Details

DecryptApplicationMessage() public method

Decrypt the given NetMQMessage, the first frame of which is assumed to contain the protocol version.
cipherMessage must not be null. NetMQSecurityErrorCode.SecureChannelNotReady: The secure channel must be ready. NetMQSecurityErrorCode.InvalidFramesCount: The cipher message must have at least 2 frames. NetMQSecurityErrorCode.InvalidProtocolVersion: The protocol must be the correct version. NetMQSecurityErrorCode.InvalidContentType: The message must contain application data.
public DecryptApplicationMessage ( [ cipherMessage ) : NetMQMessage
cipherMessage [ the NetMQMessage to decrypt
return NetMQMessage

Dispose() public method

Release any contained resources of this SecureChannel object.
This disposes of the handshake-layer and the record-layer.
public Dispose ( ) : void
return void

Dispose() protected method

Release any contained resources of this SecureChannel object.
This disposes of the handshake-layer and the record-layer.
protected Dispose ( bool disposing ) : void
disposing bool set this to true if disposing of managed resources
return void

EncryptApplicationMessage() public method

Encrypt the given NetMQMessage, wrapping it's content as application-data and preficing it with the encryption protocol.
plainMessage must not be null. NetMQSecurityErrorCode.SecureChannelNotReady: The secure channel must be ready.
public EncryptApplicationMessage ( [ plainMessage ) : NetMQMessage
plainMessage [ The unencrypted form of the message to be encrypted.
return NetMQMessage

ProcessMessage() public method

Process handshake and change cipher suite messages. This method should be called for every incoming message until the method returns true. You cannot encrypt or decrypt messages until the method return true. Each call to the method may include outgoing messages that need to be sent to the other peer.
Note: Within this library, this method is ONLY called from within the unit-tests.
NetMQSecurityErrorCode.InvalidContentType: Unknown content type. NetMQSecurityErrorCode.InvalidFrameLength: Wrong length for protocol version frame. NetMQSecurityErrorCode.InvalidFrameLength: Wrong length for message size. NetMQSecurityErrorCode.InvalidProtocolVersion: Wrong protocol version.
public ProcessMessage ( NetMQMessage incomingMessage, IList outgoingMesssages ) : bool
incomingMessage NetMQMessage the incoming message from the other peer
outgoingMesssages IList the list of outgoing messages that need to be sent to the other peer
return bool

SecureChannel() public method

Create a new SecureChannel with the given ConnectionEnd.
public SecureChannel ( ConnectionEnd connectionEnd ) : System
connectionEnd ConnectionEnd the ConnectionEnd that this channel is to talk to
return System

SetVerifyCertificate() public method

Assign the delegate to use to verify the X.509 certificate.
public SetVerifyCertificate ( VerifyCertificateDelegate verifyCertificate ) : void
verifyCertificate VerifyCertificateDelegate
return void