Fixes: web workers

Hi,

jsbn library needed some fixes to be able to run in web workers where window and alert are not available.

Some fixes from mikex are merged in here as well.

 Regards,

Matej