Exemple #1
0
        public string GetISBPath(string PathPrefix, cdeSenderType pOriginType, cdeSenderType pDestinationType, long pCounter, Guid pSessionID, bool IsWS)
        {
            if (string.IsNullOrEmpty(MySecrets?.GetApID5()))
            {
                return("");
            }
            if (string.IsNullOrEmpty(PathPrefix))
            {
                PathPrefix = "/";
            }
            else
            {
                if (!PathPrefix.EndsWith("/"))
                {
                    PathPrefix += "/";
                }
            }
            string pSessID = pSessionID.ToString();

            if (pCounter == 1 && pSessionID == Guid.Empty && !(MyServiceHostInfo?.UseFixedConnectionUrl == true))
            {
                pSessID = "P" + GetCryptoGuid().ToString().Substring(1);
            }
            MyServiceHostInfo?.MyKPIs?.IncrementKPI(eKPINames.KPI4);
            string tPath = PathPrefix + "ISB" + Uri.EscapeUriString(CU.cdeEncrypt($"{MySecrets?.GetApID5()}{(MyServiceHostInfo?.ProtocolVersion == null ? "40" : MyServiceHostInfo?.ProtocolVersion)}&{pCounter}&{((int)(pOriginType))}&{pSessID}", MySecrets?.GetAI())); //3.083: Must be cdeAI

            if (IsWS && (pDestinationType == cdeSenderType.CDE_CLOUDROUTE || pDestinationType == cdeSenderType.CDE_SERVICE || pDestinationType == cdeSenderType.CDE_CUSTOMISB))                                                                                           //TODO: Might need this for Local Services that are IIS but not CloudRoutes
            {
                tPath += ".ashx";
            }
            return(tPath);
        }
Exemple #2
0
        public string GetRealScopeIDFromEasyID(string pEasyID, bool bNoLogging = false, bool bUseEasyScope16 = false)
        {
            Guid   tG = CU.CGuid(MySecrets?.GetAK());
            string tg = InsertCodeIntoGUID(pEasyID, tG, bNoLogging, bUseEasyScope16).ToString();

            return(CU.cdeEncrypt(CU.CGuid(tg.Substring(0, 11) + tG.ToString().Substring(11, "00-0000-0000-000000000000".Length)).ToByteArray(), MySecrets?.GetAI()));
        }
Exemple #3
0
        /// <summary>
        /// Return a Scrambled ScopeID from an easy scopeID
        /// </summary>
        /// <param name="pEasyScope">Source EasyScope</param>
        /// <param name="bNoLogging">If true, errors will not be logged</param>
        /// <param name="bUseEasyScope16">if true, the EasyScopeID can have up to 16 characters. Attention: this might not be compatible to existing mesh setups as all nodes in a mesh need to understand 16chars ScopeIDs</param>
        /// <returns></returns>
        public string GetScrambledScopeIDFromEasyID(string pEasyScope, bool bNoLogging, bool bUseEasyScope16)
        {
            if (string.IsNullOrEmpty(pEasyScope))
            {
                return(null);                                   //NEW 10/20/2012
            }
            Guid   tG = CU.CGuid(MySecrets?.GetAK());
            string tg = InsertCodeIntoGUID(pEasyScope, tG, bNoLogging, bUseEasyScope16).ToString();

            MyServiceHostInfo?.MyKPIs?.IncrementKPI(eKPINames.KPI4);
            return(CU.cdeEncrypt(CU.GetRandomUInt(0, 1000) + "&" + CU.cdeEncrypt(CU.CGuid(tg.Substring(0, 11) + tG.ToString().Substring(11, "00-0000-0000-000000000000".Length)).ToByteArray(), MySecrets?.GetAI()), MySecrets?.GetAI()));
        }
Exemple #4
0
 /// <summary>
 /// Encrypts an string to an encrypted string.
 /// </summary>
 /// <param name="pInBuffer">The inbuffer.</param>
 /// <param name="pType">Type of the buffer.</param>
 /// <returns>System.String.</returns>
 public string EncryptToString(string pInBuffer, string pType)
 {
     switch (pType)
     {
     case "CDEP":
         if (!pInBuffer.StartsWith("&^CDESP1^&:"))
         {
             return("&^CDESP1^&:" + CU.cdeEncrypt(pInBuffer, MySecrets?.GetNodeKey()));
         }
         break;
     }
     return(pInBuffer);
 }
 /// <summary>
 /// Adds an encrypted cost-ticket to the current message to the CST parameter
 /// </summary>
 /// <param name="pCosts"></param>
 public void AddCosting(TSMCosting pCosts)
 {
     if (pCosts != null)
     {
         if (string.IsNullOrEmpty(CST))
         {
             CST = "";
         }
         string tCosting = TheCommonUtils.cdeEncrypt(string.Format("{0};{1};{2};{3}", pCosts.Credits, pCosts.Description, pCosts.Vendor, pCosts.VendorCode), TheBaseAssets.MySecrets.GetAI()); //3.083: Must be cdeAI
         if (!string.IsNullOrEmpty(CST))
         {
             CST += ";:;";
         }
         CST += tCosting;
     }
 }
Exemple #6
0
        public string GetScrambledScopeID(string pRealScopeID, bool IsRealId)
        {
            if (string.IsNullOrEmpty(pRealScopeID))
            {
                return("");
            }

            MyServiceHostInfo?.MyKPIs?.IncrementKPI(eKPINames.KPI4);
            if (IsRealId)
            {
                return(CU.cdeEncrypt(CU.GetRandomUInt(0, 1000) + "&" + pRealScopeID, MySecrets?.GetAI()));
            }
            else
            {
                return(CU.cdeEncrypt(CU.GetRandomUInt(0, 1000) + "&" + GetRealScopeID(pRealScopeID), MySecrets?.GetAI())); //GRSI: Low frequency
            }
        }
Exemple #7
0
        public string GetScrambledScopeID()
        {
            if (!IsScopingEnabled)
            {
                return("");
            }
            if (FastSScopeID != null)
            {
                return(FastSScopeID);
            }
            MyServiceHostInfo?.MyKPIs?.IncrementKPI(eKPINames.KPI4);
            string t = CU.cdeEncrypt(CU.GetRandomUInt(0, 1000) + "&" + ScopeID, MySecrets?.GetAI());

            if (MyServiceHostInfo?.EnableFastSecurity == true)
            {
                FastSScopeID = t;
            }
            return(t);
        }