-
Notifications
You must be signed in to change notification settings - Fork 4
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
Can't parse incoming messages with Content-Type: application/pkcs7-mime #40
Comments
Well, here's how you can extract the PDF from one example: f = File.read('tmp/11378.eml')
m = Mail.new(f)
a = OpenSSL::ASN1.decode(Base64.decode64(m.body.raw_source))
v = a.value[1].value[0].value[2].value[1].value[0].value.map(&:value).join
eml = Mail.new(v)
File.open('tmp/blah.pdf', 'wb') { |f| f.write(eml.attachments.first.decoded) }
File.open('tmp/blah.pdf', &:gets)
# => "%PDF-1.3\r1 0 obj\r<</Type /XObject /Subtype /Image /Name /Im1 /Width 1240 /Height 1753 /Length 108309/ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter [ /DCTDecode ] >> stream\r\xFF\xD8\xFF\xE0\u0000\u0010JFIF\u0000\u0001\u0001\u0001\u0000\x96\u0000\x96\u0000\u0000\xFF\xDB\u0000C\u0000\b\u0006\u0006\a\u0006\u0005\b\a\a\a\t\t\b\n" |
This is a bit nicer (ruby provides no docs for this class, https://stackoverflow.com/a/1999887/669631 was of most help): ...
a = OpenSSL::PKCS7.new(Base64.decode64(m.body.raw_source))
a.verify([], OpenSSL::X509::Store.new, nil, OpenSSL::PKCS7::NOVERIFY) # Don't verify anything!
v = a.data
... |
Now we know how to unwrap the |
Hi, everyone, can we help with resolving this issue? Unfortunately I don't have Ruby dev expertise, but I have a Python team here in Prague, would that be of any help? I realise it's a long shot, but maybe there's some language-independent research to be done, for example? |
Looks like all the tools we need are available to us to correctly parse the content type – its more of a case of integrating them in to Alaveteli. |
OK, understand. If there's anything we can help with in the future, please do let me know! Thanks again for having a look at this, much appreciated. |
http://www.infoprovsechny.cz/request/dokumentace_k_projektu_socialni?nocache=incoming-11330#incoming-11330
The text was updated successfully, but these errors were encountered: