Consolidate code.
Add excpetions to signal 401 and 403.
Fix fomrat.
Add classes to generate random server nonce.