Secure Exchanges SDK Documentation
Search Results for

    Show / Hide Table of Contents

    Class MessengingHelper

    MessengingHelper is the class use to create, and get Messenging. SESAR service use messenging. The messenging is usefull when is configured to keep a copy encrypted or not of all Secure Exchanges communications in you own organisation

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

    Methods

    CompleteNewSESARConfigRequestConfirmed(CompleteNewSESARConfigRequestConfirmedArgs)

    Complete the new SESAR config confirmed request

    Declaration
    public static CompleteNewSESARConfigRequestConfirmedAnswer CompleteNewSESARConfigRequestConfirmed(CompleteNewSESARConfigRequestConfirmedArgs args)
    Parameters
    Type Name Description
    CompleteNewSESARConfigRequestConfirmedArgs args

    CompleteNewSESARConfigConfirmedArgs

    Returns
    Type Description
    CompleteNewSESARConfigRequestConfirmedAnswer

    CompleteNewSESARConfigConfirmedAnswer

    CreateMessenging(CreateMessengingArgs)

    This method let you create a messenging to another SE licence

    Declaration
    public static CreateMessengingAnswer CreateMessenging(CreateMessengingArgs args)
    Parameters
    Type Name Description
    CreateMessengingArgs args
    Returns
    Type Description
    CreateMessengingAnswer

    CreateRestoreRequest(CreateRestoreRequestArgs)

    To create a SESAR restore request

    Declaration
    public static CreateRestoreRequestAnswer CreateRestoreRequest(CreateRestoreRequestArgs args)
    Parameters
    Type Name Description
    CreateRestoreRequestArgs args
    Returns
    Type Description
    CreateRestoreRequestAnswer

    GetBusinessMessenginKeys(GetBusinessMessenginKeysArgs)

    Retreived the public key to encrypts com AES and file AES keys

    Declaration
    public static GetBusinessMessenginKeysAnswer GetBusinessMessenginKeys(GetBusinessMessenginKeysArgs args)
    Parameters
    Type Name Description
    GetBusinessMessenginKeysArgs args
    Returns
    Type Description
    GetBusinessMessenginKeysAnswer

    GetMessenging(GetMessengingArgs)

    This method let you create a messenging to another SE licence

    Declaration
    public static GetMessengingResponse GetMessenging(GetMessengingArgs args)
    Parameters
    Type Name Description
    GetMessengingArgs args
    Returns
    Type Description
    GetMessengingResponse
    Examples
    // Note: In this sample the Settings are get from a GlobalSettings object, it's only a object that store the value in memory
    // Load the base 64 XmlKey from settings in that sample, but we recommand to store that key in a secure place of your choice
    string privateXmlKey = SecureExchangesSDK.Helpers.SerializationHelper.DeserializeTextFromBase64(GlobalSettings.Base64MessengingPrivateKey);
    
    // Call Secure Exchanges to validate if we get messengings for that serial
    var messengings = SecureExchangesSDK.Helpers.MessengingHelper.GetMessenging(new SecureExchangesSDK.Models.Args.GetMessengingArgs()
    {
      EndPointConfigurationName = GlobalSettings.bindingSecure,
      ApiPassword = GlobalSettings.ApiPasswordMessenging,
      ApiUser = GlobalSettings.ApiUserMessenging,
      Serial = GlobalSettings.serialMessenging,
      // The hashkey is the SHA512 of the xml public key of the xml private key 
      HashKey = SecureExchangesSDK.Helpers.CryptoHelper.GetSHA512HashOfString(SecureExchangesSDK.Helpers.CryptoHelper.GetPublicKeyFromPrivateKey(privateXmlKey))
    });
    if (messengings == null) throw new Exception("No messenging");
    if (messengings.Status != 200)
    {
      throw new Exception(messengings.Data);
    }
    foreach (var seM in messengings.Messengings)
    {
      // For each messenging get the cryptedCallObject
      CallBackCryptedObject cryptedCallObject = SecureExchangesSDK.Helpers.SerializationHelper.DeserializeFromJson<CallBackCryptedObject>(seM.Message);
      byte[] comKey, comiv;
      // Retreived the communication crypted key. That key was crypted with the public key of the messenging
      string jsonKeys = SecureExchangesSDK.Helpers.CryptoHelper.DecryptRSAContentToString(SecureExchangesSDK.Helpers.SerializationHelper.DeserializeTextFromBase64(GlobalSettings.Base64MessengingPrivateKey), Convert.FromBase64String(seM.CryptedAESKeyWithPublicKeyComMessenging), true);
      var keys = SecureExchangesSDK.Helpers.SerializationHelper.DeserializeFromJson<Keys>(jsonKeys);
      comKey = Convert.FromBase64String(keys.Base64Key);
      comiv = Convert.FromBase64String(keys.Base64IV);
    
      // Unencrypt the crypted with the key crypted with the AES key build bellow
      string JSONCallBackObject = SecureExchangesSDK.Helpers.CryptoHelper.DecryptStringFromBase64(cryptedCallObject.CallBackObject, comKey, comiv);
      // Construct the callbackobject
      CallBackObject callBack = SecureExchangesSDK.Helpers.SerializationHelper.DeserializeFromJson<CallBackObject>(JSONCallBackObject);
      // Load the Sesar manifest
      SesarManifest manifest = SecureExchangesSDK.Helpers.SerializationHelper.DeserializeFromJson<SesarManifest>(callBack.CallBackParameters);
    
      // Get the SEcureExchangesMessage from the callback url
      SecureExchangesMessage msg = MessageHelper.GetSecureExchangesMessageFromLink(callBack.SecureExchangesURL);
    
      // Call the GetResponse of the message url
      GetMessageResponse response = SecureExchangesSDK.Helpers.MessageHelper.GetMessage(new SecureExchangesSDK.Models.Args.GetMessageArgs(
          GlobalSettings.bindingSecure,
         GlobalSettings.serialMessenging,
         GlobalSettings.ApiUserMessenging,
         GlobalSettings.ApiPasswordMessenging, msg.MessageID, msg.Cpart, msg.Sems, msg.NIv, msg.P2, callBack.Password, msg.Pit, string.Empty, msg.Sit));
    
    
      // That object represent the keys of the encrypted callback. 
      // That key are encrypted with the public key of the communication keys
      Keys parametersKeys = null;
      // Create the callback parameters keys
      if (!string.IsNullOrEmpty(response.CallBackParametersKeys))
      {
        // Get the callback parameters 
        string parameterJsonKey = SecureExchangesSDK.Helpers.CryptoHelper.DecryptRSAContentToString(privateXmlKey, Convert.FromBase64String(response.CallBackParametersKeys), true);
        parametersKeys = SecureExchangesSDK.Helpers.SerializationHelper.DeserializeFromJson<Keys>(parameterJsonKey);
    
      }
      // Retretive the email from of the message
      if (!string.IsNullOrEmpty(seM.CryptedFromEmailAddress) && parametersKeys != null)
      {
        // That determine if it's a reply
        string fromEmail = SecureExchangesSDK.Helpers.CryptoHelper.DecryptStringFromBytes(Convert.FromBase64String(seM.CryptedFromEmailAddress), parametersKeys.Key, parametersKeys.IV);
    
      }
      // Retreveid the email to of the message
      if (!string.IsNullOrEmpty(seM.CryptedToEmailAddress) && parametersKeys != null)
      {
        string toEmail = SecureExchangesSDK.Helpers.CryptoHelper.DecryptStringFromBytes(Convert.FromBase64String(seM.CryptedToEmailAddress), parametersKeys.Key, parametersKeys.IV);
      }
      // Retrevied callback parameters string. 
      if (!string.IsNullOrEmpty(response.CallBackParameters) && parametersKeys != null)
      {
    
        // You suppose to get your callback parameter in clear here
        string callBackParameter = SecureExchangesSDK.Helpers.CryptoHelper.DecryptStringFromBytes(Convert.FromBase64String(response.CallBackParameters), parametersKeys.Key, parametersKeys.IV);
      }
    }

    GetResendSignatureRequest(GetSESARResendSignatureRequestArgs)

    To create a SESAR resend signature request

    Declaration
    public static GetResendSignatureRequestAnswer GetResendSignatureRequest(GetSESARResendSignatureRequestArgs args)
    Parameters
    Type Name Description
    GetSESARResendSignatureRequestArgs args
    Returns
    Type Description
    GetResendSignatureRequestAnswer

    GetRestoreRequest(GetRestoreRequestArgs)

    To create a SESAR restore request

    Declaration
    public static GetRestoreRequestAnswer GetRestoreRequest(GetRestoreRequestArgs args)
    Parameters
    Type Name Description
    GetRestoreRequestArgs args
    Returns
    Type Description
    GetRestoreRequestAnswer

    GetSESARLatestVersion(GetSESARLatestVersionArgs)

    Get the latest version of SESAR

    Declaration
    public static GetSESARVersionResponse GetSESARLatestVersion(GetSESARLatestVersionArgs args)
    Parameters
    Type Name Description
    GetSESARLatestVersionArgs args
    Returns
    Type Description
    GetSESARVersionResponse

    InitializeSesar(InitSesarArgs)

    When you initialize a Sesar connection, you received the notification parameters and chontacts

    Declaration
    public static InitSesarResponse InitializeSesar(InitSesarArgs args)
    Parameters
    Type Name Description
    InitSesarArgs args
    Returns
    Type Description
    InitSesarResponse

    LogMessengingRequests(string, MessengingLogRequestType, NotificationBags, BaseAPIArgs, bool)

    Declaration
    public static Answer LogMessengingRequests(string message, MessengingLogRequestType messageType, NotificationBags bags, BaseAPIArgs args, bool notifyContacts = false)
    Parameters
    Type Name Description
    string message
    MessengingLogRequestType messageType
    NotificationBags bags
    BaseAPIArgs args
    bool notifyContacts
    Returns
    Type Description
    Answer

    SetResendSignatureAsExecutedRequest(SetResendSignatureAsExecutedRequestArgs)

    To set an executed date to resend signature

    Declaration
    public static SetResendSignatureAsExecutedRequestAnswer SetResendSignatureAsExecutedRequest(SetResendSignatureAsExecutedRequestArgs args)
    Parameters
    Type Name Description
    SetResendSignatureAsExecutedRequestArgs args
    Returns
    Type Description
    SetResendSignatureAsExecutedRequestAnswer

    UpdateRestoreRequestStatus(UpdateRestoreRequestStatusArgs)

    Update the restore request status to notify the execution

    Declaration
    public static UpdateRestoreRequestStatusAnswer UpdateRestoreRequestStatus(UpdateRestoreRequestStatusArgs args)
    Parameters
    Type Name Description
    UpdateRestoreRequestStatusArgs args
    Returns
    Type Description
    UpdateRestoreRequestStatusAnswer
    In this article
    Back to top Secure Exchanges Inc. - Documentation