restruct sub_key/pub_key and debug for STDERR etc.