Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VerifyMessageECv2 return false #14

Open
sajasbana opened this issue Jan 22, 2023 · 9 comments
Open

VerifyMessageECv2 return false #14

sajasbana opened this issue Jan 22, 2023 · 9 comments

Comments

@sajasbana
Copy link

sajasbana commented Jan 22, 2023

Dear
please I need help, I have issue in test file SignatureVerificationTest.cs
I have this payload token and we tried it with our merchant ID
but it returns false

please can you help where is issue in my method

this is the method

[Fact]
        public void TestVerifyMessageECv2New()
        {
            var keyProvider = new GoogleKeyProvider(true);

            var payload = new PaymentData()
            {
                Signature = "MEQCIHO0tKvzdtAlW97QodVUHFiAyYLwUkeflDxDjQEbaNNAAiBl4POFTtAAMVBJLfUlkoljhUJpLg2qk2MTfG2O5EARAg\u003d\u003d",
                IntermediateSigningKey = new SigningKey()
                {
                    SignedKey = "{\"keyValue\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE5Wq0wHGCfnmRs4I+biemX8PxXWXszbkYbk+VOK7p3vp5b7TvXun5AFu1IVwKlEke2Lie4xyCpfdjuNsrOnLNUw\\u003d\\u003d\",\"keyExpiration\":\"1674781891312\"}",
                    Signatures = new string[] { "MEQCIDwVjfQwdtH0hglpOS8G56+/Zn+zvqEWyFtMMMr+i9hDAiAKoHTNM8tiWxQBTJGHXSw983lGPLmfKUUmvkaYWGAAFg\u003d\u003d" }
                },
                ProtocolVersion = "ECv2",
                SignedMessage = "{\"encryptedMessage\":\"WcNkDyuJzpbQJTOJFlHVoeghSCyjWupqAOjcWNZVWH7xOt5Guj5S2yA3jndChQq3oTWYmqAvrIMWT/GJ+0ql7aejJOIEKBUuRJEBPlgI5De9mHlt4MagmrKoNHbSlidQM56g4mHpxwMgPrbpyzRxFzdhu+l0psHJRkJsrx//LYId53KD7YRY/zunIQvBd6AOgSTrZ148oAB1nPL26PEJaiAcGmsnOP0IACFx51ciNkvDIUuog7g+bVH6x7qAdX2v0WFbfA+KSGH4besDOXxNyUkvlboq7eoUks1t6D7d3pBJvntvKvLWBZVslccoFmyLvbtFObAuCIY3DYLxOYTMqp4FAuZXGd/FaBPAQwHVV3cTQhzIA1V7+zLuvpzAjNATPgOpIgHSLb7EsC7mIGyWibdU0Sa0R124V/Yj2hDMKUdzdXyQniltdTRpcJsn/YfhtHmZ+ogQK4/5xvoDwTiLbdurvPl3zHSF187zqhnYxEqE5WQKaxNDboswE8qEVqrP989M8i/Q4+WctzPmQt5TvDccESMKkrdEQDWsfbA7vAhU3eR3lhj3X+W4c0zrQykJCzB12gI56dFp\",\"ephemeralPublicKey\":\"BHt4yaMDJ3zOj95ZF3pNrxXKSeoG0Bp6azeot8sOwFkUuYtLyMBH1SuUkwmI7d8OLxbEIJyngEkuL31rb1G4J3s\\u003d\",\"tag\":\"cyF1Hgvx+HKoCIWYK7UcF6ssuRxneJM7NfKS2XQk/2k\\u003d\"}",
            };
            var signatureVerification = new SignatureVerification();
            Assert.True(signatureVerification.VerifyMessage(payload, "Google", "merchant:1234", keyProvider));
        }
@sajasbana
Copy link
Author

sajasbana commented Jan 23, 2023

issue now is in this part it returns false

ECPublicKeyParameters signingKey = KeyParser.ParsePublicKeyDer(signedKey.KeyValue);
            return VerifySignature(signingKey, signedString, signature);

in method VerifyMessageECv2 in class SignatureVerification.cs

@sajasbana sajasbana changed the title exception 'System.Security.SecurityException: 'No valid signing keys found in payload' VerifyMessageECv2 return false Jan 24, 2023
@olufemitomilola004
Copy link

olufemitomilola004 commented Aug 18, 2024

Hello, were you able to resolve this because i am having the same bug

@unzeitip
Copy link

Hey, were you guys able to reslove this issue?

@olufemitomilola004
Copy link

Hey, were you guys able to reslove this issue?

Yes

@unzeitip
Copy link

Hey, were you guys able to reslove this issue?

Yes

May i ask you for the solution?

@olufemitomilola004
Copy link

Hey, were you guys able to reslove this issue?

Yes

May i ask you for the solution?

What is the error message you got

@unzeitip
Copy link

@olufemitomilola004
When I set the IsTest parametr to true, VerifyMessage simply returns false exactly as this issue descibe. When I set IsTest to false, I'm getting No valid signing keys found in payload.

@olufemitomilola004
Copy link

@olufemitomilola004 When I set the IsTest parametr to true, VerifyMessage simply returns false exactly as this issue descibe. When I set IsTest to false, I'm getting No valid signing keys found in payload.

Then kindly confirm with Google to know if your payload is still valid because they do expire after 5days I guess. Also be certain that you are inputting the right gatewayId

@unzeitip
Copy link

@olufemitomilola004 How did you fix your issue #16 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants