Great, after patching libsec and reinstall of tlsclient and upas both command work with gmail.
Maybe I should run a system update


2015-07-30 22:19 GMT+02:00 David du Colombier <0intro@gmail.com>:
> echo -n 'open /imaps/imap.gmail.com/NAME/INBOX gmail' > /mail/fs/ctl
> echo: write error: imap.gmail.com/imaps:tlsClient: tls: local invalid
> x509/rsa certificate

It works for me:

% tlsclient tcp!imap.gmail.com!imaps
* OK Gimap ready for requests from 88.164.189.37 z20mb397773409wjy

I notice the certificate is signed with SHA-256.
Maybe you're running an older release of 9legacy.

Please apply this patch and give a try:

http://9legacy.org/9legacy/patch/libsec-x509-sha256rsa.diff

--
David du Colombier