Hi,

I have encrypted signed smime message with xml file.

Messages are constructed:
1) xml file is embedded to MIME message as attacment
(Content-Disposition: attachment;).
2) over whole content MIME message is signed by PKCS#7 and encoded Base64.
3) This message is encrypted by public key.

I use M2crypto to decrypt:

from M2Crypto import BIO, SMIME, X509
import os
output = open("c://decrypted.txt", 'w')
s = SMIME.SMIME()
s.load_key('test.pem', 'test.pem')
p7, data = SMIME.smime_load_pkcs7('input.txt')
out = s.decrypt(p7)
output.write(out)
output.close()

this part works properly. I try to verify the signed data, but without
success. File decrypted.txt contains base64 encoded data. (

I tried to decode through

from M2Crypto import BIO, SMIME, X509
import base64
import os
input = open("C://decrypted.txt", 'r')
output= open("C://decoded.txt", 'w')
base64.decode(input,output)
output.close
input.close

Decoded.txt contains quoted printable data, but if I try decode these data:

import os
import quopri
input = open("c://decoded.txt", 'r')
output= open("c://output.xml", 'w')
quopri.decode(input, output)
output.close
input.close

I obtain invalid and incomplete data. Data contains for example
"s ? čplitting" instead of "splitting".

Do you have any idea, what do I do wrong?

Thanks you very much

Best regards

Milan
0€     *†H†÷
 €0€10   +0€    *†H†÷
 €$€‚èContent-Type: application/octet-stream; name=60000000809820.XML

Content-Transfer-Encoding: quoted-printable

Content-Disposition: attachment; filename=60000000809820.XML



<?xml version=3D"1.0" encoding=3D"UTF-8"?>

<ISOTEDATA xmlns=3D"http://www.ote-cr.cz/schema/market/data"; answer-require=

d=3D"0" date-time=3D"2010-11-20T17:28:00" dtd-release=3D"1" dtd-version=3D"=

1" id=3D"60000000809820" message-code=3D"933"><SenderIdentification coding-=

scheme=3D"14" id=3D"8591824000007"></SenderIdentification><ReceiverIdentifi=

cation coding-scheme=3D"14" id=3D"8591824345009"></ReceiverIdentification><=

Trade acceptance=3D"N" id=3D"84953" market=3D"VDT" trade-day=3D"2010-11-20"=

 trade-order=3D"1" trade-type=3D"P" version=3D"0"><TimeData datetime=3D"201=

0-11-19T15:18:40" datetime-type=3D"DTC"></TimeData><ProfileData profile-rol=

e=3D"P72"><Data period=3D"20" unit=3D"CZK" value=3D"1290.00"></Data><Data p=

eriod=3D"21" unit=3D"CZK" value=3D"1190.00"></Data><Data period=3D"23" unit=

=3‚èD"CZK" value=3D"1090.00"></Data><Data period=3D"24" unit=3D"CZK" value=3D=

"790.00"></Data></ProfileData><ProfileData profile-role=3D"C72"><Data perio=

d=3D"20" splitting=3D"A" unit=3D"MWH" value=3D"10.00"></Data><Data period=

=3D"21" splitting=3D"A" unit=3D"MWH" value=3D"30.00"></Data><Data period=3D=

"23" splitting=3D"A" unit=3D"MWH" value=3D"20.00"></Data><Data period=3D"24=

" splitting=3D"A" unit=3D"MWH" value=3D"25.00"></Data></ProfileData><Commen=

t></Comment></Trade><Trade acceptance=3D"N" id=3D"85018" market=3D"VDT" tra=

de-day=3D"2010-11-20" trade-order=3D"16" trade-type=3D"P" version=3D"0"><Ti=

meData datetime=3D"2010-11-20T18:28:00" datetime-type=3D"DTR"></TimeData><T=

imeData datetime=3D"2010-11-20T10:38:22" datetime-type=3D"DTC"></TimeData><=

ProfileData profile-role=3D"P72"><Data period=3D"21" unit=3D"CZK" value=3D"=

1367.00"></Data><Data period=3D"22" unit=3D"CZK" value=3D"1262.00"></Data><=

/ProfileData><ProfileData profile-role=3D"C72"><Data period=3D"21" s‚èplittin=

g=3D"A" unit=3D"MWH" value=3D"10.00"></Data><Data period=3D"22" splitting=

=3D"A" unit=3D"MWH" value=3D"10.00"></Data></ProfileData><Comment></Comment=

></Trade><Trade acceptance=3D"N" id=3D"85048" market=3D"VDT" trade-day=3D"2=

010-11-20" trade-order=3D"16" trade-type=3D"N" version=3D"0"><TimeData date=

time=3D"2010-11-20T17:29:00" datetime-type=3D"DTR"></TimeData><TimeData dat=

etime=3D"2010-11-20T16:39:21" datetime-type=3D"DTC"></TimeData><ProfileData=

 profile-role=3D"P71"><Data period=3D"20" unit=3D"CZK" value=3D"510.00"></D=

ata></ProfileData><ProfileData profile-role=3D"C71"><Data period=3D"20" spl=

itting=3D"A" unit=3D"MWH" value=3D"10.00"></Data></ProfileData><Comment></C=

omment></Trade><Trade acceptance=3D"N" id=3D"85049" market=3D"VDT" trade-da=

y=3D"2010-11-20" trade-order=3D"17" trade-type=3D"N" version=3D"0"><TimeDat=

a datetime=3D"2010-11-20T18:29:00" datetime-type=3D"DTR"></TimeData><TimeDa=

ta datetime=3D"2010-11-20T16:39:43" datetime-type=3D"DTC‚è"></TimeData><Profi=

leData profile-role=3D"P71"><Data period=3D"21" unit=3D"CZK" value=3D"480.0=

0"></Data><Data period=3D"22" unit=3D"CZK" value=3D"470.00"></Data></Profil=

eData><ProfileData profile-role=3D"C71"><Data period=3D"21" splitting=3D"A"=

 unit=3D"MWH" value=3D"10.00"></Data><Data period=3D"22" splitting=3D"A" un=

it=3D"MWH" value=3D"10.00"></Data></ProfileData><Comment></Comment></Trade>=

<Trade acceptance=3D"N" id=3D"85050" market=3D"VDT" trade-day=3D"2010-11-20=

" trade-order=3D"18" trade-type=3D"N" version=3D"0"><TimeData datetime=3D"2=

010-11-20T20:29:00" datetime-type=3D"DTR"></TimeData><TimeData datetime=3D"=

2010-11-20T16:40:26" datetime-type=3D"DTC"></TimeData><ProfileData profile-=

role=3D"P71"><Data period=3D"23" unit=3D"CZK" value=3D"450.00"></Data><Data=

 period=3D"24" unit=3D"CZK" value=3D"420.00"></Data></ProfileData><ProfileD=

ata profile-role=3D"C71"><Data period=3D"23" splitting=3D"A" unit=3D"MWH" v=

alue=3D"10.00"></Data><Data period=3D"24" ‚èsplitting=3D"A" unit=3D"MWH" valu=

e=3D"10.00"></Data></ProfileData><Comment></Comment></Trade><Trade acceptan=

ce=3D"N" id=3D"85052" market=3D"VDT" trade-day=3D"2010-11-20" trade-order=

=3D"26" trade-type=3D"P" version=3D"0"><TimeData datetime=3D"2010-11-20T20:=

28:00" datetime-type=3D"DTR"></TimeData><TimeData datetime=3D"2010-11-20T16=

:41:46" datetime-type=3D"DTC"></TimeData><ProfileData profile-role=3D"P72">=

<Data period=3D"23" unit=3D"CZK" value=3D"1260.00"></Data><Data period=3D"2=

4" unit=3D"CZK" value=3D"1260.00"></Data></ProfileData><ProfileData profile=

-role=3D"C72"><Data period=3D"23" splitting=3D"A" unit=3D"MWH" value=3D"10.=

00"></Data><Data period=3D"24" splitting=3D"A" unit=3D"MWH" value=3D"10.00"=

></Data></ProfileData><Comment></Comment></Trade><ds:Signature xmlns:ds=3D"=

http://www.w3.org/2000/09/xmldsig#";>

<ds:SignedInfo>

<ds:CanonicalizationMethod Algorithm=3D"http://www.w3.org/TR/2001/REC-xml-c=

14n-20010315"></ds:CanonicalizationMethod>

<ds:Signa‚ètureMethod Algorithm=3D"http://www.w3.org/2000/09/xmldsig#rsa-sha1=

"></ds:SignatureMethod>

<ds:Reference URI=3D"">

<ds:Transforms>

<ds:Transform Algorithm=3D"http://www.w3.org/2000/09/xmldsig#enveloped-sign=

ature"></ds:Transform>

</ds:Transforms>

<ds:DigestMethod Algorithm=3D"http://www.w3.org/2000/09/xmldsig#sha1";></ds:=

DigestMethod>

<ds:DigestValue>8YHs/sxfgB3k0UzVK008AA4GHO4=3D</ds:DigestValue>

</ds:Reference>

</ds:SignedInfo>

<ds:SignatureValue>

zf+U2XLnE14YWQdeJ0apGPQBVviiQ1JJqCKZGFWcQ1ljwgG61f9JnALZsBYZP+6G2p9aAsyto2+=

D

at78MnNiuENXwzBnKdCMUU9wOYsnVdKXnfCCUQzJeP7yQgaev4QL8fSXpaziI52AH1caXPM4e7V=

3

bcpQKXBwUrZq+hhJfyFSLm/R31APWqlujPk9gwSSiDWZ6aFLFob4jKj1FWQBTQzi0fnC/N50dA7=

7

C4V/X5XsbqlRxA4G83GneryrOEa0l1UXggFGlFQ5xNFwAMFOHnAz55HXQ9llRnm4safqvl4HNAX=

x

mZIqoiF7caWYe2WfGsQ+Soy3MCwltlemK4/FHQ=3D=3D

</ds:SignatureValue>

<ds:KeyInfo>

<ds:X509Data>

<ds:X509Certificate>

MIIDyTCCArGgAwIBAgIKL7h+8AAFAAAV8DANBg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Z=

4

+NuQK68jK5MAT8GH3GiJ/ikphTTknSpLm/9JRjnjX9pbGbKpIFPYiRBzdQI28Y7wqOuzvRPcknI=

X

LGWh+QYymRTGHQDaJts5mOzgsl2WbvdFMgt3wocAp35HyK9QHH9NrnT0+x+VxvW8sTJ5zQYQyhq=

5

mXmQwgKSAJUnM3y2NHEjOiYwNf2iwoAwHgM8/GNymaLLHbgeaK7GoTqiBsmuUKcFSGC9lRJhGZq=

L

EufT1A=3D=3D

</ds:X509Certificate>

</ds:X509Data>

<ds:KeyValue>

<ds:RSAKeyValue>

<ds:Modulus>

9mo6AupquHbeQ26caDIOgOIchGVpv7DV0QjqqixFNPSkg+POqDSB8txUKjcRmV0HKWT1o46SzpI=

V

aUod1eaESTRoKiEp10v7EFC+InYBRk7HzHoBau1kyYaGHrECdeOddFN1LhFsZXcdWQLGE5AWW9A=

5

hmyksQK8aoJoZNWXYzBSrNIHRQpQi7x3rEg80o/UhezBbU1KZXhg0LSCzayzixjzw++TR6l3Ywd=

k

O2wHUpBzKwdU46rWPMdN3NcWbocrVDUWkyLnNHWlO6olKVWV+751ZjszjjgNI+E+Wc2kxRUqKJR=

R

9Ren5PYLvPPv+oCnZaxvkKQDd30fyPSnyvVoxQ=3D=3D

</ds:Modulus>

<ds:Exponent>AQAB</ds:Exponent>

</ds:RSAKeyValue>

</ds:KeyValue>

</ds:KeyInfo>

</ds:Signature></ISOTEDATA> €0‚É0‚± 
/¸~ðð0
       *†H†÷
0B10      UCZ10
U
Logica10U      PKI Group10UOTECA0
100216134342Z
120216135342Z0e1$0"    *†H†÷
       cs...@csote.ote-cr.cz10     UCZ10U
       OTE, a.s.10
UPKI10UCSOTE0‚"0
       *†H†÷
‚0‚
‚öj:êj¸vÞCnœh2€â„ei¿°ÕÑêª,E4ô¤ƒãΨ4�òÜT*7™])dõ£Ž’Î’iJÕæ„I4h*!)×KûP¾"vFNÇÌzjídɆ†±uã�tSu.lewYÆ�[Ð9†l¤±¼j‚hdÕ—c0R¬ÒE
P‹¼w¬H<Ò�Ô…ìÁmMJex`д‚ͬ³‹óÃï“G©wcd;lR�s+TãªÖ<ÇMÜ×n‡+T5“"ç4u¥;ª%)U•û¾uf;3Ž8
#á>YͤÅ*(”Qõ§äö¼óïú€§e¬o�¤w}Èô§ÊõhÅ£��0�š0Uá°”‰YD>ÅèàíÇ_ÿ²0yU#r0p€ôñW÷ˆ:^Tvì;ëÄO‡åØ�Ñ¡F¤D0B1
0    UCZ10
U
Logica10U      PKI Group10UOTECA‚yƒB^>‹£M{ÄÎ×í|0
       *†H†÷
‚‚®CJ9ô¹›# Z}ÿ˜þ \i²Û!³Ä%21s«Ûâä’²Èmå&©\§òzM›F.K÷
æïÔgûîªÎs#l˜ÌÛ¥zX0$b'jôVxøÛ�+¯#+“OÁ‡Üh‰þ))…4ä�*K›ÿIF9ã_Ú[²© 
S؉su6ñŽð¨ë³½Ü’r,e¡ù2™ÆÚ&Û9˜ìà²]–n÷E2w‡§~GȯPM®tôû•Æõ¼±2yÍʹ™y�Â’•'3|¶4q#:&05ý¢Â€0<ücr™¢Ë¸h®Æ¡:¢É®P§H`½•aš‹çÓÔ1‚Ö0‚Ò0P0B10
   UCZ10
U
Logica10U      PKI Group10UOTECA
/¸~ðð0     + ]0  *†H†÷
       1    *†H†÷
0  *†H†÷
       1
101120162809Z0#        *†H†÷
       1¶ýz¶gOäoió�éÑ´80
       *†H†÷
‚6‡·JCëeàȇ‰ò^§‰K“y,›ðí]ôœÏh*0<É Bï%Êâˆd´À+vâ-é$š0”UuõC8*^Ó¤Ö�Np1BO#šzå¯/Í:Y±¢÷^©7B£E÷?´²,Vᜑ¸—pü6œ¡ÃèL¯ü
    g
Lg�ŸàøÂÞ�˜3/;zN–‹ŽÃˆâ­—z,”ÅÌ�$
[“©X„¥ÝWžêtˆ   x±¸BTÖÌè„ptvÈ¥vŸÞ•Ç®ãý=
±Áº´¦,r]Ú.Vön‡!Lg÷0;É…˜yXYi¡÷µÔLwo“-h1Wؾò®þ±¼ü:~¹
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to