Hi Gaetan,

> When I try and download a p12, it is corrupt.
> I traced it down to get_privkey.html.

sincere apologies, I believe you have hit a bug that we have also encountered 
on some of our systems. Could you please state your operating system and Perl 
version? If you are using Perl 5.10 this is most certainly the "double UTF8 
encoding bug" we have been seeing ourselves as well.
If this is the case please try to do an UTF8 decoding on your corrupt binary 
files. If this results in usable files, it is the same problem.

In December I have spent more than one whole day debugging on this issue, even 
down to the lowest Perl levels the debugger could reach. It seems that only 
Perl 5.10, other versions seem to be unaffected.

> If I save the content directly on a file on the sever, it is valid, but it 
> looks the corruption occurs when mod_perl sends the content (something 
> related to bin mode I guess ?)
> 
> This give a broken download:
> 
>      $r->content_type ($content_type);
>      print $item;
>      return 1;
> 
> 
> This ugly workaround works:
> 
>        my $tmpfile = File::Temp->new( TEMPLATE => 'tempXXXXX',
>                        DIR => '/var/tmp/',
>                        SUFFIX => '.bin');
>        open (TMP ,">$tmpfile");
>        print TMP $item;
>        close TMP;
>        $r->sendfile($tmpfile);
>        unlink($tmpfile);
>      return 1;

Interesting information, I will have a look at it. You are probably right about 
the MIME type.

> Alas, BINMODE STDOUT does not cure the problem :(
> Any idea of a clean fix to send the $item in true raw mode to the output 
> stream?

I am afraid I cannot spend any time on this currently.

Regards,

Martin


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenXPKI-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openxpki-users

Reply via email to