我已经将CCAvenue集成到我的应用程序中,但是问题是当代码被命中时
https://secure.ccavenue.com/transaction/initTrans
下面是代码:
NSString *encryptedStr = [NSString stringWithFormat:@"Merchant_Id=%@&Order_Id=%@&redirect_url=%@&cancel_url=%@&enc_val=%@&access_code=AVSB00EA86CN75BSNC&billing_name=%@&billing_address =%@&billing_city=%@&billing_state=%@&billing_zip=%@&billing_country=%@&billing_email=%@&billing_tel=%@",MerchantID,_order_id,redirectUrl,cancelUrl,encVal,self.billing_name,self.billing_address,self.billing_city,self.billing_state,self.billing_zip,self.billing_country,self.billing_email,self.billing_tel];
NSData *myRequestData = [NSData dataWithBytes: [encryptedStr UTF8String] length: [encryptedStr length]];
NSMutableURLRequest *requestN = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString: urlAsString]];
[requestN setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
[requestN setValue:urlAsString forHTTPHeaderField:@"Referer"];
[requestN setHTTPMethod: @"POST"];
[requestN setHTTPBody: myRequestData];
[self.webView loadRequest:requestN];
每次回来
遇到错误。错误!解密申请请求时出现问题
最佳答案
这是非耻辱的解决方案……我认为唯一的区别在于付款明细(非耻辱和无耻)……。
这对我来说是有效的,我希望它能解决您的问题...并检查您是否在获得rsa密钥后在120秒内通过ur mobile命中ccavenue服务器。您需要命中ccavenue服务器( 120秒),否则它将过期。
尝试以下操作:
来自服务器:
您一旦按urt访问码和orderID的 RSA 密钥打了ccavenue服务器
您将获得:您交易的rsa密钥。
您需要使用 base64 和 AES-256 格式对密钥进行加密。
在加密之前,您需要删除密钥中的一些不必要的数据
1.键中的双引号
键中的
// removing double quates
NSString * newReplacedString2 = [rsaKey stringByReplacingOccurrencesOfString:@"\"" withString:@""];
NSLog(@"%@",rsaKey);
//removing \n in the key
NSString * newReplacedString = [newReplacedString2 stringByReplacingOccurrencesOfString:@"\\n" withString:@""];
NSLog(@"%@",rsaKey);
//removing \ in the key
NSString * newReplacedString1 = [newReplacedString stringByReplacingOccurrencesOfString:@"\\" withString:@""];
NSLog(@"%@",newReplacedString1);
//and u need to divide the key for every 64 bits
NSString * abc = [NSString stringWithFormat:@"%@", newReplacedString1];
NSMutableString *sss=[NSMutableString new];
int j=(int)([abc length]/63);
for (int i=0; i<=j; i++) {
int k= i*63;
NSString * newString;
if (i != j) {
newString = [abc substringWithRange:NSMakeRange(k,63)];
NSLog(@"%lu",(unsigned long)newString.length);
newString=[NSString stringWithFormat:@"%@",newString];
}else{
newString = [abc substringWithRange:NSMakeRange(k,[abc length]-k)];
NSLog(@"%lu",(unsigned long)newString.length);
if (newString.length !=0)
newString=[NSString stringWithFormat:@"%@",newString];
}
if (newString.length !=0)
[sss appendString:[NSString stringWithFormat:@"%@\n",newString]];
}
NSLog(@"%@",sss);
//as per the documentation u can follow the process
rsaKey = [NSString stringWithFormat:@"-----BEGIN PUBLIC KEY-----\n%@-----END PUBLIC KEY-----\n",sss];
NSLog(@"%@",rsaKey);
//Encrypting Card Details
NSString *myRequestString = [NSString stringWithFormat:@"amount=%@¤cy=%@",amount,currency];
CCTool *ccTool = [[CCTool alloc] init];
NSLog(@"emcrpted data %@",[ccTool encryptRSA:myRequestString key:rsaKey]);
关于ios - CCAvenue“遇到错误。错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43929323/