Show / Hide Table of Contents

Class MessageHelper

This class is use to send and retreived message from Secure Exchanges

Inheritance
System.Object
MessageHelper
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: SecureExchangesSDK.Helpers
Assembly: SecureExchangesSDK.dll
Syntax
public static class MessageHelper

Methods

DeleteMessageByTrackingId(DeleteMessageByTrackingIdArgs)

Delete message by tracking id, tracking id came from log

Declaration
public static bool DeleteMessageByTrackingId(DeleteMessageByTrackingIdArgs args)
Parameters
Type Name Description
DeleteMessageByTrackingIdArgs args
Returns
Type Description
System.Boolean

EncryptMessage(EncryptMessageArgs)

Encrypt a single message. Must use MultiRecipientMessage to send the same message to one or more recipient

Declaration
[Obsolete("Please use the MultiRecipientMessage")]
public static SendMessageAnswer EncryptMessage(EncryptMessageArgs args)
Parameters
Type Name Description
EncryptMessageArgs args
Returns
Type Description
SendMessageAnswer

EncryptMessage(Guid, Guid, Guid, String, String, String, String, String, List<FileArgs>, SendMethodEnum, Boolean, Boolean, Boolean, String)

Méthode pour envoyé un message. Tous les paramètre seront encrypter par un Handshake et un échange de clef avec le serveur

Declaration
[Obsolete("Please use the MultiRecipientMessage")]
public static SendMessageAnswer EncryptMessage(Guid serial, Guid apiUser, Guid apiPassword, string message, string subject, string email, string phone, string password, List<FileArgs> filesList, SendMethodEnum SendMode, bool getBackHtml, bool showSubject, bool getNotify, string cultureID)
Parameters
Type Name Description
System.Guid serial

Représente le no de série

System.Guid apiUser

Représente le "USER" API

System.Guid apiPassword

Représente le "PASSWORD" API

System.String message

Le message en clair qui doit être envoyé

System.String subject

Le sujet en clair qui doit être envoyé

System.String email

Le email en clair qui doit être envoyé

System.String phone

Le téléphone avec qui communiqué un code SMS ou envoyé un message

System.String password

Le mot de passe en clair pour ouvrir le message

System.Collections.Generic.List<FileArgs> filesList

Liste des fichiers devant être envoyé - null aucun fichier

SendMethodEnum SendMode

La méthode d'envoi

System.Boolean getBackHtml

Voulons nous récupéré le HTML du message envoyé

System.Boolean showSubject

Voulons nous afficher le sujet

System.Boolean getNotify

Est-ce que l'expéditeur veux être notifier de l'ouverture du message

System.String cultureID

La culture du message

Returns
Type Description
SendMessageAnswer

ExtenMessageLive(ExtenMessageLiveArgs)

Declaration
public static bool ExtenMessageLive(ExtenMessageLiveArgs args)
Parameters
Type Name Description
ExtenMessageLiveArgs args
Returns
Type Description
System.Boolean

GetEnvelopes(GetEnvelopesArgs)

Return multiple envelopes. One per recipient

Declaration
public static GetEnvelopesResponse GetEnvelopes(GetEnvelopesArgs args)
Parameters
Type Name Description
GetEnvelopesArgs args

In the args.Recipient if the phone number is used, then you activate automaticly the Two Factor Authentication

Returns
Type Description
GetEnvelopesResponse

Return a list of envelopes, one per recipient. When use the phone in the recipient, the 2FA is activated

GetEnveloppe(GetEnveloppeArgs)

Create a link to send to a recipient. This link will allow the recipient to send your back some information. If the reply API is activated on your licence, when the user will reply, you will be notify by our system. Your callbackparameter will be encrypted AES 256, and only your service endpoint will able to retreived it. This callbackparameters are usefull to let know your service, wich client, folder or anything usefull for your system to know about the callback request If you pass "false" to ReplyToAPI, the answer will came back by email to the licence email address

Declaration
public static GetEnveloppeResponse GetEnveloppe(GetEnveloppeArgs args)
Parameters
Type Name Description
GetEnveloppeArgs args

GetEnveloppeArgs

Returns
Type Description
GetEnveloppeResponse

GetEnveloppeResponse

Examples
 GetEnveloppeResponse response = MessageHelper.GetEnveloppe(
 new GetEnveloppeArgs(new Uri("https://www.secure-exchanges.com/_api/0217/0217.asmx"),
       [your serial],
       [your apiuser],
       [your apipsw], "Subject", "Recipient email addresse", "fr-CA")
  {
    ReplyToAPI = true,
    CallBackParameters = "[Place your object here. XML, JSON]"
  });

GetMessage(GetMessageArgs)

This method is used to decrypt a message from Secure Exchanges

Declaration
public static GetMessageResponse GetMessage(GetMessageArgs args)
Parameters
Type Name Description
GetMessageArgs args

GetMessageArgs

Returns
Type Description
GetMessageResponse

GetMessageResponse

Examples
 SecureExchangesMessage msg = MessageHelper.GetSecureExchangesMessageFromLink(link);
 var password = "[The password use to protect the mesasge]";
 var digit = "[The SMS digit code received]";
GetMessageResponse response =  MessageHelper.GetMessage(new GetMessageArgs(
new Uri("https://www.secure-exchanges.com/_api/0217/0217.asmx"),
       [your serial],
       [your apiuser],
       [your apipsw],
       msg.MessageID, 
       msg.Cpart, 
       msg.Sems, 
       msg.NIv,
       msg.P2, 
       password, 
       digit));

GetSecureExchangesMessageFromLink(String)

This method is create to parse a link from Secure Exchanges

Declaration
public static SecureExchangesMessage GetSecureExchangesMessageFromLink(string link)
Parameters
Type Name Description
System.String link

Secure Exchanges read message link

Returns
Type Description
SecureExchangesMessage

Secure Exchanges Message

Examples
// Use to extract parameters from Secure Exchanges Link
var link = "https://www.secure-exchanges.com/mon-message-secure-exchanges.aspx?msgid=bXrEeahH6pTi9JoSZ92Bo3kZ1gQd6EueXK0db0qdMKCi6tMEmOiAL87fElNqiuaJmEg%2fR%2b5Hka2TmUQfEjtmpu2TQrpTSafHWJ%2bVbUEmw59YyofHzOwMatlrJgmCm3KHcTv1abfyZqBE9xJOrXPiNUclA2uEDdBaoEU%2fC1uT42g%3d&sems=de0e1511-bf38-41d9-b4c1-21748d2fdf0a&cpart=o5vUPaRoXo4ETlyIzKgFcCUCEiS1lZMOAkNC9lUig4dE6joJ1bsKSqIpWRg6I2EeQAyvVTS6kVbJk%2FEE7Is07rfsQI%2FbS6TPEYZtR6rpaEDoD%2ByWzcSRQX7kA810sYf1SaOnf3xNMZHuuu33TQSPt1%2FOkCH8raH8NdhVxDflHRE%3D&psw=0&digit=False&nIV=3d3a051c-ea8e-a24a-619b-077ebd6a6529&p2=095847b7-95e1-4e7b-a647-fe432aa687a2";
SecureExchangesMessage msg = MessageHelper.GetSecureExchangesMessageFromLink(link);    /// 

GetSerialInfo(GetSerialInfoArgs)

Declaration
[Obsolete("Please use the method in the LicenceHelper")]
public static GetSerialInfoResponse GetSerialInfo(GetSerialInfoArgs args)
Parameters
Type Name Description
GetSerialInfoArgs args
Returns
Type Description
GetSerialInfoResponse

InitializeSMS(ISEMSInitialization)

This method only initialize SEMS Keys to send the SMS when a message contains a digit

Declaration
public static GetKeysAnswer InitializeSMS(ISEMSInitialization args)
Parameters
Type Name Description
ISEMSInitialization args
Returns
Type Description
GetKeysAnswer

MultiRecipientMessage(MutliRecipientArgs)

Use to send the same message to multiple recipident. Each recipient will received a unique link. They will received a unique SMS code if use it, and will share the same password.

Declaration
public static MultiRecipientAnswer MultiRecipientMessage(MutliRecipientArgs args)
Parameters
Type Name Description
MutliRecipientArgs args
Returns
Type Description
MultiRecipientAnswer

Return an answer to manage the message send

Examples
 

Create a files list path : physical path
   List<string> files = new List<string>();
     if (!string.IsNullOrEmpty(originalFilePath))
     {
       files.Add(originalFilePath);
     }
 // Use fileArgs if you have file in memory or binary witout the path
 List<FileArgs> filesArgs = null;

 string HTMLBody = $"{body}";
 string EmailSubject = $"{methodName} - {subject}";

 // Create a list of recipient. Phone number could be filled to received SMS
 // WARNING : the SendMethodEnum must be set to msgEmailCodeSms to received an email with a sms code to open it
 List<RecipientInfo> recipients = new List<RecipientInfo>();
 recipients.Add(new RecipientInfo() { Email = recipient1});
     recipients.Add(new RecipientInfo() { Email = recipient2, Phone = null });

     //Create the message args
     var args = new MutliRecipientArgs(
        new Uri("https://www.secure-exchanges.com/_api/0217/0217.asmx"),
       [your serial],
       [your apiuser],
       [your apipsw],
        recipients,
        HTMLBody,
        EmailSubject,
        psw,
        filesArgs,
        SecureExchangesSDK.SecureExchanges.SendMethodEnum.onlyEmail,
        getBackHtml,
        true,
        true, "fr-CA", 1, 5)
     { FilesPath = files };
 // Call the multicecipient method 
 MultiRecipientAnswer answer = MessageHelper.MultiRecipientMessage(args);
     // if the status is set to 200 the call was made successfully. See in answer.Data if the status is not 200
     if (answer.Status == 200)
     {
       foreach (var a in answer.RecipientsAnswer)
       {
         // Here use a.Answer.HtmlMsg to send your email with your SMTP server



       }
     }

MultiRecipientMessage(MutliRecipientArgs, FileHelper)

Use to send the same message to multiple recipident. Each recipient will received a unique link. They will received a unique SMS code if use it, and will share the same password.

Declaration
public static MultiRecipientAnswer MultiRecipientMessage(MutliRecipientArgs args, FileHelper fileHelper)
Parameters
Type Name Description
MutliRecipientArgs args
FileHelper fileHelper
Returns
Type Description
MultiRecipientAnswer

Return an answer to manage the message send

Examples
 

Create a files list path : physical path
   List<string> files = new List<string>();
     if (!string.IsNullOrEmpty(originalFilePath))
     {
       files.Add(originalFilePath);
     }
 // Use fileArgs if you have file in memory or binary witout the path
 List<FileArgs> filesArgs = null;

 string HTMLBody = $"{body}";
 string EmailSubject = $"{methodName} - {subject}";

 // Create a list of recipient. Phone number could be filled to received SMS
 // WARNING : the SendMethodEnum must be set to msgEmailCodeSms to received an email with a sms code to open it
 List<RecipientInfo> recipients = new List<RecipientInfo>();
 recipients.Add(new RecipientInfo() { Email = recipient1});
     recipients.Add(new RecipientInfo() { Email = recipient2, Phone = null });

     //Create the message args
     var args = new MutliRecipientArgs(
        new Uri("https://www.secure-exchanges.com/_api/0217/0217.asmx"),
       [your serial],
       [your apiuser],
       [your apipsw],
        recipients,
        HTMLBody,
        EmailSubject,
        psw,
        filesArgs,
        SecureExchangesSDK.SecureExchanges.SendMethodEnum.onlyEmail,
        getBackHtml,
        true,
        true, "fr-CA", 1, 5)
     { FilesPath = files };
 // Call the multicecipient method 
 MultiRecipientAnswer answer = MessageHelper.MultiRecipientMessage(args);
     // if the status is set to 200 the call was made successfully. See in answer.Data if the status is not 200
     if (answer.Status == 200)
     {
       foreach (var a in answer.RecipientsAnswer)
       {
         // Here use a.Answer.HtmlMsg to send your email with your SMTP server



       }
     }

SendTrace(SendTraceArgs)

To send support trace to SEcure Exchanges Team

Declaration
public static bool SendTrace(SendTraceArgs args)
Parameters
Type Name Description
SendTraceArgs args
Returns
Type Description
System.Boolean

TransformSECryptedMail(SEMail, String, String, Byte[], Byte[], Byte[])

Transform a SEMail encrypted to a SEMail unencrypted

Declaration
public static SEMail TransformSECryptedMail(SEMail mail, string password, string SEMSPCKS, byte[] cpart, byte[] ComKey, byte[] ComIV)
Parameters
Type Name Description
SEMail mail

SEMail encrypted

System.String password

The password of the message

System.String SEMSPCKS

The public xml public key of the SEMS

System.Byte[] cpart

The cpart of the message

System.Byte[] ComKey

The communication key

System.Byte[] ComIV

The communication iv

Returns
Type Description
SEMail
In This Article
Back to top Generated by DocFX