NetMQ.Security.V0_1.SecureChannel.EncryptApplicationMessage C# (CSharp) Method

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
        public NetMQMessage EncryptApplicationMessage([NotNull] NetMQMessage plainMessage)
        {
            if (!SecureChannelReady)
            {
                throw new NetMQSecurityException(NetMQSecurityErrorCode.SecureChannelNotReady, "Cannot encrypt messages until the secure channel is ready");
            }

            if (plainMessage == null)
            {
                throw new ArgumentNullException("plainMessage");
            }

            return InternalEncryptAndWrapMessage(ContentType.ApplicationData, plainMessage);
        }