1

I receive this file from my friend. I use command to decompress it:

openssl cms -uncompress -in myfile.txt -out content.txt

but there are error:

Error reading S/MIME message
4294956672:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long:asn1_lib.c:157:
4294956672:error:0D0D106E:asn1 encoding routines:B64_READ_ASN1:decode error:asn_mime.c:192:
4294956672:error:0D0D40CB:asn1 encoding routines:SMIME_read_ASN1:asn1 parse error:asn_mime.c:517:

I upload myfile.txt to google drive, you can view it via myfile.txt

Thanks.

6
  • Are you sure this is the right command? Are you sure he didn't encrypt it (as would be normal when using CMS)?
    – SEJPM
    Jul 6, 2016 at 9:39
  • I am not sure, but I have another tool AS2Secure.jar, I can decompress without any key.
    – user2693571
    Jul 6, 2016 at 9:46
  • 4
    I'm voting to close this question as off-topic because it's about using software that only happens to be cryptographic. This site is about how the cryptographic algorithms themselves work.
    – otus
    Jul 6, 2016 at 9:59
  • @SEJPM the (outer) MIME header says compressed-data and so does the CMS body once you get it; see answer Jul 7, 2016 at 3:32
  • I'm voting to close this question as off-topic because it is an abandoned question, the linked file no longer exists, and there is no way to get input from the OP. There is also no indication whether the answer was a solution. There cannot be a definitive answer, so the question can't add value to the site.
    – fixer1234
    Jul 27, 2017 at 4:36

1 Answer 1

1

openssl cms (also the earlier and less capable smime) uses internal routines that implement SMIME format only for Content-transfer-encoding: base64 and don't support Content-transfer-encoding: binary. FWIW these are documented as bugs, so might someday get fixed.

As a workaround, on Unix you can discard the MIME headers with sed leaving the binary body, which openssl can handle (as der):

$ sed '1,/^\r$/d' <suA97544.mime >suA97544.body
$ ll suA975*
-rw-r--r--. 1 [redacted] 2760 Jul  6 23:07 suA97544.body
-rw-r--r--. 1 [redacted] 2934 Jul  6 22:26 suA97544.mime
$ openssl cms -uncompress -inform der -in suA97544.body
MIME-Version: 1.0
Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="boundaryk/tP"

--boundaryk/tP
Content-Type: application/edi-x12
Content-Transfer-Encoding: binary
Content-Disposition: Attachment; filename="test_data_1.edi"

[content snipped but it does look like EDI to me]

--boundaryk/tP
Content-Type: application/pkcs7-signature;      name="smime.p7s"
Content-Disposition: attachment; filename="smime.p7s"
Content-Transfer-Encoding: base64

MIIETwYJKoZIhvcNAQcCoIIEQDCCBDwCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCCAoUw
ggKBMIIB6qADAgECAgICzDANBgkqhkiG9w0BAQsFADCBhTEPMA0GA1UEAxMGUlNTQnVzMQ8wDQYD
VQQKEwZSU1NCdXMxDzANBgNVBAsTBlJTU0J1czEPMA0GA1UEBxMGUlNTQnVzMQ8wDQYDVQQIEwZS
U1NCdXMxCzAJBgNVBAYTAlVTMSEwHwYJKoZIhvcNAQkBFhJjb250YWN0QHJzc2J1cy5jb20wHhcN
MTYwNzA2MDM0OTMwWhcNMjEwNzA1MDM0OTMwWjCBhTEPMA0GA1UEAxMGUlNTQnVzMQ8wDQYDVQQK
EwZSU1NCdXMxDzANBgNVBAsTBlJTU0J1czEPMA0GA1UEBxMGUlNTQnVzMQ8wDQYDVQQIEwZSU1NC
dXMxCzAJBgNVBAYTAlVTMSEwHwYJKoZIhvcNAQkBFhJjb250YWN0QHJzc2J1cy5jb20wgZ8wDQYJ
KoZIhvcNAQEBBQADgY0AMIGJAoGBAOX0Z14r96LO/4MucxgoIEa2UZkpxHhvR00mwVpqBS0l0Kn9
2zI8RbVnDXUotaNB0KzadVct+AjivFj07YbX+EW0WAPhspXLrIxsxX3AIqfGC6KEK4CCfhwdazns
8n9jIHWCqk/kfnYpTWINeAPxQs3OgzbZrd3AowI+dFsYKFqRAgMBAAEwDQYJKoZIhvcNAQELBQAD
gYEAZVU+LCu1fARUGDxyGk10EeTXhMTSukw6EOLEAixUA8rr3nvj4dk2EbUlKNeaQ+4VjTJMRBGp
PF/0Pdw6olBerldJYq6Ri7XLFOwexNc2/j4oEEahAUHxH5YTGLiDiaTKJ2jjP0CVSqF34ElFLcdq
pKjgJe/wRZDk845AgGjvu00xggGSMIIBjgIBATCBjDCBhTEPMA0GA1UEAxMGUlNTQnVzMQ8wDQYD
VQQKEwZSU1NCdXMxDzANBgNVBAsTBlJTU0J1czEPMA0GA1UEBxMGUlNTQnVzMQ8wDQYDVQQIEwZS
U1NCdXMxCzAJBgNVBAYTAlVTMSEwHwYJKoZIhvcNAQkBFhJjb250YWN0QHJzc2J1cy5jb20CAgLM
MAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0x
NjA3MDYwNDA4MjlaMCMGCSqGSIb3DQEJBDEWBBRlZtMMIUzoSqDb4wc6ClFNPoEvpjANBgkqhkiG
9w0BAQEFAASBgKNvF+6hCS1TH1XPEfty2Dz9OvJ6LqKCDfzC/W9GPvo3Te0u00T21hPM1imfJJaD
oc6LFxiyE5JwXkgJBq7kx1yaYXL3coDdlnrrff3dvJos6yoY1DoHc+/b1wQyDIfrZTQeUf2F3XkA
RYV+n0be2C4zaBCz6F5JrCJob3uw2xVK

--boundaryk/tP--

If instead of displaying the decompressed output, I put it in a file and try cms -verify on it (as SMIME format by default), it parses successfully but fails verification because the cert is selfsigned; if I extract the cert and manually trust it (which is of course not secure, but this is just a test) it does verify.

HTH.

You must log in to answer this question.