本文整理汇总了C#中System.Security.Cryptography.SHA512Managed.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# SHA512Managed.Equals方法的具体用法?C# SHA512Managed.Equals怎么用?C# SHA512Managed.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Cryptography.SHA512Managed
的用法示例。
在下文中一共展示了SHA512Managed.Equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessCallback
public override CallbackInfo ProcessCallback( Order order, HttpRequest request, IDictionary<string, string> settings )
{
CallbackInfo callbackInfo = null;
try {
order.MustNotBeNull( "order" );
request.MustNotBeNull( "request" );
settings.MustNotBeNull( "settings" );
settings.MustContainKey( "SHAOUTPASSPHRASE", "settings" );
//Write data when testing
if ( settings.ContainsKey( "TESTMODE" ) && settings[ "TESTMODE" ] == "1" ) {
LogRequest<Ogone>( request, logGetData: true );
}
Dictionary<string, string> inputFields = new Dictionary<string, string>();
string shaSign = request.QueryString[ "SHASIGN" ];
string strAmount = request.QueryString[ "AMOUNT" ];
string transaction = request.QueryString[ "PAYID" ];
string status = request.QueryString[ "STATUS" ];
string cardType = request.QueryString[ "BRAND" ];
string cardNo = request.QueryString[ "CARDNO" ];
foreach ( string key in request.QueryString.Keys ) {
if ( !key.Equals( "SHASIGN" ) )
inputFields[ key ] = request.QueryString[ key ];
}
string strToHash = string.Join( "", inputFields.OrderBy( i => i.Key ).Select( i => i.Key.ToUpperInvariant() + "=" + i.Value + settings[ "SHAOUTPASSPHRASE" ] ) );
string digest = new SHA512Managed().ComputeHash( Encoding.UTF8.GetBytes( strToHash ) ).ToHex().ToUpperInvariant();
if ( order.CartNumber == request.QueryString[ "ORDERID" ] && digest.Equals( shaSign ) ) {
callbackInfo = new CallbackInfo( decimal.Parse( strAmount, CultureInfo.InvariantCulture ), transaction, status == "5" || status == "51" ? PaymentState.Authorized : PaymentState.Captured, cardType, cardNo );
} else {
LoggingService.Instance.Warn<Ogone>( "Ogone(" + order.CartNumber + ") - SHASIGN check isn't valid - Calculated digest: " + digest + " - Ogone SHASIGN: " + shaSign );
}
} catch ( Exception exp ) {
LoggingService.Instance.Error<Ogone>( "Ogone(" + order.CartNumber + ") - Process callback", exp );
}
return callbackInfo;
}