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

Cannot verify IAP receipt from Windows Store #13

Closed
bugant opened this issue Dec 16, 2013 · 8 comments
Closed

Cannot verify IAP receipt from Windows Store #13

bugant opened this issue Dec 16, 2013 · 8 comments

Comments

@bugant
Copy link

bugant commented Dec 16, 2013

I am trying to verify receipt from Windows Store using Ruby. I'am using the xmldsig gem as follows:

certificate = OpenSSL::X509::Certificate.new(cert)
signed_document = Xmldsig::SignedDocument.new(xml)
signed_document.validate(certificate)

but it fails using the data taken from MS example (which is working in C#).

I've also asked for help on SO, if you would like to contribute to the discussion there.

@Chelo
Copy link

Chelo commented Jan 20, 2014

Hi! I have this problem too!, did you find some answer? I have been searching but I don't find nothing :(

@bugant
Copy link
Author

bugant commented Jan 21, 2014

@Chelo still nothing here! I haven't been able to validate a Windows Store receipt using Ruby.

@benoist
Copy link
Owner

benoist commented Jan 21, 2014

http://stackoverflow.com/questions/18823837/verify-iap-receipt-from-windows-store-using-php
Looking at this URL it could indicate that you need to strip the whitespace completely

ops, i missed out that you need a $dom->preserveWhiteSpace = false; before $dom->loadXML to make the DigestValue match – Elf Yang Oct 9 '13 at 10:10

@bugant
Copy link
Author

bugant commented Jan 21, 2014

@benoist I've tried to add

xml = xml.gsub("\n", "")
xml = xml.gsub(" ", "")

but still I got that the receipt is not valid.

@bugant
Copy link
Author

bugant commented Jan 21, 2014

@benoist the following worked:

xml = xml.gsub(/^\s+/, '').gsub(/\s+$/, '').gsub(/\n/, '')

Many thanks to @potomak that helped solving the issue. \CC @Chelo

@bugant bugant closed this as completed Jan 21, 2014
@benoist
Copy link
Owner

benoist commented Jan 21, 2014

Great, I'll put a link to this issue in the Readme :)

@bugant
Copy link
Author

bugant commented Jan 21, 2014

@benoist I was thinking about crafting a little gem to verify Windows in-app receipts usign xmldsig.

@Chelo
Copy link

Chelo commented Jan 21, 2014

@bugant @benoist this works!!! thanks for your help guys 👍

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