Package tlslite :: Package integration :: Module IMAP4_TLS :: Class IMAP4_TLS
[show private | hide private]
[frames | no frames]

Class IMAP4_TLS

       IMAP4 --+
               |
ClientHelper --+
               |
              IMAP4_TLS


This class extends imaplib.IMAP4 with TLS support.
Method Summary
  __init__(self, host, port, username, password, sharedKey, certChain, privateKey, cryptoID, protocol, x509Fingerprint, x509TrustList, x509CommonName, settings)
Create a new IMAP4_TLS.
  open(self, host, port)
Setup connection to remote server on "host:port".
    Inherited from IMAP4
  __getattr__(self, attr)
  append(self, mailbox, flags, date_time, message)
Append message to named mailbox.
  authenticate(self, mechanism, authobject)
Authenticate command - requires response processing.
  check(self)
Checkpoint mailbox on server.
  close(self)
Close currently selected mailbox.
  copy(self, message_set, new_mailbox)
Copy 'message_set' messages onto end of 'new_mailbox'.
  create(self, mailbox)
Create new mailbox.
  delete(self, mailbox)
Delete old mailbox.
  expunge(self)
Permanently remove deleted items from selected mailbox.
  fetch(self, message_set, message_parts)
Fetch (parts of) messages.
  getacl(self, mailbox)
Get the ACLs for a mailbox.
  getquota(self, root)
Get the quota root's resource usage and limits.
  getquotaroot(self, mailbox)
Get the list of quota roots for the named mailbox.
  list(self, directory, pattern)
List mailbox names in directory matching pattern.
  login(self, user, password)
Identify client using plaintext password.
  login_cram_md5(self, user, password)
Force use of CRAM-MD5 authentication.
  logout(self)
Shutdown connection to server.
  lsub(self, directory, pattern)
List 'subscribed' mailbox names in directory matching pattern.
  namespace(self)
Returns IMAP namespaces ala rfc2342
  noop(self)
Send NOOP command.
  partial(self, message_num, message_part, start, length)
Fetch truncated part of a message.
  print_log(self)
  proxyauth(self, user)
Assume authentication as "user".
  read(self, size)
Read 'size' bytes from remote.
  readline(self)
Read line from remote.
  recent(self)
Return most recent 'RECENT' responses if any exist, else prompt server for an update using the 'NOOP' command.
  rename(self, oldmailbox, newmailbox)
Rename old mailbox name to new.
  response(self, code)
Return data for response 'code' if received, or None.
  search(self, charset, *criteria)
Search mailbox for matching messages.
  select(self, mailbox, readonly)
Select a mailbox.
  send(self, data)
Send data to remote.
  setacl(self, mailbox, who, what)
Set a mailbox acl.
  setquota(self, root, limits)
Set the quota root's resource limits.
  shutdown(self)
Close I/O established in "open".
  socket(self)
Return socket instance used to connect to IMAP4 server.
  sort(self, sort_criteria, charset, *search_criteria)
IMAP4rev1 extension SORT command.
  status(self, mailbox, names)
Request named status conditions for mailbox.
  store(self, message_set, command, flags)
Alters flag dispositions for messages in mailbox.
  subscribe(self, mailbox)
Subscribe to new mailbox.
  uid(self, command, *args)
Execute "command arg ..." with messages identified by UID, rather than message number.
  unsubscribe(self, mailbox)
Unsubscribe from old mailbox.
  xatom(self, name, *args)
Allow simple extension commands notified by server in CAPABILITY response.
  _append_untagged(self, typ, dat)
  _check_bye(self)
  _checkquote(self, arg)
  _command(self, name, *args)
  _command_complete(self, name, tag)
  _CRAM_MD5_AUTH(self, challenge)
Authobject to use with CRAM-MD5 authentication.
  _dump_ur(self, dict)
  _get_line(self)
  _get_response(self)
  _get_tagged_response(self, tag)
  _log(self, line)
  _match(self, cre, s)
  _mesg(self, s, secs)
  _new_tag(self)
  _quote(self, arg)
  _simple_command(self, name, *args)
  _untagged_response(self, typ, dat, name)
    Inherited from ClientHelper
  _handshake(self, tlsConnection)

Class Variable Summary
    Inherited from IMAP4
SRE_Pattern mustquote = [^\w!#\$%&'\*\+,\.:;<=>\?\^`\|~-]

Method Details

__init__(self, host='', port=993, username=None, password=None, sharedKey=None, certChain=None, privateKey=None, cryptoID=None, protocol=None, x509Fingerprint=None, x509TrustList=None, x509CommonName=None, settings=None)
(Constructor)

Create a new IMAP4_TLS.

For client authentication, use one of these argument combinations:
  • username, password (SRP)
  • username, sharedKey (shared-key)
  • certChain, privateKey (certificate)
For server authentication, you can either rely on the implicit mutual authentication performed by SRP or shared-keys, or you can do certificate-based server authentication with one of these argument combinations:
  • cryptoID[, protocol] (requires cryptoIDlib)
  • x509Fingerprint
  • x509TrustList[, x509CommonName] (requires cryptlib_py)

Certificate-based server authentication is compatible with SRP or certificate-based client authentication. It is not compatible with shared-keys.

The caller should be prepared to handle TLS-specific exceptions. See the client handshake functions in tlslite.TLSConnection.TLSConnection for details on which exceptions might be raised.
Parameters:
host - Server to connect to.
           (type=str)
port - Port to connect to.
           (type=int)
username - SRP or shared-key username. Requires the 'password' or 'sharedKey' argument.
           (type=str)
password - SRP password for mutual authentication. Requires the 'username' argument.
           (type=str)
sharedKey - Shared key for mutual authentication. Requires the 'username' argument.
           (type=str)
certChain - Certificate chain for client authentication. Requires the 'privateKey' argument. Excludes the SRP or shared-key related arguments.
           (type=tlslite.X509CertChain.X509CertChain or cryptoIDlib.CertChain.CertChain)
privateKey - Private key for client authentication. Requires the 'certChain' argument. Excludes the SRP or shared-key related arguments.
           (type=tlslite.utils.RSAKey.RSAKey)
cryptoID - cryptoID for server authentication. Mutually exclusive with the 'x509...' arguments.
           (type=str)
protocol - cryptoID protocol URI for server authentication. Requires the 'cryptoID' argument.
           (type=str)
x509Fingerprint - Hex-encoded X.509 fingerprint for server authentication. Mutually exclusive with the 'cryptoID' and 'x509TrustList' arguments.
           (type=str)
x509TrustList - A list of trusted root certificates. The other party must present a certificate chain which extends to one of these root certificates. The cryptlib_py module must be installed to use this parameter. Mutually exclusive with the 'cryptoID' and 'x509Fingerprint' arguments.
           (type=list of tlslite.X509.X509)
x509CommonName - The end-entity certificate's 'CN' field must match this value. For a web server, this is typically a server name such as 'www.amazon.com'. Mutually exclusive with the 'cryptoID' and 'x509Fingerprint' arguments. Requires the 'x509TrustList' argument.
           (type=str)
settings - Various settings which can be used to control the ciphersuites, certificate types, and SSL/TLS versions offered by the client.
           (type=tlslite.HandshakeSettings.HandshakeSettings)
Overrides:
imaplib.IMAP4.__init__

open(self, host='', port=993)

Setup connection to remote server on "host:port".

This connection will be used by the routines: read, readline, send, shutdown.
Overrides:
imaplib.IMAP4.open

Generated by Epydoc 2.0 on Mon Feb 21 21:56:55 2005 http://epydoc.sf.net