コード例 #1
0
        public override void ProcessMessage(SoapMessage message)
        {
            try
            {
                if (message.Stage == SoapMessageStage.AfterDeserialize)
                {
                    string _mtd         = this._processSoap(message);
                    string _userExecute = string.Format("USERID '{0}'  ", "unknown");
                    foreach (SoapHeader header in message.Headers)
                    {
                        if (header is AuthHeader)
                        {
                            AuthHeader credentials = (AuthHeader)header;
                            try
                            {
                                switch (credentials.CryptoAlgorithm)
                                {
                                case AuthHeader.CryptoAlgorithmEnum.NONE:
                                    _userExecute = string.Format("USERID '{0}'  ", credentials.AuthKey.Split(new char[]
                                    {
                                        '|'
                                    })[0]);
                                    break;

                                case AuthHeader.CryptoAlgorithmEnum.TRIPLEDES:
                                    _userExecute = string.Format("USERID '{0}'  ", CryptorEngineTripleDES.Decrypt(SAFConfiguration.readConnectionStringCoreEncrypted(), new SecurityInfo(SAFConfiguration.readMasterKey(), SAFConfiguration.readInfoKey(), SAFConfiguration.readInfoIV()), true).Split(new char[]
                                    {
                                        '|'
                                    })[0]);
                                    break;
                                }
                            }
                            catch (SoapException ex)
                            {
                                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFAPILOGGER", new string[]
                                {
                                    "http://sfexpand.SAFBusiness.AuthExtension.softfinanca.com/",
                                    ex.ToString()
                                });
                            }
                        }
                    }
                    SAFLOGGER.dump(SAFLOGGER.LOGGEREventID.INFORMATION, "SAFAPILOGGER", new string[]
                    {
                        _userExecute + _mtd
                    });
                }
            }
            catch
            {
            }
        }
コード例 #2
0
        public int TRIPLEDESDecrypt(string deviceKey, string messageData, out string outMessage)
        {
            outMessage = null;
            int result;

            if (deviceKey == null || (deviceKey ?? "").Length < 1 || messageData == null || (messageData ?? "").Length < 1)
            {
                result = 100;
            }
            else
            {
                outMessage = CryptorEngineTripleDES.Decrypt(messageData, new SecurityInfo(deviceKey, deviceKey, deviceKey), true);
                result     = ((outMessage == null || (outMessage ?? "").Length < 1) ? 109 : 0);
            }
            return(result);
        }
コード例 #3
0
        public static string ExpandSAFCore()
        {
            string result;

            try
            {
                string cipherString = SAFConfiguration.readConnectionStringCoreEncrypted();
                string text         = CryptorEngineTripleDES.Decrypt(cipherString, SAFSecurityKeys.getSecurityInfoFromWConfig(), true);
                result = text;
            }
            catch (Exception ex)
            {
                LOGGER.Write(LOGGER.LogCategory.ERROR, "SF.Expand.SAF.Core.DBConnectionString::ExpandSAFCore[]\r\n" + ex.Message, null);
                result = null;
            }
            return(result);
        }
コード例 #4
0
        public static string ExpandSAFCore()
        {
            string result;

            try
            {
                result = CryptorEngineTripleDES.Decrypt(SAFConfiguration.readConnectionStringCoreEncrypted(), new SecurityInfo(SAFConfiguration.readMasterKey(), SAFConfiguration.readInfoKey(), SAFConfiguration.readInfoIV()), true);
            }
            catch (Exception ex)
            {
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFCORE", new string[]
                {
                    "http://sfexpand.SAFCore.dbConnectionString.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                result = null;
            }
            return(result);
        }
コード例 #5
0
        public int TRIPLEDESDecryptOTPBase(string deviceKey, string messageData, string deviceID, string dataEntropy, out string outMessage)
        {
            outMessage = null;
            int result;

            if (deviceID == null || (deviceID ?? "").Length < 1 || deviceKey == null || (deviceKey ?? "").Length < 1 || messageData == null || (messageData ?? "").Length < 1)
            {
                result = 100;
            }
            else
            {
                TokenStatus tokenStatus;
                if (OperationResult.Success != this.CheckStatus(deviceID, out tokenStatus))
                {
                    result = 101;
                }
                else
                {
                    if (tokenStatus != TokenStatus.Enabled)
                    {
                        result = 102;
                    }
                    else
                    {
                        string newPWD = null;
                        if (OperationResult.Success != this.StartServerAuthentication(deviceID, long.Parse(deviceKey), dataEntropy, out newPWD))
                        {
                            result = 103;
                        }
                        else
                        {
                            string msgData = CryptorEngineTripleDES.Decrypt(messageData, new SecurityInfo(deviceKey, newPWD, deviceKey), true);
                            result = ((outMessage == null || (outMessage ?? "").Length < 1) ? 109 : 0);
                        }
                    }
                }
            }
            return(result);
        }