[lib] remove duplicated code in rsa.c

remove duplicated code in rsa.c
    - duplicated code in public_key_to_gstring and public_key_append_to_gstring is not necessary
    - better code style