Implement method for base64 encoding

Base64 encoding is used by parts of the IMAP protocol, as well as many
other mail related protocols. We need a way to encode data according to
base64. While this is not a hard algorithm to implement it is already
implemented in the Security framework, which we already use for TLS.

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>
Allow replies which only has a tag

We only allow replies if they contain at least a tag and a key. This is
wrong since that will not allow command continuation requests which may
be sent as only the '+' tag and nothing else. We should allow the key to
be nil in a reply.

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>
Implement support for plain authentication

The AUTHENTICATE command with the PLAIN authentication method sends a
base64 encoded message with the user id and password. Implement client
support for it.

We wrap the provided command handler since we need to signal the
semaphore even if no command continuation request was received.

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>