Reputation: 1961
I am trying to integrate paytm for our android app.
New PaytmOrder object requires checksumhash as parameter.
To generate checksumhash, we are using jar file recommended from paytm.
https://github.com/Paytm-Payments/Paytm_Google_App_Engine_Kit
We have added this jar in our lib folder.
implementation files('src/main/libs/pg-checksum-1.0-jar-with-dependencies.jar')
This is the code used to generate checksumhash in our android app.
try{
String checkSum = CheckSumServiceHelper.getCheckSumServiceHelper().genrateCheckSum("7MTqfy715ot231CT", convertToTreeMap(paramMap));
paramMap.put("CHECKSUMHASH" , checkSum);
System.out.println("Paytm Payload: "+ paramMap);
}catch(Exception e) {
e.printStackTrace();
}
But we are getting below exception below when trying to get checksumhash.
System.err: java.security.NoSuchProviderException: No such provider: SunJCE
2020-01-01 11:32:33.581 26112-26112 W/System.err: at javax.crypto.Cipher.getInstance(Cipher.java:671)
2020-01-01 11:32:33.581 26112-26112 W/System.err: at com.paytm.pg.crypto.AesEncryption.encrypt(AesEncryption.java:34)
2020-01-01 11:32:33.581 26112-26112/System.err: at com.paytm.pg.merchant.CheckSumServiceHelper.genrateCheckSum(CheckSumServiceHelper.java:53)
Upvotes: 0
Views: 1603
Reputation: 1645
I Solve my Issue To generate Check Sum in Android Side.
download this jar (paytm-checksum-1.1.jar) and de-compile it properly, include all java class in your project replace this line in AesEncryption class.And use Base64Encoder jar this (sun.misc.BASE64Decoder.jar).
//Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING", "SunJCE");// replace this
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING"); // by this line
to Know more,follow this url https://medium.com/@dharmmobiledev/paytm-checksum-generate-in-android-nosuchproviderexception-no-such-provider-sunjce-e02c216557a5
Upvotes: 3
Reputation: 1961
I was able to fix this problem when i started generating checksum hash from my application server.
The above issue occurred because i was trying to generate checksum hash in android locally.
Upvotes: 1