Add more error codes and message, reflow some doc comments.

ErrKeyIsPublic should be used here, defined like ErrKeyIsPrivate