payment-data-cryptography-dotnet
payment-data-cryptography-dotnet copied to clipboard
VerifyMessageECv2 return false
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));
}
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
Hello, were you able to resolve this because i am having the same bug
Hey, were you guys able to reslove this issue?
Hey, were you guys able to reslove this issue?
Yes
Hey, were you guys able to reslove this issue?
Yes
May i ask you for the solution?
Hey, were you guys able to reslove this issue?
Yes
May i ask you for the solution?
What is the error message you got
@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 When I set the
IsTest
parametr totrue
,VerifyMessage
simply returnsfalse
exactly as this issue descibe. When I setIsTest
tofalse
, I'm gettingNo 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
@olufemitomilola004 How did you fix your issue https://github.com/google-pay/payment-data-cryptography-dotnet/issues/16 ?