fix ssl negotiation

since ssl.SSLContext does not exist prior to python 2.7.9
Refactor client crypto for better code readability.
Add encryption scheme, method and iv to symmetrically encrypted document MAC (#6400).
Fix bits from review.
Update debian package building script.