PlayIntegrity token issue- 404 not found - java

Implement play integrity code with the help of this stack answer I did the same as mentioned in this article except produce nonce from random alphanumeric string, place my JSON file, place my project id, etc..needed as per our requirement, get the result in debug apk or run time - application but the problem is I am getting below error in signed apk .
"404 not found- decode playIntegrityTokenwas not found on this server."

Related

Android - Paytm payment gateway integration Issue : Type com.paytm.pg.AppTest is defined multiple times

I'm trying to integrate Paytm in my android application,
When I try to Initiate Transaction API as per documnetation in https://developer.paytm.com/docs/initiate-transaction-api/ I get this error:
Type com.paytm.pg.AppTest is defined multiple times: /home/gowthamn/.gradle/caches/transforms-2/files-2.1/80727521e63bd8147327c9aae576f6b7/jetified-PaytmChecksum.jar:com/paytm/pg/AppTest.class, /home/gowthamn/.gradle/caches/transforms-2/files-2.1/80727521e63bd8147327c9aae576f6b7/jetified-PaytmChecksum.jar:target/test-classes/com/paytm/pg/AppTest.class.
Changes I did in Code are mentioned below:
I added implementation 'com.paytm.appinvokesdk:appinvokesdk:1.2' in app level build.gradle.
I added maven {
url "https://artifactory.paytm.in/libs-release-local"
} in project level build.gradle
Also paytmchecksum.jar file from https://github.com/Paytm-Payments/Paytm_Web_Sample_Kit_Java/tree/master/Java%20Kit%201.8
I have searched in google about this error. Some suggested to remove the paytmchecksum.jar file.
But if I remove the jar file, I don't find CheckSumServiceHelper.java in code which is used to genrate checksum.
After long research I found that CHECKSUM cannot be generated from android locally.
Don't know the reason but when I used xampp to generate CHECKSUM, it worked.
We do not recommend to generate checksum at App side, Checksum should be generate at server side.
As per paytm official document, init_transaction token must be generate on your server only.
Second thing you don't need to add checksum.jar file because the checksum and transaction token both are different. In paytm All-in-one SDK you need to get transaction token not checksum.
So please use your server to generate transaction token.
You can get generate transaction token php code and android code from here

AWS S3: The request signature we calculated does not match the signature you provided. Check your key and signing method

I am trying to download the CSV file from S3 using access key and secret provided in the environment variable. Below are my finding based on debugging.
One of my folder name start with / which is causing this issue other folder and files are working file.
AWS console does not allow you to create a folder with name starts with /. However, Cost usage report can have / in the report path prefix which creates that folder inside S3 bucket.
I am able to download the file using CLI by appending one more / before the folder name. I also check the Java SDK code which also does the same thing but it did not work.
I am able to list the files but when I try to get the s3Object it gave SignatureDoesNotMatch error.
I tried all possible solution but it did not work in the end from AWS JAVA SDK however it is working with AWS CLI.
Can someone provide me any pointer or reference? I tried a few solutions given on the internet but nothing works for me.
Getting below error
com.amazonaws.services.s3.model.AmazonS3Exception:
The request signature we calculated does not match the signature you provided. Check your key and signing method.
(Service: Amazon S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: A2C6F2F49F230E18; S3 Extended Request ID: xxxxxxxx), S3 Extended Request ID: yyyyyyyyyyyy
Note: I am using Spring boot app with JAVA SDK version 1.11.510.
After spending two days in debugging, I found out that there is a problem with Spring boot version.
I was using spring boot version 2.1.3.RELEASE after updating Spring boot version 2.1.0.RELEASE it worked like a charm.
Note: This issue occurred only for few S3 Folder which starts with '/'.
FYI:
https://github.com/aws/aws-sdk-java/issues/1919#issuecomment-471451804
Finding from AWS
AWS console does not allow the creation of folder with name starts with '/' however Cost usage report can contain '/' in path prefix.

Java integration with Docu Sign

I am trying to integrate docusign with java application.
I am following Github example which is working.
https://github.com/docusign/docusign-java-client
Here I am just changing Integrator key,clientId and private key but is not working.
https://github.com/docusign/docusign-java-client/blob/master/src/test/java/SdkUnitTests.java
Here I have attached how I am copying key and id etc...
https://gitlab.com/sanju24689/docusign
Here I have also attached my code also.
It's giving me error like
"com.docusign.esign.client.ApiException: Error while requesting an
access token: POST https://account-d.docusign.com/oauth/token returned
a response status of 400 Bad Request"
See the stack trace
Please try starting with the Java webapp that is ready to go--it is a complete project.
See eg-03-java-auth-code-grant

Signed URL with AWS ApiGateway

I'm using AWS signV4 to sign requests for calling AWS API Gateway.
Using Requests with headers are not suited for my use case hence the initiative to work with signed urls and query strings.
I had used AWS Sample Python sample that works great for IAM user creation.
the same Access Key and Secret are used in both cases (IAM Creation , API Gateway call) so its definitely not an issue of wrong access key / secret.
The main issue i see is that the signature i get is different than the one the API Gateway thinks i should send.
I've added all the documented query string but still get the below error.
What am i missing here?
Here is the request URL:
https://*******.execute-api.us-east-1.amazonaws.com/******?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=**********%2F20170424%2Fus-east-1%2Fexecute-api%2Faws4_request&X-Amz-Date=20170424T124521Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host&X-Amz-Signature=**********821742cee7661ef3a0ab1e5c
While using it with the execute-api service i had received the following error :
{
"message": "The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.\n\nThe Canonical String for this request should have been\n'GET\n/*******\nX-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=*********%2F20170424%2Fus-east-1%2Fexecute-api%2Faws4_request&X-Amz-Date=20170424T124521Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host\nhost:*******.execute-api.us-east-1.amazonaws.com\n\nhost\n*********'\n\nThe String-to-Sign should have been\n'AWS4-HMAC-SHA256\n20170424T124521Z\n20170424/us-east-1/execute-api/aws4_request\n**********'\n"
}
I've Checked also the java implementation using the samples from : AWS Signer Java
but the results were the same.
SigV4 signing and this error message isn't anything specific to API Gateway itself. The signing algorithm and the verification at the AWS end is common for all AWS services.
Can you compare the canonical string that is in the error message and the one that you are generating while sending the request? That should help you identify the issue.
Also, go through the step-by-step explanation to see if you are doing everything right. One of the common issues is case-sensitivity of header names and the sorting order of parameters.

PGP Encryption in Mule keeps failing with NullPointerException

I have been attempting to encrypt a text file with the PGP encryptor in my Mule flow and have so far been unsuccessful. I am executing against the CloudHub Mule Runtime (Dec 2013) as I intend to deploy to CloudHub.
I have used GnuPG to generate the binary public key from the .asc file provided to me by my client and put the resulting .gpg file in my src/main/resources directory. Even though it doesn't seem like I should have to I generated my own secret gpg keyring and provided that in my application as well.
When I attempt to run my flow it keeps giving me an NPE:
Root Exception stack trace:
java.lang.NullPointerException
at org.mule.module.pgp.KeyBasedEncryptionStrategy.checkKeyExpirity(KeyBasedEncryptionStrategy.java:100)
at org.mule.module.pgp.KeyBasedEncryptionStrategy.safeGetCryptInfo(KeyBasedEncryptionStrategy.java:87)
at org.mule.module.pgp.KeyBasedEncryptionStrategy.encrypt(KeyBasedEncryptionStrategy.java:54)
I'm not sure what is causing this. Any ideas?
UPDATE:
I've updated to use the latest version of AnyPoint Studio with the 3.5.1 runtime and get the same error, on line 98 this time which is the same line of code.
UPDATE AND MY SOLUTION:
I got it to work. It was an error on my part. I had a principal in the Encryption element that was overriding the principal from the Global element. I had placed this principal in the configuration to overcome an initial error telling me it was required. Removing this principal seems to have resolved all of my problems.
ANOTHER UPDATE
I can successfully encrypt using the pub and sec keys provided in a Mule blog post, however, attempting to use the gpg file that I exported from the public key (.asc file) that my client provided but I again get the NPE mentioned above. I have followed all the steps I can find for importing their key into my keyring and exporting it as a binary. I'm stumped.
FINAL UPDATE
So it turns out the success with the keys from the Mule blog were giving me a success that I didn't completely understand. Turns out that I was not properly setting the Principal value. I was setting the principal according to what I thought it should be for the secret keyring, when, as I found out, it is actually for the public key ring. All seems to be working now.

Categories