From 9d79ac666605211107c099e530823792a4c4ecea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Thu, 5 Oct 2017 14:53:20 +0200 Subject: Update docs --- doc/conf.py | 2 +- doc/doctrees/M2Crypto.PGP.doctree | Bin 86275 -> 0 bytes doc/doctrees/M2Crypto.SSL.doctree | Bin 296531 -> 383428 bytes doc/doctrees/M2Crypto.doctree | Bin 1082506 -> 1368244 bytes doc/doctrees/ZServerSSL-HOWTO.doctree | Bin 49205 -> 47807 bytes doc/doctrees/environment.pickle | Bin 442226 -> 490409 bytes doc/doctrees/howto.ca.doctree | Bin 51341 -> 49739 bytes doc/doctrees/howto.smime.doctree | Bin 94635 -> 89126 bytes doc/doctrees/howto.ssl.doctree | Bin 22375 -> 21303 bytes doc/doctrees/index.doctree | Bin 7200 -> 7215 bytes doc/html/.buildinfo | 4 +- doc/html/M2Crypto.PGP.html | 414 - doc/html/M2Crypto.SSL.html | 616 +- doc/html/M2Crypto.html | 1939 ++-- doc/html/ZServerSSL-HOWTO.html | 229 +- doc/html/_modules/M2Crypto/ASN1.html | 168 +- doc/html/_modules/M2Crypto/AuthCookie.html | 158 +- doc/html/_modules/M2Crypto/BIO.html | 337 +- doc/html/_modules/M2Crypto/BN.html | 98 +- doc/html/_modules/M2Crypto/DH.html | 140 +- doc/html/_modules/M2Crypto/DSA.html | 216 +- doc/html/_modules/M2Crypto/EC.html | 228 +- doc/html/_modules/M2Crypto/EVP.html | 282 +- doc/html/_modules/M2Crypto/Engine.html | 156 +- doc/html/_modules/M2Crypto/Err.html | 127 +- doc/html/_modules/M2Crypto/PGP/PublicKey.html | 169 - doc/html/_modules/M2Crypto/PGP/PublicKeyRing.html | 192 - doc/html/_modules/M2Crypto/PGP/RSA.html | 122 - doc/html/_modules/M2Crypto/PGP/packet.html | 514 - doc/html/_modules/M2Crypto/RC4.html | 102 +- doc/html/_modules/M2Crypto/RSA.html | 272 +- doc/html/_modules/M2Crypto/Rand.html | 240 +- doc/html/_modules/M2Crypto/SMIME.html | 271 +- doc/html/_modules/M2Crypto/SSL.html | 108 +- doc/html/_modules/M2Crypto/SSL/Checker.html | 176 +- doc/html/_modules/M2Crypto/SSL/Cipher.html | 102 +- doc/html/_modules/M2Crypto/SSL/Connection.html | 424 +- doc/html/_modules/M2Crypto/SSL/Context.html | 240 +- doc/html/_modules/M2Crypto/SSL/SSLServer.html | 129 +- doc/html/_modules/M2Crypto/SSL/Session.html | 126 +- .../M2Crypto/SSL/TwistedProtocolWrapper.html | 339 +- doc/html/_modules/M2Crypto/SSL/cb.html | 110 +- doc/html/_modules/M2Crypto/SSL/ssl_dispatcher.html | 112 +- doc/html/_modules/M2Crypto/SSL/timeout.html | 98 +- doc/html/_modules/M2Crypto/X509.html | 603 +- doc/html/_modules/M2Crypto/ftpslib.html | 114 +- doc/html/_modules/M2Crypto/httpslib.html | 176 +- doc/html/_modules/M2Crypto/m2crypto.html | 38 +- doc/html/_modules/M2Crypto/m2urllib.html | 141 +- doc/html/_modules/M2Crypto/m2urllib2.html | 128 +- doc/html/_modules/M2Crypto/m2xmlrpclib.html | 106 +- doc/html/_modules/M2Crypto/threading.html | 92 +- doc/html/_modules/M2Crypto/util.html | 152 +- doc/html/_modules/index.html | 86 +- doc/html/_modules/urllib2.html | 1575 +++ doc/html/_sources/M2Crypto.PGP.txt | 51 - doc/html/_sources/M2Crypto.SSL.rst.txt | 91 + doc/html/_sources/M2Crypto.rst.txt | 218 + doc/html/_sources/M2Crypto.txt | 1 - doc/html/_sources/ZServerSSL-HOWTO.rst.txt | 239 + doc/html/_sources/howto.ca.rst.txt | 370 + doc/html/_sources/howto.smime.rst.txt | 778 ++ doc/html/_sources/howto.ssl.rst.txt | 131 + doc/html/_sources/index.rst.txt | 30 + doc/html/_static/alabaster.css | 693 ++ doc/html/_static/basic.css | 163 +- doc/html/_static/comment-bright.png | Bin 3500 -> 756 bytes doc/html/_static/comment-close.png | Bin 3578 -> 829 bytes doc/html/_static/comment.png | Bin 3445 -> 641 bytes doc/html/_static/custom.css | 1 + doc/html/_static/doctools.js | 72 +- doc/html/_static/down-pressed.png | Bin 368 -> 222 bytes doc/html/_static/down.png | Bin 363 -> 202 bytes doc/html/_static/file.png | Bin 392 -> 286 bytes doc/html/_static/jquery-3.1.0.js | 10074 +++++++++++++++++++ doc/html/_static/jquery.js | 158 +- doc/html/_static/minus.png | Bin 199 -> 90 bytes doc/html/_static/plus.png | Bin 199 -> 90 bytes doc/html/_static/pygments.css | 4 + doc/html/_static/searchtools.js | 502 +- doc/html/_static/underscore-1.3.1.js | 999 ++ doc/html/_static/underscore.js | 50 +- doc/html/_static/up-pressed.png | Bin 372 -> 214 bytes doc/html/_static/up.png | Bin 363 -> 203 bytes doc/html/_static/websupport.js | 32 +- doc/html/genindex.html | 4640 +++------ doc/html/howto.ca.html | 592 +- doc/html/howto.smime.html | 724 +- doc/html/howto.ssl.html | 120 +- doc/html/index.html | 211 +- doc/html/objects.inv | Bin 5904 -> 4390 bytes doc/html/py-modindex.html | 267 +- doc/html/search.html | 74 +- doc/html/searchindex.js | 2 +- 94 files changed, 22884 insertions(+), 10574 deletions(-) delete mode 100644 doc/doctrees/M2Crypto.PGP.doctree delete mode 100644 doc/html/M2Crypto.PGP.html delete mode 100644 doc/html/_modules/M2Crypto/PGP/PublicKey.html delete mode 100644 doc/html/_modules/M2Crypto/PGP/PublicKeyRing.html delete mode 100644 doc/html/_modules/M2Crypto/PGP/RSA.html delete mode 100644 doc/html/_modules/M2Crypto/PGP/packet.html create mode 100644 doc/html/_modules/urllib2.html delete mode 100644 doc/html/_sources/M2Crypto.PGP.txt create mode 100644 doc/html/_sources/M2Crypto.SSL.rst.txt create mode 100644 doc/html/_sources/M2Crypto.rst.txt create mode 100644 doc/html/_sources/ZServerSSL-HOWTO.rst.txt create mode 100644 doc/html/_sources/howto.ca.rst.txt create mode 100644 doc/html/_sources/howto.smime.rst.txt create mode 100644 doc/html/_sources/howto.ssl.rst.txt create mode 100644 doc/html/_sources/index.rst.txt create mode 100644 doc/html/_static/alabaster.css create mode 100644 doc/html/_static/custom.css create mode 100644 doc/html/_static/jquery-3.1.0.js create mode 100644 doc/html/_static/underscore-1.3.1.js (limited to 'doc') diff --git a/doc/conf.py b/doc/conf.py index d782515..8530a00 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -16,7 +16,7 @@ import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath(os.path.join('..'))) # -- General configuration ----------------------------------------------------- diff --git a/doc/doctrees/M2Crypto.PGP.doctree b/doc/doctrees/M2Crypto.PGP.doctree deleted file mode 100644 index 85f452c..0000000 Binary files a/doc/doctrees/M2Crypto.PGP.doctree and /dev/null differ diff --git a/doc/doctrees/M2Crypto.SSL.doctree b/doc/doctrees/M2Crypto.SSL.doctree index c613ca6..d4c48b1 100644 Binary files a/doc/doctrees/M2Crypto.SSL.doctree and b/doc/doctrees/M2Crypto.SSL.doctree differ diff --git a/doc/doctrees/M2Crypto.doctree b/doc/doctrees/M2Crypto.doctree index b195fd4..e8b41bc 100644 Binary files a/doc/doctrees/M2Crypto.doctree and b/doc/doctrees/M2Crypto.doctree differ diff --git a/doc/doctrees/ZServerSSL-HOWTO.doctree b/doc/doctrees/ZServerSSL-HOWTO.doctree index a807552..4bb8159 100644 Binary files a/doc/doctrees/ZServerSSL-HOWTO.doctree and b/doc/doctrees/ZServerSSL-HOWTO.doctree differ diff --git a/doc/doctrees/environment.pickle b/doc/doctrees/environment.pickle index 0068ff7..da5be06 100644 Binary files a/doc/doctrees/environment.pickle and b/doc/doctrees/environment.pickle differ diff --git a/doc/doctrees/howto.ca.doctree b/doc/doctrees/howto.ca.doctree index 25d7aae..83eb476 100644 Binary files a/doc/doctrees/howto.ca.doctree and b/doc/doctrees/howto.ca.doctree differ diff --git a/doc/doctrees/howto.smime.doctree b/doc/doctrees/howto.smime.doctree index dde291f..0761480 100644 Binary files a/doc/doctrees/howto.smime.doctree and b/doc/doctrees/howto.smime.doctree differ diff --git a/doc/doctrees/howto.ssl.doctree b/doc/doctrees/howto.ssl.doctree index 6032ac5..c757283 100644 Binary files a/doc/doctrees/howto.ssl.doctree and b/doc/doctrees/howto.ssl.doctree differ diff --git a/doc/doctrees/index.doctree b/doc/doctrees/index.doctree index ddb7340..d8661d3 100644 Binary files a/doc/doctrees/index.doctree and b/doc/doctrees/index.doctree differ diff --git a/doc/html/.buildinfo b/doc/html/.buildinfo index d49bc3a..1473c05 100644 --- a/doc/html/.buildinfo +++ b/doc/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 2ba17edb1c13f7cef17e22ec0437fce4 -tags: fbb0d17656682115ca4d033fb2f83ba1 +config: a5615f96278642a071afe91980cda73c +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/doc/html/M2Crypto.PGP.html b/doc/html/M2Crypto.PGP.html deleted file mode 100644 index b64f7a2..0000000 --- a/doc/html/M2Crypto.PGP.html +++ /dev/null @@ -1,414 +0,0 @@ - - - - - - - - - - PGP Package — M2Crypto documentation - - - - - - - - - - - - - - - - -
-
-
-
- -
-

PGP Package

-
-

PGP Package

-
-
-

PublicKey Module

-
-
-class M2Crypto.PGP.PublicKey.PublicKey(pubkey_pkt)[source]
-
-
-add_signature(userid, s_pkt)[source]
-
- -
-
-add_userid(u_pkt)[source]
-
- -
-
-decrypt(ctxt)[source]
-
- -
-
-encrypt(ptxt)[source]
-
- -
-
-keyid()[source]
-
- -
-
-remove_userid(userid)[source]
-
- -
-
-write(stream)[source]
-
- -
- -
-
-

PublicKeyRing Module

-
-
-class M2Crypto.PGP.PublicKeyRing.PublicKeyRing(keyring)[source]
-
-
-load()[source]
-
- -
-
-save(keyring)[source]
-
- -
-
-spurious()[source]
-
- -
- -
-
-M2Crypto.PGP.PublicKeyRing.load_pubring(filename='pubring.pgp')[source]
-
- -
-
-

RSA Module

-

M2Crypto PGP2 RSA.

-

Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved.

-
-
-M2Crypto.PGP.RSA.new_pub_key(e_n)[source]
-

Factory function that instantiates an RSA_pub object from a (e, n) tuple.

-

‘e’ is the RSA public exponent; it is a string in OpenSSL’s binary format, -i.e., a number of bytes in big-endian.

-
-
‘n’ is the RSA composite of primes; it is a string in OpenSSL’s
-
binary format, i.e., a number of bytes in big-endian.
-
-
- -
-
-

constants Module

-

M2Crypto PGP2.

-

Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved.

-
-
-

packet Module

-
-
-class M2Crypto.PGP.packet.CKEPacket(ctb, body=None)[source]
-

Bases: M2Crypto.PGP.packet.Packet

-
- -
-
-class M2Crypto.PGP.packet.CommentPacket(ctb, body=None)[source]
-

Bases: M2Crypto.PGP.packet.Packet

-
-
-pack()[source]
-
- -
- -
-
-class M2Crypto.PGP.packet.CompressedPacket(ctb, stream)[source]
-

Bases: M2Crypto.PGP.packet.Packet

-
-
-uncompress()[source]
-
- -
-
-validate()[source]
-
- -
- -
-
-class M2Crypto.PGP.packet.LiteralPacket(ctb, body=None)[source]
-

Bases: M2Crypto.PGP.packet.Packet

-
- -
-
-class M2Crypto.PGP.packet.PKEPacket(ctb, body=None)[source]
-

Bases: M2Crypto.PGP.packet.Packet

-
- -
-
-class M2Crypto.PGP.packet.Packet(ctb, body=None)[source]
-
-
-pack()[source]
-
- -
-
-pkc()[source]
-
- -
-
-timestamp()[source]
-
- -
-
-validate()[source]
-
- -
-
-validity()[source]
-
- -
-
-version()[source]
-
- -
- -
-
-class M2Crypto.PGP.packet.PacketStream(input)[source]
-
-
-close()[source]
-
- -
-
-count()[source]
-
- -
-
-read(keep_trying=0)[source]
-
- -
- -
-
-class M2Crypto.PGP.packet.PrivateKeyPacket(ctb, body=None)[source]
-

Bases: M2Crypto.PGP.packet.Packet

-
-
-is_encrypted()[source]
-
- -
- -
-
-class M2Crypto.PGP.packet.PublicKeyPacket(ctb, body=None)[source]
-

Bases: M2Crypto.PGP.packet.Packet

-
-
-pack()[source]
-
- -
-
-pubkey()[source]
-
- -
- -
-
-class M2Crypto.PGP.packet.SignaturePacket(ctb, body=None)[source]
-

Bases: M2Crypto.PGP.packet.Packet

-
-
-pack()[source]
-
- -
-
-validate()[source]
-
- -
- -
-
-class M2Crypto.PGP.packet.TrustPacket(ctb, body=None)[source]
-

Bases: M2Crypto.PGP.packet.Packet

-
- -
-
-class M2Crypto.PGP.packet.UserIDPacket(ctb, body=None)[source]
-

Bases: M2Crypto.PGP.packet.Packet

-
-
-pack()[source]
-
- -
-
-userid()[source]
-
- -
- -
-
-exception M2Crypto.PGP.packet.XXXError[source]
-

Bases: exceptions.Exception

-
- -
-
-M2Crypto.PGP.packet.is_ctb(ctb)[source]
-
- -
-
-M2Crypto.PGP.packet.make_ctb(value, llf)[source]
-
- -
-
- - -
-
-
-
-
-

Table Of Contents

- - -

Previous topic

-

M2Crypto Package

-

Next topic

-

SSL Package

-

This Page

- - - -
-
-
-
- - - - \ No newline at end of file diff --git a/doc/html/M2Crypto.SSL.html b/doc/html/M2Crypto.SSL.html index 1c1eb09..63d1f24 100644 --- a/doc/html/M2Crypto.SSL.html +++ b/doc/html/M2Crypto.SSL.html @@ -1,149 +1,136 @@ - - - - SSL Package — M2Crypto documentation - - + SSL Package — M2Crypto documentation + - - - - + + + + + + + + + - +
-
+

SSL Package

-

SSL Package

+

SSL Package

-exception M2Crypto.SSL.SSLError[source]
-

Bases: exceptions.Exception

+exception M2Crypto.SSL.SSLError[source] +

Bases: exceptions.Exception

-exception M2Crypto.SSL.SSLTimeoutError[source]
-

Bases: M2Crypto.SSL.SSLError, socket.timeout

+exception M2Crypto.SSL.SSLTimeoutError[source] +

Bases: M2Crypto.SSL.SSLError, socket.timeout

-

Checker Module

+

Checker Module

SSL peer certificate checking routines

Copyright (c) 2004-2007 Open Source Applications Foundation. All rights reserved.

Copyright 2008 Heikki Toivonen. All rights reserved.

-exception M2Crypto.SSL.Checker.SSLVerificationError[source]
-

Bases: exceptions.Exception

+exception M2Crypto.SSL.Checker.SSLVerificationError[source] +

Bases: exceptions.Exception

-exception M2Crypto.SSL.Checker.NoCertificate[source]
-

Bases: M2Crypto.SSL.Checker.SSLVerificationError

+exception M2Crypto.SSL.Checker.NoCertificate[source] +

Bases: M2Crypto.SSL.Checker.SSLVerificationError

-exception M2Crypto.SSL.Checker.WrongCertificate[source]
-

Bases: M2Crypto.SSL.Checker.SSLVerificationError

+exception M2Crypto.SSL.Checker.WrongCertificate[source] +

Bases: M2Crypto.SSL.Checker.SSLVerificationError

-exception M2Crypto.SSL.Checker.WrongHost(expectedHost, actualHost, fieldName='commonName')[source]
-

Bases: M2Crypto.SSL.Checker.SSLVerificationError

+exception M2Crypto.SSL.Checker.WrongHost(expectedHost, actualHost, fieldName='commonName')[source] +

Bases: M2Crypto.SSL.Checker.SSLVerificationError

-class M2Crypto.SSL.Checker.Checker(host=None, peerCertHash=None, peerCertDigest='sha1')[source]
+class M2Crypto.SSL.Checker.Checker(host=None, peerCertHash=None, peerCertDigest='sha1')[source]
-numericIpMatch = <_sre.SRE_Pattern object at 0x1fe7dd0>
+numericIpMatch = <_sre.SRE_Pattern object>
-

Cipher Module

+

Cipher Module

SSL Ciphers

Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved.

-class M2Crypto.SSL.Cipher.Cipher(cipher)[source]
+class M2Crypto.SSL.Cipher.Cipher(cipher)[source]
-name()[source]
+name()[source]
-version()[source]
+version()[source]
-class M2Crypto.SSL.Cipher.Cipher_Stack(stack)[source]
+class M2Crypto.SSL.Cipher.Cipher_Stack(stack)[source]
-

Connection Module

+

Connection Module

-class M2Crypto.SSL.Connection.Connection(ctx, sock=None, family=2)[source]
+class M2Crypto.SSL.Connection.Connection(ctx, sock=None, family=2)[source]

An SSL connection.

-accept()[source]
+accept()[source]

Accept an SSL connection.

The return value is a pair (ssl, addr) where ssl is a new SSL connection object and addr is the address bound to the other end @@ -164,7 +151,7 @@ optional ints.

-accept_ssl()[source]
+accept_ssl()[source]

Waits for a TLS/SSL client to initiate the TLS/SSL handshake.

The communication channel must already have been set and assigned to the ssl by setting an underlying BIO.

@@ -195,12 +182,12 @@ out the reason.
-bind(addr)[source]
+bind(addr)[source]
-clear()[source]
+clear()[source]

If there were errors in this connection, call clear() rather than close() to end it, so that bad sessions will be cleared from cache.

@@ -208,23 +195,23 @@ from cache.

-clientPostConnectionCheck = <M2Crypto.SSL.Checker.Checker instance at 0x2057cf8>
+clientPostConnectionCheck = <M2Crypto.SSL.Checker.Checker instance>
-close()[source]
+close()[source]
-connect(addr)[source]
+connect(addr)[source]

Overloading socket.connect()

- +
Parameters:addr – addresses have various depending on their type
Parameters:addr – addresses have various depending on their type
@@ -233,30 +220,30 @@ from cache.

-connect_ssl()[source]
+connect_ssl()[source]
-fileno()[source]
+fileno()[source]
-get_cipher()[source]
+get_cipher()[source]

Return an M2Crypto.SSL.Cipher object for this connection; if the connection has not been initialised with a cipher suite, return None.

-get_cipher_list(idx=0)[source]
+get_cipher_list(idx=0)[source]

Return the cipher suites for this connection as a string object.

-get_ciphers()[source]
+get_ciphers()[source]

Return an M2Crypto.SSL.Cipher_Stack object for this connection; if the connection has not been initialised with cipher suites, return None.

@@ -264,32 +251,32 @@ cipher suites, return None.

-get_context()[source]
-

Return the SSL.Context object associated with this connection.

+get_context()[source] +

Return the Context object associated with this connection.

-get_default_session_timeout()[source]
+get_default_session_timeout()[source]
-get_peer_cert()[source]
+get_peer_cert()[source]

Return the peer certificate.

If the peer did not provide a certificate, return None.

-get_peer_cert_chain()[source]
+get_peer_cert_chain()[source]

Return the peer certificate chain; if the peer did not provide a certificate chain, return None.

- @@ -299,28 +286,28 @@ gets freed, the chain will be freed as well.
-get_session()[source]
+get_session()[source]
-get_shutdown()[source]
+get_shutdown()[source]

Get the current shutdown mode of the Connection.

-get_socket_read_timeout()[source]
+get_socket_read_timeout()[source]
-get_socket_write_timeout()[source]
+get_socket_write_timeout()[source]
-get_state()[source]
+get_state()[source]

Return the SSL state of this connection.

During its use, an SSL objects passes several states. The state is internally maintained. Querying the state information is not @@ -340,31 +327,31 @@ object ssl.

-get_verify_depth()[source]
+get_verify_depth()[source]

Return the peer certificate verification depth.

-get_verify_mode()[source]
+get_verify_mode()[source]

Return the peer certificate verification mode.

-get_verify_result()[source]
+get_verify_result()[source]

Return the peer certificate verification result.

-get_version()[source]
+get_version()[source]

Return the TLS/SSL protocol version for this connection.

-getpeername()[source]
+getpeername()[source]

Return the remote address to which the socket is connected.

This is useful to find out the port number of a remote IPv4/v6 socket, for instance. @@ -381,24 +368,24 @@ On some systems this function is not supported.

-getsockname()[source]
-

Return the socket’s own address.

+getsockname()[source] +

Return the socket’s own address.

This is useful to find out the port number of an IPv4/v6 socket, for instance. (The format of the address returned depends -on the address family – see above.)

-

:return:socket’s address as addr type

+on the address family – see above.)

+

:return:socket’s address as addr type

-getsockopt(level, optname, buflen=None)[source]
+getsockopt(level, optname, buflen=None)[source]

Get the value of the given socket option.

Warning :The returned chain will be valid only for as long as the +
Warning:The returned chain will be valid only for as long as the connection object is alive. Once the connection object gets freed, the chain will be freed as well.
@@ -519,13 +519,13 @@ different).

-set_cipher_list(cipher_list)[source]
+set_cipher_list(cipher_list)[source]

Set the cipher suites for this connection.

-set_client_CA_list_from_context()[source]
+set_client_CA_list_from_context()[source]

Set the acceptable client CA list. If the client returns a certificate, it must have been issued by one of the CAs listed in context.

@@ -534,7 +534,7 @@ one of the CAs listed in context.

-set_client_CA_list_from_file(cafile)[source]
+set_client_CA_list_from_file(cafile)[source]

Set the acceptable client CA list.

If the client returns a certificate, it must have been issued by one of the CAs listed in cafile.

@@ -543,7 +543,7 @@ one of the CAs listed in cafile.

- + - +
Parameters:
    -
  • level – level at which the option resides. +
  • level – level at which the option resides. To manipulate options at the sockets API level, level is specified as socket.SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate @@ -406,11 +393,11 @@ protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of socket.SOL_TCP; see getprotoent(3).
  • -
  • optname – The value of the given socket option is +
  • optname – The value of the given socket option is described in the Unix man page getsockopt(2)). The needed symbolic constants (SO_* etc.) are defined in the socket module.
  • -
  • buflen – If it is absent, an integer option is assumed +
  • buflen – If it is absent, an integer option is assumed and its integer value is returned by the function. If buflen is present, it specifies the maximum length of the buffer used to receive the option in, and this buffer is @@ -430,70 +417,83 @@ C structures encoded as byte strings).

    -listen(qlen=5)[source]
    +listen(qlen=5)[source]
    -m2_bio_free()
    +m2_bio_free()
    -m2_ssl_free()
    +m2_ssl_free()
    -makefile(mode='rb', bufsize=-1)[source]
    +makefile(mode='rb', bufsize=-1)[source]
    -pending()[source]
    +pending()[source]

    Return the numbers of octets that can be read from the connection.

    -read(size=1024)[source]
    +read(size=1024)[source]
    -recv(size=1024)
    +recv(size=1024)
    +
    +
    +recv_into(buff, nbytes=0)[source]
    +

    A version of recv() that stores its data into a buffer rather +than creating a new string. Receive up to buffersize bytes from +the socket. If buffersize is not specified (or 0), receive up +to the size available in the given buffer.

    +

    @param buffer: a buffer for the received bytes +@param nbytes: maximum number of bytes to read +@return: number of bytes added

    +

    See recv() for documentation about the flags.

    +
    +
    -renegotiate()[source]
    -

    Renegotiate this connection’s SSL parameters.

    +renegotiate()[source] +

    Renegotiate this connection’s SSL parameters.

    -send(data)
    +send(data)
    -sendall(data)
    +sendall(data)
    -serverPostConnectionCheck(*args, **kw)
    +serverPostConnectionCheck(*args, **kw)
    -set_accept_state()[source]
    +set_accept_state()[source]

    Sets Connection to work in the server mode.

    -set_bio(readbio, writebio)[source]
    +set_bio(readbio, writebio)[source]

    Explicitly set read and write bios

    Connects the BIOs for the read and write operations of the TLS/SSL (encrypted) side of ssl.

    @@ -508,8 +508,8 @@ different).

Parameters:
    -
  • readbio – BIO for reading
  • -
  • writebio – BIO for writing.
  • +
  • readbio – BIO for reading
  • +
  • writebio – BIO for writing.
Parameters:cafile – Filename from which to load the CA list.
Parameters:cafile – Filename from which to load the CA list.
Returns:
0 A failure while manipulating the STACK_OF(X509_NAME)
@@ -560,40 +560,40 @@ out the reason.
-set_connect_state()[source]
+set_connect_state()[source]

Sets Connection to work in the client mode.

-set_post_connection_check_callback(postConnectionCheck)[source]
+set_post_connection_check_callback(postConnectionCheck)[source]
-set_session(session)[source]
+set_session(session)[source]
-set_session_id_ctx(id)[source]
+set_session_id_ctx(id)[source]
-set_shutdown(mode)[source]
+set_shutdown(mode)[source]

Sets the shutdown state of the Connection to mode.

The shutdown state of an ssl connection is a bitmask of (use m2.SSL_* constants):

0 No shutdown setting, yet.

SSL_SENT_SHUTDOWN
-
A “close notify” shutdown alert was sent to the peer, the +
A “close notify” shutdown alert was sent to the peer, the connection is being considered closed and the session is closed and correct.
SSL_RECEIVED_SHUTDOWN
A shutdown alert was received form the peer, either a normal -“close notify” or a fatal error.
+“close notify” or a fatal error.

SSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time.

@@ -601,7 +601,7 @@ same time.

Parameters:mode – set the mode bitmask.
Parameters:mode – set the mode bitmask.
@@ -609,24 +609,24 @@ same time.

-set_socket_read_timeout(timeo)[source]
+set_socket_read_timeout(timeo)[source]
-set_socket_write_timeout(timeo)[source]
+set_socket_write_timeout(timeo)[source]
-set_ssl_close_flag(flag)[source]
+set_ssl_close_flag(flag)[source]

By default, SSL struct will be freed in __del__. Call with m2.bio_close to override this default.

- +
Parameters:flag – either m2.bio_close or m2.bio_noclose
Parameters:flag – either m2.bio_close or m2.bio_noclose
@@ -634,19 +634,19 @@ m2.bio_close to override this default.

-set_tlsext_host_name(name)[source]
+set_tlsext_host_name(name)[source]

Set the requested hostname for the SNI (Server Name Indication) extension.

-setblocking(mode)[source]
-

Set this connection’s underlying socket to _mode_.

+setblocking(mode)[source] +

Set this connection’s underlying socket to _mode_.

Set blocking or non-blocking mode of the socket: if flag is 0, the socket is set to non-blocking, else to blocking mode. Initially all sockets are in blocking mode. In non-blocking mode, -if a recv() call doesn’t find any data, or if a send() call can’t +if a recv() call doesn’t find any data, or if a send() call can’t immediately dispose of the data, a error exception is raised; in blocking mode, the calls block until they can proceed. s.setblocking(0) is equivalent to s.settimeout(0.0); @@ -655,7 +655,7 @@ s.setblocking(1) is equivalent to s.settimeout(None).

-Parameters:mode – new mode to be set +Parameters:mode – new mode to be set @@ -663,16 +663,16 @@ s.setblocking(1) is equivalent to s.settimeout(None).

-setsockopt(level, optname, value=None)[source]
+setsockopt(level, optname, value=None)[source]

Set the value of the given socket option.

Parameters:
    -
  • level – same as with getsockopt() above
  • -
  • optname – same as with getsockopt() above
  • -
  • value – an integer or a string representing a buffer. In +
  • level – same as with getsockopt() above
  • +
  • optname – same as with getsockopt() above
  • +
  • value – an integer or a string representing a buffer. In the latter case it is up to the caller to ensure that the string contains the proper bits (see the optional built-in module struct for a way to @@ -689,63 +689,63 @@ encode C structures as strings).
  • -settimeout(timeout)[source]
    -

    Set this connection’s underlying socket’s timeout to _timeout_.

    +settimeout(timeout)[source] +

    Set this connection’s underlying socket’s timeout to _timeout_.

    -setup_addr(addr)[source]
    +setup_addr(addr)[source]
    -setup_ssl()[source]
    +setup_ssl()[source]
    -shutdown(how)[source]
    +shutdown(how)[source]
    -ssl_get_error(ret)[source]
    +ssl_get_error(ret)[source]
    -verify_ok()[source]
    +verify_ok()[source]
    -write(data)[source]
    +write(data)[source]
    -

    Context Module

    +

    Context Module

    -M2Crypto.SSL.Context.ctxmap()[source]
    +M2Crypto.SSL.Context.ctxmap()[source]
    -class M2Crypto.SSL.Context.Context(protocol='tls', weak_crypto=None, post_connection_check=None)[source]
    -

    ‘Context’ for SSL connections.

    +class M2Crypto.SSL.Context.Context(protocol='tls', weak_crypto=None, post_connection_check=None)[source] +

    ‘Context’ for SSL connections.

    -add_session(session)[source]
    +add_session(session)[source]

    Add the session to the context.

    - +
    Parameters:session – the session to be added.
    Parameters:session – the session to be added.
    Returns:
    0 The operation failed. It was tried to add the same
    @@ -760,26 +760,26 @@ encode C structures as strings).
    -close()[source]
    +close()[source]
    -get_allow_unknown_ca()[source]
    -

    Get the context’s setting that accepts/rejects a peer -certificate if the certificate’s CA is unknown.

    +get_allow_unknown_ca()[source] +

    Get the context’s setting that accepts/rejects a peer +certificate if the certificate’s CA is unknown.

    FIXME 2Bconverted to bool

    -get_cert_store()[source]
    +get_cert_store()[source]

    Get the certificate store associated with this context.

    - @@ -788,7 +788,7 @@ to be valid once the context goes away or is changed.
    -get_session_cache_mode()[source]
    +get_session_cache_mode()[source]

    Gets the current session caching.

    The mode is set to m2.SSL_SESS_CACHE_* constants.

    Warning :The store is NOT refcounted, and as such can not be relied +
    Warning:The store is NOT refcounted, and as such can not be relied to be valid once the context goes away or is changed.
    @@ -803,7 +803,7 @@ to be valid once the context goes away or is changed.
    -get_session_timeout()[source]
    +get_session_timeout()[source]

    Get current session timeout.

    Whenever a new session is created, it is assigned a maximum lifetime. This lifetime is specified by storing the creation @@ -835,29 +835,29 @@ seconds.

    -get_verify_depth()[source]
    +get_verify_depth()[source]

    Returns the verification mode currently set in the SSL Context.

    -get_verify_mode()[source]
    +get_verify_mode()[source]
    -load_cert(certfile, keyfile=None, callback=<function passphrase_callback at 0x1faa848>)[source]
    +load_cert(certfile, keyfile=None, callback=<function passphrase_callback>)[source]

    Load certificate and private key into the context.

    -sign_asn1(digest)[source]
    +sign_asn1(digest)[source]
    -verify(digest, r, s)[source]
    +verify(digest, r, s)[source]

    Verify a newly calculated digest against the signature values r and s.

    Parameters:
      -
    • certfile – File that contains the PEM-encoded certificate.
    • -
    • keyfile – File that contains the PEM-encoded private key. +
    • certfile – File that contains the PEM-encoded certificate.
    • +
    • keyfile – File that contains the PEM-encoded private key. Default value of None indicates that the private key -is to be found in ‘certfile’.
    • -
    • callback – Callable object to be invoked if the private key is +is to be found in ‘certfile’.
    • +
    • callback – Callable object to be invoked if the private key is passphrase-protected. Default callback provides a simple terminal-style input for the passphrase.
    @@ -869,19 +869,19 @@ simple terminal-style input for the passphrase.
    -load_cert_chain(certchainfile, keyfile=None, callback=<function passphrase_callback at 0x1faa848>)[source]
    +load_cert_chain(certchainfile, keyfile=None, callback=<function passphrase_callback>)[source]

    Load certificate chain and private key into the context.

    -set_tmp_rsa_callback(callback=None)[source]
    +set_tmp_rsa_callback(callback=None)[source]

    Sets the callback function to be used when a temporary/ephemeral RSA key is required.

    -set_verify(mode, depth, callback=None)[source]
    +set_verify(mode, depth, callback=None)[source]

    Set verify options. Most applications will need to call this method with the right options to make a secure SSL connection.

    Parameters:
      -
    • certchainfile – File object containing the PEM-encoded +
    • certchainfile – File object containing the PEM-encoded certificate chain.
    • -
    • keyfile – File object containing the PEM-encoded private +
    • keyfile – File object containing the PEM-encoded private key. Default value of None indicates that the -private key is to be found in ‘certchainfile’.
    • -
    • callback – Callable object to be invoked if the private key +private key is to be found in ‘certchainfile’.
    • +
    • callback – Callable object to be invoked if the private key is passphrase-protected. Default callback provides a simple terminal-style input for the passphrase.
    • @@ -894,14 +894,14 @@ passphrase.
      -load_client_CA(cafile)
      +load_client_CA(cafile)

      Load CA certs into the context. These CA certs are sent to the peer during SSLv3 certificate request.

      - @@ -910,14 +910,14 @@ certificates concatenated together.
      -load_client_ca(cafile)
      +load_client_ca(cafile)

      Load CA certs into the context. These CA certs are sent to the peer during SSLv3 certificate request.

      Parameters:cafile – File object containing one or more PEM-encoded CA +
      Parameters:cafile – File object containing one or more PEM-encoded CA certificates concatenated together.
      - @@ -926,18 +926,18 @@ certificates concatenated together.
      -load_verify_info(cafile=None, capath=None)
      +load_verify_info(cafile=None, capath=None)

      Load CA certs into the context.

      -

      These CA certs are used during verification of the peer’s +

      These CA certs are used during verification of the peer’s certificate.

      Parameters:cafile – File object containing one or more PEM-encoded CA +
      Parameters:cafile – File object containing one or more PEM-encoded CA certificates concatenated together.
      @@ -958,18 +958,18 @@ Check the error stack to find out the reason.

      -load_verify_locations(cafile=None, capath=None)[source]
      +load_verify_locations(cafile=None, capath=None)[source]

      Load CA certs into the context.

      -

      These CA certs are used during verification of the peer’s +

      These CA certs are used during verification of the peer’s certificate.

      Parameters:
        -
      • cafile – File containing one or more PEM-encoded CA +
      • cafile – File containing one or more PEM-encoded CA certificates concatenated together.
      • -
      • capath – Directory containing PEM-encoded CA certificates +
      • capath – Directory containing PEM-encoded CA certificates (one certificate per file).
      @@ -990,18 +990,18 @@ Check the error stack to find out the reason.

      -m2_ssl_ctx_free()
      +m2_ssl_ctx_free()
      -remove_session(session)[source]
      +remove_session(session)[source]

      Remove the session from the context.

      Parameters:
        -
      • cafile – File containing one or more PEM-encoded CA +
      • cafile – File containing one or more PEM-encoded CA certificates concatenated together.
      • -
      • capath – Directory containing PEM-encoded CA certificates +
      • capath – Directory containing PEM-encoded CA certificates (one certificate per file).
      - +
      -set_tmp_rsa(rsa)[source]
      +set_tmp_rsa(rsa)[source]

      Load ephemeral RSA key into the context.

      Parameters:session – the session to be removed.
      Parameters:session – the session to be removed.
      Returns:
      0 The operation failed. The session was not found in
      @@ -1016,14 +1016,14 @@ Check the error stack to find out the reason.

      -set_allow_unknown_ca(ok)[source]
      +set_allow_unknown_ca(ok)[source]

      Set the context to accept/reject a peer certificate if the -certificate’s CA is unknown.

      +certificate’s CA is unknown.

      - +
      Parameters:ok – True to accept, False to reject.
      Parameters:ok – True to accept, False to reject.
      @@ -1031,13 +1031,13 @@ certificate’s CA is unknown.

      -set_cipher_list(cipher_list)[source]
      +set_cipher_list(cipher_list)[source]

      Sets the list of available ciphers.

      -
      -set_client_CA_list_from_file(cafile)[source]
      +set_client_CA_list_from_file(cafile)[source]

      Load CA certs into the context. These CA certs are sent to the peer during SSLv3 certificate request.

      Parameters:cipher_list – The format of the string is described in +
      Parameters:cipher_list – The format of the string is described in ciphers(1).
      Returns:1 if any cipher could be selected and 0 on complete @@ -1049,14 +1049,14 @@ failure.
      - @@ -1065,14 +1065,14 @@ certificates concatenated together.
      -set_default_verify_paths()[source]
      +set_default_verify_paths()[source]

      Specifies that the default locations from which CA certs are loaded should be used.

      There is one default directory and one default file. The default -CA certificates directory is called “certs” in the default +CA certificates directory is called “certs” in the default OpenSSL directory. Alternatively the SSL_CERT_DIR environment variable can be defined to override this location. The default -CA certificates file is called “cert.pem” in the default OpenSSL +CA certificates file is called “cert.pem” in the default OpenSSL directory. Alternatively the SSL_CERT_FILE environment variable can be defined to override this location.

      @@ -1086,7 +1086,7 @@ can be defined to override this location.

      -set_info_callback(callback=<function ssl_info_callback at 0x202cf50>)[source]
      +set_info_callback(callback=<function ssl_info_callback>)[source]

      Set a callback function to get state information.

      It can be used to get state information about the SSL connections that are created from this context.

      @@ -1094,7 +1094,7 @@ connections that are created from this context.

      - @@ -1103,7 +1103,7 @@ information to stderr.
      -set_options(op)[source]
      +set_options(op)[source]

      Adds the options set via bitmask in options to the Context.

      !!! Options already set before are not cleared!

      The behaviour of the SSL library can be changed by setting @@ -1122,7 +1122,7 @@ affect the settings.

      - @@ -1133,14 +1133,14 @@ SSL_CTX_set_options(3) manpage.
      -set_session_cache_mode(mode)[source]
      +set_session_cache_mode(mode)[source]

      Enables/disables session caching.

      The mode is set by using m2.SSL_SESS_CACHE_* constants.

      Parameters:cafile – File object containing one or more PEM-encoded CA +
      Parameters:cafile – File object containing one or more PEM-encoded CA certificates concatenated together.
      Parameters:callback – Callback function. The default prints +
      Parameters:callback – Callback function. The default prints information to stderr.
      Parameters:op – bitmask of additional options specified in +
      Parameters:op – bitmask of additional options specified in SSL_CTX_set_options(3) manpage.
      Returns:the new options bitmask after adding options.
      - + @@ -1150,13 +1150,13 @@ SSL_CTX_set_options(3) manpage.
      -set_session_id_ctx(id)[source]
      +set_session_id_ctx(id)[source]

      Sets the session id for the SSL.Context w/in a session can be reused.

      Parameters:mode – new mode value.
      Parameters:mode – new mode value.
      Returns:the previously set cache mode value.
      -
      -set_session_timeout(timeout)[source]
      +set_session_timeout(timeout)[source]

      Set new session timeout.

      See self.get_session_timeout() for explanation of the session timeouts.

      @@ -1183,7 +1183,7 @@ timeouts.

      - + @@ -1193,13 +1193,13 @@ timeouts.

      -set_tmp_dh(dhpfile)[source]
      +set_tmp_dh(dhpfile)[source]

      Load ephemeral DH parameters into the context.

      Parameters:id – Sessions are generated within a certain context. When +
      Parameters:id – Sessions are generated within a certain context. When exporting/importing sessions with i2d_SSL_SESSION/d2i_SSL_SESSION it would be possible, to re-import a session generated from another context @@ -1175,7 +1175,7 @@ and/or service name.
      Parameters:timeout – new timeout value.
      Parameters:timeout – new timeout value.
      Returns:the previously set timeout value.
      - @@ -1208,13 +1208,13 @@ DH parameters.
      -set_tmp_dh_callback(callback=None)[source]
      +set_tmp_dh_callback(callback=None)[source]

      Sets the callback function for SSL.Context.

      Parameters:dhpfile – Filename of the file containing the PEM-encoded +
      Parameters:dhpfile – Filename of the file containing the PEM-encoded DH parameters.
      - +
      Parameters:callback – Callable to be used when a DH parameters are required.
      Parameters:callback – Callable to be used when a DH parameters are required.
      @@ -1222,13 +1222,13 @@ DH parameters.
      - +
      Parameters:rsa – RSA.RSA instance.
      Parameters:rsa – RSA.RSA instance.
      @@ -1236,14 +1236,14 @@ DH parameters.
    @@ -1251,12 +1251,12 @@ method with the right options to make a secure SSL connection.

    @@ -1269,98 +1269,98 @@ verification checks.
    -M2Crypto.SSL.Context.map()
    +M2Crypto.SSL.Context.map()
    -

    SSLServer Module

    +

    SSLServer Module

    -class M2Crypto.SSL.SSLServer.SSLServer(server_address, RequestHandlerClass, ssl_context, bind_and_activate=True)[source]
    -

    Bases: SocketServer.TCPServer

    +class M2Crypto.SSL.SSLServer.SSLServer(server_address, RequestHandlerClass, ssl_context, bind_and_activate=True)[source] +

    Bases: SocketServer.TCPServer

    -handle_error(request, client_address)[source]
    +handle_error(request, client_address)[source]
    -handle_request()[source]
    +handle_request()[source]
    -class M2Crypto.SSL.SSLServer.ForkingSSLServer(server_address, RequestHandlerClass, ssl_context, bind_and_activate=True)[source]
    -

    Bases: SocketServer.ForkingMixIn, M2Crypto.SSL.SSLServer.SSLServer

    +class M2Crypto.SSL.SSLServer.ForkingSSLServer(server_address, RequestHandlerClass, ssl_context, bind_and_activate=True)[source] +

    Bases: SocketServer.ForkingMixIn, M2Crypto.SSL.SSLServer.SSLServer

    -class M2Crypto.SSL.SSLServer.ThreadingSSLServer(server_address, RequestHandlerClass, ssl_context, bind_and_activate=True)[source]
    -

    Bases: SocketServer.ThreadingMixIn, M2Crypto.SSL.SSLServer.SSLServer

    +class M2Crypto.SSL.SSLServer.ThreadingSSLServer(server_address, RequestHandlerClass, ssl_context, bind_and_activate=True)[source] +

    Bases: SocketServer.ThreadingMixIn, M2Crypto.SSL.SSLServer.SSLServer

    -

    Session Module

    +

    Session Module

    SSL Session

    Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved.

    -class M2Crypto.SSL.Session.Session(session, _pyfree=0)[source]
    +class M2Crypto.SSL.Session.Session(session, _pyfree=0)[source]
    -as_der()[source]
    +as_der()[source]
    -as_text()[source]
    +as_text()[source]
    -get_time()[source]
    +get_time()[source]
    -get_timeout()[source]
    +get_timeout()[source]
    -m2_ssl_session_free()
    +m2_ssl_session_free()
    -set_time(t)[source]
    +set_time(t)[source]
    -set_timeout(t)[source]
    +set_timeout(t)[source]
    -write_bio(bio)[source]
    +write_bio(bio)[source]
    -M2Crypto.SSL.Session.load_session(pemfile)[source]
    +M2Crypto.SSL.Session.load_session(pemfile)[source]
    -

    TwistedProtocolWrapper Module

    +

    TwistedProtocolWrapper Module

    Make Twisted use M2Crypto for SSL

    Copyright (c) 2004-2007 Open Source Applications Foundation. All rights reserved.

    @@ -1369,14 +1369,14 @@ BEEN FINISHED. THE FURTHER WORK WILL BE DONE WHEN THE STATUS OF TWISTED IN THE PYTHON 3 (AND ASYNCIO) WORLD WILL BE CLEAR.

    -M2Crypto.SSL.TwistedProtocolWrapper.connectSSL(host, port, factory, contextFactory, timeout=30, bindAddress=None, reactor=<twisted.internet.epollreactor.EPollReactor object at 0x4996190>, postConnectionCheck=<M2Crypto.SSL.Checker.Checker instance at 0x3f0bc68>)[source]
    +M2Crypto.SSL.TwistedProtocolWrapper.connectSSL(host, port, factory, contextFactory, timeout=30, bindAddress=None, reactor=<twisted.internet.epollreactor.EPollReactor object>, postConnectionCheck=<M2Crypto.SSL.Checker.Checker instance>)[source]

    A convenience function to start an SSL/TLS connection using Twisted.

    See IReactorSSL interface in Twisted.

    -M2Crypto.SSL.TwistedProtocolWrapper.connectTCP(host, port, factory, timeout=30, bindAddress=None, reactor=<twisted.internet.epollreactor.EPollReactor object at 0x4996190>, postConnectionCheck=<M2Crypto.SSL.Checker.Checker instance at 0x3f0b3f8>)[source]
    +M2Crypto.SSL.TwistedProtocolWrapper.connectTCP(host, port, factory, timeout=30, bindAddress=None, reactor=<twisted.internet.epollreactor.EPollReactor object>, postConnectionCheck=<M2Crypto.SSL.Checker.Checker instance>)[source]

    A convenience function to start a TCP connection using Twisted.

    NOTE: You must call startTLS(ctx) to go into SSL/TLS mode.

    See IReactorTCP interface in Twisted.

    @@ -1384,14 +1384,14 @@ IN THE PYTHON 3 (AND ASYNCIO) WORLD WILL BE CLEAR.

    -M2Crypto.SSL.TwistedProtocolWrapper.listenSSL(port, factory, contextFactory, backlog=5, interface='', reactor=<twisted.internet.epollreactor.EPollReactor object at 0x4996190>, postConnectionCheck=<function _alwaysSucceedsPostConnectionCheck at 0x49948c0>)[source]
    +M2Crypto.SSL.TwistedProtocolWrapper.listenSSL(port, factory, contextFactory, backlog=5, interface='', reactor=<twisted.internet.epollreactor.EPollReactor object>, postConnectionCheck=<function _alwaysSucceedsPostConnectionCheck>)[source]

    A convenience function to listen for SSL/TLS connections using Twisted.

    See IReactorSSL interface in Twisted.

    -M2Crypto.SSL.TwistedProtocolWrapper.listenTCP(port, factory, backlog=5, interface='', reactor=<twisted.internet.epollreactor.EPollReactor object at 0x4996190>, postConnectionCheck=None)[source]
    +M2Crypto.SSL.TwistedProtocolWrapper.listenTCP(port, factory, backlog=5, interface='', reactor=<twisted.internet.epollreactor.EPollReactor object>, postConnectionCheck=None)[source]

    A convenience function to listen for TCP connections using Twisted.

    NOTE: You must call startTLS(ctx) to go into SSL/TLS mode.

    See IReactorTCP interface in Twisted.

    @@ -1399,106 +1399,106 @@ IN THE PYTHON 3 (AND ASYNCIO) WORLD WILL BE CLEAR.

    -class M2Crypto.SSL.TwistedProtocolWrapper.TLSProtocolWrapper(factory, wrappedProtocol, startPassThrough, client, contextFactory, postConnectionCheck)[source]
    -

    Bases: twisted.protocols.policies.ProtocolWrapper

    +class M2Crypto.SSL.TwistedProtocolWrapper.TLSProtocolWrapper(factory, wrappedProtocol, startPassThrough, client, contextFactory, postConnectionCheck)[source] +

    Bases: twisted.protocols.policies.ProtocolWrapper

    A SSL/TLS protocol wrapper to be used with Twisted. Typically you would not use this class directly. Use connectTCP, connectSSL, listenTCP, listenSSL functions defined above, which will hook in this class.

    -clear()[source]
    +clear()[source]

    Clear this instance, after which it is ready for reuse.

    -connectionLost(reason)[source]
    +connectionLost(reason)[source]
    -connectionMade()[source]
    +connectionMade()[source]
    -dataReceived(data)[source]
    +dataReceived(data)[source]
    -loseConnection()[source]
    +loseConnection()[source]
    -startTLS(ctx)[source]
    +startTLS(ctx)[source]

    Start SSL/TLS. If this is not called, this instance just passes data through untouched.

    -write(data)[source]
    +write(data)[source]
    -writeSequence(data)[source]
    +writeSequence(data)[source]
    -

    cb Module

    +

    cb Module

    -M2Crypto.SSL.cb.ssl_verify_callback_stub(ssl_ctx_ptr, x509_ptr, errnum, errdepth, ok)[source]
    +M2Crypto.SSL.cb.ssl_verify_callback_stub(ssl_ctx_ptr, x509_ptr, errnum, errdepth, ok)[source]
    -M2Crypto.SSL.cb.ssl_verify_callback(ssl_ctx_ptr, x509_ptr, errnum, errdepth, ok)[source]
    +M2Crypto.SSL.cb.ssl_verify_callback(ssl_ctx_ptr, x509_ptr, errnum, errdepth, ok)[source]
    -M2Crypto.SSL.cb.ssl_verify_callback_allow_unknown_ca(ok, store)[source]
    +M2Crypto.SSL.cb.ssl_verify_callback_allow_unknown_ca(ok, store)[source]
    -M2Crypto.SSL.cb.ssl_info_callback(where, ret, ssl_ptr)[source]
    +M2Crypto.SSL.cb.ssl_info_callback(where, ret, ssl_ptr)[source]
    -

    ssl_dispatcher Module

    +

    ssl_dispatcher Module

    -class M2Crypto.SSL.ssl_dispatcher.ssl_dispatcher(sock=None, map=None)[source]
    -

    Bases: asyncore.dispatcher

    +class M2Crypto.SSL.ssl_dispatcher.ssl_dispatcher(sock=None, map=None)[source] +

    Bases: asyncore.dispatcher

    -connect(addr)[source]
    +connect(addr)[source]
    -create_socket(ssl_context)[source]
    +create_socket(ssl_context)[source]
    -recv(buffer_size=4096)[source]
    +recv(buffer_size=4096)[source]

    Receive data over SSL.

    -send(buffer)[source]
    +send(buffer)[source]

    Send data over SSL.

    @@ -1506,28 +1506,28 @@ through untouched.

    -

    timeout Module

    +

    timeout Module

    Support for SSL socket timeouts.

    Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved.

    Copyright 2008 Heikki Toivonen. All rights reserved.

    -class M2Crypto.SSL.timeout.timeout(sec=600, microsec=0)[source]
    +class M2Crypto.SSL.timeout.timeout(sec=600, microsec=0)[source]
    -pack()[source]
    +pack()[source]
    -M2Crypto.SSL.timeout.struct_to_timeout(binstr)[source]
    +M2Crypto.SSL.timeout.struct_to_timeout(binstr)[source]
    -M2Crypto.SSL.timeout.struct_size()[source]
    +M2Crypto.SSL.timeout.struct_size()[source]
    @@ -1537,70 +1537,70 @@ through untouched.

    -
    + - + + + + \ No newline at end of file diff --git a/doc/html/M2Crypto.html b/doc/html/M2Crypto.html index f3775c2..eb54dcf 100644 --- a/doc/html/M2Crypto.html +++ b/doc/html/M2Crypto.html @@ -1,98 +1,84 @@ - - - - M2Crypto Package — M2Crypto documentation - - + M2Crypto Package — M2Crypto documentation + - - - - + + + + + + + + + + - +
    -
    +

    M2Crypto Package

    -

    M2Crypto Package

    +

    M2Crypto Package

    -

    ASN1 Module

    +

    ASN1 Module

    -class M2Crypto.ASN1.ASN1_Integer(asn1int, _pyfree=0)[source]
    +class M2Crypto.ASN1.ASN1_Integer(asn1int, _pyfree=0)[source]
    -m2_asn1_integer_free()
    +m2_asn1_integer_free()
    -class M2Crypto.ASN1.ASN1_Object(asn1obj, _pyfree=0)[source]
    +class M2Crypto.ASN1.ASN1_Object(asn1obj, _pyfree=0)[source]
    -m2_asn1_object_free()
    +m2_asn1_object_free()
    -class M2Crypto.ASN1.ASN1_String(asn1str, _pyfree=0)[source]
    +class M2Crypto.ASN1.ASN1_String(asn1str, _pyfree=0)[source]
    -as_text(flags=0)[source]
    -

    output an ASN1_STRING structure according to the set flags.

    +as_text(flags=0)[source] +

    Output an ASN1_STRING structure according to the set flags.

    Parameters:
      -
    • mode – The verification mode to use. Typically at least +
    • mode – The verification mode to use. Typically at least SSL.verify_peer is used. Clients would also typically add SSL.verify_fail_if_no_peer_cert.
    • -
    • depth – The maximum allowed depth of the certificate chain +
    • depth – The maximum allowed depth of the certificate chain returned by the peer.
    • -
    • callback – Callable that can be used to specify custom +
    • callback – Callable that can be used to specify custom verification checks.
    - @@ -104,38 +90,38 @@ manpage for their meaning.
    -m2_asn1_string_free()
    +m2_asn1_string_free()
    -class M2Crypto.ASN1.ASN1_TIME(asn1_time=None, _pyfree=0, asn1_utctime=None)[source]
    +class M2Crypto.ASN1.ASN1_TIME(asn1_time=None, _pyfree=0, asn1_utctime=None)[source]
    -get_datetime()[source]
    +get_datetime()[source]
    -m2_asn1_time_free()
    +m2_asn1_time_free()
    -set_datetime(date)[source]
    +set_datetime(date)[source]
    -set_string(string)[source]
    +set_string(string)[source]

    Set time from UTC string.

    -set_time(time)[source]
    +set_time(time)[source]

    Set time from seconds since epoch (int).

    @@ -143,110 +129,110 @@ manpage for their meaning.
    -M2Crypto.ASN1.ASN1_UTCTIME
    -

    alias of ASN1_TIME

    +M2Crypto.ASN1.ASN1_UTCTIME +

    alias of ASN1_TIME

    -class M2Crypto.ASN1.LocalTimezone[source]
    -

    Bases: datetime.tzinfo

    -

    Localtimezone from datetime manual

    +class M2Crypto.ASN1.LocalTimezone[source] +

    Bases: datetime.tzinfo

    +

    Localtimezone from datetime manual.

    -dst(dt)[source]
    +dst(dt)[source]
    -tzname(dt)[source]
    +tzname(dt)[source]
    -utcoffset(dt)[source]
    +utcoffset(dt)[source]
    -

    AuthCookie Module

    +

    AuthCookie Module

    -class M2Crypto.AuthCookie.AuthCookie(expiry, data, dough, mac)[source]
    +class M2Crypto.AuthCookie.AuthCookie(expiry, data, dough, mac)[source]
    -data()[source]
    +data()[source]

    Return the data portion of the cookie.

    -expiry()[source]
    -

    Return the cookie’s expiry time.

    +expiry()[source] +

    Return the cookie’s expiry time.

    -headerValue()[source]
    +headerValue()[source]
    -isExpired()[source]
    +isExpired()[source]

    Return 1 if the cookie has expired, 0 otherwise.

    -mac()[source]
    -

    Return the cookie’s MAC.

    +mac()[source] +

    Return the cookie’s MAC.

    -name()[source]
    +name()[source]
    -output()[source]
    -

    Return the cookie’s output in “Set-Cookie” format.

    +output(header='Set-Cookie:')[source] +

    Return the cookie’s output in “Set-Cookie” format.

    -value()[source]
    -

    Return the cookie’s output minus the “Set-Cookie: ” portion.

    +value()[source] +

    Return the cookie’s output minus the “Set-Cookie: ” portion.

    -class M2Crypto.AuthCookie.AuthCookieJar[source]
    +class M2Crypto.AuthCookie.AuthCookieJar[source]
    -isGoodCookie(cookie)[source]
    +isGoodCookie(cookie)[source]
    -isGoodCookieString(cookie_str, _debug=False)[source]
    +isGoodCookieString(cookie_str, _debug=False)[source]
    -makeCookie(expiry, data)[source]
    +makeCookie(expiry, data)[source]

    Make a cookie

    Parameters:flags – determine the format of the output by using +
    Parameters:flags – determine the format of the output by using predetermined constants, see ASN1_STRING_print_ex(3) manpage for their meaning.
    @@ -261,46 +247,47 @@ manpage for their meaning.
    -M2Crypto.AuthCookie.mix(expiry, data, format='exp=%f&data=%s&digest=')[source]
    +M2Crypto.AuthCookie.mix(expiry, data, format='exp=%f&data=%s&digest=')[source]
    -M2Crypto.AuthCookie.unmix(dough, regex=<_sre.SRE_Pattern object at 0x1ec24a0>)[source]
    +M2Crypto.AuthCookie.unmix(dough, regex=<_sre.SRE_Pattern object>)[source]
    -M2Crypto.AuthCookie.unmix3(dough, regex=<_sre.SRE_Pattern object at 0x1ec24a0>)[source]
    +M2Crypto.AuthCookie.unmix3(dough, regex=<_sre.SRE_Pattern object>)[source]
    -

    BIO Module

    +

    BIO Module

    -class M2Crypto.BIO.BIO(bio=None, _pyfree=0, _close_cb=None)[source]
    -

    Bases: object

    +class M2Crypto.BIO.BIO(bio=None, _pyfree=0, _close_cb=None)[source] +

    Bases: object

    Abstract object interface to the BIO API.

    -bio_ptr()
    +bio_ptr()
    -close()[source]
    +close()[source]
    -fileno()[source]
    +fileno()[source]
    -flush()[source]
    -
    Parameters:
      -
    • expiry – expiration time (float in seconds)
    • -
    • data – cookie content
    • +
    • expiry – expiration time (float in seconds)
    • +
    • data – cookie content
    +flush()[source] +

    Flush the buffers.

    +
    @@ -312,73 +299,79 @@ manpage for their meaning.
    -m2_bio_free()
    +m2_bio_free()
    -read(size=None)[source]
    +read(size=None)[source]
    -readable()[source]
    +readable()[source]
    -readline(size=4096)[source]
    +readline(size=4096)[source]
    -readlines(sizehint='ignored')[source]
    +readlines(sizehint='ignored')[source]
    -reset()[source]
    -

    Sets the bio to its initial state -:return: 1 for success, and 0 or -1 for failure

    +reset()[source] +

    Set the bio to its initial state.

    +
    +++ + + + +
    Returns:1 for success, and 0 or -1 for failure
    -seek(off)[source]
    +seek(off)[source]

    Seek to the specified absolute offset.

    -should_read()[source]
    -

    Returns whether the cause of the condition is the bio -should read more data

    +should_read()[source] +

    Should we read more data?

    -should_retry()[source]
    +should_retry()[source]

    Can the call be attempted again, or was there an error ie do_handshake

    -should_write()[source]
    -

    Returns whether the cause of the condition is the bio -should write more data

    +should_write()[source] +

    Should we write more data?

    -tell()[source]
    +tell()[source]

    Return the current offset.

    -write(data)[source]
    -
    +write(data)[source] +

    Write data to BIO.

    +
    @@ -391,108 +384,120 @@ should write more data

    -write_close()[source]
    +write_close()[source]
    -writeable()[source]
    +writeable()[source]
    -exception M2Crypto.BIO.BIOError[source]
    -

    Bases: exceptions.Exception

    +exception M2Crypto.BIO.BIOError[source] +

    Bases: exceptions.Exception

    -class M2Crypto.BIO.CipherStream(obio)[source]
    -

    Bases: M2Crypto.BIO.BIO

    +class M2Crypto.BIO.CipherStream(obio)[source] +

    Bases: M2Crypto.BIO.BIO

    Object interface to BIO_f_cipher.

    -SALT_LEN = 8
    +SALT_LEN = 8
    -close()[source]
    +close()[source]
    -m2_bio_free()
    +m2_bio_free()
    -m2_bio_pop()
    +m2_bio_pop()
    -set_cipher(algo, key, iv, op)[source]
    +set_cipher(algo, key, iv, op)[source]
    -write_close()[source]
    +write_close()[source]
    -class M2Crypto.BIO.File(pyfile, close_pyfile=1)[source]
    -

    Bases: M2Crypto.BIO.BIO

    -

    Object interface to BIO_s_pyfd

    -

    This class interfaces Python to OpenSSL functions that expect BIO *. For -general file manipulation in Python, use Python’s builtin file object.

    +class M2Crypto.BIO.File(pyfile, close_pyfile=1, mode='rb')[source] +

    Bases: M2Crypto.BIO.BIO

    +

    Object interface to BIO_s_pyfd.

    +

    This class interfaces Python to OpenSSL functions that expect BIO. For +general file manipulation in Python, use Python’s builtin file object.

    -close()[source]
    +close()[source] +
    + +
    +
    +flush()[source]
    -reset()[source]
    -

    Sets the bio to its initial state -:return: 0 for success, and -1 for failure

    +reset()[source] +

    Set the bio to its initial state.

    +
    +++ + + + +
    Returns:0 for success, and -1 for failure
    -class M2Crypto.BIO.IOBuffer(under_bio, mode='rwb', _pyfree=1)[source]
    -

    Bases: M2Crypto.BIO.BIO

    +class M2Crypto.BIO.IOBuffer(under_bio, mode='rwb', _pyfree=1)[source] +

    Bases: M2Crypto.BIO.BIO

    Object interface to BIO_f_buffer.

    -

    Its principal function is to be BIO_push()’ed on top of a BIO_f_ssl, so +

    Its principal function is to be BIO_push()’ed on top of a BIO_f_ssl, so that makefile() of said underlying SSL socket works.

    -close()[source]
    +close()[source]
    -m2_bio_free()
    +m2_bio_free()
    -m2_bio_pop()
    +m2_bio_pop()
    -class M2Crypto.BIO.MemoryBuffer(data=None)[source]
    -

    Bases: M2Crypto.BIO.BIO

    +class M2Crypto.BIO.MemoryBuffer(data=None)[source] +

    Bases: M2Crypto.BIO.BIO

    Object interface to BIO_s_mem.

    Empirical testing suggests that this class performs less well than cStringIO, because cStringIO is implemented in C, whereas this class @@ -501,39 +506,39 @@ cStringIO for regular work and convert said cStringIO object to a MemoryBuffer object only when necessary.

    -close()
    +close()
    -getvalue(size=0)
    +getvalue(size=0)
    -read(size=0)[source]
    +read(size=0)[source]
    -read_all(size=0)
    +read_all(size=0)
    -write_close()[source]
    +write_close()[source]
    -class M2Crypto.BIO.SSLBio(_pyfree=1)[source]
    -

    Bases: M2Crypto.BIO.BIO

    -

    Object interface to BIO_f_ssl

    +class M2Crypto.BIO.SSLBio(_pyfree=1)[source] +

    Bases: M2Crypto.BIO.BIO

    +

    Object interface to BIO_f_ssl.

    -do_handshake()[source]
    +do_handshake()[source]

    Do the handshake.

    Return 1 if the handshake completes Return 0 or a negative number if there is a problem

    @@ -541,7 +546,7 @@ Return 0 or a negative number if there is a problem

    -set_ssl(conn, close_flag=0)[source]
    +set_ssl(conn, close_flag=0)[source]

    Sets the bio to the SSL pointer which is contained in the connection object.

    @@ -550,26 +555,26 @@ contained in the connection object.

    -M2Crypto.BIO.openfile(filename, mode='rb')[source]
    +M2Crypto.BIO.openfile(filename, mode='rb')[source]
    -

    BN Module

    +

    BN Module

    -M2Crypto.BN.rand(bits, top=-1, bottom=0)[source]
    +M2Crypto.BN.rand(bits, top=-1, bottom=0)[source]

    Generate cryptographically strong random number.

    @@ -579,13 +584,13 @@ bits will be 1.
    -M2Crypto.BN.rand_range(range)[source]
    +M2Crypto.BN.rand_range(range)[source]

    Generate a random number in a range.

    Parameters:
      -
    • bits – Length of random number in bits.
    • -
    • top – If -1, the most significant bit can be 0. If 0, the most +
    • bits – Length of random number in bits.
    • +
    • top – If -1, the most significant bit can be 0. If 0, the most significant bit is 1, and if 1, the two most significant bits will be 1.
    • -
    • bottom – If bottom is true, the number will be odd.
    • +
    • bottom – If bottom is true, the number will be odd.
    - + @@ -595,14 +600,14 @@ bits will be 1.
    -M2Crypto.BN.randfname(length)[source]
    +M2Crypto.BN.randfname(length)[source]

    Return a random filename, which is simply a string where all the characters are from the set [a-zA-Z0-9].

    Parameters:range – Upper limit for range.
    Parameters:range – Upper limit for range.
    Returns:A random number in the range [0, range)
    - + @@ -612,75 +617,74 @@ the characters are from the set [a-zA-Z0-9].

    -

    DH Module

    +

    DH Module

    -class M2Crypto.DH.DH(dh, _pyfree=0)[source]
    -

    Object interface to the Diffie-Hellman key exchange -protocol.

    +class M2Crypto.DH.DH(dh, _pyfree=0)[source] +

    Object interface to the Diffie-Hellman key exchange protocol.

    -check_params()[source]
    +check_params()[source]
    -compute_key(pubkey)[source]
    +compute_key(pubkey)[source]
    -gen_key()[source]
    +gen_key()[source]
    -m2_dh_free()
    +m2_dh_free()
    -print_params(bio)[source]
    +print_params(bio)[source]
    -exception M2Crypto.DH.DHError[source]
    -

    Bases: exceptions.Exception

    +exception M2Crypto.DH.DHError[source] +

    Bases: exceptions.Exception

    -M2Crypto.DH.gen_params(plen, g, callback=<function genparam_callback at 0x1faa758>)[source]
    +M2Crypto.DH.gen_params(plen, g, callback=<function genparam_callback>)[source]
    -M2Crypto.DH.load_params(file)[source]
    +M2Crypto.DH.load_params(file)[source]
    -M2Crypto.DH.load_params_bio(bio)[source]
    +M2Crypto.DH.load_params_bio(bio)[source]
    -M2Crypto.DH.set_params(p, g)[source]
    +M2Crypto.DH.set_params(p, g)[source]
    -

    DSA Module

    +

    DSA Module

    -class M2Crypto.DSA.DSA(dsa, _pyfree=0)[source]
    +class M2Crypto.DSA.DSA(dsa, _pyfree=0)[source]

    This class is a context supporting DSA key and parameter values, signing and verifying.

    Simple example:

    -
    from M2Crypto import EVP, DSA, util
    +
    from M2Crypto import EVP, DSA, util
     
     message = 'Kilroy was here!'
     md = EVP.MessageDigest('sha1')
    @@ -692,14 +696,14 @@ values, signing and verifying.

    r, s = dsa.sign(digest) good = dsa.verify(digest, r, s) if good: - print(' ** success **') + print(' ** success **') else: - print(' ** verification failed **') + print(' ** verification failed **')
    -check_key()[source]
    +check_key()[source]

    Check to be sure the DSA object has a valid private key.

    Parameters:length – Length of filename to return.
    Parameters:length – Length of filename to return.
    Returns:random filename string
    @@ -713,26 +717,26 @@ values, signing and verifying.

    -gen_key()[source]
    +gen_key()[source]

    Generate a key pair.

    -m2_dsa_free()
    +m2_dsa_free()
    -save_key(filename, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x1faa848>)[source]
    +save_key(filename, cipher='aes_128_cbc', callback=<function passphrase_callback>)[source]

    Save the DSA key pair to a file.

    @@ -746,15 +750,15 @@ to encrypt the private key.
    -save_key_bio(bio, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x1faa848>)[source]
    +save_key_bio(bio, cipher='aes_128_cbc', callback=<function passphrase_callback>)[source]

    Save DSA key pair to a BIO object.

    Parameters:
      -
    • filename – Save the DSA key pair to this file.
    • -
    • cipher – name of symmetric key algorithm and mode +
    • filename – Save the DSA key pair to this file.
    • +
    • cipher – name of symmetric key algorithm and mode to encrypt the private key.
    @@ -768,13 +772,13 @@ to encrypt the private key.
    -save_params(filename)[source]
    +save_params(filename)[source]

    Save the DSA parameters to a file.

    Parameters:
      -
    • bio – Save DSA parameters to this object.
    • -
    • cipher – name of symmetric key algorithm and mode +
    • bio – Save DSA parameters to this object.
    • +
    • cipher – name of symmetric key algorithm and mode to encrypt the private key.
    - + @@ -784,13 +788,13 @@ to encrypt the private key.
    -save_params_bio(bio)[source]
    +save_params_bio(bio)[source]

    Save DSA parameters to a BIO object.

    Parameters:filename – Save the DSA parameters to this file.
    Parameters:filename – Save the DSA parameters to this file.
    Returns:1 (true) if successful
    - + @@ -800,13 +804,13 @@ to encrypt the private key.
    -save_pub_key(filename)[source]
    +save_pub_key(filename)[source]

    Save the DSA public key (with parameters) to a file.

    Parameters:bio – Save DSA parameters to this object.
    Parameters:bio – Save DSA parameters to this object.
    Returns:1 (true) if successful
    - @@ -817,13 +821,13 @@ to this file.
    -save_pub_key_bio(bio)[source]
    +save_pub_key_bio(bio)[source]

    Save DSA public key (with parameters) to a BIO object.

    Parameters:filename – Save DSA public key (with parameters) +
    Parameters:filename – Save DSA public key (with parameters) to this file.
    Returns:1 (true) if successful
    - @@ -834,21 +838,21 @@ to this object.
    -set_params(p, q, g)[source]
    +set_params(p, q, g)[source]

    Set new parameters.

    Parameters:bio – Save DSA public key (with parameters) +
    Parameters:bio – Save DSA public key (with parameters) to this object.
    Returns:1 (true) if successful
    @@ -863,17 +867,17 @@ gen_params function to create a new DSA object.
    -sign(digest)[source]
    +sign(digest)[source]

    Sign the digest.

    Parameters:
      -
    • p – MPI binary representation ... format that consists of -the number’s length in bytes represented as a 4-byte +
    • p – MPI binary representation … format that consists of +the number’s length in bytes represented as a 4-byte big-endian number, and the number itself in big-endian format, where the most significant bit signals a negative number (the representation of numbers with the MSB set is prefixed with null byte).
    • -
    • q – ditto
    • -
    • g – ditto
    • +
    • q – ditto
    • +
    • g – ditto
    - + +both “byte strings”.
    Parameters:digest – SHA-1 hash of message (same as output -from MessageDigest, a “byte string”)
    Parameters:digest – SHA-1 hash of message (same as output +from MessageDigest, a “byte string”)
    Returns:DSA signature, a tuple of two values, r and s, -both “byte strings”.
    @@ -881,12 +885,12 @@ both “byte strings”.
    @@ -894,10 +898,10 @@ values r and s.

    @@ -910,27 +914,27 @@ from MessageDigest, a “byte string”)
    -verify_asn1(digest, blob)[source]
    +verify_asn1(digest, blob)[source]
    -exception M2Crypto.DSA.DSAError[source]
    -

    Bases: exceptions.Exception

    +exception M2Crypto.DSA.DSAError[source] +

    Bases: exceptions.Exception

    -class M2Crypto.DSA.DSA_pub(dsa, _pyfree=0)[source]
    -

    Bases: M2Crypto.DSA.DSA

    +class M2Crypto.DSA.DSA_pub(dsa, _pyfree=0)[source] +

    Bases: M2Crypto.DSA.DSA

    This class is a DSA context that only supports a public key and verification. It does NOT support a private key or signing.

    -check_key()[source]
    +check_key()[source]
    Parameters:
      -
    • digest – SHA-1 hash of message (same as output -from MessageDigest, a “byte string”)
    • -
    • r – r value of the signature, a “byte string”
    • -
    • s – s value of the signature, a “byte string”
    • +
    • digest – SHA-1 hash of message (same as output +from MessageDigest, a “byte string”)
    • +
    • r – r value of the signature, a “byte string”
    • +
    • s – s value of the signature, a “byte string”
    @@ -943,13 +947,13 @@ signing.

    -save_key(filename)
    +save_key(filename)

    Save the DSA public key (with parameters) to a file.

    - @@ -960,13 +964,13 @@ to this file.
    -save_key_bio(bio)
    +save_key_bio(bio)

    Save DSA public key (with parameters) to a BIO object.

    Parameters:filename – Save DSA public key (with parameters) +
    Parameters:filename – Save DSA public key (with parameters) to this file.
    Returns:1 (true) if successful
    - @@ -977,19 +981,19 @@ to this object.
    -sign(*argv)[source]
    +sign(*argv)[source]
    -sign_asn1(*argv)
    +sign_asn1(*argv)
    -M2Crypto.DSA.gen_params(bits, callback=<function genparam_callback at 0x1faa758>)[source]
    +M2Crypto.DSA.gen_params(bits, callback=<function genparam_callback>)[source]

    Factory function that generates DSA parameters and instantiates a DSA object from the output.

    Parameters:bio – Save DSA public key (with parameters) +
    Parameters:bio – Save DSA public key (with parameters) to this object.
    Returns:1 (true) if successful
    @@ -997,9 +1001,9 @@ instantiates a DSA object from the output.

    Parameters:
      -
    • bits – The length of the prime to be generated. If -‘bits’ < 512, it is set to 512.
    • -
    • callback – A Python callback object that will be +
    • bits – The length of the prime to be generated. If +‘bits’ < 512, it is set to 512.
    • +
    • callback – A Python callback object that will be invoked during parameter generation; it usual purpose is to provide visual feedback.
    @@ -1014,7 +1018,7 @@ purpose is to provide visual feedback.
    -M2Crypto.DSA.load_key(file, callback=<function passphrase_callback at 0x1faa848>)[source]
    +M2Crypto.DSA.load_key(file, callback=<function passphrase_callback>)[source]

    Factory function that instantiates a DSA object from a PEM encoded DSA key pair.

    @@ -1022,9 +1026,9 @@ PEM encoded DSA key pair.

    Parameters:
      -
    • file – Names the file (a path) that contains the PEM +
    • file – Names the file (a path) that contains the PEM representation of the DSA key pair.
    • -
    • callback – A Python callback object that will be +
    • callback – A Python callback object that will be invoked if the DSA key pair is passphrase-protected.
    @@ -1039,7 +1043,7 @@ passphrase-protected.
    -M2Crypto.DSA.load_key_bio(bio, callback=<function passphrase_callback at 0x1faa848>)[source]
    +M2Crypto.DSA.load_key_bio(bio, callback=<function passphrase_callback>)[source]

    Factory function that instantiates a DSA object from a PEM encoded DSA key pair.

    @@ -1047,9 +1051,9 @@ PEM encoded DSA key pair.

    Parameters:
      -
    • bio – Contains the PEM representation of the DSA +
    • bio – Contains the PEM representation of the DSA key pair.
    • -
    • callback – A Python callback object that will be +
    • callback – A Python callback object that will be invoked if the DSA key pair is passphrase-protected.
    @@ -1064,7 +1068,7 @@ passphrase-protected.
    -M2Crypto.DSA.load_params(file, callback=<function passphrase_callback at 0x1faa848>)[source]
    +M2Crypto.DSA.load_params(file, callback=<function passphrase_callback>)[source]

    Factory function that instantiates a DSA object with DSA parameters from a file.

    @@ -1072,9 +1076,9 @@ parameters from a file.

    Parameters:
      -
    • file – Names the file (a path) that contains the PEM +
    • file – Names the file (a path) that contains the PEM representation of the DSA parameters.
    • -
    • callback – A Python callback object that will be +
    • callback – A Python callback object that will be invoked if the DSA parameters file is passphrase-protected.
    @@ -1089,7 +1093,7 @@ passphrase-protected.
    -M2Crypto.DSA.load_params_bio(bio, callback=<function passphrase_callback at 0x1faa848>)[source]
    +M2Crypto.DSA.load_params_bio(bio, callback=<function passphrase_callback>)[source]

    Factory function that instantiates a DSA object with DSA parameters from a M2Crypto.BIO object.

    @@ -1097,9 +1101,9 @@ parameters from a M2Crypto.BIO object.

    Parameters:
      -
    • bio – Contains the PEM representation of the DSA +
    • bio – Contains the PEM representation of the DSA parameters.
    • -
    • callback – A Python callback object that will be +
    • callback – A Python callback object that will be invoked if the DSA parameters file is passphrase-protected.
    @@ -1114,7 +1118,7 @@ passphrase-protected.
    -M2Crypto.DSA.load_pub_key(file, callback=<function passphrase_callback at 0x1faa848>)[source]
    +M2Crypto.DSA.load_pub_key(file, callback=<function passphrase_callback>)[source]

    Factory function that instantiates a DSA_pub object using a DSA public key contained in PEM file. The PEM file must contain the parameters in addition to the public key.

    @@ -1123,9 +1127,9 @@ must contain the parameters in addition to the public key.

    Parameters:
      -
    • file – Names the file (a path) that contains the PEM +
    • file – Names the file (a path) that contains the PEM representation of the DSA public key.
    • -
    • callback – A Python callback object that will be +
    • callback – A Python callback object that will be invoked should the DSA public key be passphrase-protected.
    @@ -1140,7 +1144,7 @@ passphrase-protected.
    -M2Crypto.DSA.load_pub_key_bio(bio, callback=<function passphrase_callback at 0x1faa848>)[source]
    +M2Crypto.DSA.load_pub_key_bio(bio, callback=<function passphrase_callback>)[source]

    Factory function that instantiates a DSA_pub object using a DSA public key contained in PEM format. The PEM must contain the parameters in addition to the public key.

    @@ -1149,9 +1153,9 @@ must contain the parameters in addition to the public key.

    Parameters:
      -
    • bio – Contains the PEM representation of the DSA +
    • bio – Contains the PEM representation of the DSA public key (with params).
    • -
    • callback – A Python callback object that will be +
    • callback – A Python callback object that will be invoked should the DSA public key be passphrase-protected.
    @@ -1166,7 +1170,7 @@ passphrase-protected.
    -M2Crypto.DSA.pub_key_from_params(p, q, g, pub)[source]
    +M2Crypto.DSA.pub_key_from_params(p, q, g, pub)[source]

    Factory function that instantiates a DSA_pub object using the parameters and public key specified.

    @@ -1174,10 +1178,10 @@ the parameters and public key specified.

    @@ -1190,7 +1194,7 @@ the parameters and public key specified.

    -M2Crypto.DSA.set_params(p, q, g)[source]
    +M2Crypto.DSA.set_params(p, q, g)[source]

    Factory function that instantiates a DSA object with DSA parameters.

    Parameters:
      -
    • p – value of p
    • -
    • q – value of q
    • -
    • g – value of g
    • -
    • pub – value of the public key
    • +
    • p – value of p
    • +
    • q – value of q
    • +
    • g – value of g
    • +
    • pub – value of the public key
    @@ -1198,9 +1202,9 @@ parameters.

    @@ -1213,14 +1217,14 @@ parameters.

    -

    EC Module

    +

    EC Module

    -class M2Crypto.EC.EC(ec, _pyfree=0)[source]
    +class M2Crypto.EC.EC(ec, _pyfree=0)[source]

    Object interface to a EC key pair.

    -as_pem(cipher='aes_128_cbc', callback=<function passphrase_callback at 0x1faa848>)[source]
    +as_pem(cipher='aes_128_cbc', callback=<function passphrase_callback>)[source]

    Returns the key(pair) as a string in PEM format. If no password is passed and the cipher is set it exits with error

    @@ -1228,12 +1232,12 @@ it exits with error

    -check_key()[source]
    +check_key()[source]
    -compute_dh_key(pub_key)[source]
    +compute_dh_key(pub_key)[source]

    Compute the ECDH shared key of this key pair and the given public key object. They must both use the same curve. Returns the shared key in binary as a buffer object. No Key Derivation Function is @@ -1242,9 +1246,9 @@ applied.

    -gen_key()[source]
    +gen_key()[source]

    Generates the key pair from its parameters. Use:

    -
    keypair = EC.gen_params(curve)
    +
    keypair = EC.gen_params(curve)
     keypair.gen_key()
     
    @@ -1253,28 +1257,28 @@ applied.

    -m2_ec_key_free()
    +m2_ec_key_free()
    -pub()[source]
    +pub()[source]
    -save_key(file, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x1faa848>)[source]
    +save_key(file, cipher='aes_128_cbc', callback=<function passphrase_callback>)[source]

    Save the key pair to a file in PEM format.

    Parameters:
      -
    • p – value of p, a “byte string”
    • -
    • q – value of q, a “byte string”
    • -
    • g – value of g, a “byte string”
    • +
    • p – value of p, a “byte string”
    • +
    • q – value of q, a “byte string”
    • +
    • g – value of g, a “byte string”
    Parameters:
      -
    • file – Name of filename to save key to.
    • -
    • cipher – Symmetric cipher to protect the key. The default -cipher is ‘aes_128_cbc’. If cipher is None, then +
    • file – Name of filename to save key to.
    • +
    • cipher – Symmetric cipher to protect the key. The default +cipher is ‘aes_128_cbc’. If cipher is None, then the key is saved in the clear.
    • -
    • callback – A Python callable object that is invoked +
    • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key. The default is util.passphrase_callback.
    • @@ -1287,18 +1291,18 @@ util.passphrase_callback.
      -save_key_bio(bio, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x1faa848>)[source]
      +save_key_bio(bio, cipher='aes_128_cbc', callback=<function passphrase_callback>)[source]

      Save the key pair to an M2Crypto.BIO.BIO object in PEM format.

      Parameters:
        -
      • bio – M2Crypto.BIO.BIO object to save key to.
      • -
      • cipher – Symmetric cipher to protect the key. The default -cipher is ‘aes_128_cbc’. If cipher is None, then +
      • bio – M2Crypto.BIO.BIO object to save key to.
      • +
      • cipher – Symmetric cipher to protect the key. The default +cipher is ‘aes_128_cbc’. If cipher is None, then the key is saved in the clear.
      • -
      • callback – A Python callable object that is invoked +
      • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key. The default is util.passphrase_callback.
      • @@ -1311,13 +1315,13 @@ util.passphrase_callback.
        -save_pub_key(file)[source]
        +save_pub_key(file)[source]

        Save the public key to a filename in PEM format.

        - +
        Parameters:file – Name of filename to save key to.
        Parameters:file – Name of filename to save key to.
        @@ -1325,13 +1329,13 @@ util.passphrase_callback.
        -save_pub_key_bio(bio)[source]
        +save_pub_key_bio(bio)[source]

        Save the public key to an M2Crypto.BIO.BIO object in PEM format.

        - +
        Parameters:bio – M2Crypto.BIO.BIO object to save key to.
        Parameters:bio – M2Crypto.BIO.BIO object to save key to.
        @@ -1339,63 +1343,63 @@ util.passphrase_callback.
        -sign_dsa(digest)[source]
        +sign_dsa(digest)[source]

        Sign the given digest using ECDSA. Returns a tuple (r,s), the two ECDSA signature parameters.

        -sign_dsa_asn1(digest)[source]
        +sign_dsa_asn1(digest)[source]
        -verify_dsa(digest, r, s)[source]
        +verify_dsa(digest, r, s)[source]

        Verify the given digest using ECDSA. r and s are the ECDSA signature parameters.

        -verify_dsa_asn1(digest, blob)[source]
        +verify_dsa_asn1(digest, blob)[source]
        -exception M2Crypto.EC.ECError[source]
        -

        Bases: exceptions.Exception

        +exception M2Crypto.EC.ECError[source] +

        Bases: exceptions.Exception

        -class M2Crypto.EC.EC_pub(ec, _pyfree=0)[source]
        -

        Bases: M2Crypto.EC.EC

        +class M2Crypto.EC.EC_pub(ec, _pyfree=0)[source] +

        Bases: M2Crypto.EC.EC

        Object interface to an EC public key. -((don’t like this implementation inheritance))

        +((don’t like this implementation inheritance))

        -get_der()[source]
        +get_der()[source]

        Returns the public key in DER format as a buffer object.

        -get_key()[source]
        +get_key()[source]

        Returns the public key as a byte string.

        -save_key(file)
        +save_key(file)

        Save the public key to a filename in PEM format.

        - +
        Parameters:file – Name of filename to save key to.
        Parameters:file – Name of filename to save key to.
        @@ -1403,13 +1407,13 @@ signature parameters.

        -save_key_bio(bio)
        +save_key_bio(bio)

        Save the public key to an M2Crypto.BIO.BIO object in PEM format.

        - +
        Parameters:bio – M2Crypto.BIO.BIO object to save key to.
        Parameters:bio – M2Crypto.BIO.BIO object to save key to.
        @@ -1419,19 +1423,19 @@ signature parameters.

        -M2Crypto.EC.ec_error()[source]
        +M2Crypto.EC.ec_error()[source]
        -M2Crypto.EC.gen_params(curve)[source]
        +M2Crypto.EC.gen_params(curve)[source]

        Factory function that generates EC parameters and instantiates a EC object from the output.

        - +
        Parameters:curve – This is the OpenSSL nid of the curve to use.
        Parameters:curve – This is the OpenSSL nid of the curve to use.
        @@ -1439,21 +1443,21 @@ instantiates a EC object from the output.

        -M2Crypto.EC.get_builtin_curves()[source]
        +M2Crypto.EC.get_builtin_curves()[source]
        -M2Crypto.EC.load_key(file, callback=<function passphrase_callback at 0x1faa848>)[source]
        +M2Crypto.EC.load_key(file, callback=<function passphrase_callback>)[source]

        Factory function that instantiates a EC object.

        @@ -1464,16 +1468,16 @@ if the EC key pair is passphrase-protected.
        -M2Crypto.EC.load_key_bio(bio, callback=<function passphrase_callback at 0x1faa848>)[source]
        +M2Crypto.EC.load_key_bio(bio, callback=<function passphrase_callback>)[source]

        Factory function that instantiates a EC object.

        Parameters:
          -
        • file – Names the filename that contains the PEM representation +
        • file – Names the filename that contains the PEM representation of the EC key pair.
        • -
        • callback – Python callback object that will be invoked +
        • callback – Python callback object that will be invoked if the EC key pair is passphrase-protected.
        @@ -1484,15 +1488,15 @@ if the EC key pair is passphrase-protected.
        -M2Crypto.EC.load_key_string(string, callback=<function passphrase_callback at 0x1faa848>)[source]
        +M2Crypto.EC.load_key_string(string, callback=<function passphrase_callback>)[source]

        Load an EC key pair from a string.

        Parameters:
          -
        • bio – M2Crypto.BIO object that contains the PEM +
        • bio – M2Crypto.BIO object that contains the PEM representation of the EC key pair.
        • -
        • callback – Python callback object that will be invoked +
        • callback – Python callback object that will be invoked if the EC key pair is passphrase-protected.
        Parameters:
          -
        • string – String containing EC key pair in PEM format.
        • -
        • callback – A Python callable object that is invoked +
        • string – String containing EC key pair in PEM format.
        • +
        • callback – A Python callable object that is invoked to acquire a passphrase with which to unlock the key. The default is util.passphrase_callback.
        @@ -1507,15 +1511,15 @@ key. The default is util.passphrase_callback.
        -M2Crypto.EC.load_key_string_pubkey(string, callback=<function passphrase_callback at 0x1faa848>)[source]
        +M2Crypto.EC.load_key_string_pubkey(string, callback=<function passphrase_callback>)[source]

        Load an M2Crypto.EC.PKey from a public key as a string.

        Parameters:
          -
        • string – String containing the key in PEM format.
        • -
        • callback – A Python callable object that is invoked +
        • string – String containing the key in PEM format.
        • +
        • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key.
        @@ -1530,13 +1534,13 @@ key.
        -M2Crypto.EC.load_pub_key(file)[source]
        +M2Crypto.EC.load_pub_key(file)[source]

        Load an EC public key from filename.

        - @@ -1547,13 +1551,13 @@ format.
        -M2Crypto.EC.load_pub_key_bio(bio)[source]
        +M2Crypto.EC.load_pub_key_bio(bio)[source]

        Load an EC public key from an M2Crypto.BIO.BIO object.

        Parameters:file – Name of filename containing EC public key in PEM +
        Parameters:file – Name of filename containing EC public key in PEM format.
        Returns:M2Crypto.EC.EC_pub object.
        - @@ -1564,103 +1568,103 @@ format.
        -M2Crypto.EC.pub_key_from_der(der)[source]
        +M2Crypto.EC.pub_key_from_der(der)[source]

        Create EC_pub from DER.

        -M2Crypto.EC.pub_key_from_params(curve, bytes)[source]
        +M2Crypto.EC.pub_key_from_params(curve, bytes)[source]

        Create EC_pub from curve name and octet string.

        -

        EVP Module

        +

        EVP Module

        -class M2Crypto.EVP.Cipher(alg, key, iv, op, key_as_bytes=0, d='md5', salt='12345678', i=1, padding=1)[source]
        +class M2Crypto.EVP.Cipher(alg, key, iv, op, key_as_bytes=0, d='md5', salt='12345678', i=1, padding=1)[source]
        -final()[source]
        +final()[source]
        -m2_cipher_ctx_free()
        +m2_cipher_ctx_free()
        -set_padding(padding=1)[source]
        +set_padding(padding=1)[source]

        Actually always return 1

        -update(data)[source]
        +update(data)[source]
        -exception M2Crypto.EVP.EVPError[source]
        -

        Bases: exceptions.Exception

        +exception M2Crypto.EVP.EVPError[source] +

        Bases: exceptions.Exception

        -class M2Crypto.EVP.HMAC(key, algo='sha1')[source]
        +class M2Crypto.EVP.HMAC(key, algo='sha1')[source]
        -digest()
        +digest()
        -final()[source]
        +final()[source]
        -m2_hmac_ctx_free()
        +m2_hmac_ctx_free()
        -reset(key)[source]
        +reset(key)[source]
        -update(data)[source]
        +update(data)[source]
        -class M2Crypto.EVP.MessageDigest(algo)[source]
        +class M2Crypto.EVP.MessageDigest(algo)[source]

        Message Digest

        -digest()
        +digest()
        -final()[source]
        +final()[source]
        -m2_md_ctx_free()
        +m2_md_ctx_free()
        -update(data)[source]
        +update(data)[source]

        Add data to be digested.

        Parameters:bio – M2Crypto.BIO.BIO object containing EC public key in PEM +
        Parameters:bio – M2Crypto.BIO.BIO object containing EC public key in PEM format.
        Returns:M2Crypto.EC.EC_pub object.
        @@ -1676,27 +1680,27 @@ format.
        -class M2Crypto.EVP.PKey(pkey=None, _pyfree=0, md='sha1')[source]
        +class M2Crypto.EVP.PKey(pkey=None, _pyfree=0, md='sha1')[source]

        Public Key

        -as_der()[source]
        +as_der()[source]

        Return key in DER format in a string

        -as_pem(cipher='aes_128_cbc', callback=<function passphrase_callback at 0x1faa848>)[source]
        +as_pem(cipher='aes_128_cbc', callback=<function passphrase_callback>)[source]

        Return key in PEM format in a string.

        Parameters:
          -
        • cipher – Symmetric cipher to protect the key. The default -cipher is 'aes_128_cbc'. If cipher is None, +
        • cipher – Symmetric cipher to protect the key. The default +cipher is 'aes_128_cbc'. If cipher is None, then the key is saved in the clear.
        • -
        • callback – A Python callable object that is invoked +
        • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key. The default is util.passphrase_callback.
        • @@ -1709,15 +1713,15 @@ util.passphrase_callback.
          -assign_rsa(rsa, capture=1)[source]
          +assign_rsa(rsa, capture=1)[source]

          Assign the RSA key pair to self.

          Parameters:
            -
          • rsa – M2Crypto.RSA.RSA object to be assigned to self.
          • -
          • capture – If true (default), this PKey object will own the RSA +
          • rsa – M2Crypto.RSA.RSA object to be assigned to self.
          • +
          • capture – If true (default), this PKey object will own the RSA object, meaning that once the PKey object gets deleted it is no longer safe to use the RSA object.
          @@ -1732,7 +1736,7 @@ deleted it is no longer safe to use the RSA object.
          -final()
          +final()

          Return signature.

          @@ -1746,36 +1750,36 @@ deleted it is no longer safe to use the RSA object.
          -get_modulus()[source]
          +get_modulus()[source]

          Return the modulus in hex format.

          -get_rsa()[source]
          +get_rsa()[source]

          Return the underlying RSA key if that is what the EVP instance is holding.

          -m2_md_ctx_free()
          +m2_md_ctx_free()
          -m2_pkey_free()
          +m2_pkey_free()
          -reset_context(md='sha1')[source]
          +reset_context(md='sha1')[source]

          Reset internal message digest context.

          - +
          Parameters:md – The message digest algorithm.
          Parameters:md – The message digest algorithm.
          @@ -1783,18 +1787,18 @@ instance is holding.

          -save_key(file, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x1faa848>)[source]
          +save_key(file, cipher='aes_128_cbc', callback=<function passphrase_callback>)[source]

          Save the key pair to a file in PEM format.

          Parameters:
            -
          • file – Name of file to save key to.
          • -
          • cipher – Symmetric cipher to protect the key. The default -cipher is ‘aes_128_cbc’. If cipher is None, then +
          • file – Name of file to save key to.
          • +
          • cipher – Symmetric cipher to protect the key. The default +cipher is ‘aes_128_cbc’. If cipher is None, then the key is saved in the clear.
          • -
          • callback – A Python callable object that is invoked +
          • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key. The default is util.passphrase_callback.
          • @@ -1807,18 +1811,18 @@ util.passphrase_callback.
            -save_key_bio(bio, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x1faa848>)[source]
            -

            Save the key pair to the M2Crypto.BIO object ‘bio’ in PEM format.

            +save_key_bio(bio, cipher='aes_128_cbc', callback=<function passphrase_callback>)[source] +

            Save the key pair to the M2Crypto.BIO object ‘bio’ in PEM format.

            Parameters:
              -
            • bio – M2Crypto.BIO object to save key to.
            • -
            • cipher – Symmetric cipher to protect the key. The default -cipher is ‘aes_128_cbc’. If cipher is None, then +
            • bio – M2Crypto.BIO object to save key to.
            • +
            • cipher – Symmetric cipher to protect the key. The default +cipher is ‘aes_128_cbc’. If cipher is None, then the key is saved in the clear.
            • -
            • callback – A Python callable object that is invoked +
            • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key. The default is util.passphrase_callback.
            • @@ -1831,7 +1835,7 @@ util.passphrase_callback.
              -sign_final()[source]
              +sign_final()[source]

              Return signature.

              @@ -1845,19 +1849,19 @@ util.passphrase_callback.
              -sign_init()[source]
              +sign_init()[source]

              Initialise signing operation with self.

              -sign_update(data)[source]
              +sign_update(data)[source]

              Feed data to signing operation.

              - +
              Parameters:data – Data to be signed.
              Parameters:data – Data to be signed.
              @@ -1865,19 +1869,19 @@ util.passphrase_callback.
              -size()[source]
              +size()[source]

              Return the size of the key in bytes.

              -update(data)
              +update(data)

              Feed data to signing operation.

              - +
              Parameters:data – Data to be signed.
              Parameters:data – Data to be signed.
              @@ -1885,13 +1889,13 @@ util.passphrase_callback.
              -verify_final(sign)[source]
              +verify_final(sign)[source]

              Return result of verification.

              - + @@ -1902,19 +1906,19 @@ other error.
              -verify_init()[source]
              +verify_init()[source]

              Initialise signature verification operation with self.

              -verify_update(data)[source]
              +verify_update(data)[source]

              Feed data to verification operation.

              Parameters:sign – Signature to use for verification
              Parameters:sign – Signature to use for verification
              Returns:Result of verification: 1 for success, 0 for failure, -1 on other error.
              - + @@ -1926,20 +1930,20 @@ other error.
              -M2Crypto.EVP.hmac(key, data, algo='sha1')[source]
              +M2Crypto.EVP.hmac(key, data, algo='sha1')[source]
              -M2Crypto.EVP.load_key(file, callback=<function passphrase_callback at 0x1faa848>)[source]
              +M2Crypto.EVP.load_key(file, callback=<function passphrase_callback>)[source]

              Load an M2Crypto.EVP.PKey from file.

              Parameters:data – Data to be verified.
              Parameters:data – Data to be verified.
              Returns:-1 on Python error, 1 for success, 0 for OpenSSL error
              Parameters:
                -
              • file – Name of file containing the key in PEM format.
              • -
              • callback – A Python callable object that is invoked +
              • file – Name of file containing the key in PEM format.
              • +
              • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key.
              @@ -1954,15 +1958,15 @@ key.
              -M2Crypto.EVP.load_key_bio(bio, callback=<function passphrase_callback at 0x1faa848>)[source]
              +M2Crypto.EVP.load_key_bio(bio, callback=<function passphrase_callback>)[source]

              Load an M2Crypto.EVP.PKey from an M2Crypto.BIO object.

              Parameters:
                -
              • bio – M2Crypto.BIO object containing the key in PEM format.
              • -
              • callback – A Python callable object that is invoked +
              • bio – M2Crypto.BIO object containing the key in PEM format.
              • +
              • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key.
              @@ -1977,15 +1981,15 @@ key.
              -M2Crypto.EVP.load_key_bio_pubkey(bio, callback=<function passphrase_callback at 0x1faa848>)[source]
              +M2Crypto.EVP.load_key_bio_pubkey(bio, callback=<function passphrase_callback>)[source]

              Load an M2Crypto.EVP.PKey from a public key as a M2Crypto.BIO object.

              Parameters:
                -
              • bio – M2Crypto.BIO object containing the key in PEM format.
              • -
              • callback – A Python callable object that is invoked +
              • bio – M2Crypto.BIO object containing the key in PEM format.
              • +
              • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key.
              @@ -2000,15 +2004,15 @@ key.
              -M2Crypto.EVP.load_key_string(string, callback=<function passphrase_callback at 0x1faa848>)[source]
              +M2Crypto.EVP.load_key_string(string, callback=<function passphrase_callback>)[source]

              Load an M2Crypto.EVP.PKey from a string.

              Parameters:
                -
              • string – String containing the key in PEM format.
              • -
              • callback – A Python callable object that is invoked +
              • string – String containing the key in PEM format.
              • +
              • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key.
              @@ -2023,15 +2027,15 @@ key.
              -M2Crypto.EVP.load_key_string_pubkey(string, callback=<function passphrase_callback at 0x1faa848>)[source]
              +M2Crypto.EVP.load_key_string_pubkey(string, callback=<function passphrase_callback>)[source]

              Load an M2Crypto.EVP.PKey from a public key as a string.

              Parameters:
                -
              • string – String containing the key in PEM format.
              • -
              • callback – A Python callable object that is invoked +
              • string – String containing the key in PEM format.
              • +
              • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key.
              @@ -2046,17 +2050,17 @@ key.
              -M2Crypto.EVP.pbkdf2(password, salt, iter, keylen)[source]
              +M2Crypto.EVP.pbkdf2(password, salt, iter, keylen)[source]

              Derive a key from password using PBKDF2 algorithm specified in RFC 2898.

              @@ -2069,41 +2073,41 @@ key.
              -

              Engine Module

              +

              Engine Module

              M2Crypto wrapper for OpenSSL ENGINE API.

              Pavel Shramov IMEC MSU

              -class M2Crypto.Engine.Engine(id=None, _ptr=None, _pyfree=1)[source]
              +class M2Crypto.Engine.Engine(id=None, _ptr=None, _pyfree=1)[source]

              Wrapper for ENGINE object.

              -ctrl_cmd_string(cmd, arg, optional=0)[source]
              +ctrl_cmd_string(cmd, arg, optional=0)[source]

              Call ENGINE_ctrl_cmd_string

              -finish()[source]
              +finish()[source]

              Release a functional and structural reference to the engine.

              -get_id()[source]
              +get_id()[source]

              Return engine id

              -get_name()[source]
              +get_name()[source]

              Return engine name

              -init()[source]
              +init()[source]

              Obtain a functional reference to the engine.

              Parameters:
                -
              • password – Derive the key from this password.
              • -
              • salt – Salt.
              • -
              • iter – Number of iterations to perform.
              • -
              • keylen – Length of key to produce.
              • +
              • password – Derive the key from this password.
              • +
              • salt – Salt.
              • +
              • iter – Number of iterations to perform.
              • +
              • keylen – Length of key to produce.
              @@ -2117,38 +2121,38 @@ IMEC MSU

              -load_certificate(name)[source]
              +load_certificate(name)[source]

              Load certificate from engine (e.g from smartcard). NOTE: This function may be not implemented by engine!

              -load_private_key(name, pin=None)[source]
              +load_private_key(name, pin=None)[source]

              Load private key with engine methods (e.g from smartcard). If pin is not set it will be asked

              -load_public_key(name, pin=None)[source]
              +load_public_key(name, pin=None)[source]

              Load public key with engine methods (e.g from smartcard).

              -m2_engine_free()
              +m2_engine_free()
              -set_default(methods=65535)[source]
              +set_default(methods=65535)[source]

              Use this engine as default for methods specified in argument

              - +
              Parameters:methods – Possible values are bitwise OR of m2.ENGINE_METHOD_*
              Parameters:methods – Possible values are bitwise OR of m2.ENGINE_METHOD_*
              @@ -2158,130 +2162,135 @@ If pin is not set it will be asked

              -exception M2Crypto.Engine.EngineError[source]
              -

              Bases: exceptions.Exception

              +exception M2Crypto.Engine.EngineError[source] +

              Bases: exceptions.Exception

              -M2Crypto.Engine.cleanup()[source]
              +M2Crypto.Engine.cleanup()[source]

              If you load any engines, you need to clean up after your application is finished with the engines.

              -M2Crypto.Engine.load_dynamic()[source]
              +M2Crypto.Engine.load_dynamic()[source]

              Load dynamic engine

              -M2Crypto.Engine.load_dynamic_engine(id, sopath)[source]
              +M2Crypto.Engine.load_dynamic_engine(id, sopath)[source]

              Load and return dymanic engine from sopath and assign id to it

              -M2Crypto.Engine.load_openssl()[source]
              +M2Crypto.Engine.load_openssl()[source]

              Load openssl engine

              -

              Err Module

              +

              Err Module

              -exception M2Crypto.Err.M2CryptoError[source]
              -

              Bases: exceptions.Exception

              +exception M2Crypto.Err.M2CryptoError[source] +

              Bases: exceptions.Exception

              -exception M2Crypto.Err.SSLError(err, client_addr)[source]
              -

              Bases: exceptions.Exception

              +exception M2Crypto.Err.SSLError(err, client_addr)[source] +

              Bases: exceptions.Exception

              -M2Crypto.Err.get_error()[source]
              +M2Crypto.Err.get_error()[source]
              -M2Crypto.Err.get_error_code()[source]
              +M2Crypto.Err.get_error_code()[source]
              -M2Crypto.Err.get_error_func(err)[source]
              +M2Crypto.Err.get_error_func(err)[source]
              -M2Crypto.Err.get_error_lib(err)[source]
              +M2Crypto.Err.get_error_lib(err)[source] +
              + +
              +
              +M2Crypto.Err.get_error_message()[source]
              -M2Crypto.Err.get_error_reason(err)[source]
              +M2Crypto.Err.get_error_reason(err)[source]
              -M2Crypto.Err.get_x509_verify_error(err)[source]
              +M2Crypto.Err.get_x509_verify_error(err)[source]
              -M2Crypto.Err.peek_error_code()[source]
              +M2Crypto.Err.peek_error_code()[source]
              -

              RC4 Module

              +

              RC4 Module

              -class M2Crypto.RC4.RC4(key=None)[source]
              +class M2Crypto.RC4.RC4(key=None)[source]

              Object interface to the stream cipher RC4.

              -final()[source]
              +final()[source]
              -rc4_free()
              +rc4_free()
              -set_key(key)[source]
              +set_key(key)[source]
              -update(data)[source]
              +update(data)[source]
              -

              RSA Module

              +

              RSA Module

              -class M2Crypto.RSA.RSA(rsa, _pyfree=0)[source]
              +class M2Crypto.RSA.RSA(rsa, _pyfree=0)[source]

              RSA Key Pair.

              -as_pem(cipher='aes_128_cbc', callback=<function passphrase_callback at 0x1faa848>)[source]
              +as_pem(cipher='aes_128_cbc', callback=<function passphrase_callback>)[source]

              Returns the key(pair) as a string in PEM format.

              -check_key()[source]
              +check_key()[source]
              @@ -2297,48 +2306,48 @@ code can be obtained using ERR_get_error(3).
              -m2_rsa_free()
              +m2_rsa_free()
              -private_decrypt(data, padding)[source]
              +private_decrypt(data, padding)[source]
              -private_encrypt(data, padding)[source]
              +private_encrypt(data, padding)[source]
              -pub()[source]
              +pub()[source]
              -public_decrypt(data, padding)[source]
              +public_decrypt(data, padding)[source]
              -public_encrypt(data, padding)[source]
              +public_encrypt(data, padding)[source]
              -save_key(file, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x1faa848>)[source]
              +save_key(file, cipher='aes_128_cbc', callback=<function passphrase_callback>)[source]

              Save the key pair to a file in PEM format.

              Parameters:
                -
              • file – Name of file to save key to.
              • -
              • cipher – Symmetric cipher to protect the key. The default -cipher is ‘aes_128_cbc’. If cipher is None, then +
              • file – Name of file to save key to.
              • +
              • cipher – Symmetric cipher to protect the key. The default +cipher is ‘aes_128_cbc’. If cipher is None, then the key is saved in the clear.
              • -
              • callback – A Python callable object that is invoked +
              • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key. The default is util.passphrase_callback.
              • @@ -2351,18 +2360,18 @@ util.passphrase_callback.
                -save_key_bio(bio, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x1faa848>)[source]
                +save_key_bio(bio, cipher='aes_128_cbc', callback=<function passphrase_callback>)[source]

                Save the key pair to an M2Crypto.BIO.BIO object in PEM format.

                Parameters:
                  -
                • bio – M2Crypto.BIO.BIO object to save key to.
                • -
                • cipher – Symmetric cipher to protect the key. The default -cipher is ‘aes_128_cbc’. If cipher is None, then +
                • bio – M2Crypto.BIO.BIO object to save key to.
                • +
                • cipher – Symmetric cipher to protect the key. The default +cipher is ‘aes_128_cbc’. If cipher is None, then the key is saved in the clear.
                • -
                • callback – A Python callable object that is invoked +
                • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key. The default is util.passphrase_callback.
                • @@ -2375,13 +2384,13 @@ util.passphrase_callback.
                  -save_key_der(file)[source]
                  +save_key_der(file)[source]

                  Save the key pair to a file in DER format.

                  - +
                  Parameters:file – Filename to save key to
                  Parameters:file – Filename to save key to
                  @@ -2389,13 +2398,13 @@ util.passphrase_callback.
                  -save_key_der_bio(bio)[source]
                  +save_key_der_bio(bio)[source]

                  Save the key pair to an M2Crypto.BIO.BIO object in DER format.

                  - +
                  Parameters:bio – M2Crypto.BIO.BIO object to save key to.
                  Parameters:bio – M2Crypto.BIO.BIO object to save key to.
                  @@ -2403,18 +2412,18 @@ util.passphrase_callback.
                  -save_pem(file, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x1faa848>)
                  +save_pem(file, cipher='aes_128_cbc', callback=<function passphrase_callback>)

                  Save the key pair to a file in PEM format.

                  Parameters:
                    -
                  • file – Name of file to save key to.
                  • -
                  • cipher – Symmetric cipher to protect the key. The default -cipher is ‘aes_128_cbc’. If cipher is None, then +
                  • file – Name of file to save key to.
                  • +
                  • cipher – Symmetric cipher to protect the key. The default +cipher is ‘aes_128_cbc’. If cipher is None, then the key is saved in the clear.
                  • -
                  • callback – A Python callable object that is invoked +
                  • callback – A Python callable object that is invoked to acquire a passphrase with which to protect the key. The default is util.passphrase_callback.
                  • @@ -2427,13 +2436,13 @@ util.passphrase_callback.
                    -save_pub_key(file)[source]
                    +save_pub_key(file)[source]

                    Save the public key to a file in PEM format.

                    - +
                    Parameters:file – Name of file to save key to.
                    Parameters:file – Name of file to save key to.
                    @@ -2441,13 +2450,13 @@ util.passphrase_callback.
                    -save_pub_key_bio(bio)[source]
                    +save_pub_key_bio(bio)[source]

                    Save the public key to an M2Crypto.BIO.BIO object in PEM format.

                    - +
                    Parameters:bio – M2Crypto.BIO.BIO object to save key to.
                    Parameters:bio – M2Crypto.BIO.BIO object to save key to.
                    @@ -2455,17 +2464,17 @@ util.passphrase_callback.
                    -sign(digest, algo='sha1')[source]
                    +sign(digest, algo='sha1')[source]

                    Signs a digest with the private key

                    @@ -2478,18 +2487,18 @@ Legal values like ‘sha1’,’sha224’, ‘sha256’,
                    -sign_rsassa_pss(digest, algo='sha1', salt_length=20)[source]
                    +sign_rsassa_pss(digest, algo='sha1', salt_length=20)[source]

                    Signs a digest with the private key using RSASSA-PSS

                    Parameters:
                      -
                    • digest – A digest created by using the digest method
                    • -
                    • algo – The method that created the digest. -Legal values like ‘sha1’,’sha224’, ‘sha256’, -‘ripemd160’, and ‘md5’.
                    • +
                    • digest – A digest created by using the digest method
                    • +
                    • algo – The method that created the digest. +Legal values like ‘sha1’,’sha224’, ‘sha256’, +‘ripemd160’, and ‘md5’.
                    @@ -2502,18 +2511,18 @@ Legal values like ‘sha1’,’sha224’, ‘sha256’,
                    -verify(data, signature, algo='sha1')[source]
                    +verify(data, signature, algo='sha1')[source]

                    Verifies the signature with the public key

                    Parameters:
                      -
                    • digest – A digest created by using the digest method
                    • -
                    • salt_length – The length of the salt to use
                    • -
                    • algo – The hash algorithm to use -Legal values like ‘sha1’,’sha224’, ‘sha256’, -‘ripemd160’, and ‘md5’.
                    • +
                    • digest – A digest created by using the digest method
                    • +
                    • salt_length – The length of the salt to use
                    • +
                    • algo – The hash algorithm to use +Legal values like ‘sha1’,’sha224’, ‘sha256’, +‘ripemd160’, and ‘md5’.
                    @@ -2527,19 +2536,19 @@ verified or not.

                    -verify_rsassa_pss(data, signature, algo='sha1', salt_length=20)[source]
                    +verify_rsassa_pss(data, signature, algo='sha1', salt_length=20)[source]

                    Verifies the signature RSASSA-PSS

                    Parameters:
                      -
                    • data – Data that has been signed
                    • -
                    • signature – The signature signed with the private key
                    • -
                    • algo – The method use to create digest from the data +
                    • data – Data that has been signed
                    • +
                    • signature – The signature signed with the private key
                    • +
                    • algo – The method use to create digest from the data before it was signed. Legal values like -‘sha1’,’sha224’, ‘sha256’, ‘ripemd160’, and ‘md5’.
                    • +‘sha1’,’sha224’, ‘sha256’, ‘ripemd160’, and ‘md5’.
                    @@ -2555,39 +2564,39 @@ verified or not.

                    -exception M2Crypto.RSA.RSAError[source]
                    -

                    Bases: exceptions.Exception

                    +exception M2Crypto.RSA.RSAError[source] +

                    Bases: exceptions.Exception

                    -class M2Crypto.RSA.RSA_pub(rsa, _pyfree=0)[source]
                    -

                    Bases: M2Crypto.RSA.RSA

                    +class M2Crypto.RSA.RSA_pub(rsa, _pyfree=0)[source] +

                    Bases: M2Crypto.RSA.RSA

                    Object interface to an RSA public key.

                    -check_key()[source]
                    +check_key()[source]
                    -private_decrypt(*argv)[source]
                    +private_decrypt(*argv)[source]
                    -private_encrypt(*argv)[source]
                    +private_encrypt(*argv)[source]
                    -save_key(file, *args, **kw)[source]
                    +save_key(file, *args, **kw)[source]

                    Save public key to file.

                    -save_key_bio(bio, *args, **kw)[source]
                    +save_key_bio(bio, *args, **kw)[source]

                    Save public key to BIO.

                    @@ -2595,16 +2604,16 @@ verified or not.

                    -M2Crypto.RSA.gen_key(bits, e, callback=<function keygen_callback at 0x1ffa410>)[source]
                    +M2Crypto.RSA.gen_key(bits, e, callback=<function keygen_callback>)[source]

                    Generate an RSA key pair.

                    Parameters:
                      -
                    • data – Data that has been signed
                    • -
                    • signature – The signature signed with RSASSA-PSS
                    • -
                    • salt_length – The length of the salt that was used
                    • -
                    • algo – The hash algorithm to use -Legal values are for example ‘sha1’,’sha224’, -‘sha256’, ‘ripemd160’, and ‘md5’.
                    • +
                    • data – Data that has been signed
                    • +
                    • signature – The signature signed with RSASSA-PSS
                    • +
                    • salt_length – The length of the salt that was used
                    • +
                    • algo – The hash algorithm to use +Legal values are for example ‘sha1’,’sha224’, +‘sha256’, ‘ripemd160’, and ‘md5’.
                    Parameters:
                      -
                    • bits – Key length, in bits.
                    • -
                    • e – The RSA public exponent.
                    • -
                    • callback – A Python callable object that is invoked +
                    • bits – Key length, in bits.
                    • +
                    • e – The RSA public exponent.
                    • +
                    • callback – A Python callable object that is invoked during key generation; its usual purpose is to provide visual feedback. The default callback is keygen_callback.
                    • @@ -2620,21 +2629,21 @@ keygen_callback.
                      -M2Crypto.RSA.keygen_callback(p, n, out=<open file '<stdout>', mode 'w' at 0x7fc7ebc63150>)[source]
                      +M2Crypto.RSA.keygen_callback(p, n, out=<open file '<stdout>', mode 'w'>)[source]

                      Default callback for gen_key().

                      -M2Crypto.RSA.load_key(file, callback=<function passphrase_callback at 0x1faa848>)[source]
                      +M2Crypto.RSA.load_key(file, callback=<function passphrase_callback>)[source]

                      Load an RSA key pair from file.

                      Parameters:
                        -
                      • file – Name of file containing RSA public key in PEM format.
                      • -
                      • callback – A Python callable object that is invoked +
                      • file – Name of file containing RSA public key in PEM format.
                      • +
                      • callback – A Python callable object that is invoked to acquire a passphrase with which to unlock the key. The default is util.passphrase_callback.
                      @@ -2649,16 +2658,16 @@ key. The default is util.passphrase_callback.
                      -M2Crypto.RSA.load_key_bio(bio, callback=<function passphrase_callback at 0x1faa848>)[source]
                      +M2Crypto.RSA.load_key_bio(bio, callback=<function passphrase_callback>)[source]

                      Load an RSA key pair from an M2Crypto.BIO.BIO object.

                      Parameters:
                        -
                      • bio – M2Crypto.BIO.BIO object containing RSA key pair in PEM +
                      • bio – M2Crypto.BIO.BIO object containing RSA key pair in PEM format.
                      • -
                      • callback – A Python callable object that is invoked +
                      • callback – A Python callable object that is invoked to acquire a passphrase with which to unlock the key. The default is util.passphrase_callback.
                      @@ -2673,15 +2682,15 @@ key. The default is util.passphrase_callback.
                      -M2Crypto.RSA.load_key_string(string, callback=<function passphrase_callback at 0x1faa848>)[source]
                      +M2Crypto.RSA.load_key_string(string, callback=<function passphrase_callback>)[source]

                      Load an RSA key pair from a string.

                      Parameters:
                        -
                      • string – String containing RSA key pair in PEM format.
                      • -
                      • callback – A Python callable object that is invoked +
                      • string – String containing RSA key pair in PEM format.
                      • +
                      • callback – A Python callable object that is invoked to acquire a passphrase with which to unlock the key. The default is util.passphrase_callback.
                      @@ -2696,13 +2705,13 @@ key. The default is util.passphrase_callback.
                      -M2Crypto.RSA.load_pub_key(file)[source]
                      +M2Crypto.RSA.load_pub_key(file)[source]

                      Load an RSA public key from file.

                      - + @@ -2712,13 +2721,13 @@ key. The default is util.passphrase_callback.
                      -M2Crypto.RSA.load_pub_key_bio(bio)[source]
                      +M2Crypto.RSA.load_pub_key_bio(bio)[source]

                      Load an RSA public key from an M2Crypto.BIO.BIO object.

                      Parameters:file – Name of file containing RSA public key in PEM format.
                      Parameters:file – Name of file containing RSA public key in PEM format.
                      Returns:M2Crypto.RSA.RSA_pub object.
                      - @@ -2729,17 +2738,17 @@ format.
                      -M2Crypto.RSA.new_pub_key(e_n)[source]
                      +M2Crypto.RSA.new_pub_key(e_n)[source]

                      Instantiate an RSA_pub object from an (e, n) tuple.

                      Parameters:bio – M2Crypto.BIO.BIO object containing RSA public key in PEM +
                      Parameters:bio – M2Crypto.BIO.BIO object containing RSA public key in PEM format.
                      Returns:M2Crypto.RSA.RSA_pub object.
                      Parameters:
                        -
                      • e – The RSA public exponent; it is a string in OpenSSL’s MPINT +
                      • e – The RSA public exponent; it is a string in OpenSSL’s MPINT format - 4-byte big-endian bit-count followed by the appropriate number of bits.
                      • -
                      • n – The RSA composite of primes; it is a string in OpenSSL’s +
                      • n – The RSA composite of primes; it is a string in OpenSSL’s MPINT format - 4-byte big-endian bit-count followed by the appropriate number of bits.
                      @@ -2754,229 +2763,348 @@ appropriate number of bits.
                      -M2Crypto.RSA.rsa_error()[source]
                      +M2Crypto.RSA.rsa_error()[source]
                      -

                      Rand Module

                      +

                      Rand Module

                      +

                      M2Crypto wrapper for OpenSSL PRNG. Requires OpenSSL 0.9.5 and above.

                      +

                      Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved. +Copyright (c) 2014-2017 Matej Cepl. All rights reserved.

                      +

                      See LICENCE for the license information.

                      -M2Crypto.Rand.rand_seed()
                      -
                      +M2Crypto.Rand.rand_seed(seed)[source] +

                      Equivalent to rand_add() when len(seed) == entropy.

                      + +++ + + + +
                      Parameters:seed – added data (see description at rand_add)
                      +
                      -M2Crypto.Rand.rand_add()
                      -
                      +M2Crypto.Rand.rand_add(blob, entropy)[source] +

                      Mixes blob into the PRNG state.

                      + +++ + + + +
                      Parameters:
                        +
                      • blob – added data
                      • +
                      • entropy – (the lower bound of) an estimate of how much randomness +is contained in blob, measured in bytes.
                      • +
                      +
                      +

                      Thus, if the data at buf are unpredictable to an adversary, this +increases the uncertainty about the state and makes the PRNG output less +predictable. Suitable input comes from user interaction (random key +presses, mouse movements) and certain hardware events.

                      +

                      Details about sources of randomness and how to estimate their entropy +can be found in the literature, e.g. RFC 1750.

                      +
                      -M2Crypto.Rand.load_file()
                      -
                      +M2Crypto.Rand.load_file(filename, max_bytes)[source] +

                      Read a number of bytes from file filename and adds them to the PRNG.

                      +

                      If max_bytes is non-negative, up to to max_bytes are read; starting with +OpenSSL 0.9.5, if max_bytes is -1, the complete file is read.

                      + +++ + + + + + +
                      Parameters:
                        +
                      • filename
                      • +
                      • max_bytes
                      • +
                      +
                      Returns:

                      the number of bytes read.

                      +
                      +
                      -M2Crypto.Rand.save_file()
                      -
                      +M2Crypto.Rand.save_file(filename)[source] +

                      Write a number of random bytes (currently 1024) to file.

                      +

                      The file then can be used to initialize the PRNG by calling load_file() in +a later session.

                      + +++ + + + + + +
                      Parameters:filename
                      Returns:returns the number of bytes written, and -1 if the bytes +written were generated without appropriate seed.
                      +
                      -M2Crypto.Rand.rand_bytes()
                      -
                      +M2Crypto.Rand.rand_bytes(num)[source] +

                      Return n cryptographically strong pseudo-random bytes.

                      +

                      An error occurs if the PRNG has not been seeded with enough randomness +to ensure an unpredictable byte sequence.

                      + +++ + + + + + +
                      Parameters:num – number of bytes to be returned
                      Returns:random bytes
                      +
                      -M2Crypto.Rand.rand_pseudo_bytes(n)[source]
                      -
                      +M2Crypto.Rand.rand_pseudo_bytes(num)[source] +

                      Return num pseudo-random bytes into buf.

                      +

                      Pseudo-random byte sequences generated by this method will be unique +if they are of sufficient length, but are not necessarily +unpredictable. They can be used for non-cryptographic purposes and for +certain purposes in cryptographic protocols, but usually not for key +generation etc.

                      +

                      Output of the function is mixed into the entropy pool before +retrieving the new pseudo-random bytes unless disabled at compile +time (see FAQ).

                      + +++ + + + + + +
                      Parameters:num – number of bytes to be returned
                      Returns:random bytes
                      +
                      -M2Crypto.Rand.rand_file_name()[source]
                      -
                      +M2Crypto.Rand.rand_file_name()[source] +

                      Generate a default path for the random seed file.

                      + +++ + + + +
                      Returns:string with the filename. +The seed file is $RANDFILE if that environment variable +is set, $HOME/.rnd otherwise. If $HOME is not set either, +an error occurs.
                      +
                      -M2Crypto.Rand.rand_status()
                      -
                      +M2Crypto.Rand.rand_status()[source] +

                      Check whether there is enough entropy in PRNG.

                      + +++ + + + +
                      Returns:1 if the PRNG has been seeded with enough +data, 0 otherwise.
                      +
                      -

                      SMIME Module

                      +

                      SMIME Module

                      -class M2Crypto.SMIME.Cipher(algo)[source]
                      +class M2Crypto.SMIME.Cipher(algo)[source]

                      Object interface to EVP_CIPHER without all the frills of M2Crypto.EVP.Cipher.

                      -class M2Crypto.SMIME.PKCS7(pkcs7=None, _pyfree=0)[source]
                      +class M2Crypto.SMIME.PKCS7(pkcs7=None, _pyfree=0)[source]
                      -get0_signers(certs, flags=0)[source]
                      +get0_signers(certs, flags=0)[source]
                      -m2_pkcs7_free()
                      +m2_pkcs7_free()
                      -type(text_name=0)[source]
                      +type(text_name=0)[source]
                      -write(bio)[source]
                      +write(bio)[source]
                      -write_der(bio)[source]
                      +write_der(bio)[source]
                      -exception M2Crypto.SMIME.PKCS7_Error[source]
                      -

                      Bases: exceptions.Exception

                      +exception M2Crypto.SMIME.PKCS7_Error[source] +

                      Bases: exceptions.Exception

                      -class M2Crypto.SMIME.SMIME[source]
                      +class M2Crypto.SMIME.SMIME[source]
                      -decrypt(pkcs7, flags=0)[source]
                      +decrypt(pkcs7, flags=0)[source]
                      -encrypt(data_bio, flags=0)[source]
                      +encrypt(data_bio, flags=0)[source]
                      -load_key(keyfile, certfile=None, callback=<function passphrase_callback at 0x1faa848>)[source]
                      +load_key(keyfile, certfile=None, callback=<function passphrase_callback>)[source]
                      -load_key_bio(keybio, certbio=None, callback=<function passphrase_callback at 0x1faa848>)[source]
                      +load_key_bio(keybio, certbio=None, callback=<function passphrase_callback>)[source]
                      -set_cipher(cipher)[source]
                      +set_cipher(cipher)[source]
                      -set_x509_stack(stack)[source]
                      +set_x509_stack(stack)[source]
                      -set_x509_store(store)[source]
                      +set_x509_store(store)[source]
                      -sign(data_bio, flags=0, algo='sha1')[source]
                      +sign(data_bio, flags=0, algo='sha1')[source]
                      -unset_cipher()[source]
                      +unset_cipher()[source]
                      -unset_key()[source]
                      +unset_key()[source]
                      -unset_x509_stack()[source]
                      +unset_x509_stack()[source]
                      -unset_x509_store()[source]
                      +unset_x509_store()[source]
                      -verify(pkcs7, data_bio=None, flags=0)[source]
                      +verify(pkcs7, data_bio=None, flags=0)[source]
                      -write(out_bio, pkcs7, data_bio=None, flags=0)[source]
                      +write(out_bio, pkcs7, data_bio=None, flags=0)[source]
                      -exception M2Crypto.SMIME.SMIME_Error[source]
                      -

                      Bases: exceptions.Exception

                      +exception M2Crypto.SMIME.SMIME_Error[source] +

                      Bases: exceptions.Exception

                      -M2Crypto.SMIME.load_pkcs7(p7file)[source]
                      +M2Crypto.SMIME.load_pkcs7(p7file)[source]
                      -M2Crypto.SMIME.load_pkcs7_bio(p7_bio)[source]
                      +M2Crypto.SMIME.load_pkcs7_bio(p7_bio)[source]
                      -M2Crypto.SMIME.load_pkcs7_bio_der(p7_bio)[source]
                      +M2Crypto.SMIME.load_pkcs7_bio_der(p7_bio)[source]
                      -M2Crypto.SMIME.load_pkcs7_der(p7file)[source]
                      +M2Crypto.SMIME.load_pkcs7_der(p7file)[source]
                      -M2Crypto.SMIME.smime_load_pkcs7(p7file)[source]
                      +M2Crypto.SMIME.smime_load_pkcs7(p7file)[source]
                      -M2Crypto.SMIME.smime_load_pkcs7_bio(p7_bio)[source]
                      +M2Crypto.SMIME.smime_load_pkcs7_bio(p7_bio)[source]
                      -M2Crypto.SMIME.text_crlf(text)[source]
                      +M2Crypto.SMIME.text_crlf(text)[source]
                      -M2Crypto.SMIME.text_crlf_bio(bio_in)[source]
                      +M2Crypto.SMIME.text_crlf_bio(bio_in)[source]
                      -

                      X509 Module

                      +

                      X509 Module

                      -class M2Crypto.X509.CRL(crl=None, _pyfree=0)[source]
                      +class M2Crypto.X509.CRL(crl=None, _pyfree=0)[source]

                      X509 Certificate Revocation List

                      -as_text()[source]
                      +as_text()[source]

                      Return CRL in PEM format in a string.

                      @@ -2990,24 +3118,24 @@ M2Crypto.EVP.Cipher.

                      -m2_x509_crl_free()
                      +m2_x509_crl_free()
                      -class M2Crypto.X509.Request(req=None, _pyfree=0)[source]
                      +class M2Crypto.X509.Request(req=None, _pyfree=0)[source]

                      X509 Certificate Request.

                      -add_extensions(ext_stack)[source]
                      +add_extensions(ext_stack)[source]

                      Add X509 extensions to this request.

                      - + @@ -3017,22 +3145,22 @@ M2Crypto.EVP.Cipher.

                      -as_der()[source]
                      +as_der()[source]
                      -as_pem()[source]
                      +as_pem()[source]
                      -as_text()[source]
                      +as_text()[source]
                      -get_pubkey()[source]
                      +get_pubkey()[source]

                      Get the public key for the request.

                      Parameters:ext_stack – Stack of extensions to add.
                      Parameters:ext_stack – Stack of extensions to add.
                      Returns:1 for success and 0 for failure
                      @@ -3046,12 +3174,12 @@ M2Crypto.EVP.Cipher.

                      -get_subject()[source]
                      +get_subject()[source]
                      -get_version()[source]
                      +get_version()[source]

                      Get version.

                      @@ -3065,12 +3193,12 @@ M2Crypto.EVP.Cipher.

                      -m2_x509_req_free()
                      +m2_x509_req_free()
                      -save(filename, format=1)[source]
                      +save(filename, format=1)[source]

                      Saves X.509 certificate request to a file. Default output format is PEM.

                      @@ -3078,8 +3206,8 @@ format is PEM.

                      Parameters:
                        -
                      • filename – Name of the file the request will be saved to.
                      • -
                      • format – Controls what output format is used to save the +
                      • filename – Name of the file the request will be saved to.
                      • +
                      • format – Controls what output format is used to save the request. Either FORMAT_PEM or FORMAT_DER to save in PEM or DER format. Raises ValueError if an unknown format is used.
                      • @@ -3096,18 +3224,18 @@ The error code can be obtained by ERR_get_error.

                        -save_pem(filename)[source]
                        +save_pem(filename)[source]
                        -set_pubkey(pkey)[source]
                        +set_pubkey(pkey)[source]

                        Set the public key for the request.

                        - + @@ -3117,13 +3245,13 @@ The error code can be obtained by ERR_get_error.

                        -set_subject(name)
                        +set_subject(name)

                        Set subject name.

                        Parameters:pkey – Public key
                        Parameters:pkey – Public key
                        Returns:Return 1 for success and 0 for failure.
                        - + @@ -3133,13 +3261,13 @@ The error code can be obtained by ERR_get_error.

                        -set_subject_name(name)[source]
                        +set_subject_name(name)[source]

                        Set subject name.

                        Parameters:name – subjectName field.
                        Parameters:name – subjectName field.
                        Returns:1 for success and 0 for failure
                        - + @@ -3149,13 +3277,13 @@ The error code can be obtained by ERR_get_error.

                        -set_version(version)[source]
                        +set_version(version)[source]

                        Set version.

                        Parameters:name – subjectName field.
                        Parameters:name – subjectName field.
                        Returns:1 for success and 0 for failure
                        - + @@ -3165,14 +3293,14 @@ The error code can be obtained by ERR_get_error.

                        -sign(pkey, md)[source]
                        +sign(pkey, md)[source]
                        Parameters:version – Version number.
                        Parameters:version – Version number.
                        Returns:Returns 0 on failure.
                        @@ -3185,12 +3313,12 @@ The error code can be obtained by ERR_get_error.

                        -verify(pkey)[source]
                        +verify(pkey)[source]
                        Parameters:
                          -
                        • pkey – PKey to be signed
                        • -
                        • md – used algorigthm
                        • +
                        • pkey – PKey to be signed
                        • +
                        • md – used algorigthm
                        - + @@ -3202,17 +3330,17 @@ The error code can be obtained by ERR_get_error.

                        -class M2Crypto.X509.X509(x509=None, _pyfree=0)[source]
                        +class M2Crypto.X509.X509(x509=None, _pyfree=0)[source]

                        X.509 Certificate

                        -add_ext(ext)[source]
                        +add_ext(ext)[source]

                        Add X509 extension to this certificate.

                        Parameters:pkey – PKey to be verified
                        Parameters:pkey – PKey to be verified
                        Returns:1 for success and 0 for failure
                        - +
                        Parameters:ext – Extension
                        Parameters:ext – Extension
                        @@ -3221,22 +3349,22 @@ The error code can be obtained by ERR_get_error.

                        -as_der()[source]
                        +as_der()[source]
                        -as_pem()[source]
                        +as_pem()[source]
                        -as_text()[source]
                        +as_text()[source]
                        -check_ca()[source]
                        +check_ca()[source]

                        Check if the certificate is a Certificate Authority (CA) certificate.

                        @@ -3244,7 +3372,7 @@ The error code can be obtained by ERR_get_error.

                        - +
                        Returns:0 if the certificate is not CA, nonzero otherwise.
                        Requires :OpenSSL 0.9.8 or newer
                        Requires:OpenSSL 0.9.8 or newer
                        @@ -3252,15 +3380,15 @@ The error code can be obtained by ERR_get_error.

                        -check_purpose(id, ca)[source]
                        -

                        Check if the certificate’s purpose matches the asked purpose.

                        +check_purpose(id, ca)[source] +

                        Check if the certificate’s purpose matches the asked purpose.

                        @@ -3274,13 +3402,13 @@ otherwise.

                        -get_ext(name)[source]
                        +get_ext(name)[source]

                        Get X509 extension by name.

                        Parameters:
                          -
                        • id – Purpose id. See X509_PURPOSE_* constants.
                        • -
                        • ca – 1 if the certificate should be CA, 0 otherwise.
                        • +
                        • id – Purpose id. See X509_PURPOSE_* constants.
                        • +
                        • ca – 1 if the certificate should be CA, 0 otherwise.
                        - + @@ -3290,13 +3418,13 @@ otherwise.

                        -get_ext_at(index)[source]
                        +get_ext_at(index)[source]

                        Get X509 extension by index.

                        Parameters:name – Name of the extension
                        Parameters:name – Name of the extension
                        Returns:X509_Extension
                        - + @@ -3306,19 +3434,19 @@ otherwise.

                        -get_ext_count()[source]
                        +get_ext_count()[source]

                        Get X509 extension count.

                        -get_fingerprint(md='md5')[source]
                        +get_fingerprint(md='md5')[source]

                        Get the fingerprint of the certificate.

                        Parameters:index – Name of the extension
                        Parameters:index – Name of the extension
                        Returns:X509_Extension
                        - + @@ -3328,47 +3456,47 @@ otherwise.

                        -get_issuer()[source]
                        +get_issuer()[source]
                        -get_not_after()[source]
                        +get_not_after()[source]
                        -get_not_before()[source]
                        +get_not_before()[source]
                        -get_pubkey()[source]
                        +get_pubkey()[source]
                        -get_serial_number()[source]
                        +get_serial_number()[source]
                        -get_subject()[source]
                        +get_subject()[source]
                        -get_version()[source]
                        +get_version()[source]
                        -m2_x509_free()
                        +m2_x509_free()
                        -save(filename, format=1)[source]
                        +save(filename, format=1)[source]

                        Saves X.509 certificate to a file. Default output format is PEM.

                        Parameters:md – Message digest algorithm to use.
                        Parameters:md – Message digest algorithm to use.
                        Returns:String containing the fingerprint in hex format.
                        @@ -3376,8 +3504,8 @@ format is PEM.

                        Parameters:
                          -
                        • filename – Name of the file the cert will be saved to.
                        • -
                        • format – Controls what output format is used to save the cert. +
                        • filename – Name of the file the cert will be saved to.
                        • +
                        • format – Controls what output format is used to save the cert. Either FORMAT_PEM or FORMAT_DER to save in PEM or DER format. Raises a ValueError if an unknow format is used.
                        • @@ -3393,12 +3521,12 @@ format is used.
                          -save_pem(filename)[source]
                          +save_pem(filename)[source]
                          - + @@ -3408,13 +3536,13 @@ format is used.
                          -set_issuer(name)[source]
                          +set_issuer(name)[source]

                          Set issuer name.

                          Parameters:filename – name of the file to be loaded
                          Parameters:filename – name of the file to be loaded
                          Returns:1 for success or 0 for failure
                          - +
                          Parameters:name – subjectName field.
                          Parameters:name – subjectName field.
                          @@ -3423,7 +3551,7 @@ format is used.
                          -set_issuer_name(name)[source]
                          +set_issuer_name(name)[source]
                          @@ -3436,7 +3564,7 @@ format is used.
                          -set_not_after(asn1_time)[source]
                          +set_not_after(asn1_time)[source]
                          @@ -3449,7 +3577,7 @@ format is used.
                          -set_not_before(asn1_time)[source]
                          +set_not_before(asn1_time)[source]
                          @@ -3462,13 +3590,13 @@ format is used.
                          -set_pubkey(pkey)[source]
                          +set_pubkey(pkey)[source]

                          Set the public key for the certificate

                          - +
                          Parameters:pkey – Public key
                          Parameters:pkey – Public key
                          @@ -3477,13 +3605,13 @@ format is used.
                          -set_serial_number(serial)[source]
                          +set_serial_number(serial)[source]

                          Set serial number.

                          - +
                          Parameters:serial – Serial number.
                          Parameters:serial – Serial number.
                          @@ -3492,13 +3620,13 @@ format is used.
                          -set_subject(name)[source]
                          +set_subject(name)[source]

                          Set subject name.

                          - +
                          Parameters:name – subjectName field.
                          Parameters:name – subjectName field.
                          @@ -3507,7 +3635,7 @@ format is used.
                          -set_subject_name(name)[source]
                          +set_subject_name(name)[source]
                          @@ -3520,13 +3648,13 @@ format is used.
                          -set_version(version)[source]
                          +set_version(version)[source]

                          Set version of the certificate.

                          - + @@ -3536,16 +3664,16 @@ format is used.
                          -sign(pkey, md)[source]
                          +sign(pkey, md)[source]

                          Sign the certificate.

                          Parameters:version – Version number.
                          Parameters:version – Version number.
                          Returns:Returns 0 on failure.
                          @@ -3556,24 +3684,24 @@ for example ‘sha1’.
                          -verify(pkey=None)[source]
                          +verify(pkey=None)[source]
                          -exception M2Crypto.X509.X509Error[source]
                          -

                          Bases: exceptions.Exception

                          +exception M2Crypto.X509.X509Error[source] +

                          Bases: exceptions.Exception

                          -class M2Crypto.X509.X509_Extension(x509_ext_ptr=None, _pyfree=1)[source]
                          +class M2Crypto.X509.X509_Extension(x509_ext_ptr=None, _pyfree=1)[source]

                          X509 Extension

                          -get_critical()[source]
                          +get_critical()[source]

                          Return whether or not this is a critical extension.

                          Parameters:
                            -
                          • pkey – Public key
                          • -
                          • md – Message digest algorithm to use for signing, -for example ‘sha1’.
                          • +
                          • pkey – Public key
                          • +
                          • md – Message digest algorithm to use for signing, +for example ‘sha1’.
                          @@ -3587,21 +3715,21 @@ for example ‘sha1’.
                          -get_name()[source]
                          -

                          Get the extension name, for example ‘subjectAltName’.

                          +get_name()[source] +

                          Get the extension name, for example ‘subjectAltName’.

                          -get_value(flag=0, indent=0)[source]
                          -

                          Get the extension value, for example ‘DNS:www.example.com‘.

                          +get_value(flag=0, indent=0)[source] +

                          Get the extension value, for example ‘DNS:www.example.com’.

                          @@ -3611,19 +3739,19 @@ for example ‘sha1’.
                          -m2_x509_extension_free()
                          +m2_x509_extension_free()
                          -set_critical(critical=1)[source]
                          +set_critical(critical=1)[source]

                          Mark this extension critical or noncritical. By default an extension is not critical.

                          Parameters:
                            -
                          • flag – Flag to control what and how to print.
                          • -
                          • indent – How many spaces to print before actual value.
                          • +
                          • flag – Flag to control what and how to print.
                          • +
                          • indent – How many spaces to print before actual value.
                          - @@ -3637,13 +3765,13 @@ set this extension to critical.
                          -class M2Crypto.X509.X509_Extension_Stack(stack=None, _pyfree=0)[source]
                          +class M2Crypto.X509.X509_Extension_Stack(stack=None, _pyfree=0)[source]

                          X509 Extension Stack

                          Parameters:critical – Nonzero sets this extension as critical. +
                          Parameters:critical – Nonzero sets this extension as critical. Calling this method without arguments will set this extension to critical.
                          -
                          Warning :Do not modify the underlying OpenSSL stack +
                          Warning:Do not modify the underlying OpenSSL stack except through this interface, or use any OpenSSL functions that do so indirectly. Doing so will get the OpenSSL stack and the internal pystack of this class out @@ -3654,12 +3782,12 @@ even python crashes!
                          -m2_sk_x509_extension_free()
                          +m2_sk_x509_extension_free()
                          -pop()[source]
                          +pop()[source]

                          Pop X509_Extension object from the stack.

                          @@ -3673,13 +3801,13 @@ even python crashes!
                          -push(x509_ext)[source]
                          +push(x509_ext)[source]

                          Push X509_Extension object onto the stack.

                          - + @@ -3691,29 +3819,29 @@ even python crashes!
                          -class M2Crypto.X509.X509_Name(x509_name=None, _pyfree=0)[source]
                          +class M2Crypto.X509.X509_Name(x509_name=None, _pyfree=0)[source]

                          X509 Name

                          -add_entry_by_txt(field, type, entry, len, loc, set)[source]
                          +add_entry_by_txt(field, type, entry, len, loc, set)[source]

                          Add X509_Name field whose name is identified by its name.

                          Parameters:x509_ext – X509_Extension object to be pushed onto the stack.
                          Parameters:x509_ext – X509_Extension object to be pushed onto the stack.
                          Returns:The number of extensions on the stack.
                          Parameters:
                            -
                          • field – name of the entry
                          • -
                          • type – use MBSTRING_ASC or MBSTRING_UTF8 +
                          • field – name of the entry
                          • +
                          • type – use MBSTRING_ASC or MBSTRING_UTF8 (or standard ASN1 type like V_ASN1_IA5STRING)
                          • -
                          • entry – value
                          • -
                          • len – buf_len of the entry +
                          • entry – value
                          • +
                          • len – buf_len of the entry (-1 and the length is computed automagically)
                          -

                          The loc and set parameters determine where a new entry +

                          The loc and set parameters determine where a new entry should be added. For almost all applications loc can be set to -1 and set to 0. This adds a new entry to the end of name as a single valued @@ -3723,9 +3851,9 @@ RelativeDistinguishedName (RDN).

                        Parameters:
                          -
                        • loc – determines the index where the new entry is +
                        • loc – determines the index where the new entry is inserted: if it is -1 it is appended.
                        • -
                        • set – determines how the new type is added. If it is zero +
                        • set – determines how the new type is added. If it is zero a new RDN is created. If set is -1 or 1 it is added to the previous or next RDN structure respectively. This will then be a multivalued @@ -3743,26 +3871,26 @@ almost always set to zero.
                        • -as_der()[source]
                          +as_der()[source]
                          -as_hash()[source]
                          +as_hash()[source]
                          -as_text(indent=0, flags=0)[source]
                          +as_text(indent=0, flags=0)[source]

                          as_text returns the name as a string.

                          @@ -3772,18 +3900,18 @@ by this many spaces.
                          -entry_count()[source]
                          +entry_count()[source]
                          -get_entries_by_nid(nid)[source]
                          +get_entries_by_nid(nid)[source]

                          Retrieve the next index matching nid.

                          Parameters:
                            -
                          • indent – Each line in multiline format is indented +
                          • indent – Each line in multiline format is indented by this many spaces.
                          • -
                          • flags – Flags that control how the output should be formatted.
                          • +
                          • flags – Flags that control how the output should be formatted.
                          - + @@ -3793,49 +3921,49 @@ by this many spaces.
                          -m2_x509_name_free()
                          +m2_x509_name_free()
                          -nid = {'C': 14, 'serialNumber': 105, 'organizationName': 17, 'CN': 13, 'SP': 16, 'commonName': 13, 'L': 15, 'stateOrProvinceName': 16, 'ST': 16, 'emailAddress': 48, 'O': 17, 'localityName': 15, 'GN': 99, 'surname': 100, 'OU': 18, 'givenName': 99, 'Email': 48, 'organizationUnitName': 18, 'SN': 100}
                          +nid = {'C': 14, 'serialNumber': 105, 'organizationName': 17, 'CN': 13, 'SP': 16, 'commonName': 13, 'L': 15, 'stateOrProvinceName': 16, 'ST': 16, 'emailAddress': 48, 'O': 17, 'localityName': 15, 'GN': 99, 'surname': 100, 'OU': 18, 'givenName': 99, 'Email': 48, 'organizationUnitName': 18, 'SN': 100}
                          -class M2Crypto.X509.X509_Name_Entry(x509_name_entry, _pyfree=0)[source]
                          +class M2Crypto.X509.X509_Name_Entry(x509_name_entry, _pyfree=0)[source]

                          X509 Name Entry

                          -create_by_txt(field, type, entry, len)[source]
                          +create_by_txt(field, type, entry, len)[source]
                          -get_data()[source]
                          +get_data()[source]
                          -get_object()[source]
                          +get_object()[source]
                          -m2_x509_name_entry_free()
                          +m2_x509_name_entry_free()
                          -set_data(data, type=4097)[source]
                          +set_data(data, type=4097)[source]

                          Sets the field name to asn1obj

                          Parameters:nid – name of the entry (as m2.NID* constants)
                          Parameters:nid – name of the entry (as m2.NID* constants)
                          Returns:list of X509_Name_Entry items
                          - + @@ -3845,13 +3973,13 @@ by this many spaces.
                          -set_object(asn1obj)[source]
                          +set_object(asn1obj)[source]

                          Sets the field name to asn1obj

                          Parameters:data – data in a binary form to be set
                          Parameters:data – data in a binary form to be set
                          Returns:0 on failure, 1 on success
                          - + @@ -3863,13 +3991,13 @@ by this many spaces.
                          -class M2Crypto.X509.X509_Stack(stack=None, _pyfree=0, _pyfree_x509=0)[source]
                          +class M2Crypto.X509.X509_Stack(stack=None, _pyfree=0, _pyfree_x509=0)[source]

                          X509 Stack

                          Parameters:asn1obj
                          Parameters:asn1obj
                          Returns:0 on failure, 1 on success
                          -
                          Warning :Do not modify the underlying OpenSSL stack +
                          Warning:Do not modify the underlying OpenSSL stack except through this interface, or use any OpenSSL functions that do so indirectly. Doing so will get the OpenSSL stack and the internal pystack of this class out @@ -3880,18 +4008,18 @@ even python crashes!
                          -as_der()[source]
                          +as_der()[source]

                          Return the stack as a DER encoded string

                          -m2_sk_x509_free()
                          +m2_sk_x509_free()
                          -pop()[source]
                          +pop()[source]

                          pop a certificate from the stack.

                          @@ -3906,13 +4034,13 @@ nothing to pop.
                          -push(x509)[source]
                          +push(x509)[source]

                          push an X509 certificate onto the stack.

                          - + @@ -3924,26 +4052,26 @@ nothing to pop.
                          -class M2Crypto.X509.X509_Store(store=None, _pyfree=0)[source]
                          +class M2Crypto.X509.X509_Store(store=None, _pyfree=0)[source]

                          X509 Store

                          -add_cert(x509)
                          +add_cert(x509)
                          -add_x509(x509)[source]
                          +add_x509(x509)[source]
                          -load_info(file)[source]
                          +load_info(file)[source]
                          Parameters:x509 – X509 object.
                          Parameters:x509 – X509 object.
                          Returns:The number of X509 objects currently on the stack.
                          - + @@ -3953,12 +4081,12 @@ nothing to pop.
                          -load_locations(file)
                          +load_locations(file)
                          Parameters:file – filename
                          Parameters:file – filename
                          Returns:1 on success, 0 on failure
                          - + @@ -3968,28 +4096,28 @@ nothing to pop.
                          -m2_x509_store_free()
                          +m2_x509_store_free()
                          -set_verify_cb(callback=None)[source]
                          +set_verify_cb(callback=None)[source]

                          Set callback which will be called when the store is verified. Wrapper over OpenSSL X509_STORE_set_verify_cb().

                          Parameters:file – filename
                          Parameters:file – filename
                          Returns:1 on success, 0 on failure
                          - - - @@ -4002,11 +4130,11 @@ verify() call.
                          -class M2Crypto.X509.X509_Store_Context(x509_store_ctx, _pyfree=0)[source]
                          +class M2Crypto.X509.X509_Store_Context(x509_store_ctx, _pyfree=0)[source]

                          X509 Store Context

                          -get1_chain()[source]
                          +get1_chain()[source]

                          Get certificate chain.

                          Parameters:callback – Callable to specify verification options. +
                          Parameters:callback – Callable to specify verification options. Type of the callable must be: (int, X509_Store_Context) -> int. If None: set the standard options.
                          Note :compile-time or run-time errors in the callback would result +
                          Note:compile-time or run-time errors in the callback would result in mysterious errors during verification, which could be hard to trace.
                          Note :Python exceptions raised in callbacks do not propagate to +
                          Note:Python exceptions raised in callbacks do not propagate to verify() call.
                          Returns:None
                          @@ -4021,13 +4149,13 @@ context goes away) stack of certificates in the chain.
                          -get_current_cert()[source]
                          +get_current_cert()[source]

                          Get current X.509 certificate.

                          - @@ -4037,35 +4165,35 @@ away or is modified.
                          -get_error()[source]
                          +get_error()[source]

                          Get error code.

                          -get_error_depth()[source]
                          +get_error_depth()[source]

                          Get error depth.

                          -m2_x509_store_ctx_free()
                          +m2_x509_store_ctx_free()
                          -M2Crypto.X509.load_cert(file, format=1)[source]
                          +M2Crypto.X509.load_cert(file, format=1)[source]

                          Load certificate from file.

                          Warning :The returned certificate is NOT refcounted, so you can not +
                          Warning:The returned certificate is NOT refcounted, so you can not rely on it being valid once the store context goes away or is modified.
                          @@ -4079,15 +4207,15 @@ either PEM or DER.
                          -M2Crypto.X509.load_cert_bio(bio, format=1)[source]
                          +M2Crypto.X509.load_cert_bio(bio, format=1)[source]

                          Load certificate from a bio.

                          Parameters:
                            -
                          • file – Name of file containing certificate in either DER or +
                          • file – Name of file containing certificate in either DER or PEM format.
                          • -
                          • format – Describes the format of the file to be loaded, +
                          • format – Describes the format of the file to be loaded, either PEM or DER.
                          Parameters:
                            -
                          • bio – BIO pointing at a certificate in either DER or PEM format.
                          • -
                          • format – Describes the format of the cert to be loaded, +
                          • bio – BIO pointing at a certificate in either DER or PEM format.
                          • +
                          • format – Describes the format of the cert to be loaded, either PEM or DER (via constants FORMAT_PEM and FORMAT_FORMAT_DER)
                          @@ -4102,13 +4230,13 @@ and FORMAT_FORMAT_DER)
                          -M2Crypto.X509.load_cert_der_string(string)[source]
                          +M2Crypto.X509.load_cert_der_string(string)[source]

                          Load certificate from a string.

                          - + @@ -4118,15 +4246,15 @@ and FORMAT_FORMAT_DER)
                          -M2Crypto.X509.load_cert_string(string, format=1)[source]
                          +M2Crypto.X509.load_cert_string(string, format=1)[source]

                          Load certificate from a string.

                          Parameters:string – String containing a certificate in DER format.
                          Parameters:string – String containing a certificate in DER format.
                          Returns:M2Crypto.X509.X509 object.
                          Parameters:
                            -
                          • string – String containing a certificate in either DER or PEM format.
                          • -
                          • format – Describes the format of the cert to be loaded, +
                          • string – String containing a certificate in either DER or PEM format.
                          • +
                          • format – Describes the format of the cert to be loaded, either PEM or DER (via constants FORMAT_PEM and FORMAT_FORMAT_DER)
                          @@ -4141,13 +4269,13 @@ and FORMAT_FORMAT_DER)
                          -M2Crypto.X509.load_crl(file)[source]
                          +M2Crypto.X509.load_crl(file)[source]

                          Load CRL from file.

                          - + @@ -4157,16 +4285,16 @@ and FORMAT_FORMAT_DER)
                          -M2Crypto.X509.load_request(file, format=1)[source]
                          +M2Crypto.X509.load_request(file, format=1)[source]

                          Load certificate request from file.

                          Parameters:file – Name of file containing CRL in PEM format.
                          Parameters:file – Name of file containing CRL in PEM format.
                          Returns:M2Crypto.X509.CRL object.
                          Parameters:
                            -
                          • file – Name of file containing certificate request in +
                          • file – Name of file containing certificate request in either PEM or DER format.
                          • -
                          • format – Describes the format of the file to be loaded, +
                          • format – Describes the format of the file to be loaded, either PEM or DER. (using constants FORMAT_PEM and FORMAT_DER)
                          @@ -4181,16 +4309,16 @@ and FORMAT_DER)
                          -M2Crypto.X509.load_request_bio(bio, format=1)[source]
                          +M2Crypto.X509.load_request_bio(bio, format=1)[source]

                          Load certificate request from a bio.

                          Parameters:
                            -
                          • bio – BIO pointing at a certificate request in +
                          • bio – BIO pointing at a certificate request in either DER or PEM format.
                          • -
                          • format – Describes the format of the request to be loaded, +
                          • format – Describes the format of the request to be loaded, either PEM or DER. (using constants FORMAT_PEM and FORMAT_DER)
                          @@ -4205,13 +4333,13 @@ and FORMAT_DER)
                          -M2Crypto.X509.load_request_der_string(string)[source]
                          +M2Crypto.X509.load_request_der_string(string)[source]

                          Load certificate request from a string.

                          - + @@ -4221,16 +4349,16 @@ and FORMAT_DER)
                          -M2Crypto.X509.load_request_string(string, format=1)[source]
                          +M2Crypto.X509.load_request_string(string, format=1)[source]

                          Load certificate request from a string.

                          Parameters:string – String containing a certificate request in DER format.
                          Parameters:string – String containing a certificate request in DER format.
                          Returns:M2Crypto.X509.Request object.
                          -
                          Parameters:
                            -
                          • string – String containing a certificate request in +
                          • string – String containing a certificate request in either DER or PEM format.
                          • -
                          • format – Describes the format of the request to be loaded, +
                          • format – Describes the format of the request to be loaded, either PEM or DER. (using constants FORMAT_PEM and FORMAT_DER)
                          @@ -4245,13 +4373,13 @@ and FORMAT_DER)
                          -M2Crypto.X509.new_extension(name, value, critical=0, _pyfree=1)[source]
                          +M2Crypto.X509.new_extension(name, value, critical=0, _pyfree=1)[source]

                          Create new X509_Extension instance.

                          -M2Crypto.X509.new_stack_from_der(der_string)[source]
                          +M2Crypto.X509.new_stack_from_der(der_string)[source]

                          Create a new X509_Stack from DER string.

                          @@ -4265,47 +4393,47 @@ and FORMAT_DER)
                          -M2Crypto.X509.x509_store_default_cb(ok, ctx)[source]
                          +M2Crypto.X509.x509_store_default_cb(ok, ctx)[source]
                          -

                          callback Module

                          +

                          callback Module

                          -

                          ftpslib Module

                          +

                          ftpslib Module

                          -class M2Crypto.ftpslib.FTP_TLS(host=None, ssl_ctx=None)[source]
                          -

                          Bases: ftplib.FTP

                          +class M2Crypto.ftpslib.FTP_TLS(host=None, ssl_ctx=None)[source] +

                          Bases: ftplib.FTP

                          Python OO interface to client-side FTP/TLS.

                          -auth_ssl()[source]
                          +auth_ssl()[source]

                          Secure the control connection per AUTH SSL, aka AUTH TLS-P.

                          -auth_tls()[source]
                          +auth_tls()[source]

                          Secure the control connection per AUTH TLS, aka AUTH TLS-C.

                          -ntransfercmd(cmd, rest=None)[source]
                          +ntransfercmd(cmd, rest=None)[source]

                          Initiate a data transfer.

                          -prot_c()[source]
                          +prot_c()[source]

                          Set up data connection in the clear.

                          -prot_p()[source]
                          +prot_p()[source]

                          Set up secure data connection.

                          @@ -4313,43 +4441,43 @@ and FORMAT_DER)
                          -

                          httpslib Module

                          +

                          httpslib Module

                          -class M2Crypto.httpslib.HTTPSConnection(host, port=None, strict=None, **ssl)[source]
                          -

                          Bases: httplib.HTTPConnection

                          +class M2Crypto.httpslib.HTTPSConnection(host, port=None, strict=None, **ssl)[source] +

                          Bases: httplib.HTTPConnection

                          This class allows communication via SSL using M2Crypto.

                          -close()[source]
                          +close()[source]
                          -connect()[source]
                          +connect()[source]
                          -default_port = 443
                          +default_port = 443
                          -get_session()[source]
                          +get_session()[source]
                          -set_session(session)[source]
                          +set_session(session)[source]
                          -class M2Crypto.httpslib.ProxyHTTPSConnection(host, port=None, strict=None, username=None, password=None, **ssl)[source]
                          -

                          Bases: M2Crypto.httpslib.HTTPSConnection

                          +class M2Crypto.httpslib.ProxyHTTPSConnection(host, port=None, strict=None, username=None, password=None, **ssl)[source] +

                          Bases: M2Crypto.httpslib.HTTPSConnection

                          An HTTPS Connection that uses a proxy and the CONNECT request.

                          When the connection is initiated, CONNECT is first sent to the proxy (along with authorization headers, if supplied). If successful, an SSL connection @@ -4359,22 +4487,22 @@ host.

                          through the proxy.

                          -connect()[source]
                          +connect()[source]
                          -endheaders(*args, **kwargs)[source]
                          +endheaders(*args, **kwargs)[source]
                          -putheader(header, value)[source]
                          +putheader(header, value)[source]
                          -putrequest(method, url, skip_host=0, skip_accept_encoding=0)[source]
                          +putrequest(method, url, skip_host=0, skip_accept_encoding=0)[source]

                          putrequest is called before connect, so can interpret url and get real host/port to be used to make CONNECT request to proxy

                          @@ -4383,71 +4511,25 @@ real host/port to be used to make CONNECT request to proxy

                          -

                          m2 Module

                          +

                          m2 Module

                          -

                          m2crypto Module

                          -
                          -
                          -class M2Crypto.m2crypto.stack_st_OPENSSL_BLOCK
                          -

                          Bases: SwigPyObject

                          -

                          ::stack_st_OPENSSL_BLOCK

                          -
                          -
                          -stack
                          -

                          stack_st_OPENSSL_BLOCK.stack

                          -
                          - -
                          -
                          -this
                          -
                          - -
                          -
                          -thisown
                          -
                          - -
                          - -
                          -
                          -class M2Crypto.m2crypto.stack_st_OPENSSL_STRING
                          -

                          Bases: SwigPyObject

                          -

                          ::stack_st_OPENSSL_STRING

                          -
                          -
                          -stack
                          -

                          stack_st_OPENSSL_STRING.stack

                          -
                          - -
                          -
                          -this
                          -
                          - -
                          -
                          -thisown
                          -
                          - -
                          - +

                          m2crypto Module

                          -

                          m2urllib Module

                          +

                          m2urllib Module

                          -M2Crypto.m2urllib.open_https(self, url, data=None, ssl_context=None)[source]
                          +M2Crypto.m2urllib.open_https(self, url, data=None, ssl_context=None)[source]

                          Open URL over the SSL connection.

                          @@ -4460,14 +4542,14 @@ real host/port to be used to make CONNECT request to proxy

                          -

                          m2urllib2 Module

                          +

                          m2urllib2 Module

                          -class M2Crypto.m2urllib2.HTTPSHandler(ssl_context=None)[source]
                          -

                          Bases: urllib2.AbstractHTTPHandler

                          +class M2Crypto.m2urllib2.HTTPSHandler(ssl_context=None)[source] +

                          Bases: urllib2.AbstractHTTPHandler

                          -https_open(req)[source]
                          +https_open(req)[source]

                          Return an addinfourl object for the request, using http_class.

                          http_class must implement the HTTPConnection API from httplib. The addinfourl return value is a file-like object. It also @@ -4483,14 +4565,14 @@ has methods and attributes including:

                          -https_request(request)
                          +https_request(request)
                          -M2Crypto.m2urllib2.build_opener(ssl_context=None, *handlers)[source]
                          +M2Crypto.m2urllib2.build_opener(ssl_context=None, *handlers)[source]

                          Create an opener object from a list of handlers.

                          The opener will use several default handlers, including support for HTTP and FTP.

                          @@ -4500,95 +4582,95 @@ default handlers, the default handlers will not be used.

                          -

                          m2xmlrpclib Module

                          +

                          m2xmlrpclib Module

                          -class M2Crypto.m2xmlrpclib.SSL_Transport(ssl_context=None, *args, **kw)[source]
                          -

                          Bases: xmlrpclib.Transport

                          +class M2Crypto.m2xmlrpclib.SSL_Transport(ssl_context=None, *args, **kw)[source] +

                          Bases: xmlrpclib.Transport

                          -request(host, handler, request_body, verbose=0)[source]
                          +request(host, handler, request_body, verbose=0)[source]
                          -user_agent = 'M2Crypto_XMLRPC/0.26.0 - xmlrpclib.py/1.0.1 (by www.pythonware.com)'
                          +user_agent = 'M2Crypto_XMLRPC/0.28.0 - xmlrpclib.py/1.0.1 (by www.pythonware.com)'
                          -

                          threading Module

                          +

                          threading Module

                          -M2Crypto.threading.cleanup()[source]
                          +M2Crypto.threading.cleanup()[source]

                          End and cleanup threading support.

                          -M2Crypto.threading.init()[source]
                          +M2Crypto.threading.init()[source]

                          Initialize threading support.

                          -

                          util Module

                          +

                          util Module

                          -exception M2Crypto.util.UtilError[source]
                          -

                          Bases: exceptions.Exception

                          +exception M2Crypto.util.UtilError[source] +

                          Bases: exceptions.Exception

                          -M2Crypto.util.bin_to_hex(b)[source]
                          +M2Crypto.util.bin_to_hex(b)[source]
                          -M2Crypto.util.genparam_callback(p, n, out=<open file '<stdout>', mode 'w' at 0x7fc7ebc63150>)[source]
                          +M2Crypto.util.genparam_callback(p, n, out=<open file '<stdout>', mode 'w'>)[source]
                          -M2Crypto.util.no_passphrase_callback(*args)[source]
                          +M2Crypto.util.no_passphrase_callback(*args)[source]
                          -M2Crypto.util.octx_to_num(x)[source]
                          +M2Crypto.util.octx_to_num(x)[source]
                          -M2Crypto.util.passphrase_callback(v, prompt1='Enter passphrase:', prompt2='Verify passphrase:')[source]
                          +M2Crypto.util.passphrase_callback(v, prompt1='Enter passphrase:', prompt2='Verify passphrase:')[source]
                          -M2Crypto.util.pkcs5_pad(data, blklen=8)[source]
                          +M2Crypto.util.pkcs5_pad(data, blklen=8)[source]
                          -M2Crypto.util.pkcs7_pad(data, blklen)[source]
                          +M2Crypto.util.pkcs7_pad(data, blklen)[source]
                          -M2Crypto.util.py3bytes(x)[source]
                          +M2Crypto.util.py3bytes(x)[source]
                          -M2Crypto.util.py3str(x)[source]
                          +M2Crypto.util.py3str(x)[source]
                          -M2Crypto.util.quiet_genparam_callback(p, n, out)[source]
                          +M2Crypto.util.quiet_genparam_callback(p, n, out)[source]
                          @@ -4596,27 +4678,18 @@ default handlers, the default handlers will not be used.

                          Subpackages

                          -
                          + - + + + + \ No newline at end of file diff --git a/doc/html/ZServerSSL-HOWTO.html b/doc/html/ZServerSSL-HOWTO.html index dc1dc32..61bc6e0 100644 --- a/doc/html/ZServerSSL-HOWTO.html +++ b/doc/html/ZServerSSL-HOWTO.html @@ -1,50 +1,42 @@ - - - - 1.   ZServerSSL-HOWTO — M2Crypto documentation - - + 1.   ZServerSSL-HOWTO — M2Crypto documentation + - - + + + + + + + + - +
                          -
                          +

                          1.   ZServerSSL-HOWTO

                          @@ -81,7 +73,7 @@

                          1.1.   Introduction

                          -

                          ZServerSSL adds to Zope’s ZServer the following:

                          +

                          ZServerSSL adds to Zope’s ZServer the following:

                          • HTTPS server
                          • WebDAV-source-over-HTTPS server
                          • @@ -95,67 +87,70 @@ in Un*x fashion.

                            1.2.   Preparation

                              -
                            1. Download M2Crypto 0.11, contained in the file m2crypto-0.11.zip.
                            2. -
                            3. Unpack m2crypto-0.11.zip. This will create a directory -m2crypto-0.11. Henceforth, we refer to this directory as $M2.
                            4. -
                            5. Install M2Crypto per the instructions in $M2/INSTALL.
                            6. +
                            7. Download M2Crypto 0.11, contained in the file m2crypto-0.11.zip.
                            8. +
                            9. Unpack m2crypto-0.11.zip. This will create a directory +m2crypto-0.11. Henceforth, we refer to this directory as $M2.
                            10. +
                            11. Install M2Crypto per the instructions in $M2/INSTALL.
                            -

                            The ZServerSSL distribution is in $M2/demo/Zope. We shall refer to -this directory as $ZSSL.

                            +

                            The ZServerSSL distribution is in $M2/demo/Zope. We shall refer to +this directory as $ZSSL.

                            1.3.   Installation

                            -

                            Below, we refer to your Zope top-level directory as $ZOPE.

                            +

                            Below, we refer to your Zope top-level directory as $ZOPE.

                              -
                            1. Copy $ZSSL/z2s.py into $ZOPE.

                              +
                            2. Copy $ZSSL/z2s.py into $ZOPE.

                            3. -
                            4. Depending on your operating system, modify $ZOPE/start or -$ZOPE/start.bat to invoke $ZOPE/z2s.py, instead of -$ZOPE/z2.py. The files $ZSSL/starts and $ZSSL/starts.bat +

                            5. Depending on your operating system, modify $ZOPE/start or +$ZOPE/start.bat to invoke $ZOPE/z2s.py, instead of +$ZOPE/z2.py. The files $ZSSL/starts and $ZSSL/starts.bat serve as examples.

                            6. -
                            7. Copy $ZSSL/dh1024.pem into $ZOPE. This file contains +

                            8. Copy $ZSSL/dh1024.pem into $ZOPE. This file contains Diffie-Hellman parameters for use by the SSL protocol.

                            9. -
                            10. Copy $ZSSL/randpool.dat into $ZOPE. This file contains seed +

                            11. Copy $ZSSL/randpool.dat into $ZOPE. This file contains seed material for the OpenSSL PRNG. Alternatively, create -$ZOPE/randpool.dat thusly:

                              -
                              $ dd if=/dev/urandom of=randpool.dat bs=1024 count=1
                              +$ZOPE/randpool.dat thusly:

                              +
                              $ dd if=/dev/urandom of=randpool.dat bs=1024 count=1
                              +
                            12. -
                            13. Copy $ZSSL/ca.pem to $ZOPE. This file contains an +

                            14. Copy $ZSSL/ca.pem to $ZOPE. This file contains an example Certification Authority (CA) certificate. For -information on operating your own CA, see HOWTO: Creating your own CA with OpenSSL or +information on operating your own CA, see HOWTO: Creating your own CA with OpenSSL or one of numerous similar documents available on the web.

                            15. -
                            16. Copy $ZSSL/server.pem to $ZOPE. This file contains an RSA key +

                            17. Copy $ZSSL/server.pem to $ZOPE. This file contains an RSA key pair and its X.509v3 certificate issued by the above CA. You may also create your own key/certificate bundle.

                            18. -
                            19. Copy $ZSSL/ZServer/HTTPS_Server.py to $ZOPE/ZServer.

                              +
                            20. Copy $ZSSL/ZServer/HTTPS_Server.py to $ZOPE/ZServer.

                            21. -
                            22. Copy $ZSSL/ZServer/__init__.py to $ZOPE/ZServer. This -overwrites the existing $ZOPE/ZServer/__init__.py. Alternatively, -apply the following patch to $ZOPE/ZServer/__init__.py:

                              -
                              --- __init__.py.org     Sat Jun 21 23:20:41 2003
                              -+++ __init__.py Tue Jan  7 23:30:53 2003
                              -@@ -84,6 +84,7 @@
                              - import asyncore
                              - from medusa import resolver, logger
                              - from HTTPServer import zhttp_server, zhttp_handler
                              -+from HTTPS_Server import zhttps_server, zhttps_handler
                              - from PCGIServer import PCGIServer
                              - from FCGIServer import FCGIServer
                              - from FTPServer import FTPServer
                              +
                            23. Copy $ZSSL/ZServer/__init__.py to $ZOPE/ZServer. This +overwrites the existing $ZOPE/ZServer/__init__.py. Alternatively, +apply the following patch to $ZOPE/ZServer/__init__.py:

                              +
                              --- __init__.py.org     Sat Jun 21 23:20:41 2003
                              ++++ __init__.py Tue Jan  7 23:30:53 2003
                              +@@ -84,6 +84,7 @@
                              + import asyncore
                              + from medusa import resolver, logger
                              + from HTTPServer import zhttp_server, zhttp_handler
                              ++from HTTPS_Server import zhttps_server, zhttps_handler
                              + from PCGIServer import PCGIServer
                              + from FCGIServer import FCGIServer
                              + from FTPServer import FTPServer
                              +
                            24. -
                            25. Copy $ZSSL/ZServer/medusa/https_server.py to -$ZOPE/ZServer/medusa.

                              +
                            26. Copy $ZSSL/ZServer/medusa/https_server.py to +$ZOPE/ZServer/medusa.

                            27. Stop Zope, if it is running.

                            28. Start Zope with ZServerSSL thusly:

                              -
                              ./starts -X -f 9021 -w 9080 -W 9081 -y 9443 -Y 9444
                              +
                              ./starts -X -f 9021 -w 9080 -W 9081 -y 9443 -Y 9444
                              +

                              This starts the following:

                                @@ -170,28 +165,28 @@ apply the following patch to $ZOP

                              1.4.   Testing

                              -

                              Below, we assume your Zope server is running on localhost.

                              +

                              Below, we assume your Zope server is running on localhost.

                              1.5.   HTTPS

                              This testing is done with Mozilla 1.1 on FreeBSD.

                              1. With a browser, connect to https://localhost:9443/. Browse around. -Check out your browser’s HTTPS informational screens.
                              2. +Check out your browser’s HTTPS informational screens.
                              3. Connect to https://localhost:9443/manage. Verify that you can access -Zope’s management functionality.
                              4. +Zope’s management functionality.

                              1.6.   WebDAV-over-HTTPS

                              This testing is done with Cadaver 0.21.0 on FreeBSD.:

                              -
                              $ cadaver https://localhost:9443/
                              +
                              $ cadaver https://localhost:9443/
                               WARNING: Untrusted server certificate presented:
                               Issued to: M2Crypto, SG
                               Issued by: M2Crypto, SG
                               Do you wish to accept the certificate? (y/n) y
                               dav:/> ls
                              -Listing collection `/': succeeded.
                              +Listing collection `/': succeeded.
                               Coll:   Channels                               0  Jun 19 00:04
                               Coll:   Control_Panel                          0  Jun  6 00:13
                               Coll:   Examples                               0  Jun  6 00:12
                              @@ -214,8 +209,9 @@ Coll:   zope                                   0  Jun 20 15:27
                                       standard_template.pt                 282  Jun  6 00:12
                                       zsyncer                                0  Jun 17 15:28
                               dav:/> quit
                              -Connection to `localhost' closed.
                              -$
                              +Connection to `localhost' closed. +$ +
                            @@ -223,10 +219,10 @@ $

                            This testing is done with Mozilla 1.1 on FreeBSD.

                            1. Open the Mozilla Composer window.
                            2. -
                            3. Click “File”, “Open Web Location”. A dialog box appears.
                            4. -
                            5. Enter https://localhost:9444/index_html for the URL.
                            6. -
                            7. Select “Open in new Composer window.”
                            8. -
                            9. Click “Open”. A new Composer window will open with index_html +
                            10. Click “File”, “Open Web Location”. A dialog box appears.
                            11. +
                            12. Enter https://localhost:9444/index_html for the URL.
                            13. +
                            14. Select “Open in new Composer window.”
                            15. +
                            16. Click “Open”. A new Composer window will open with index_html loaded.
                            @@ -236,7 +232,7 @@ loaded.

                          1.9.   HTTPS

                          -
                          >>> from M2Crypto import Rand, SSL, m2urllib
                          +
                          >>> from M2Crypto import Rand, SSL, m2urllib
                           >>> url = m2urllib.FancyURLopener()
                           >>> url.addheader('Connection', 'close')
                           >>> u = url.open('https://127.0.0.1:9443/')
                          @@ -251,37 +247,38 @@ loaded.
                           >>> while 1:
                           ...     data = u.read()
                           ...     if not data: break
                          -...     print(data)
                          +...     print(data)
                           ...
                           
                          -
                          <html><head>
                          -<base href="https://127.0.0.1:9443/" />
                          -<title>Zope</title></head><body bgcolor="#FFFFFF">
                          +
                          <html><head>
                          +<base href="https://127.0.0.1:9443/" />
                          +<title>Zope</title></head><body bgcolor="#FFFFFF">
                           
                          -<h1>NgPS Desktop Portal</h1>
                          +<h1>NgPS Desktop Portal</h1>
                           
                          -&nbsp;&nbsp;So many hacks.<br>
                          -&nbsp;&nbsp;So little time.<br>
                          +&nbsp;&nbsp;So many hacks.<br>
                          +&nbsp;&nbsp;So little time.<br>
                           
                          -<h2>Link Farm</h2>
                          -<ul>
                          -<li><a href="http://localhost:8080/portal">Portal</a></li>
                          -<li><a href="http://localhost/">Local Apache Home Page</a></li>
                          -</ul>
                          +<h2>Link Farm</h2>
                          +<ul>
                          +<li><a href="http://localhost:8080/portal">Portal</a></li>
                          +<li><a href="http://localhost/">Local Apache Home Page</a></li>
                          +</ul>
                           
                          -<hr><a href="http://www.zope.org/Credits" target="_top"><img src="https://127.0.0.1:9443/p_/ZopeButton" width="115" height="50" border="0" alt="Powered by Zope" /></a></body></html>
                          +<hr><a href="http://www.zope.org/Credits" target="_top"><img src="https://127.0.0.1:9443/p_/ZopeButton" width="115" height="50" border="0" alt="Powered by Zope" /></a></body></html> +
                          -
                          >>> u.close()
                          +
                          >>> u.close()
                           >>>
                           

                          1.10.   XMLRPC-over-HTTPS

                          -
                          >>> from M2Crypto.m2xmlrpclib import Server, SSL_Transport
                          +
                          >>> from M2Crypto.m2xmlrpclib import Server, SSL_Transport
                           >>> zs = Server('https://127.0.0.1:9443/', SSL_Transport())
                          ->>> print(zs.propertyMap())
                          +>>> print(zs.propertyMap())
                           [{'type': 'string', 'id': 'title', 'mode': 'w'}]
                           >>>
                           
                          @@ -297,7 +294,7 @@ loaded.
                          -
                          + - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/ASN1.html b/doc/html/_modules/M2Crypto/ASN1.html index c290e6a..a506287 100644 --- a/doc/html/_modules/M2Crypto/ASN1.html +++ b/doc/html/_modules/M2Crypto/ASN1.html @@ -1,55 +1,45 @@ - - - - M2Crypto.ASN1 — M2Crypto documentation - - + M2Crypto.ASN1 — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.ASN1

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """
                           M2Crypto wrapper for OpenSSL ASN1 API.
                          @@ -63,9 +53,9 @@
                           import datetime
                           import time
                           
                          -from M2Crypto import BIO, m2, util
                          +from M2Crypto import BIO, m2, util
                           if util.py27plus:
                          -    from typing import Any, Callable, Optional, Tuple  # noqa
                          +    from typing import Any, Callable, Optional, Tuple  # noqa
                           
                           MBSTRING_FLAG = 0x1000
                           MBSTRING_ASC = MBSTRING_FLAG | 1
                          @@ -83,7 +73,7 @@
                           
                               def __cmp__(self, other):
                                   # type: (ASN1_Integer) -> int
                          -        if isinstance(other, ASN1_Integer):
                          +        if not isinstance(other, ASN1_Integer):
                                       raise TypeError(
                                           "Comparisons supported only between ANS1_Integer objects")
                           
                          @@ -96,9 +86,9 @@
                           
                               def __int__(self):
                                   # type: () -> int
                          -        return m2.asn1_integer_get(self.asn1int)
                          +        return m2.asn1_integer_get(self.asn1int)
                          + -
                          [docs]class ASN1_String: # noqa m2_asn1_string_free = m2.asn1_string_free @@ -116,7 +106,7 @@ def __str__(self): # type: () -> str - return util.py3str(self.__bytes__()) + return util.py3str(self.__bytes__()) def __del__(self): # type: () -> None @@ -128,7 +118,7 @@
                          [docs] def as_text(self, flags=0): # type: (int) -> str - """output an ASN1_STRING structure according to the set flags. + """Output an ASN1_STRING structure according to the set flags. :param flags: determine the format of the output by using predetermined constants, see ASN1_STRING_print_ex(3) @@ -137,9 +127,9 @@ """ buf = BIO.MemoryBuffer() m2.asn1_string_print_ex(buf.bio_ptr(), self.asn1str, flags) - return util.py3str(buf.read_all()) + return util.py3str(buf.read_all())
                          + -
                          [docs]class ASN1_Object: # noqa m2_asn1_object_free = m2.asn1_object_free @@ -155,9 +145,9 @@ self.m2_asn1_object_free(self.asn1obj) def _ptr(self): - return self.asn1obj + return self.asn1obj
                          + -
                          class _UTC(datetime.tzinfo): def tzname(self, dt): # type: (Optional[datetime.datetime]) -> str @@ -172,12 +162,15 @@ return datetime.timedelta(0) def __repr__(self): - return "<Timezone: %s>" % self.tzname(None) + return "<Timezone: %s>" % self.tzname(None) + + UTC = _UTC() # type: _UTC
                          [docs]class LocalTimezone(datetime.tzinfo): - """ Localtimezone from datetime manual """ + """Localtimezone from datetime manual.""" + def __init__(self): # type: () -> None self._stdoffset = datetime.timedelta(seconds=-time.timezone) @@ -192,19 +185,19 @@ if self._isdst(dt): return self._dstoffset else: - return self._stdoffset -
                          + return self._stdoffset
                          +
                          [docs] def dst(self, dt): # type: (datetime.datetime) -> datetime.timedelta if self._isdst(dt): return self._dstdiff else: - return datetime.timedelta(0) -
                          + return datetime.timedelta(0)
                          +
                          [docs] def tzname(self, dt): # type: (datetime.datetime) -> str - return time.tzname[self._isdst(dt).real] -
                          + return time.tzname[self._isdst(dt).real]
                          + def _isdst(self, dt): # type: (datetime.datetime) -> bool tt = (dt.year, dt.month, dt.day, @@ -212,20 +205,20 @@ dt.weekday(), 0, -1) stamp = time.mktime(tt) tt = time.localtime(stamp) - return tt.tm_isdst > 0 + return tt.tm_isdst > 0
                          + -
                          [docs]class ASN1_TIME: # noqa _ssl_months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] m2_asn1_time_free = m2.asn1_time_free - def __init__(self, asn1_time=None, _pyfree=0, asn1_utctime=None): - # type: (Optional[ASN1_TIME], int) -> None + def __init__(self, asn1_time=None, _pyfree=0, asn1_utctime=None): + # type: (Optional[ASN1_TIME], Optional[int], Optional[ASN1_TIME]) -> None # handle old keyword parameter - if asn1_time is None: + if asn1_time is None: asn1_time = asn1_utctime - if asn1_time is not None: + if asn1_time is not None: assert m2.asn1_time_type_check(asn1_time), \ "'asn1_time' type error'" self.asn1_time = asn1_time @@ -254,27 +247,23 @@
                          [docs] def set_string(self, string): # type: (bytes) -> int - """ - Set time from UTC string. - """ + """Set time from UTC string.""" assert m2.asn1_time_type_check(self.asn1_time), \ "'asn1_time' type error'" - return m2.asn1_time_set_string(self.asn1_time, string) -
                          + return m2.asn1_time_set_string(self.asn1_time, string)
                          +
                          [docs] def set_time(self, time): # type: (int) -> ASN1_TIME - """ - Set time from seconds since epoch (int). - """ + """Set time from seconds since epoch (int).""" assert m2.asn1_time_type_check(self.asn1_time), \ "'asn1_time' type error'" - return m2.asn1_time_set(self.asn1_time, time) -
                          + return m2.asn1_time_set(self.asn1_time, time)
                          +
                          [docs] def get_datetime(self): # type: () -> ASN1_TIME date = str(self) - timezone = None + timezone = None if ' ' not in date: raise ValueError("Invalid date: %s" % date) month, rest = date.split(' ', 1) @@ -291,57 +280,58 @@ dt = dt.replace(month=self._ssl_months.index(month) + 1) if timezone: dt = dt.replace(tzinfo=UTC) - return dt -
                          + return dt
                          +
                          [docs] def set_datetime(self, date): # type: (datetime.datetime) -> ASN1_TIME local = LocalTimezone() - if date.tzinfo is None: + if date.tzinfo is None: date = date.replace(tzinfo=local) date = date.astimezone(local) - return self.set_time(int(time.mktime(date.timetuple()))) -
                          + return self.set_time(int(time.mktime(date.timetuple())))
                          + + ASN1_UTCTIME = ASN1_TIME
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/AuthCookie.html b/doc/html/_modules/M2Crypto/AuthCookie.html index a35c736..47f127c 100644 --- a/doc/html/_modules/M2Crypto/AuthCookie.html +++ b/doc/html/_modules/M2Crypto/AuthCookie.html @@ -1,55 +1,45 @@ - - - - M2Crypto.AuthCookie — M2Crypto documentation - - + M2Crypto.AuthCookie — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.AuthCookie

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """Secure Authenticator Cookies
                           
                          @@ -59,41 +49,41 @@
                           import re
                           import time
                           
                          -from M2Crypto import Rand, m2, util, six
                          -from M2Crypto.six.moves.http_cookies import SimpleCookie  # pylint: disable=no-name-in-module,import-error
                          +from M2Crypto import Rand, m2, util, six
                          +from M2Crypto.six.moves.http_cookies import SimpleCookie  # pylint: disable=no-name-in-module,import-error
                           
                           if util.py27plus:
                          -    from typing import re as type_re, AnyStr, Dict, Optional, Union  # noqa
                          +    from typing import re as type_re, AnyStr, Dict, Optional, Union  # noqa
                           
                           _MIX_FORMAT = 'exp=%f&data=%s&digest='
                          -_MIX_RE = re.compile(r'exp=(\d+\.\d+)&data=(.+)&digest=(\S*)')
                          +_MIX_RE = re.compile(r'exp=(\d+\.\d+)&data=(.+)&digest=(\S*)')
                           
                          -log = logging.getLogger(__name__)
                          +log = logging.getLogger(__name__)
                           
                           
                          -
                          [docs]def mix(expiry, data, format=_MIX_FORMAT): +
                          [docs]def mix(expiry, data, format=_MIX_FORMAT): # type: (float, AnyStr, str) -> AnyStr - return format % (expiry, data) + return format % (expiry, data)
                          + -
                          [docs]def unmix(dough, regex=_MIX_RE): # type: (AnyStr, type_re) -> object mo = regex.match(dough) if mo: return float(mo.group(1)), mo.group(2) else: - return None + return None
                          + -
                          [docs]def unmix3(dough, regex=_MIX_RE): # type: (AnyStr, type_re) -> Optional[tuple[float, AnyStr, AnyStr]] mo = regex.match(dough) if mo: return float(mo.group(1)), mo.group(2), mo.group(3) else: - return None + return None
                          + -
                          _TOKEN = '_M2AUTH_' # type: str @@ -121,8 +111,8 @@ if not isinstance(expiry, (six.integer_types, float)): raise ValueError('Expiration time must be number, not "%s' % expiry) dough = mix(expiry, data) - return AuthCookie(expiry, data, dough, self._hmac(self._key, dough)) -
                          + return AuthCookie(expiry, data, dough, self._hmac(self._key, dough))
                          +
                          [docs] def isGoodCookie(self, cookie): # type: (AuthCookie) -> Union[bool, int] assert isinstance(cookie, AuthCookie) @@ -132,9 +122,9 @@ return (c._expiry == cookie._expiry) \ and (c._data == cookie._data) \ and (c._mac == cookie._mac) \ - and (c.output() == cookie.output()) -
                          -
                          [docs] def isGoodCookieString(self, cookie_str, _debug=False): + and (c.output() == cookie.output())
                          + +
                          [docs] def isGoodCookieString(self, cookie_str, _debug=False): # type: (Union[dict, bytes], bool) -> Union[bool, int] c = SimpleCookie() c.load(cookie_str) @@ -142,7 +132,7 @@ log.error('_TOKEN not in c (keys = %s)', dir(c)) return 0 undough = unmix3(c[_TOKEN].value) - if undough is None: + if undough is None: log.error('undough is None') return 0 exp, data, mac = undough @@ -153,9 +143,9 @@ log.error('mac = %s', mac) log.error('c2._mac = %s', c2._mac) log.error('c2._mac == mac: %s', str(c2._mac == mac)) - return (not c2.isExpired()) and (c2._mac == mac) + return (not c2.isExpired()) and (c2._mac == mac)
                          + -
                          [docs]class AuthCookie: def __init__(self, expiry, data, dough, mac): @@ -179,42 +169,42 @@
                          [docs] def expiry(self): # type: () -> float """Return the cookie's expiry time.""" - return self._expiry -
                          + return self._expiry
                          +
                          [docs] def data(self): # type: () -> str """Return the data portion of the cookie.""" - return self._data -
                          + return self._data
                          +
                          [docs] def mac(self): # type: () -> str """Return the cookie's MAC.""" - return self._mac -
                          -
                          [docs] def output(self): - # type: () -> str + return self._mac
                          + +
                          [docs] def output(self, header="Set-Cookie:"): + # type: (Optional[str]) -> str """Return the cookie's output in "Set-Cookie" format.""" - return self._cookie.output() -
                          + return self._cookie.output(header=header) +
                          [docs] def value(self): # type: () -> str """Return the cookie's output minus the "Set-Cookie: " portion. """ - return self._cookie[_TOKEN].value -
                          + return self._cookie[_TOKEN].value +
                          [docs] def isExpired(self): # type: () -> bool """Return 1 if the cookie has expired, 0 otherwise.""" return isinstance(self._expiry, (float, six.integer_types)) and \ - (time.time() > self._expiry) + (time.time() > self._expiry)
                          # Following two methods are for WebKit only. # I may wish to push them to WKAuthCookie, but they are part - # of the API now. Oh well. + # of the API now. Oh well.
                          [docs] def name(self): # type: () -> str - return self._name -
                          + return self._name +
                          [docs] def headerValue(self): # type: () -> str return self.value()
                          @@ -223,41 +213,41 @@ -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/BIO.html b/doc/html/_modules/M2Crypto/BIO.html index 753291c..a252b48 100644 --- a/doc/html/_modules/M2Crypto/BIO.html +++ b/doc/html/_modules/M2Crypto/BIO.html @@ -1,83 +1,72 @@ - - - - M2Crypto.BIO — M2Crypto documentation - - + M2Crypto.BIO — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.BIO

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """M2Crypto wrapper for OpenSSL BIO API.
                           
                           Copyright (c) 1999-2004 Ng Pheng Siong. All rights reserved."""
                           
                           import logging
                          -import io  # noqa
                           
                          -from M2Crypto import m2, six, util
                          +from M2Crypto import m2, six, util
                           if util.py27plus:
                          -    from typing import AnyStr, Callable, Iterable, Optional, Union  # noqa
                          +    from typing import AnyStr, Callable, Iterable, Optional, Union  # noqa
                           
                           log = logging.getLogger('BIO')
                           
                           
                           
                          [docs]class BIOError(Exception): - pass -
                          + pass
                          + + m2.bio_init(BIOError)
                          [docs]class BIO(object): - """Abstract object interface to the BIO API.""" m2_bio_free = m2.bio_free - def __init__(self, bio=None, _pyfree=0, _close_cb=None): + def __init__(self, bio=None, _pyfree=0, _close_cb=None): # type: (Optional[BIO], int, Optional[Callable]) -> None self.bio = bio self._pyfree = _pyfree @@ -97,17 +86,17 @@
                          [docs] def fileno(self): # type: () -> int - return m2.bio_get_fd(self.bio) -
                          + return m2.bio_get_fd(self.bio)
                          +
                          [docs] def readable(self): # type: () -> bool - return not self.closed -
                          -
                          [docs] def read(self, size=None): + return not self.closed
                          + +
                          [docs] def read(self, size=None): # type: (int) -> Union[bytes, bytearray] if not self.readable(): raise IOError('cannot read') - if size is None: + if size is None: buf = bytearray() while 1: data = m2.bio_read(self.bio, 4096) @@ -116,19 +105,20 @@ buf += data return buf elif size == 0: - return b'' + return b'' elif size < 0: raise ValueError('read count is negative') else: - return bytes(m2.bio_read(self.bio, size)) -
                          + return bytes(m2.bio_read(self.bio, size))
                          +
                          [docs] def readline(self, size=4096): # type: (int) -> bytes if not self.readable(): raise IOError('cannot read') buf = m2.bio_gets(self.bio, size) - return buf -
                          + buf = '' if buf is None else buf + return util.py3bytes(buf)
                          +
                          [docs] def readlines(self, sizehint='ignored'): # type: (Union[AnyStr, int]) -> Iterable[bytes] if not self.readable(): @@ -136,18 +126,18 @@ lines = [] while 1: buf = m2.bio_gets(self.bio, 4096) - if buf is None: + if buf is None: break - lines.append(buf) - return lines -
                          + lines.append(util.py3bytes(buf)) + return lines
                          +
                          [docs] def writeable(self): # type: () -> bool - return (not self.closed) and (not self.write_closed) -
                          + return (not self.closed) and (not self.write_closed)
                          +
                          [docs] def write(self, data): # type: (AnyStr) -> int - """ + """Write data to BIO. :return: either data written, or [0, -1] for nothing written, -2 not implemented @@ -156,34 +146,34 @@ raise IOError('cannot write') if isinstance(data, six.text_type): data = data.encode('utf8') - return m2.bio_write(self.bio, data) -
                          + return m2.bio_write(self.bio, data)
                          +
                          [docs] def write_close(self): # type: () -> None - self.write_closed = 1 -
                          + self.write_closed = 1
                          +
                          [docs] def flush(self): # type: () -> None - """ + """Flush the buffers. :return: 1 for success, and 0 or -1 for failure """ - m2.bio_flush(self.bio) -
                          + m2.bio_flush(self.bio)
                          +
                          [docs] def reset(self): # type: () -> int - """ - Sets the bio to its initial state + """Set the bio to its initial state. + :return: 1 for success, and 0 or -1 for failure """ - return m2.bio_reset(self.bio) -
                          + return m2.bio_reset(self.bio) +
                          [docs] def close(self): # type: () -> None self.closed = 1 if self._close_cb: - self._close_cb() -
                          + self._close_cb() +
                          [docs] def should_retry(self): # type: () -> int """ @@ -191,46 +181,37 @@ ie do_handshake """ - return m2.bio_should_retry(self.bio) -
                          + return m2.bio_should_retry(self.bio) +
                          [docs] def should_read(self): # type: () -> int - """ - Returns whether the cause of the condition is the bio - should read more data - """ - return m2.bio_should_read(self.bio) -
                          + """Should we read more data?""" + + return m2.bio_should_read(self.bio) +
                          [docs] def should_write(self): # type: () -> int - """ - Returns whether the cause of the condition is the bio - should write more data - """ - return m2.bio_should_write(self.bio) -
                          + """Should we write more data?""" + return m2.bio_should_write(self.bio) +
                          [docs] def tell(self): - """ - Return the current offset. - """ - return m2.bio_tell(self.bio) -
                          + """Return the current offset.""" + return m2.bio_tell(self.bio) +
                          [docs] def seek(self, off): - """ - Seek to the specified absolute offset. - """ - return m2.bio_seek(self.bio, off) -
                          + """Seek to the specified absolute offset.""" + return m2.bio_seek(self.bio, off) + def __enter__(self): return self def __exit__(self, *args): - self.close() + # type: (*Any) -> int + self.close() + -
                          [docs]class MemoryBuffer(BIO): - """ - Object interface to BIO_s_mem. + """Object interface to BIO_s_mem. Empirical testing suggests that this class performs less well than cStringIO, because cStringIO is implemented in C, whereas this class @@ -239,15 +220,15 @@ a MemoryBuffer object only when necessary. """ - def __init__(self, data=None): + def __init__(self, data=None): # type: (Optional[bytes]) -> None - if data is not None and not isinstance(data, bytes): + super(MemoryBuffer, self).__init__(self) + if data is not None and not isinstance(data, bytes): raise TypeError( - "data must be bytes or None, not %s" % (type(data).__name__, )) - BIO.__init__(self) + "data must be bytes or None, not %s" % (type(data).__name__, )) self.bio = m2.bio_new(m2.bio_s_mem()) self._pyfree = 1 - if data is not None: + if data is not None: m2.bio_write(self.bio, data) def __len__(self): @@ -261,33 +242,43 @@ if size: return m2.bio_read(self.bio, size) else: - return m2.bio_read(self.bio, m2.bio_ctrl_pending(self.bio)) + return m2.bio_read(self.bio, m2.bio_ctrl_pending(self.bio))
                          - # Backwards-compatibility. + # Backwards-compatibility. getvalue = read_all = read
                          [docs] def write_close(self): # type: () -> None - self.write_closed = 1 - m2.bio_set_mem_eof_return(self.bio, 0) -
                          - close = write_close + super(MemoryBuffer, self).write_close() + m2.bio_set_mem_eof_return(self.bio, 0) + + close = write_close - -
                          [docs]class File(BIO): - """ - Object interface to BIO_s_pyfd +
                          [docs]class File(BIO): + """Object interface to BIO_s_pyfd. - This class interfaces Python to OpenSSL functions that expect BIO \*. For + This class interfaces Python to OpenSSL functions that expect BIO. For general file manipulation in Python, use Python's builtin file object. """ - def __init__(self, pyfile, close_pyfile=1): - # type: (io.BytesIO, int) -> None - BIO.__init__(self, _pyfree=1) + def __init__(self, pyfile, close_pyfile=1, mode='rb'): + # type: (Union[io.BytesIO, AnyStr], int, AnyStr) -> None + super(File, self).__init__(self, _pyfree=1) + + if isinstance(pyfile, six.string_types): + pyfile = open(pyfile, mode) + + # This is for downward compatibility, but I don't think, that it is + # good practice to have two handles for the same file. Whats about + # concurrent write access? Last write, last wins? Especially since Py3 + # has its own buffer management. See: + # + # https://docs.python.org/3.3/c-api/file.html + # + pyfile.flush() + self.fname = pyfile.name self.pyfile = pyfile - self.close_pyfile = close_pyfile # Be wary of https://github.com/openssl/openssl/pull/1925 # BIO_new_fd is NEVER to be used before OpenSSL 1.1.1 if hasattr(m2, "bio_new_pyfd"): @@ -295,30 +286,41 @@ else: self.bio = m2.bio_new_pyfile(pyfile, m2.bio_noclose) + self.close_pyfile = close_pyfile + self.closed = False + +
                          [docs] def flush(self): + # type: () -> None + super(File, self).flush() + self.pyfile.flush()
                          +
                          [docs] def close(self): # type: () -> None - self.closed = 1 + self.flush() + super(File, self).close() if self.close_pyfile: - self.pyfile.close() -
                          + self.pyfile.close()
                          +
                          [docs] def reset(self): # type: () -> int - """ - Sets the bio to its initial state + """Set the bio to its initial state. + :return: 0 for success, and -1 for failure """ - return super(File, self).reset() + return super(File, self).reset()
                          + + def __del__(self): + if not self.closed: + m2.bio_free(self.bio)
                          + -
                          [docs]def openfile(filename, mode='rb'): # type: (AnyStr, AnyStr) -> File - return File(open(filename, mode)) + return File(open(filename, mode))
                          - -
                          [docs]class IOBuffer(BIO): - """ - Object interface to BIO_f_buffer. +
                          [docs]class IOBuffer(BIO): + """Object interface to BIO_f_buffer. Its principal function is to be BIO_push()'ed on top of a BIO_f_ssl, so that makefile() of said underlying SSL socket works. @@ -329,7 +331,7 @@ def __init__(self, under_bio, mode='rwb', _pyfree=1): # type: (BIO, str, int) -> None - BIO.__init__(self, _pyfree=_pyfree) + super(IOBuffer, self).__init__(self, _pyfree=_pyfree) self.io = m2.bio_new(m2.bio_f_buffer()) self.bio = m2.bio_push(self.io, under_bio._ptr()) # This reference keeps the underlying BIO alive while we're not closed. @@ -347,14 +349,11 @@
                          [docs] def close(self): # type: () -> None - BIO.close(self) + BIO.close(self)
                          -
                          -
                          [docs]class CipherStream(BIO): - """ - Object interface to BIO_f_cipher. - """ +
                          [docs]class CipherStream(BIO): + """Object interface to BIO_f_cipher.""" SALT_LEN = m2.PKCS5_SALT_LEN @@ -363,7 +362,7 @@ def __init__(self, obio): # type: (BIO) -> None - BIO.__init__(self, _pyfree=1) + super(CipherStream, self).__init__(self, _pyfree=1) self.obio = obio self.bio = m2.bio_new(m2.bio_f_cipher()) self.closed = 0 @@ -377,16 +376,16 @@ # type: () -> None self.m2_bio_pop(self.bio) self.m2_bio_free(self.bio) - self.closed = 1 -
                          + self.closed = 1
                          +
                          [docs] def write_close(self): # type: () -> None - self.obio.write_close() -
                          + self.obio.write_close() +
                          [docs] def set_cipher(self, algo, key, iv, op): # type: (str, AnyStr, AnyStr, int) -> None - cipher = getattr(m2, algo, None) - if cipher is None: + cipher = getattr(m2, algo, None) + if cipher is None: raise ValueError('unknown cipher', algo) else: if not isinstance(key, bytes): @@ -394,16 +393,15 @@ if not isinstance(iv, bytes): iv = iv.encode('utf8') m2.bio_set_cipher(self.bio, cipher(), key, iv, int(op)) - m2.bio_push(self.bio, self.obio._ptr()) + m2.bio_push(self.bio, self.obio._ptr())
                          + -
                          [docs]class SSLBio(BIO): - """ - Object interface to BIO_f_ssl - """ + """Object interface to BIO_f_ssl.""" + def __init__(self, _pyfree=1): # type: (int) -> None - BIO.__init__(self, _pyfree=_pyfree) + super(SSLBio, self).__init__(self, _pyfree=_pyfree) self.bio = m2.bio_new(m2.bio_f_ssl()) self.closed = 0 @@ -416,12 +414,11 @@ self._pyfree = 0 m2.bio_set_ssl(self.bio, conn.ssl, close_flag) if close_flag == m2.bio_noclose: - conn.set_ssl_close_flag(m2.bio_close) -
                          + conn.set_ssl_close_flag(m2.bio_close) +
                          [docs] def do_handshake(self): # type: () -> int - """ - Do the handshake. + """Do the handshake. Return 1 if the handshake completes Return 0 or a negative number if there is a problem @@ -432,41 +429,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/BN.html b/doc/html/_modules/M2Crypto/BN.html index 139fb19..5a6c2f4 100644 --- a/doc/html/_modules/M2Crypto/BN.html +++ b/doc/html/_modules/M2Crypto/BN.html @@ -1,55 +1,45 @@ - - - - M2Crypto.BN — M2Crypto documentation - - + M2Crypto.BN — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.BN

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """
                           M2Crypto wrapper for OpenSSL BN (BIGNUM) API.
                          @@ -57,9 +47,9 @@
                           Copyright (c) 2005 Open Source Applications Foundation. All rights reserved.
                           """
                           
                          -from M2Crypto import m2, util
                          +from M2Crypto import m2, util
                           if util.py27plus:
                          -    from typing import Optional  # noqa
                          +    from typing import Optional  # noqa
                           
                           
                           
                          [docs]def rand(bits, top=-1, bottom=0): @@ -73,9 +63,9 @@ bits will be 1. :param bottom: If bottom is true, the number will be odd. """ - return m2.bn_rand(bits, top, bottom) + return m2.bn_rand(bits, top, bottom)
                          + -
                          [docs]def rand_range(range): # type: (int) -> int """ @@ -84,9 +74,9 @@ :param range: Upper limit for range. :return: A random number in the range [0, range) """ - return m2.bn_rand_range(range) + return m2.bn_rand_range(range)
                          + -
                          [docs]def randfname(length): # type: (int) -> str """ @@ -112,41 +102,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/DH.html b/doc/html/_modules/M2Crypto/DH.html index 20e4120..2f94b2e 100644 --- a/doc/html/_modules/M2Crypto/DH.html +++ b/doc/html/_modules/M2Crypto/DH.html @@ -1,77 +1,64 @@ - - - - M2Crypto.DH — M2Crypto documentation - - + M2Crypto.DH — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.DH

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """M2Crypto wrapper for OpenSSL DH API.
                           
                           Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
                           
                          -from M2Crypto import BIO, m2, util
                          -from M2Crypto.util import genparam_callback
                          +from M2Crypto import BIO, m2, util
                          +from M2Crypto.util import genparam_callback
                           if util.py27plus:
                          -    from typing import AnyStr, Callable  # noqa
                          +    from typing import AnyStr, Callable  # noqa
                           
                           
                           
                          [docs]class DHError(Exception): - pass -
                          + pass
                          + m2.dh_init(DHError)
                          [docs]class DH: - - """ - Object interface to the Diffie-Hellman key exchange - protocol. + """Object interface to the Diffie-Hellman key exchange protocol. """ m2_dh_free = m2.dh_free @@ -108,7 +95,7 @@ elif name in ('pub', 'priv'): raise DHError('generate (pub, priv) via gen_key()') else: - self.__dict__[name] = value + self.__dict__[name] = value def _ptr(self): return self.dh @@ -116,52 +103,53 @@
                          [docs] def check_params(self): # type: () -> int assert m2.dh_type_check(self.dh), "'dh' type error" - return m2.dh_check(self.dh) -
                          + return m2.dh_check(self.dh)
                          +
                          [docs] def gen_key(self): # type: () -> None assert m2.dh_type_check(self.dh), "'dh' type error" - m2.dh_generate_key(self.dh) -
                          + m2.dh_generate_key(self.dh)
                          +
                          [docs] def compute_key(self, pubkey): # type: (bytes) -> bytes assert m2.dh_type_check(self.dh), "'dh' type error" - return m2.dh_compute_key(self.dh, pubkey) -
                          + return m2.dh_compute_key(self.dh, pubkey)
                          +
                          [docs] def print_params(self, bio): # type: (BIO.BIO) -> int assert m2.dh_type_check(self.dh), "'dh' type error" - return m2.dhparams_print(bio._ptr(), self.dh) + return m2.dhparams_print(bio._ptr(), self.dh)
                          + -
                          [docs]def gen_params(plen, g, callback=genparam_callback): # type: (int, int, Optional[Callable]) -> DH dh_parms = m2.dh_generate_parameters(plen, g, callback) dh_obj = DH(dh_parms, 1) - return dh_obj + return dh_obj
                          -
                          -
                          [docs]def load_params(file): + +
                          [docs]def load_params(file): # type: (AnyStr) -> DH - with BIO.openfile(file) as bio: - return load_params_bio(bio) -
                          + with BIO.openfile(file) as bio: + return load_params_bio(bio)
                          + +
                          [docs]def load_params_bio(bio): # type: (BIO.BIO) -> DH - return DH(m2.dh_read_parameters(bio._ptr()), 1) + return DH(m2.dh_read_parameters(bio._ptr()), 1)
                          + -
                          [docs]def set_params(p, g): # type: (bytes, bytes) -> DH dh = m2.dh_new() m2.dh_set_pg(dh, p, g) - return DH(dh, 1) + return DH(dh, 1)
                          # def free_params(cptr): # m2.dh_free(cptr) -
                          + DH_GENERATOR_2 = m2.DH_GENERATOR_2 DH_GENERATOR_5 = m2.DH_GENERATOR_5
                          @@ -169,41 +157,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/DSA.html b/doc/html/_modules/M2Crypto/DSA.html index 680b32e..902b028 100644 --- a/doc/html/_modules/M2Crypto/DSA.html +++ b/doc/html/_modules/M2Crypto/DSA.html @@ -1,55 +1,45 @@ - - - - M2Crypto.DSA — M2Crypto documentation - - + M2Crypto.DSA — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.DSA

                          -from __future__ import absolute_import, print_function
                          +from __future__ import absolute_import, print_function
                           
                           """
                               M2Crypto wrapper for OpenSSL DSA API.
                          @@ -60,14 +50,14 @@
                               Copyright (C) 2004 OSAF. All Rights Reserved.
                           """
                           
                          -from M2Crypto import BIO, m2, util
                          +from M2Crypto import BIO, m2, util
                           if util.py27plus:
                          -    from typing import AnyStr, Callable, Tuple  # noqa
                          +    from typing import AnyStr, Callable, Tuple  # noqa
                           
                           
                           
                          [docs]class DSAError(Exception): - pass -
                          + pass
                          + m2.dsa_init(DSAError) @@ -146,7 +136,7 @@ elif name in ['pub', 'priv']: raise DSAError('generate (pub, priv) via gen_key()') else: - self.__dict__[name] = value + self.__dict__[name] = value
                          [docs] def set_params(self, p, q, g): # type: (bytes, bytes, bytes) -> None @@ -166,16 +156,16 @@ unsafe to use this method. It is better to use gen_params function to create a new DSA object. """ - m2.dsa_set_pqg(self.dsa, p, q, g) -
                          + m2.dsa_set_pqg(self.dsa, p, q, g)
                          +
                          [docs] def gen_key(self): # type: () -> None """ Generate a key pair. """ assert m2.dsa_type_check(self.dsa), "'dsa' type error" - m2.dsa_gen_key(self.dsa) -
                          + m2.dsa_gen_key(self.dsa)
                          +
                          [docs] def save_params(self, filename): # type: (AnyStr) -> int """ @@ -187,8 +177,8 @@ with BIO.openfile(filename, 'wb') as bio: ret = m2.dsa_write_params_bio(self.dsa, bio._ptr()) - return ret -
                          + return ret
                          +
                          [docs] def save_params_bio(self, bio): # type: (BIO.BIO) -> int """ @@ -197,8 +187,8 @@ :param bio: Save DSA parameters to this object. :return: 1 (true) if successful """ - return m2.dsa_write_params_bio(self.dsa, bio._ptr()) -
                          + return m2.dsa_write_params_bio(self.dsa, bio._ptr())
                          +
                          [docs] def save_key(self, filename, cipher='aes_128_cbc', callback=util.passphrase_callback): # type: (AnyStr, str, Callable) -> int @@ -213,8 +203,8 @@ with BIO.openfile(filename, 'wb') as bio: ret = self.save_key_bio(bio, cipher, callback) - return ret -
                          + return ret
                          +
                          [docs] def save_key_bio(self, bio, cipher='aes_128_cbc', callback=util.passphrase_callback): # type: (BIO.BIO, str, Callable) -> int @@ -226,17 +216,17 @@ to encrypt the private key. :return: 1 (true) if successful """ - if cipher is None: + if cipher is None: return m2.dsa_write_key_bio_no_cipher(self.dsa, bio._ptr(), callback) else: - ciph = getattr(m2, cipher, None) - if ciph is None: + ciph = getattr(m2, cipher, None) + if ciph is None: raise DSAError('no such cipher: %s' % cipher) else: ciph = ciph() - return m2.dsa_write_key_bio(self.dsa, bio._ptr(), ciph, callback) -
                          + return m2.dsa_write_key_bio(self.dsa, bio._ptr(), ciph, callback)
                          +
                          [docs] def save_pub_key(self, filename): # type: (AnyStr) -> int """ @@ -249,8 +239,8 @@ with BIO.openfile(filename, 'wb') as bio: ret = self.save_pub_key_bio(bio) - return ret -
                          + return ret
                          +
                          [docs] def save_pub_key_bio(self, bio): # type: (BIO.BIO) -> int """ @@ -260,8 +250,8 @@ to this object. :return: 1 (true) if successful """ - return m2.dsa_write_pub_key_bio(self.dsa, bio._ptr()) -
                          + return m2.dsa_write_pub_key_bio(self.dsa, bio._ptr()) +
                          [docs] def sign(self, digest): # type: (bytes) -> Tuple[bytes, bytes] """ @@ -273,8 +263,8 @@ both "byte strings". """ assert self.check_key(), 'key is not initialised' - return m2.dsa_sign(self.dsa, digest) -
                          + return m2.dsa_sign(self.dsa, digest) +
                          [docs] def verify(self, digest, r, s): # type: (bytes, bytes, bytes) -> int """ @@ -288,16 +278,16 @@ :return: 1 (true) if verify succeeded, 0 if failed """ assert self.check_key(), 'key is not initialised' - return m2.dsa_verify(self.dsa, digest, r, s) -
                          + return m2.dsa_verify(self.dsa, digest, r, s) +
                          [docs] def sign_asn1(self, digest): assert self.check_key(), 'key is not initialised' - return m2.dsa_sign_asn1(self.dsa, digest) -
                          + return m2.dsa_sign_asn1(self.dsa, digest) +
                          [docs] def verify_asn1(self, digest, blob): assert self.check_key(), 'key is not initialised' - return m2.dsa_verify_asn1(self.dsa, digest, blob) -
                          + return m2.dsa_verify_asn1(self.dsa, digest, blob) +
                          [docs] def check_key(self): """ Check to be sure the DSA object has a valid private key. @@ -305,9 +295,9 @@ :return: 1 (true) if a valid private key """ assert m2.dsa_type_check(self.dsa), "'dsa' type error" - return m2.dsa_check_key(self.dsa) + return m2.dsa_check_key(self.dsa)
                          + -
                          [docs]class DSA_pub(DSA): # noqa """ @@ -318,9 +308,9 @@ """
                          [docs] def sign(self, *argv): - # type: (Any) -> None - raise DSAError('DSA_pub object has no private key') -
                          + # type: (*Any) -> None + raise DSAError('DSA_pub object has no private key')
                          + sign_asn1 = sign
                          [docs] def check_key(self): @@ -328,16 +318,16 @@ """ :return: does DSA_pub contain a pub key? """ - return m2.dsa_check_pub_key(self.dsa) -
                          + return m2.dsa_check_pub_key(self.dsa) + save_key = DSA.save_pub_key - save_key_bio = DSA.save_pub_key_bio + save_key_bio = DSA.save_pub_key_bio # -------------------------------------------------------------- # factories and other functions - +
                          [docs]def gen_params(bits, callback=util.genparam_callback): # type: (int, Callable) -> DSA """ @@ -352,11 +342,11 @@ :return: instance of DSA. """ dsa = m2.dsa_generate_parameters(bits, callback) - if dsa is None: + if dsa is None: raise DSAError('problem generating DSA parameters') - return DSA(dsa, 1) + return DSA(dsa, 1)
                          + -
                          [docs]def set_params(p, q, g): # type: (bytes, bytes, bytes) -> DSA """ @@ -370,10 +360,10 @@ """ dsa = m2.dsa_new() m2.dsa_set_pqg(dsa, p, q, g) - return DSA(dsa, 1) + return DSA(dsa, 1)
                          - -
                          [docs]def load_params(file, callback=util.passphrase_callback): + +
                          [docs]def load_params(file, callback=util.passphrase_callback): # type: (AnyStr, Callable) -> DSA """ Factory function that instantiates a DSA object with DSA @@ -386,12 +376,12 @@ passphrase-protected. :return: instance of DSA. """ - with BIO.openfile(file) as bio: + with BIO.openfile(file) as bio: ret = load_params_bio(bio, callback) - return ret + return ret
                          + -
                          [docs]def load_params_bio(bio, callback=util.passphrase_callback): # type: (BIO.BIO, Callable) -> DSA """ @@ -406,12 +396,12 @@ :return: instance of DSA. """ dsa = m2.dsa_read_params(bio._ptr(), callback) - if dsa is None: + if dsa is None: raise DSAError('problem loading DSA parameters') - return DSA(dsa, 1) + return DSA(dsa, 1)
                          - -
                          [docs]def load_key(file, callback=util.passphrase_callback): + +
                          [docs]def load_key(file, callback=util.passphrase_callback): # type: (AnyStr, Callable) -> DSA """ Factory function that instantiates a DSA object from a @@ -424,12 +414,12 @@ passphrase-protected. :return: instance of DSA. """ - with BIO.openfile(file) as bio: + with BIO.openfile(file) as bio: ret = load_key_bio(bio, callback) - return ret + return ret
                          + -
                          [docs]def load_key_bio(bio, callback=util.passphrase_callback): # type: (BIO.BIO, Callable) -> DSA """ @@ -446,9 +436,9 @@ dsa = m2.dsa_read_key(bio._ptr(), callback) if not dsa: raise DSAError('problem loading DSA key pair') - return DSA(dsa, 1) + return DSA(dsa, 1)
                          + -
                          [docs]def pub_key_from_params(p, q, g, pub): # type: (bytes, bytes, bytes, bytes) -> DSA_pub """ @@ -464,10 +454,10 @@ dsa = m2.dsa_new() m2.dsa_set_pqg(dsa, p, q, g) m2.dsa_set_pub(dsa, pub) - return DSA_pub(dsa, 1) + return DSA_pub(dsa, 1)
                          - -
                          [docs]def load_pub_key(file, callback=util.passphrase_callback): + +
                          [docs]def load_pub_key(file, callback=util.passphrase_callback): # type: (AnyStr, Callable) -> DSA_pub """ Factory function that instantiates a DSA_pub object using @@ -481,12 +471,12 @@ passphrase-protected. :return: instance of DSA_pub. """ - with BIO.openfile(file) as bio: + with BIO.openfile(file) as bio: ret = load_pub_key_bio(bio, callback) - return ret + return ret
                          + -
                          [docs]def load_pub_key_bio(bio, callback=util.passphrase_callback): # type: (BIO.BIO, Callable) -> DSA_pub """ @@ -510,41 +500,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/EC.html b/doc/html/_modules/M2Crypto/EC.html index 65e6690..c252714 100644 --- a/doc/html/_modules/M2Crypto/EC.html +++ b/doc/html/_modules/M2Crypto/EC.html @@ -1,55 +1,45 @@ - - - - M2Crypto.EC — M2Crypto documentation - - + M2Crypto.EC — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.EC

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """
                           M2Crypto wrapper for OpenSSL ECDH/ECDSA API.
                          @@ -61,16 +51,16 @@
                           Portions copyright (c) 2005-2006 Vrije Universiteit Amsterdam.
                           All rights reserved."""
                           
                          -from M2Crypto import BIO, m2, util
                          +from M2Crypto import BIO, Err, EVP, m2, util
                           if util.py27plus:
                          -    from typing import AnyStr, Callable, Dict, Optional, Tuple, Union  # noqa
                          +    from typing import AnyStr, Callable, Dict, Optional, Tuple, Union  # noqa
                           
                           EC_Key = bytes
                           
                           
                           
                          [docs]class ECError(Exception): - pass -
                          + pass
                          + m2.ec_init(ECError) # Curve identifier constants @@ -214,13 +204,13 @@ to create an EC key pair. """ assert m2.ec_key_type_check(self.ec), "'ec' type error" - m2.ec_key_gen_key(self.ec) -
                          + m2.ec_key_gen_key(self.ec)
                          +
                          [docs] def pub(self): # type: () -> EC_pub # Don't let python free - return EC_pub(self.ec, 0) -
                          + return EC_pub(self.ec, 0)
                          +
                          [docs] def sign_dsa(self, digest): # type: (bytes) -> Tuple[bytes, bytes] """ @@ -228,8 +218,8 @@ ECDSA signature parameters. """ assert self._check_key_type(), "'ec' type error" - return m2.ecdsa_sign(self.ec, digest) -
                          + return m2.ecdsa_sign(self.ec, digest)
                          +
                          [docs] def verify_dsa(self, digest, r, s): # type: (bytes, bytes, bytes) -> int """ @@ -237,17 +227,17 @@ signature parameters. """ assert self._check_key_type(), "'ec' type error" - return m2.ecdsa_verify(self.ec, digest, r, s) -
                          + return m2.ecdsa_verify(self.ec, digest, r, s)
                          +
                          [docs] def sign_dsa_asn1(self, digest): # type: (bytes) -> bytes assert self._check_key_type(), "'ec' type error" - return m2.ecdsa_sign_asn1(self.ec, digest) -
                          + return m2.ecdsa_sign_asn1(self.ec, digest)
                          +
                          [docs] def verify_dsa_asn1(self, digest, blob): assert self._check_key_type(), "'ec' type error" - return m2.ecdsa_verify_asn1(self.ec, digest, blob) -
                          + return m2.ecdsa_verify_asn1(self.ec, digest, blob)
                          +
                          [docs] def compute_dh_key(self, pub_key): # type: (EC) -> Optional[bytes] """ @@ -257,8 +247,8 @@ applied. """ assert self.check_key(), 'key is not initialised' - return m2.ecdh_compute_key(self.ec, pub_key.ec) -
                          + return m2.ecdh_compute_key(self.ec, pub_key.ec) +
                          [docs] def save_key_bio(self, bio, cipher='aes_128_cbc', callback=util.passphrase_callback): # type: (BIO.BIO, Optional[str], Callable) -> int @@ -276,15 +266,15 @@ the key. The default is util.passphrase_callback. """ - if cipher is None: + if cipher is None: return m2.ec_key_write_bio_no_cipher(self.ec, bio._ptr(), callback) else: - ciph = getattr(m2, cipher, None) - if ciph is None: + ciph = getattr(m2, cipher, None) + if ciph is None: raise ValueError('not such cipher %s' % cipher) - return m2.ec_key_write_bio(self.ec, bio._ptr(), ciph(), callback) -
                          -
                          [docs] def save_key(self, file, cipher='aes_128_cbc', + return m2.ec_key_write_bio(self.ec, bio._ptr(), ciph(), callback)
                          + +
                          [docs] def save_key(self, file, cipher='aes_128_cbc', callback=util.passphrase_callback): # type: (AnyStr, Optional[str], Callable) -> int """ @@ -301,9 +291,9 @@ the key. The default is util.passphrase_callback. """ - with BIO.openfile(file, 'wb') as bio: - return self.save_key_bio(bio, cipher, callback) -
                          + with BIO.openfile(file, 'wb') as bio: + return self.save_key_bio(bio, cipher, callback) +
                          [docs] def save_pub_key_bio(self, bio): # type: (BIO.BIO) -> int """ @@ -311,18 +301,18 @@ :param bio: M2Crypto.BIO.BIO object to save key to. """ - return m2.ec_key_write_pubkey(self.ec, bio._ptr()) -
                          -
                          [docs] def save_pub_key(self, file): + return m2.ec_key_write_pubkey(self.ec, bio._ptr())
                          + +
                          [docs] def save_pub_key(self, file): # type: (AnyStr) -> int """ Save the public key to a filename in PEM format. :param file: Name of filename to save key to. """ - with BIO.openfile(file, 'wb') as bio: - return m2.ec_key_write_pubkey(self.ec, bio._ptr()) -
                          + with BIO.openfile(file, 'wb') as bio: + return m2.ec_key_write_pubkey(self.ec, bio._ptr()) +
                          [docs] def as_pem(self, cipher='aes_128_cbc', callback=util.passphrase_callback): """ Returns the key(pair) as a string in PEM format. @@ -331,8 +321,8 @@ """ with BIO.MemoryBuffer() as bio: self.save_key_bio(bio, cipher, callback) - return bio.read() -
                          + return bio.read() + def _check_key_type(self): # type: () -> int return m2.ec_key_type_check(self.ec) @@ -340,9 +330,9 @@
                          [docs] def check_key(self): # type: () -> int assert m2.ec_key_type_check(self.ec), "'ec' type error" - return m2.ec_key_check_key(self.ec) + return m2.ec_key_check_key(self.ec)
                          + -
                          [docs]class EC_pub(EC): # noqa """ @@ -351,8 +341,8 @@ """ def __init__(self, ec, _pyfree=0): # type: (EC, int) -> None - EC.__init__(self, ec, _pyfree) - self.der = None # type: Optional[bytes] + EC.__init__(self, ec, _pyfree) + self.der = None # type: Optional[bytes]
                          [docs] def get_der(self): # type: () -> bytes @@ -360,23 +350,23 @@ Returns the public key in DER format as a buffer object. """ assert self.check_key(), 'key is not initialised' - if self.der is None: + if self.der is None: self.der = m2.ec_key_get_public_der(self.ec) - return self.der -
                          + return self.der
                          +
                          [docs] def get_key(self): # type: () -> bytes """ Returns the public key as a byte string. """ assert self.check_key(), 'key is not initialised' - return m2.ec_key_get_public_key(self.ec) -
                          + return m2.ec_key_get_public_key(self.ec) + save_key = EC.save_pub_key - save_key_bio = EC.save_pub_key_bio + save_key_bio = EC.save_pub_key_bio + -
                          [docs]def gen_params(curve): # type: (int) -> EC """ @@ -388,10 +378,10 @@ assert curve in [x['NID'] for x in m2.ec_get_builtin_curves()], \ 'Elliptic curve %s is not available on this system.' % \ m2.obj_nid2sn(curve) - return EC(m2.ec_key_new_by_curve_name(curve), 1) + return EC(m2.ec_key_new_by_curve_name(curve), 1)
                          - -
                          [docs]def load_key(file, callback=util.passphrase_callback): + +
                          [docs]def load_key(file, callback=util.passphrase_callback): # type: (AnyStr, Callable) -> EC """ Factory function that instantiates a EC object. @@ -402,10 +392,10 @@ :param callback: Python callback object that will be invoked if the EC key pair is passphrase-protected. """ - with BIO.openfile(file) as bio: - return load_key_bio(bio, callback) + with BIO.openfile(file) as bio: + return load_key_bio(bio, callback)
                          + -
                          [docs]def load_key_string(string, callback=util.passphrase_callback): # type: (str, Callable) -> EC """ @@ -420,9 +410,9 @@ :return: M2Crypto.EC.EC object. """ with BIO.MemoryBuffer(string) as bio: - return load_key_bio(bio, callback) + return load_key_bio(bio, callback)
                          + -
                          [docs]def load_key_bio(bio, callback=util.passphrase_callback): # type: (BIO.BIO, Callable) -> EC """ @@ -434,10 +424,10 @@ :param callback: Python callback object that will be invoked if the EC key pair is passphrase-protected. """ - return EC(m2.ec_key_read_bio(bio._ptr(), callback), 1) + return EC(m2.ec_key_read_bio(bio._ptr(), callback), 1)
                          - -
                          [docs]def load_pub_key(file): + +
                          [docs]def load_pub_key(file): # type: (AnyStr) -> EC_pub """ Load an EC public key from filename. @@ -447,10 +437,10 @@ :return: M2Crypto.EC.EC_pub object. """ - with BIO.openfile(file) as bio: - return load_pub_key_bio(bio) + with BIO.openfile(file) as bio: + return load_pub_key_bio(bio)
                          + -
                          [docs]def load_key_string_pubkey(string, callback=util.passphrase_callback): # type: (str, Callable) -> PKey """ @@ -465,9 +455,9 @@ :return: M2Crypto.EC.PKey object. """ with BIO.MemoryBuffer(string) as bio: - return load_key_bio_pubkey(bio, callback) + return EVP.load_key_bio_pubkey(bio, callback)
                          + -
                          [docs]def load_pub_key_bio(bio): # type: (BIO.BIO) -> EC_pub """ @@ -479,32 +469,32 @@ :return: M2Crypto.EC.EC_pub object. """ ec = m2.ec_key_read_pubkey(bio._ptr()) - if ec is None: + if ec is None: ec_error() - return EC_pub(ec, 1) + return EC_pub(ec, 1)
                          + -
                          [docs]def ec_error(): # type: () -> ECError - raise ECError(m2.err_reason_error_string(m2.err_get_error())) + raise ECError(Err.get_error_message())
                          + -
                          [docs]def pub_key_from_der(der): # type: (bytes) -> EC_pub """ Create EC_pub from DER. """ - return EC_pub(m2.ec_key_from_pubkey_der(der), 1) + return EC_pub(m2.ec_key_from_pubkey_der(der), 1)
                          + -
                          [docs]def pub_key_from_params(curve, bytes): # type: (bytes, bytes) -> EC_pub """ Create EC_pub from curve name and octet string. """ - return EC_pub(m2.ec_key_from_pubkey_params(curve, bytes), 1) + return EC_pub(m2.ec_key_from_pubkey_params(curve, bytes), 1)
                          + -
                          [docs]def get_builtin_curves(): # type: () -> Tuple[Dict[str, Union[int, str]]] return m2.ec_get_builtin_curves()
                          @@ -513,41 +503,41 @@ -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/EVP.html b/doc/html/_modules/M2Crypto/EVP.html index 4c7d6e0..61dd3f9 100644 --- a/doc/html/_modules/M2Crypto/EVP.html +++ b/doc/html/_modules/M2Crypto/EVP.html @@ -1,55 +1,45 @@ - - - - M2Crypto.EVP — M2Crypto documentation - - + M2Crypto.EVP — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.EVP

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """M2Crypto wrapper for OpenSSL EVP API.
                           
                          @@ -59,14 +49,14 @@
                           Author: Heikki Toivonen
                           """
                           
                          -from M2Crypto import BIO, Err, RSA, m2, util
                          +from M2Crypto import BIO, Err, RSA, m2, util
                           if util.py27plus:
                          -    from typing import AnyStr, Optional, Callable  # noqa
                          +    from typing import AnyStr, Optional, Callable  # noqa
                           
                           
                           
                          [docs]class EVPError(Exception): - pass -
                          + pass
                          + m2.evp_init(EVPError) @@ -81,9 +71,9 @@ :param keylen: Length of key to produce. :return: Key. """ - return m2.pkcs5_pbkdf2_hmac_sha1(password, salt, iter, keylen) + return m2.pkcs5_pbkdf2_hmac_sha1(password, salt, iter, keylen)
                          + -
                          [docs]class MessageDigest: """ Message Digest @@ -92,12 +82,12 @@ def __init__(self, algo): # type: (str) -> None - md = getattr(m2, algo, None) # type: Optional[Callable] - if md is None: + md = getattr(m2, algo, None) # type: Optional[Callable] + if md is None: # if the digest algorithm isn't found as an attribute of the m2 # module, try to look up the digest using get_digestbyname() self.md = m2.get_digestbyname(algo) - if self.md is None: + if self.md is None: raise ValueError('unknown algorithm', algo) else: self.md = md() @@ -106,7 +96,7 @@ def __del__(self): # type: () -> None - if getattr(self, 'ctx', None): + if getattr(self, 'ctx', None): self.m2_md_ctx_free(self.ctx)
                          [docs] def update(self, data): @@ -116,23 +106,23 @@ :return: -1 for Python error, 1 for success, 0 for OpenSSL failure. """ - return m2.digest_update(self.ctx, data) -
                          + return m2.digest_update(self.ctx, data)
                          +
                          [docs] def final(self): - return m2.digest_final(self.ctx) + return m2.digest_final(self.ctx)
                          + + # Deprecated. + digest = final
                          - # Deprecated.
                          - digest = final -
                          [docs]class HMAC: m2_hmac_ctx_free = m2.hmac_ctx_free def __init__(self, key, algo='sha1'): # type: (bytes, str) -> None - md = getattr(m2, algo, None) - if md is None: + md = getattr(m2, algo, None) + if md is None: raise ValueError('unknown algorithm', algo) self.md = md() self.ctx = m2.hmac_ctx_new() @@ -140,46 +130,46 @@ def __del__(self): # type: () -> None - if getattr(self, 'ctx', None): + if getattr(self, 'ctx', None): self.m2_hmac_ctx_free(self.ctx)
                          [docs] def reset(self, key): # type: (bytes) -> None - m2.hmac_init(self.ctx, key, self.md) -
                          + m2.hmac_init(self.ctx, key, self.md)
                          +
                          [docs] def update(self, data): # type: (bytes) -> None - m2.hmac_update(self.ctx, data) -
                          + m2.hmac_update(self.ctx, data)
                          +
                          [docs] def final(self): # type: () -> bytes - return m2.hmac_final(self.ctx) -
                          - digest = final + return m2.hmac_final(self.ctx)
                          + + digest = final + -
                          [docs]def hmac(key, data, algo='sha1'): # type: (bytes, bytes, str) -> bytes - md = getattr(m2, algo, None) - if md is None: + md = getattr(m2, algo, None) + if md is None: raise ValueError('unknown algorithm', algo) - return m2.hmac(key, data, md()) + return m2.hmac(key, data, md())
                          + -
                          [docs]class Cipher: m2_cipher_ctx_free = m2.cipher_ctx_free def __init__(self, alg, key, iv, op, key_as_bytes=0, d='md5', - salt='12345678', i=1, padding=1): + salt=b'12345678', i=1, padding=1): # type: (str, bytes, bytes, object, int, str, bytes, int, int) -> None - cipher = getattr(m2, alg, None) - if cipher is None: + cipher = getattr(m2, alg, None) + if cipher is None: raise ValueError('unknown cipher', alg) self.cipher = cipher() if key_as_bytes: - kmd = getattr(m2, d, None) - if kmd is None: + kmd = getattr(m2, d, None) + if kmd is None: raise ValueError('unknown message digest', d) key = m2.bytes_to_key(self.cipher, kmd(), key, salt, iv, i) self.ctx = m2.cipher_ctx_new() @@ -189,25 +179,25 @@ def __del__(self): # type: () -> None - if getattr(self, 'ctx', None): + if getattr(self, 'ctx', None): self.m2_cipher_ctx_free(self.ctx)
                          [docs] def update(self, data): # type: (bytes) -> bytes - return m2.cipher_update(self.ctx, data) -
                          + return m2.cipher_update(self.ctx, data)
                          +
                          [docs] def final(self): # type: () -> bytes - return m2.cipher_final(self.ctx) -
                          + return m2.cipher_final(self.ctx) +
                          [docs] def set_padding(self, padding=1): # type: (int) -> int """ Actually always return 1 """ - return m2.cipher_set_padding(self.ctx, padding) + return m2.cipher_set_padding(self.ctx, padding)
                          + -
                          [docs]class PKey: """ Public Key @@ -216,9 +206,9 @@ m2_pkey_free = m2.pkey_free m2_md_ctx_free = m2.md_ctx_free - def __init__(self, pkey=None, _pyfree=0, md='sha1'): + def __init__(self, pkey=None, _pyfree=0, md='sha1'): # type: (Optional[bytes], int, str) -> None - if pkey is not None: + if pkey is not None: self.pkey = pkey # type: bytes self._pyfree = _pyfree else: @@ -230,7 +220,7 @@ # type: () -> None if getattr(self, '_pyfree', 0): self.m2_pkey_free(self.pkey) - if getattr(self, 'ctx', None): + if getattr(self, 'ctx', None): self.m2_md_ctx_free(self.ctx) def _ptr(self): @@ -238,8 +228,8 @@ def _set_context(self, md): # type: (str) -> None - mda = getattr(m2, md, None) # type: Optional[Callable] - if mda is None: + mda = getattr(m2, md, None) # type: Optional[Callable] + if mda is None: raise ValueError('unknown message digest', md) self.md = mda() self.ctx = m2.md_ctx_new() # type: Context @@ -251,15 +241,15 @@ :param md: The message digest algorithm. """ - self._set_context(md) -
                          + self._set_context(md) +
                          [docs] def sign_init(self): # type: () -> None """ Initialise signing operation with self. """ - m2.sign_init(self.ctx, self.md) -
                          + m2.sign_init(self.ctx, self.md) +
                          [docs] def sign_update(self, data): # type: (bytes) -> None """ @@ -267,8 +257,8 @@ :param data: Data to be signed. """ - m2.sign_update(self.ctx, data) -
                          + m2.sign_update(self.ctx, data) +
                          [docs] def sign_final(self): # type: () -> bytes """ @@ -276,9 +266,9 @@ :return: The signature. """ - return m2.sign_final(self.ctx, self.pkey) + return m2.sign_final(self.ctx, self.pkey)
                          - # Deprecated + # Deprecated update = sign_update final = sign_final @@ -287,8 +277,8 @@ """ Initialise signature verification operation with self. """ - m2.verify_init(self.ctx, self.md) - + m2.verify_init(self.ctx, self.md) +
                          [docs] def verify_update(self, data): # type: (bytes) -> int """ @@ -297,8 +287,8 @@ :param data: Data to be verified. :return: -1 on Python error, 1 for success, 0 for OpenSSL error """ - return m2.verify_update(self.ctx, data) -
                          + return m2.verify_update(self.ctx, data) +
                          [docs] def verify_final(self, sign): # type: (bytes) -> int """ @@ -308,8 +298,8 @@ :return: Result of verification: 1 for success, 0 for failure, -1 on other error. """ - return m2.verify_final(self.ctx, sign, self.pkey) -
                          + return m2.verify_final(self.ctx, sign, self.pkey) +
                          [docs] def assign_rsa(self, rsa, capture=1): # type: (RSA.RSA, int) -> int """ @@ -329,8 +319,8 @@ rsa._pyfree = 0 else: ret = m2.pkey_set1_rsa(self.pkey, rsa.rsa) - return ret -
                          + return ret +
                          [docs] def get_rsa(self): # type: () -> RSA.RSA_pub """ @@ -338,13 +328,13 @@ instance is holding. """ rsa_ptr = m2.pkey_get1_rsa(self.pkey) - if rsa_ptr is None: + if rsa_ptr is None: raise ValueError("PKey instance is not holding a RSA key") rsa = RSA.RSA_pub(rsa_ptr, 1) - return rsa -
                          -
                          [docs] def save_key(self, file, cipher='aes_128_cbc', + return rsa
                          + +
                          [docs] def save_key(self, file, cipher='aes_128_cbc', callback=util.passphrase_callback): # type: (AnyStr, Optional[str], Callable) -> int """ @@ -361,9 +351,9 @@ the key. The default is util.passphrase_callback. """ - with BIO.openfile(file, 'wb') as bio: - return self.save_key_bio(bio, cipher, callback) -
                          + with BIO.openfile(file, 'wb') as bio: + return self.save_key_bio(bio, cipher, callback) +
                          [docs] def save_key_bio(self, bio, cipher='aes_128_cbc', callback=util.passphrase_callback): # type: (BIO.BIO, Optional[str], Callable) -> int @@ -381,14 +371,14 @@ the key. The default is util.passphrase_callback. """ - if cipher is None: + if cipher is None: return m2.pkey_write_pem_no_cipher(self.pkey, bio._ptr(), callback) else: - proto = getattr(m2, cipher, None) - if proto is None: + proto = getattr(m2, cipher, None) + if proto is None: raise ValueError('no such cipher %s' % cipher) - return m2.pkey_write_pem(self.pkey, bio._ptr(), proto(), callback) -
                          + return m2.pkey_write_pem(self.pkey, bio._ptr(), proto(), callback) +
                          [docs] def as_pem(self, cipher='aes_128_cbc', callback=util.passphrase_callback): # type: (Optional[str], Callable) -> bytes """ @@ -405,8 +395,8 @@ """ bio = BIO.MemoryBuffer() self.save_key_bio(bio, cipher, callback) - return bio.read_all() -
                          + return bio.read_all() +
                          [docs] def as_der(self): # type: () -> bytes """ @@ -414,24 +404,24 @@ """ buf = m2.pkey_as_der(self.pkey) bio = BIO.MemoryBuffer(buf) - return bio.read_all() -
                          + return bio.read_all() +
                          [docs] def size(self): # type: () -> int """ Return the size of the key in bytes. """ - return m2.pkey_size(self.pkey) -
                          + return m2.pkey_size(self.pkey) +
                          [docs] def get_modulus(self): # type: () -> Optional[bytes] """ Return the modulus in hex format. """ - return m2.pkey_get_modulus(self.pkey) + return m2.pkey_get_modulus(self.pkey)
                          - -
                          [docs]def load_key(file, callback=util.passphrase_callback): + +
                          [docs]def load_key(file, callback=util.passphrase_callback): # type: (AnyStr, Callable) -> PKey """ Load an M2Crypto.EVP.PKey from file. @@ -444,16 +434,16 @@ :return: M2Crypto.EVP.PKey object. """ - bio = m2.bio_new_file(file, 'r') - if bio is None: + bio = m2.bio_new_file(file, 'r') + if bio is None: raise BIO.BIOError(Err.get_error()) cptr = m2.pkey_read_pem(bio, callback) m2.bio_free(bio) - if cptr is None: + if cptr is None: raise EVPError(Err.get_error()) - return PKey(cptr, 1) + return PKey(cptr, 1)
                          + -
                          [docs]def load_key_bio(bio, callback=util.passphrase_callback): # type: (BIO.BIO, Callable) -> PKey """ @@ -468,11 +458,11 @@ :return: M2Crypto.EVP.PKey object. """ cptr = m2.pkey_read_pem(bio._ptr(), callback) - if cptr is None: + if cptr is None: raise EVPError(Err.get_error()) - return PKey(cptr, 1) + return PKey(cptr, 1)
                          + -
                          [docs]def load_key_bio_pubkey(bio, callback=util.passphrase_callback): # type: (BIO.BIO, Callable) -> PKey """ @@ -487,11 +477,11 @@ :return: M2Crypto.EVP.PKey object. """ cptr = m2.pkey_read_pem_pubkey(bio._ptr(), callback) - if cptr is None: + if cptr is None: raise EVPError(Err.get_error()) - return PKey(cptr, 1) + return PKey(cptr, 1)
                          + -
                          [docs]def load_key_string(string, callback=util.passphrase_callback): # type: (AnyStr, Callable) -> PKey """ @@ -506,9 +496,9 @@ :return: M2Crypto.EVP.PKey object. """ bio = BIO.MemoryBuffer(string) - return load_key_bio(bio, callback) + return load_key_bio(bio, callback)
                          + -
                          [docs]def load_key_string_pubkey(string, callback=util.passphrase_callback): # type: (AnyStr, Callable) -> PKey """ @@ -529,41 +519,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/Engine.html b/doc/html/_modules/M2Crypto/Engine.html index 9812dbb..1b74291 100644 --- a/doc/html/_modules/M2Crypto/Engine.html +++ b/doc/html/_modules/M2Crypto/Engine.html @@ -1,52 +1,42 @@ - - - - M2Crypto.Engine — M2Crypto documentation - - + M2Crypto.Engine — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.Engine

                           # vim: sts=4 sw=4 et
                          @@ -57,14 +47,14 @@
                           IMEC MSU
                           """
                           
                          -from M2Crypto import EVP, Err, X509, m2, six, util
                          +from M2Crypto import EVP, Err, X509, m2, six, util
                           if util.py27plus:
                          -    from typing import AnyStr, Callable, Optional  # noqa
                          +    from typing import AnyStr, Callable, Optional  # noqa
                           
                           
                           
                          [docs]class EngineError(Exception): - pass -
                          + pass
                          + m2.engine_init_error(EngineError) @@ -73,7 +63,7 @@ m2_engine_free = m2.engine_free - def __init__(self, id=None, _ptr=None, _pyfree=1): + def __init__(self, id=None, _ptr=None, _pyfree=1): # type: (Optional[bytes], Optional[bytes], int) -> None """Create new Engine from ENGINE pointer or obtain by id""" if not _ptr and not id: @@ -95,29 +85,29 @@ """Obtain a functional reference to the engine. :return: 0 on error, non-zero on success.""" - return m2.engine_init(self._ptr) -
                          + return m2.engine_init(self._ptr)
                          +
                          [docs] def finish(self): # type: () -> int """Release a functional and structural reference to the engine.""" - return m2.engine_finish(self._ptr) -
                          + return m2.engine_finish(self._ptr)
                          +
                          [docs] def ctrl_cmd_string(self, cmd, arg, optional=0): # type: (bytes, Optional[bytes], int) -> int """Call ENGINE_ctrl_cmd_string""" if not m2.engine_ctrl_cmd_string(self._ptr, cmd, arg, optional): - raise EngineError(Err.get_error()) -
                          + raise EngineError(Err.get_error())
                          +
                          [docs] def get_name(self): # type: () -> bytes """Return engine name""" - return m2.engine_get_name(self._ptr) -
                          + return m2.engine_get_name(self._ptr)
                          +
                          [docs] def get_id(self): # type: () -> bytes """Return engine id""" - return m2.engine_get_id(self._ptr) -
                          + return m2.engine_get_id(self._ptr)
                          +
                          [docs] def set_default(self, methods=m2.ENGINE_METHOD_ALL): # type: (int) -> int """ @@ -125,9 +115,9 @@ :param methods: Possible values are bitwise OR of m2.ENGINE_METHOD_* """ - return m2.engine_set_default(self._ptr, methods) -
                          - def _engine_load_key(self, func, name, pin=None): + return m2.engine_set_default(self._ptr, methods)
                          + + def _engine_load_key(self, func, name, pin=None): # type: (Callable, bytes, Optional[bytes]) -> EVP.PKey """Helper function for loading keys""" ui = m2.ui_openssl() @@ -141,18 +131,18 @@ m2.engine_pkcs11_data_free(cbd) return key -
                          [docs] def load_private_key(self, name, pin=None): +
                          [docs] def load_private_key(self, name, pin=None): # type: (bytes, Optional[bytes]) -> X509.X509 """Load private key with engine methods (e.g from smartcard). If pin is not set it will be asked """ - return self._engine_load_key(m2.engine_load_private_key, name, pin) -
                          -
                          [docs] def load_public_key(self, name, pin=None): + return self._engine_load_key(m2.engine_load_private_key, name, pin)
                          + +
                          [docs] def load_public_key(self, name, pin=None): # type: (bytes, Optional[bytes]) -> EVP.PKey """Load public key with engine methods (e.g from smartcard).""" - return self._engine_load_key(m2.engine_load_public_key, name, pin) -
                          + return self._engine_load_key(m2.engine_load_public_key, name, pin)
                          +
                          [docs] def load_certificate(self, name): # type: (bytes) -> X509.X509 """Load certificate from engine (e.g from smartcard). @@ -160,9 +150,9 @@ cptr = m2.engine_load_certificate(self._ptr, name) if not cptr: raise EngineError("Certificate or card not found") - return X509.X509(cptr, _pyfree=1) + return X509.X509(cptr, _pyfree=1)
                          + -
                          [docs]def load_dynamic_engine(id, sopath): # type: (bytes, AnyStr) -> Engine """Load and return dymanic engine from sopath and assign id to it""" @@ -170,25 +160,25 @@ sopath = sopath.encode('utf8') m2.engine_load_dynamic() e = Engine('dynamic') - e.ctrl_cmd_string(b'SO_PATH', sopath) - e.ctrl_cmd_string(b'ID', id) - e.ctrl_cmd_string(b'LIST_ADD', '1') - e.ctrl_cmd_string(b'LOAD', None) - return e + e.ctrl_cmd_string(b'SO_PATH', sopath) + e.ctrl_cmd_string(b'ID', id) + e.ctrl_cmd_string(b'LIST_ADD', '1') + e.ctrl_cmd_string(b'LOAD', None) + return e
                          + -
                          [docs]def load_dynamic(): # type: () -> None """Load dynamic engine""" - m2.engine_load_dynamic() + m2.engine_load_dynamic()
                          + -
                          [docs]def load_openssl(): # type: () -> None """Load openssl engine""" - m2.engine_load_openssl() + m2.engine_load_openssl()
                          + -
                          [docs]def cleanup(): # type: () -> None """If you load any engines, you need to clean up after your application @@ -199,41 +189,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/Err.html b/doc/html/_modules/M2Crypto/Err.html index 955ab09..2e776ae 100644 --- a/doc/html/_modules/M2Crypto/Err.html +++ b/doc/html/_modules/M2Crypto/Err.html @@ -1,63 +1,53 @@ - - - - M2Crypto.Err — M2Crypto documentation - - + M2Crypto.Err — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.Err

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """M2Crypto wrapper for OpenSSL Error API.
                           
                           Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
                           
                          -from M2Crypto import BIO, m2, util, six  # noqa
                          +from M2Crypto import BIO, m2, util, six  # noqa
                           if util.py27plus:
                          -    from typing import Optional  # noqa
                          +    from typing import Optional  # noqa
                           
                           
                           
                          [docs]def get_error(): @@ -66,39 +56,44 @@ m2.err_print_errors(err.bio_ptr()) err_msg = err.read() if err_msg: - return util.py3str(err_msg) + return util.py3str(err_msg)
                          + -
                          [docs]def get_error_code(): # type: () -> int - return m2.err_get_error() + return m2.err_get_error()
                          + -
                          [docs]def peek_error_code(): # type: () -> int - return m2.err_peek_error() + return m2.err_peek_error()
                          + -
                          [docs]def get_error_lib(err): # type: (int) -> str - return util.py3str(m2.err_lib_error_string(err)) + return util.py3str(m2.err_lib_error_string(err))
                          + -
                          [docs]def get_error_func(err): # type: (int) -> str - return util.py3str(m2.err_func_error_string(err)) + return util.py3str(m2.err_func_error_string(err))
                          + -
                          [docs]def get_error_reason(err): # type: (int) -> str - return util.py3str(m2.err_reason_error_string(err)) + return util.py3str(m2.err_reason_error_string(err))
                          + + +
                          [docs]def get_error_message(): + # type: () -> str + return util.py3str(get_error_reason(get_error_code()))
                          + -
                          [docs]def get_x509_verify_error(err): # type: (int) -> str - return util.py3str(m2.x509_get_verify_error(err)) + return util.py3str(m2.x509_get_verify_error(err))
                          + -
                          [docs]class SSLError(Exception): def __init__(self, err, client_addr): # type: (int, util.AddrType) -> None @@ -112,9 +107,9 @@ else: s = self.client_addr return "%s: %s: %s" % (get_error_func(self.err), s, - get_error_reason(self.err)) + get_error_reason(self.err))
                          + -
                          [docs]class M2CryptoError(Exception): pass
                          @@ -122,41 +117,41 @@ -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/PGP/PublicKey.html b/doc/html/_modules/M2Crypto/PGP/PublicKey.html deleted file mode 100644 index 8e9593b..0000000 --- a/doc/html/_modules/M2Crypto/PGP/PublicKey.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - M2Crypto.PGP.PublicKey — M2Crypto documentation - - - - - - - - - - - - - - -
                          -
                          -
                          -
                          - -

                          Source code for M2Crypto.PGP.PublicKey

                          -from __future__ import absolute_import
                          -
                          -"""M2Crypto PGP2.
                          -
                          -Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
                          -
                          -from M2Crypto.PGP.RSA import new_pub_key
                          -from M2Crypto.RSA import pkcs1_padding
                          -from M2Crypto.PGP.packet import PublicKeyPacket  # noqa
                          -from M2Crypto.PGP.constants import *  # noqa
                          -from M2Crypto.PGP.packet import *  # noqa
                          -
                          -
                          -
                          [docs]class PublicKey: - def __init__(self, pubkey_pkt): - # type: (PublicKeyPacket) -> None - import warnings - warnings.warn( - 'Deprecated. No maintainer for PGP. If you use this, ' + - 'please inform M2Crypto maintainer.', - DeprecationWarning) - - self._pubkey_pkt = pubkey_pkt - self._pubkey = new_pub_key((pubkey_pkt._e, pubkey_pkt._n)) - self._userid = {} # type: dict - self._signature = {} # type: dict - -
                          [docs] def keyid(self): - # type: () -> bytes - return self._pubkey.n[-8:] -
                          -
                          [docs] def add_userid(self, u_pkt): - # type: (Packet.UserIDPacket) -> None - assert isinstance(u_pkt, UserIDPacket) - self._userid[u_pkt.userid()] = u_pkt -
                          -
                          [docs] def remove_userid(self, userid): - # type: (int) -> None - del self._userid[userid] -
                          -
                          [docs] def add_signature(self, userid, s_pkt): - # type: (int, SignaturePacket) -> None - assert isinstance(s_pkt, SignaturePacket) - assert userid in self._userid - if userid in self._signature: - self._signature.append(s_pkt) - else: - self._signature = [s_pkt] -
                          - def __getitem__(self, id): - # type: (int) -> SignaturePacket - return self._userid[id] - - def __setitem__(self, *args): - raise NotImplementedError - - def __delitem__(self, id): - # type: (int) -> None - del self._userid[id] - if self._signature[id]: - del self._signature[id] - -
                          [docs] def write(self, stream): - # type: (IO[bytes]) -> None - pass -
                          -
                          [docs] def encrypt(self, ptxt): - # type: (bytes) -> bytes - # XXX Munge ptxt into pgp format. - return self._pubkey.public_encrypt(ptxt, pkcs1_padding) -
                          -
                          [docs] def decrypt(self, ctxt): - # type: (bytes) -> bytes - # XXX Munge ctxt into pgp format. - return self._pubkey.public_encrypt(ctxt, pkcs1_padding)
                          -
                          - -
                          -
                          -
                          -
                          -
                          - - -
                          -
                          -
                          -
                          - - - - \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/PGP/PublicKeyRing.html b/doc/html/_modules/M2Crypto/PGP/PublicKeyRing.html deleted file mode 100644 index 6ca29ed..0000000 --- a/doc/html/_modules/M2Crypto/PGP/PublicKeyRing.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - - - M2Crypto.PGP.PublicKeyRing — M2Crypto documentation - - - - - - - - - - - - - - -
                          -
                          -
                          -
                          - -

                          Source code for M2Crypto.PGP.PublicKeyRing

                          -from __future__ import absolute_import
                          -
                          -"""M2Crypto PGP2.
                          -
                          -Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
                          -
                          -from M2Crypto import util
                          -from M2Crypto.PGP.PublicKey import *  # noqa
                          -from M2Crypto.PGP.constants import *  # noqa
                          -from M2Crypto.PGP.packet import *  # noqa
                          -if util.py27plus:
                          -    from typing import Any, AnyStr, List, Tuple  # noqa
                          -
                          -
                          -
                          [docs]class PublicKeyRing: - def __init__(self, keyring): - # type: (object) -> None - import warnings - warnings.warn( - 'Deprecated. No maintainer for PGP. If you use this, ' + - 'please inform M2Crypto maintainer.', - DeprecationWarning) - - self._keyring = keyring - self._userid = {} # type: dict - self._keyid = {} # type: dict - self._spurious = [] # type: list - self._pubkey = [] # type: list - -
                          [docs] def load(self): - # type: () -> None - curr_pub = None - curr_index = -1 - - ps = PacketStream(self._keyring) - while 1: - pkt = ps.read() - - if pkt is None: - break - - elif isinstance(pkt, PublicKeyPacket): - curr_index = curr_index + 1 - curr_pub = PublicKey(pkt) - self._pubkey.append(curr_pub) - # self._keyid[curr_pub.keyid()] = (curr_pub, curr_index) - - elif isinstance(pkt, UserIDPacket): - if curr_pub is None: - self._spurious.append(pkt) - else: - curr_pub.add_userid(pkt) - self._userid[pkt.userid()] = (curr_pub, curr_index) - - elif isinstance(pkt, SignaturePacket): - if curr_pub is None: - self._spurious.append(pkt) - else: - curr_pub.add_signature(pkt) - - else: - self._spurious.append(pkt) - - ps.close() -
                          - def __getitem__(self, id): - # type: (int) -> int - return self._userid[id][0] - - def __setitem__(self, *args): - # type: (*List[Any]) -> None - raise NotImplementedError - - def __delitem__(self, id): - # type: (int) -> None - pkt, idx = self._userid[id] - del self._pubkey[idx] - del self._userid[idx] - pkt, idx = self._keyid[id] - del self._keyid[idx] - -
                          [docs] def spurious(self): - # type: () -> Tuple[SignaturePacket] - return tuple(self._spurious) -
                          -
                          [docs] def save(self, keyring): - # type: (file) -> None - for p in self._pubkey: - pp = p.pack() - keyring.write(pp) - -
                          -
                          [docs]def load_pubring(filename='pubring.pgp'): - # type: (AnyStr) -> PublicKeyRing - with open(filename, 'rb') as pkr_f: - pkr = PublicKeyRing(pkr_f) - pkr.load() - return pkr
                          -
                          - -
                          -
                          -
                          -
                          -
                          - - -
                          -
                          -
                          -
                          - - - - \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/PGP/RSA.html b/doc/html/_modules/M2Crypto/PGP/RSA.html deleted file mode 100644 index 4c2151d..0000000 --- a/doc/html/_modules/M2Crypto/PGP/RSA.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - M2Crypto.PGP.RSA — M2Crypto documentation - - - - - - - - - - - - - - -
                          -
                          -
                          -
                          - -

                          Source code for M2Crypto.PGP.RSA

                          -"""M2Crypto PGP2 RSA.
                          -
                          -Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
                          -
                          -from M2Crypto import m2, util
                          -from M2Crypto.RSA import RSA_pub  # noqa
                          -if util.py27plus:
                          -    from typing import Tuple  # noqa
                          -
                          -
                          -
                          [docs]def new_pub_key(e_n): - # type: (Tuple[int, int]) -> RSA_pub - """ - Factory function that instantiates an RSA_pub object from a (e, n) tuple. - - 'e' is the RSA public exponent; it is a string in OpenSSL's binary format, - i.e., a number of bytes in big-endian. - - 'n' is the RSA composite of primes; it is a string in OpenSSL's - binary format, i.e., a number of bytes in big-endian. - """ - import warnings - warnings.warn('Deprecated. No maintainer for PGP. If you use this, please inform M2Crypto maintainer.', DeprecationWarning) - - (e, n) = e_n - rsa = m2.rsa_new() - m2.rsa_set_en_bin(rsa, e, n) - return RSA_pub(rsa, 1)
                          -
                          - -
                          -
                          -
                          -
                          -
                          - - -
                          -
                          -
                          -
                          - - - - \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/PGP/packet.html b/doc/html/_modules/M2Crypto/PGP/packet.html deleted file mode 100644 index bef4f47..0000000 --- a/doc/html/_modules/M2Crypto/PGP/packet.html +++ /dev/null @@ -1,514 +0,0 @@ - - - - - - - - - - M2Crypto.PGP.packet — M2Crypto documentation - - - - - - - - - - - - - - -
                          -
                          -
                          -
                          - -

                          Source code for M2Crypto.PGP.packet

                          -from __future__ import absolute_import
                          -
                          -"""M2Crypto PGP2.
                          -
                          -This module implements PGP packets per RFC1991 and various source
                          -distributions.
                          -
                          -Each Packet type is represented by a class; Packet classes derive from
                          -the abstract 'Packet' class.
                          -
                          -The 'message digest' Packet type, mentioned but not documented in RFC1991,
                          -is not implemented.
                          -
                          -Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
                          -
                          -# XXX Work-in-progress. UNFINISHED, type hinting is probably wrong!!!
                          -
                          -# Be liberal in what you accept.
                          -# Be conservative in what you send.
                          -# Be lazy in what you eval.
                          -
                          -import struct
                          -
                          -from io import BytesIO
                          -
                          -from M2Crypto import util  # noqa
                          -from M2Crypto.util import octx_to_num
                          -from M2Crypto.PGP import constants  # noqa
                          -if util.py27plus:
                          -    from typing import AnyStr, IO, Optional, Tuple  # noqa
                          -
                          -_OK_VERSION = ('\002', '\003')
                          -_OK_VALIDITY = ('\000',)
                          -_OK_PKC = ('\001',)
                          -
                          -
                          -
                          [docs]class XXXError(Exception): - pass - -
                          -
                          [docs]class Packet: - def __init__(self, ctb, body=None): - # type: (int, Optional[str]) -> None - import warnings - warnings.warn( - 'Deprecated. No maintainer for PGP. If you use this, ' + - 'please inform M2Crypto maintainer.', - DeprecationWarning) - - self.ctb = ctb - if body is not None: - self.body = BytesIO(body) # type: Optional[IO[str]] - else: - self.body = None - -
                          [docs] def validate(self): - # type: () -> int - return 1 -
                          -
                          [docs] def pack(self): - # type: () -> None - raise NotImplementedError('%s.pack(): abstract method' % - (self.__class__,)) -
                          -
                          [docs] def version(self): - # type: () -> Optional[int] - if hasattr(self, '_version'): - return ord(self._version) - else: - return None -
                          -
                          [docs] def timestamp(self): - # type: () -> Optional[int] - if hasattr(self, '_timestamp'): - return struct.unpack('>L', self._timestamp)[0] - else: - return None -
                          -
                          [docs] def validity(self): - # type: () -> Optional[int] - if hasattr(self, '_validity'): - return struct.unpack('>H', self._validity)[0] - else: - return None -
                          -
                          [docs] def pkc(self): - # type: () -> Optional[bytes] - if hasattr(self, '_pkc'): - return self._pkc - else: - return None -
                          - def _llf(self, lenf): - # type: (int) -> Tuple[int, bytes] - if lenf < 256: - return 0, chr(lenf) - elif lenf < 65536: - return 1, struct.pack('>H', lenf) - else: - assert lenf < 2**32 - return 2, struct.pack('>L', lenf) - - def _ctb(self, llf): - # type: (int) -> int - ctbv = _FACTORY[self.__class__] - return chr((1 << 7) | (ctbv << 2) | llf) - -
                          -
                          [docs]class PublicKeyPacket(Packet): # noqa - def __init__(self, ctb, body=None): - # type: (int, Optional[IO[str]) -> None - Packet.__init__(self, ctb, body) - if self.body is not None: - self._version = self.body.read(1) - self._timestamp = self.body.read(4) - self._validity = self.body.read(2) - self._pkc = self.body.read(1) - - self._nlen = self.body.read(2) - nlen = (struct.unpack('>H', self._nlen)[0] + 7) / 8 - self._n = self.body.read(nlen) - - self._elen = self.body.read(2) - elen = (struct.unpack('>H', self._elen)[0] + 7) / 8 - self._e = self.body.read(elen) - -
                          [docs] def pack(self): - # type: () -> str - if self.body is None: - self.body = BytesIO() - self.body.write(self._version) - self.body.write(self._timestamp) - self.body.write(self._validity) - self.body.write(self._pkc) - self.body.write(self._nlen) - self.body.write(self._n) - self.body.write(self._elen) - self.body.write(self._e) - self.body = self.body.getvalue() - llf, lenf = self._llf(len(self.body)) - ctb = self._ctb(llf) - return '%s%s%s' % (ctb, lenf, self.body) -
                          -
                          [docs] def pubkey(self): - # type: () -> bytes - return self._pubkey.pub() - -
                          -
                          [docs]class TrustPacket(Packet): # noqa - # This implementation neither interprets nor emits trust packets. - def __init__(self, ctb, body=None): - # type: (int, Optional[AnyStr]) -> None - Packet.__init__(self, ctb, body) - if body is not None: - self.trust = self.body.read(1) - -
                          -
                          [docs]class UserIDPacket(Packet): # noqa - def __init__(self, ctb, body=None): - # type: (int, Optional[str]) -> None - Packet.__init__(self, ctb, body) - if body is not None: - self._userid = body - -
                          [docs] def pack(self): - # type: () -> int - if self.body is None: - self.body = '' - self.body += chr(len(self._userid)) - self.body += self._userid - return self.ctb + self.body -
                          -
                          [docs] def userid(self): - # type: () -> int - return self._userid - -
                          -
                          [docs]class CommentPacket(Packet): # noqa - def __init__(self, ctb, body=None): - # type: (int, Optional[int]) -> None - Packet.__init__(self, ctb, body) - if body is not None: - self.comment = self.body.getvalue() - -
                          [docs] def pack(self): - # type: () -> int - if self.body is None: - self.body = chr(len(self.comment)) - self.body += self.comment - return self.ctb + self.body - -
                          -
                          [docs]class SignaturePacket(Packet): # noqa - def __init__(self, ctb, body=None): - # type: (int, Optional[IO[bytes]]) -> None - Packet.__init__(self, ctb, body) - if body is not None: - self._version = self.body.read(1) - self._len_md_stuff = self.body.read(1) - self._classification = self.body.read(1) - self._timestamp = self.body.read(4) - self._keyid = self.body.read(8) - self._pkc = self.body.read(1) - self._md_algo = self.body.read(1) - self._md_chksum = self.body.read(2) - self._sig = self.body.read() - -
                          [docs] def pack(self): - # type: () -> str - if self.body is None: - self.body = self._version - self.body += self._len_md_stuff - self.body += self._classification - self.body += self._timestamp - self.body += self._keyid - self.body += self._pkc - self.body += self._md_algo - self.body += self._md_chksum - self.body += self._sig - llf, lenf = self._llf(len(self.body)) - self.ctb = self.ctb | llf - return '%s%s%s' % (self.ctb, lenf, self.body) -
                          -
                          [docs] def validate(self): - # type: () -> None - # FIXME this looks broken ... returning None always? - if self._version not in _OK_VERSION: - return None - if self._len_md_stuff != '\005': - return None - -
                          -
                          [docs]class PrivateKeyPacket(Packet): # noqa - def __init__(self, ctb, body=None): - # type: (int, IO[bytes]) -> None - Packet.__init__(self, ctb, body) - if body is not None: - self._version = self.body.read(1) - self._timestamp = self.body.read(4) - self._validity = self.body.read(2) - self._pkc = self.body.read(1) - - self._nlen = self.body.read(2) - nlen = (struct.unpack('>H', self._nlen)[0] + 7) / 8 - self._n = self.body.read(nlen) - - self._elen = self.body.read(2) - elen = (struct.unpack('>H', self._elen)[0] + 7) / 8 - self._e = self.body.read(elen) - - self._cipher = self.body.read(1) - if self._cipher == '\001': - self._iv = self.body.read(8) - else: - self._iv = None - - for param in ['d', 'p', 'q', 'u']: - _plen = self.body.read(2) - setattr(self, '_' + param + 'len', _plen) - plen = (struct.unpack('>H', _plen)[0] + 7) / 8 - setattr(self, '_' + param, self.body.read(plen)) - - self._cksum = self.body.read(2) - -
                          [docs] def is_encrypted(self): - # type: () -> int - return ord(self._cipher) - -
                          -
                          [docs]class CKEPacket(Packet): # noqa - def __init__(self, ctb, body=None): - # type: (int, IO[bytes]) -> None - Packet.__init__(self, ctb, body) - if body is not None: - self._iv = self.body.read(8) - self._cksum = self.body.read(2) - self._ctxt = self.body.read() - -
                          -
                          [docs]class PKEPacket(Packet): # noqa - def __init__(self, ctb, body=None): - # type: (int, IO[bytes]) -> None - Packet.__init__(self, ctb, body) - if body is not None: - self._version = self.body.read(1) - self._keyid = self.body.read(8) - self._pkc = ord(self.body.read(1)) - - deklen = (struct.unpack('>H', self.body.read(2))[0] + 7) / 8 - self._dek = octx_to_num(self.body.read(deklen)) - -
                          -
                          [docs]class LiteralPacket(Packet): # noqa - def __init__(self, ctb, body=None): - # type: (int, IO[bytes]) -> None - Packet.__init__(self, ctb, body) - if body is not None: - self.fmode = self.body.read(1) - fnlen = self.body.read(1) - self.fname = self.body.read(fnlen) - self.ftime = self.body.read(4) - # self.data = self.body.read() - -
                          -
                          [docs]class CompressedPacket(Packet): # noqa - def __init__(self, ctb, stream): - # type: (int, IO[bytes]) -> None - Packet.__init__(self, ctb, '') - if self.body is not None: - self.algo = stream.read(1) - # This reads the entire stream into memory. - self.data = stream.read() - -
                          [docs] def validate(self): - # type: () -> bool - return self.algo == '\001' -
                          -
                          [docs] def uncompress(self): - # type: () -> IO[bytes] - import zlib - decomp = zlib.decompressobj(-13) # RFC 2440, pg 61. - # This doubles the memory usage. - stream = BytesIO(decomp.decompress(self.data)) - return stream - -
                          -_FACTORY = { - 1: PKEPacket, - 2: SignaturePacket, - # 3 : message_digest_packet, # XXX not implemented - 5: PrivateKeyPacket, - 6: PublicKeyPacket, - # 8 : CompressedPacket, # special case - 9: CKEPacket, - 11: LiteralPacket, - 12: TrustPacket, - 13: UserIDPacket, - 14: CommentPacket, - PKEPacket: 1, - SignaturePacket: 2, - # 3 : message_digest_packet, - PrivateKeyPacket: 5, - PublicKeyPacket: 6, - # 8 : CompressedPacket, - CKEPacket: 9, - LiteralPacket: 11, - TrustPacket: 12, - UserIDPacket: 13, - CommentPacket: 14 -} - - -
                          [docs]class PacketStream: # noqa - def __init__(self, input): - # type: (IO[bytes]) -> None - self.stream = input - self.under_current = None - self._count = 0 - -
                          [docs] def close(self): - # type: () -> None - self.stream.close() - if self.under_current is not None: - self.under_current.close() -
                          -
                          [docs] def read(self, keep_trying=0): - # type: (int) -> Packet - while 1: - ctb0 = self.stream.read(1) - if not ctb0: - return None - ctb = ord(ctb0) - if is_ctb(ctb): - break - elif keep_trying: - continue - else: - raise XXXError - ctbt = (ctb & 0x3c) >> 2 - - if ctbt == constants.CTB_COMPRESSED_DATA: - self.under_current = self.stream - cp = CompressedPacket(ctb0, self.stream) - self.stream = cp.uncompress() - return self.read() - - # Decode the length of following data. See RFC for details. - llf = ctb & 3 - if llf == 0: - lenf = ord(self.stream.read(1)) - elif llf == 1: - lenf = struct.unpack('>H', self.stream.read(2))[0] - elif llf == 2: - lenf = struct.unpack('>L', self.stream.read(4))[0] - else: # llf == 3 - raise XXXError('impossible case') - - body = self.stream.read(lenf) - if not body or (len(body) != lenf): - raise XXXError('corrupted Packet') - - self._count = self.stream.tell() - try: - return _FACTORY[ctbt](ctb0, body) - except KeyError: - return Packet(ctb0, body) -
                          -
                          [docs] def count(self): - # type: () -> int - return self._count - -
                          -
                          [docs]def is_ctb(ctb): - # type: (int) -> bool - return ctb & 0xc0 - -
                          -
                          [docs]def make_ctb(value, llf): - # type: (int, int) -> str - return chr((1 << 7) | (value << 2) | llf)
                          -
                          - -
                          -
                          -
                          -
                          -
                          - - -
                          -
                          -
                          -
                          - - - - \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/RC4.html b/doc/html/_modules/M2Crypto/RC4.html index dc7b374..9c2e976 100644 --- a/doc/html/_modules/M2Crypto/RC4.html +++ b/doc/html/_modules/M2Crypto/RC4.html @@ -1,69 +1,59 @@ - - - - M2Crypto.RC4 — M2Crypto documentation - - + M2Crypto.RC4 — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.RC4

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """M2Crypto wrapper for OpenSSL RC4 API.
                           
                           Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
                           
                          -from M2Crypto.m2 import rc4_free, rc4_new, rc4_set_key, rc4_update
                          +from M2Crypto.m2 import rc4_free, rc4_new, rc4_set_key, rc4_update
                           
                          -
                          [docs]class RC4: +
                          [docs]class RC4: """Object interface to the stream cipher RC4.""" rc4_free = rc4_free - def __init__(self, key=None): + def __init__(self, key=None): # type: (bytes) -> None self.cipher = rc4_new() if key: @@ -71,17 +61,17 @@ def __del__(self): # type: () -> None - if getattr(self, 'cipher', None): + if getattr(self, 'cipher', None): self.rc4_free(self.cipher)
                          [docs] def set_key(self, key): # type: (bytes) -> None - rc4_set_key(self.cipher, key) -
                          + rc4_set_key(self.cipher, key)
                          +
                          [docs] def update(self, data): # type: (bytes) -> bytes - return rc4_update(self.cipher, data) -
                          + return rc4_update(self.cipher, data)
                          +
                          [docs] def final(self): # type: () -> str return ''
                          @@ -90,41 +80,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/RSA.html b/doc/html/_modules/M2Crypto/RSA.html index 30933d1..f8509c8 100644 --- a/doc/html/_modules/M2Crypto/RSA.html +++ b/doc/html/_modules/M2Crypto/RSA.html @@ -1,55 +1,45 @@ - - - - M2Crypto.RSA — M2Crypto documentation - - + M2Crypto.RSA — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.RSA

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """M2Crypto wrapper for OpenSSL RSA API.
                           
                          @@ -57,14 +47,14 @@
                           
                           import sys
                           
                          -from M2Crypto import BIO, m2, util
                          +from M2Crypto import BIO, Err, m2, util
                           if util.py27plus:
                          -    from typing import Any, AnyStr, Callable, Dict, List, IO, Optional, Tuple  # noqa
                          +    from typing import Any, AnyStr, Callable, Dict, List, IO, Optional, Tuple  # noqa
                           
                           
                           
                          [docs]class RSAError(Exception): - pass -
                          + pass
                          + m2.rsa_init(RSAError) no_padding = m2.no_padding @@ -110,28 +100,28 @@
                          [docs] def pub(self): # type: () -> Tuple[bytes, bytes] assert self.check_key(), 'key is not initialised' - return m2.rsa_get_e(self.rsa), m2.rsa_get_n(self.rsa) -
                          + return m2.rsa_get_e(self.rsa), m2.rsa_get_n(self.rsa)
                          +
                          [docs] def public_encrypt(self, data, padding): # type: (bytes, int) -> bytes assert self.check_key(), 'key is not initialised' - return m2.rsa_public_encrypt(self.rsa, data, padding) -
                          + return m2.rsa_public_encrypt(self.rsa, data, padding)
                          +
                          [docs] def public_decrypt(self, data, padding): # type: (bytes, int) -> bytes assert self.check_key(), 'key is not initialised' - return m2.rsa_public_decrypt(self.rsa, data, padding) -
                          + return m2.rsa_public_decrypt(self.rsa, data, padding)
                          +
                          [docs] def private_encrypt(self, data, padding): # type: (bytes, int) -> bytes assert self.check_key(), 'key is not initialised' - return m2.rsa_private_encrypt(self.rsa, data, padding) -
                          + return m2.rsa_private_encrypt(self.rsa, data, padding)
                          +
                          [docs] def private_decrypt(self, data, padding): # type: (bytes, int) -> bytes assert self.check_key(), 'key is not initialised' - return m2.rsa_private_decrypt(self.rsa, data, padding) -
                          + return m2.rsa_private_decrypt(self.rsa, data, padding)
                          +
                          [docs] def save_key_bio(self, bio, cipher='aes_128_cbc', callback=util.passphrase_callback): # type: (BIO.BIO, Optional[str], Callable) -> int @@ -149,17 +139,17 @@ the key. The default is util.passphrase_callback. """ - if cipher is None: + if cipher is None: return m2.rsa_write_key_no_cipher(self.rsa, bio._ptr(), callback) else: - ciph = getattr(m2, cipher, None) - if ciph is None: + ciph = getattr(m2, cipher, None) + if ciph is None: raise RSAError('not such cipher %s' % cipher) else: ciph = ciph() - return m2.rsa_write_key(self.rsa, bio._ptr(), ciph, callback) -
                          -
                          [docs] def save_key(self, file, cipher='aes_128_cbc', + return m2.rsa_write_key(self.rsa, bio._ptr(), ciph, callback)
                          + +
                          [docs] def save_key(self, file, cipher='aes_128_cbc', callback=util.passphrase_callback): # type: (AnyStr, Optional[str], Callable) -> int """ @@ -176,9 +166,9 @@ the key. The default is util.passphrase_callback. """ - with BIO.openfile(file, 'wb') as bio: - return self.save_key_bio(bio, cipher, callback) -
                          + with BIO.openfile(file, 'wb') as bio: + return self.save_key_bio(bio, cipher, callback)
                          + save_pem = save_key
                          [docs] def as_pem(self, cipher='aes_128_cbc', callback=util.passphrase_callback): @@ -188,8 +178,8 @@ """ bio = BIO.MemoryBuffer() self.save_key_bio(bio, cipher, callback) - return bio.read() -
                          + return bio.read()
                          +
                          [docs] def save_key_der_bio(self, bio): # type: (BIO.BIO) -> int """ @@ -197,18 +187,18 @@ :param bio: M2Crypto.BIO.BIO object to save key to. """ - return m2.rsa_write_key_der(self.rsa, bio._ptr()) -
                          -
                          [docs] def save_key_der(self, file): + return m2.rsa_write_key_der(self.rsa, bio._ptr())
                          + +
                          [docs] def save_key_der(self, file): # type: (AnyStr) -> int """ Save the key pair to a file in DER format. :param file: Filename to save key to """ - with BIO.openfile(file, 'wb') as bio: - return self.save_key_der_bio(bio) -
                          + with BIO.openfile(file, 'wb') as bio: + return self.save_key_der_bio(bio)
                          +
                          [docs] def save_pub_key_bio(self, bio): # type: (BIO.BIO) -> int """ @@ -216,18 +206,18 @@ :param bio: M2Crypto.BIO.BIO object to save key to. """ - return m2.rsa_write_pub_key(self.rsa, bio._ptr()) -
                          -
                          [docs] def save_pub_key(self, file): + return m2.rsa_write_pub_key(self.rsa, bio._ptr())
                          + +
                          [docs] def save_pub_key(self, file): # type: (AnyStr) -> int """ Save the public key to a file in PEM format. :param file: Name of file to save key to. """ - with BIO.openfile(file, 'wb') as bio: - return m2.rsa_write_pub_key(self.rsa, bio._ptr()) -
                          + with BIO.openfile(file, 'wb') as bio: + return m2.rsa_write_pub_key(self.rsa, bio._ptr())
                          +
                          [docs] def check_key(self): # type: () -> int """ @@ -237,8 +227,8 @@ If the key is invalid or an error occurred, the reason code can be obtained using ERR_get_error(3). """ - return m2.rsa_check_key(self.rsa) -
                          + return m2.rsa_check_key(self.rsa)
                          +
                          [docs] def sign_rsassa_pss(self, digest, algo='sha1', salt_length=20): # type: (bytes, str, int) -> bytes """ @@ -254,15 +244,15 @@ :return: a string which is the signature """ - hash = getattr(m2, algo, None) + hash = getattr(m2, algo, None) - if hash is None: + if hash is None: raise RSAError('not such hash algorithm %s' % algo) signature = m2.rsa_padding_add_pkcs1_pss(self.rsa, digest, hash(), salt_length) - return self.private_encrypt(signature, m2.no_padding) -
                          + return self.private_encrypt(signature, m2.no_padding)
                          +
                          [docs] def verify_rsassa_pss(self, data, signature, algo='sha1', salt_length=20): # type: (bytes, bytes, str, int) -> int """ @@ -281,15 +271,15 @@ :return: 1 or 0, depending on whether the signature was verified or not. """ - hash = getattr(m2, algo, None) + hash = getattr(m2, algo, None) - if hash is None: + if hash is None: raise RSAError('not such hash algorithm %s' % algo) plain_signature = self.public_decrypt(signature, m2.no_padding) - return m2.rsa_verify_pkcs1_pss(self.rsa, data, plain_signature, hash(), salt_length) -
                          + return m2.rsa_verify_pkcs1_pss(self.rsa, data, plain_signature, hash(), salt_length) +
                          [docs] def sign(self, digest, algo='sha1'): # type: (bytes, str) -> bytes """ @@ -303,12 +293,12 @@ :return: a string which is the signature """ - digest_type = getattr(m2, 'NID_' + algo, None) - if digest_type is None: + digest_type = getattr(m2, 'NID_' + algo, None) + if digest_type is None: raise ValueError('unknown algorithm', algo) - return m2.rsa_sign(self.rsa, digest, digest_type) -
                          + return m2.rsa_sign(self.rsa, digest, digest_type) +
                          [docs] def verify(self, data, signature, algo='sha1'): # type: (bytes, bytes, str) -> int """ @@ -325,13 +315,13 @@ :return: 1 or 0, depending on whether the signature was verified or not. """ - digest_type = getattr(m2, 'NID_' + algo, None) - if digest_type is None: + digest_type = getattr(m2, 'NID_' + algo, None) + if digest_type is None: raise ValueError('unknown algorithm', algo) - return m2.rsa_verify(self.rsa, data, signature, digest_type) + return m2.rsa_verify(self.rsa, data, signature, digest_type)
                          + -
                          [docs]class RSA_pub(RSA): # noqa """ @@ -343,44 +333,44 @@ if name in ['e', 'n']: raise RSAError('use factory function new_pub_key() to set (e, n)') else: - self.__dict__[name] = value + self.__dict__[name] = value
                          [docs] def private_encrypt(self, *argv): - # type: (*List[Any]) -> None - raise RSAError('RSA_pub object has no private key') -
                          + # type: (*Any) -> None + raise RSAError('RSA_pub object has no private key')
                          +
                          [docs] def private_decrypt(self, *argv): - # type: (*List[Any]) -> None - raise RSAError('RSA_pub object has no private key') -
                          -
                          [docs] def save_key(self, file, *args, **kw): - # type: (AnyStr, *List[Any], **Dict[Any, Any]) -> int + # type: (*Any) -> None + raise RSAError('RSA_pub object has no private key')
                          + +
                          [docs] def save_key(self, file, *args, **kw): + # type: (AnyStr, *Any, **Any) -> int """ Save public key to file. """ - return self.save_pub_key(file) -
                          + return self.save_pub_key(file) +
                          [docs] def save_key_bio(self, bio, *args, **kw): - # type: (BIO.BIO, *List[Any], **Dict[Any, Any]) -> int + # type: (BIO.BIO, *Any, **Any) -> int """ Save public key to BIO. """ - return self.save_pub_key_bio(bio) + return self.save_pub_key_bio(bio)
                          # save_key_der # save_key_der_bio - +
                          [docs] def check_key(self): # type: () -> int - return m2.rsa_check_pub_key(self.rsa) + return m2.rsa_check_pub_key(self.rsa)
                          + -
                          [docs]def rsa_error(): # type: () -> None - raise RSAError(m2.err_reason_error_string(m2.err_get_error())) + raise RSAError(Err.get_error_message())
                          + -
                          [docs]def keygen_callback(p, n, out=sys.stdout): # type: (int, Any, IO[str]) -> None """ @@ -388,9 +378,9 @@ """ ch = ['.', '+', '*', '\n'] out.write(ch[p]) - out.flush() + out.flush()
                          + -
                          [docs]def gen_key(bits, e, callback=keygen_callback): # type: (int, int, Callable) -> RSA """ @@ -407,10 +397,10 @@ :return: M2Crypto.RSA.RSA object. """ - return RSA(m2.rsa_generate_key(bits, e, callback), 1) + return RSA(m2.rsa_generate_key(bits, e, callback), 1)
                          - -
                          [docs]def load_key(file, callback=util.passphrase_callback): + +
                          [docs]def load_key(file, callback=util.passphrase_callback): # type: (AnyStr, Callable) -> RSA """ Load an RSA key pair from file. @@ -423,10 +413,10 @@ :return: M2Crypto.RSA.RSA object. """ - with BIO.openfile(file) as bio: - return load_key_bio(bio, callback) + with BIO.openfile(file) as bio: + return load_key_bio(bio, callback)
                          + -
                          [docs]def load_key_bio(bio, callback=util.passphrase_callback): # type: (BIO.BIO, Callable) -> RSA """ @@ -442,11 +432,11 @@ :return: M2Crypto.RSA.RSA object. """ rsa = m2.rsa_read_key(bio._ptr(), callback) - if rsa is None: + if rsa is None: rsa_error() - return RSA(rsa, 1) + return RSA(rsa, 1)
                          + -
                          [docs]def load_key_string(string, callback=util.passphrase_callback): # type: (AnyStr, Callable) -> RSA """ @@ -461,10 +451,10 @@ :return: M2Crypto.RSA.RSA object. """ bio = BIO.MemoryBuffer(string) - return load_key_bio(bio, callback) + return load_key_bio(bio, callback)
                          - -
                          [docs]def load_pub_key(file): + +
                          [docs]def load_pub_key(file): # type: (AnyStr) -> RSA_pub """ Load an RSA public key from file. @@ -473,10 +463,10 @@ :return: M2Crypto.RSA.RSA_pub object. """ - with BIO.openfile(file) as bio: - return load_pub_key_bio(bio) + with BIO.openfile(file) as bio: + return load_pub_key_bio(bio)
                          + -
                          [docs]def load_pub_key_bio(bio): # type: (BIO.BIO) -> RSA_pub """ @@ -488,11 +478,11 @@ :return: M2Crypto.RSA.RSA_pub object. """ rsa = m2.rsa_read_pub_key(bio._ptr()) - if rsa is None: + if rsa is None: rsa_error() - return RSA_pub(rsa, 1) + return RSA_pub(rsa, 1)
                          + -
                          [docs]def new_pub_key(e_n): # type: (Tuple[bytes, bytes]) -> RSA_pub """ @@ -517,41 +507,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/Rand.html b/doc/html/_modules/M2Crypto/Rand.html index f22a12f..2915acd 100644 --- a/doc/html/_modules/M2Crypto/Rand.html +++ b/doc/html/_modules/M2Crypto/Rand.html @@ -1,127 +1,235 @@ - - - - M2Crypto.Rand — M2Crypto documentation - - + M2Crypto.Rand — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.Rand

                          -from __future__ import absolute_import
                          +"""M2Crypto wrapper for OpenSSL PRNG. Requires OpenSSL 0.9.5 and above.
                           
                          -"""M2Crypto wrapper for OpenSSL PRNG. Requires OpenSSL 0.9.5 and above.
                          +Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved.
                          +Copyright (c) 2014-2017 Matej Cepl. All rights reserved.
                           
                          -Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
                          +See LICENCE for the license information.
                          +"""
                          +from __future__ import absolute_import
                           
                          -from M2Crypto import m2, util
                          +from M2Crypto import m2, util
                           if util.py27plus:
                          -    from typing import AnyStr, List  # noqa
                          +    from typing import AnyStr, Tuple
                           
                           
                           __all__ = ['rand_seed', 'rand_add', 'load_file', 'save_file', 'rand_bytes',
                                      'rand_pseudo_bytes', 'rand_file_name', 'rand_status']
                           
                          -rand_seed = m2.rand_seed  # type: (bytes) -> None
                          -rand_add = m2.rand_add  # type: (bytes, float) -> None
                          -load_file = m2.rand_load_file  # type: (AnyStr, int) -> int
                          -save_file = m2.rand_save_file  # type: (AnyStr) -> int
                          -rand_bytes = m2.rand_bytes  # type: (int) -> bytes
                          -rand_status = m2.rand_status  # type: () -> int
                           
                          +
                          [docs]def rand_add(blob, entropy): + # type: (bytes, float) -> None + """ + Mixes blob into the PRNG state. + + :param blob: added data + :param entropy: (the lower bound of) an estimate of how much randomness + is contained in blob, measured in bytes. + + Thus, if the data at buf are unpredictable to an adversary, this + increases the uncertainty about the state and makes the PRNG output less + predictable. Suitable input comes from user interaction (random key + presses, mouse movements) and certain hardware events. + + Details about sources of randomness and how to estimate their entropy + can be found in the literature, e.g. RFC 1750. + """ + m2.rand_add(blob, entropy) # pylint: disable=no-member
                          + + +
                          [docs]def rand_seed(seed): + # type: (bytes) -> None + """ + Equivalent to rand_add() when len(seed) == entropy. + + :param seed: added data (see description at rand_add) + """ + m2.rand_seed(seed) # pylint: disable=no-member
                          + + +
                          [docs]def rand_status(): + # type: () -> int + """ + Check whether there is enough entropy in PRNG. + + :return: 1 if the PRNG has been seeded with enough + data, 0 otherwise. + """ + return m2.rand_status() # pylint: disable=no-member
                          + + +
                          [docs]def rand_file_name(): + # type: () -> AnyStr + """ + Generate a default path for the random seed file. + + :return: string with the filename. + The seed file is $RANDFILE if that environment variable + is set, $HOME/.rnd otherwise. If $HOME is not set either, + an error occurs. + """ + return util.py3str(m2.rand_file_name()) # pylint: disable=no-member
                          + + +
                          [docs]def load_file(filename, max_bytes): + # type: (bytes, int) -> int + """ + Read a number of bytes from file filename and adds them to the PRNG. + + If max_bytes is non-negative, up to to max_bytes are read; starting with + OpenSSL 0.9.5, if max_bytes is -1, the complete file is read. -
                          [docs]def rand_pseudo_bytes(n): + :param filename: + :param max_bytes: + :return: the number of bytes read. + """ + return m2.rand_load_file(filename, max_bytes) # pylint: disable=no-member
                          + + +
                          [docs]def save_file(filename): + # type: (AnyStr) -> int + """ + Write a number of random bytes (currently 1024) to file. + + The file then can be used to initialize the PRNG by calling load_file() in + a later session. + + :param filename: + :return: returns the number of bytes written, and -1 if the bytes + written were generated without appropriate seed. + """ + return m2.rand_save_file(filename) # pylint: disable=no-member
                          + + +
                          [docs]def rand_bytes(num): + # type: (int) -> bytes + """ + Return n cryptographically strong pseudo-random bytes. + + An error occurs if the PRNG has not been seeded with enough randomness + to ensure an unpredictable byte sequence. + + :param num: number of bytes to be returned + :return: random bytes + """ + out = m2.rand_bytes(num) # pylint: disable=no-member + if out is None: + raise ValueError('Not enough randomness.') + elif out == -1: + raise ValueError('Not supported by the current RAND method.') + else: + return out
                          + + +
                          [docs]def rand_pseudo_bytes(num): # type: (int) -> Tuple[bytes, int] + """ + Return num pseudo-random bytes into buf. + + Pseudo-random byte sequences generated by this method will be unique + if they are of sufficient length, but are not necessarily + unpredictable. They can be used for non-cryptographic purposes and for + certain purposes in cryptographic protocols, but usually not for key + generation etc. + + Output of the function is mixed into the entropy pool before + retrieving the new pseudo-random bytes unless disabled at compile + time (see FAQ). + + :param num: number of bytes to be returned + :return: random bytes + """ import warnings - warnings.warn('The underlying OpenSSL method has been ' + - 'deprecated. Use Rand.rand_bytes instead.', DeprecationWarning) - return m2.rand_pseudo_bytes(n) + if m2.OPENSSL_VERSION_NUMBER >= 0x10100000: + warnings.warn('The underlying OpenSSL method has been ' + + 'deprecated. Use Rand.rand_bytes instead.', + DeprecationWarning) -
                          -
                          [docs]def rand_file_name(): - # type: () -> str - return util.py3str(m2.rand_file_name())
                          + out = m2.rand_pseudo_bytes(num) # pylint: disable=no-member + if out is None: + raise ValueError('Not enough randomness.') + else: + return out
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/SMIME.html b/doc/html/_modules/M2Crypto/SMIME.html index 18a768d..2b0bb6f 100644 --- a/doc/html/_modules/M2Crypto/SMIME.html +++ b/doc/html/_modules/M2Crypto/SMIME.html @@ -1,63 +1,53 @@ - - - - M2Crypto.SMIME — M2Crypto documentation - - + M2Crypto.SMIME — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.SMIME

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """M2Crypto wrapper for OpenSSL S/MIME API.
                           
                           Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
                           
                          -from M2Crypto import BIO, EVP, Err, X509, m2, util
                          +from M2Crypto import BIO, EVP, Err, X509, m2, util
                           if util.py27plus:
                          -    from typing import AnyStr, Callable, Optional  # noqa
                          +    from typing import AnyStr, Callable, Optional  # noqa
                           
                           PKCS7_TEXT = m2.PKCS7_TEXT  # type: int
                           PKCS7_NOCERTS = m2.PKCS7_NOCERTS  # type: int
                          @@ -76,8 +66,8 @@
                           
                           
                           
                          [docs]class PKCS7_Error(Exception): # noqa - pass -
                          + pass
                          + m2.pkcs7_init(PKCS7_Error) @@ -85,13 +75,14 @@ m2_pkcs7_free = m2.pkcs7_free - def __init__(self, pkcs7=None, _pyfree=0): + def __init__(self, pkcs7=None, _pyfree=0): # type: (Optional[bytes], int) -> None - """ + """PKCS7 object. + :param pkcs7: binary representation of the OpenSSL type PKCS7 """ - if pkcs7 is not None: + if pkcs7 is not None: self.pkcs7 = pkcs7 self._pyfree = _pyfree else: @@ -111,26 +102,26 @@ if text_name: return m2.pkcs7_type_sn(self.pkcs7) else: - return m2.pkcs7_type_nid(self.pkcs7) -
                          + return m2.pkcs7_type_nid(self.pkcs7)
                          +
                          [docs] def write(self, bio): # type: (BIO.BIO) -> int - return m2.pkcs7_write_bio(self.pkcs7, bio._ptr()) -
                          + return m2.pkcs7_write_bio(self.pkcs7, bio._ptr())
                          +
                          [docs] def write_der(self, bio): # type: (BIO.BIO) -> int - return m2.pkcs7_write_bio_der(self.pkcs7, bio._ptr()) -
                          + return m2.pkcs7_write_bio_der(self.pkcs7, bio._ptr())
                          +
                          [docs] def get0_signers(self, certs, flags=0): # type: (X509.X509_Stack, int) -> X509.X509_Stack return X509.X509_Stack(m2.pkcs7_get0_signers(self.pkcs7, - certs.stack, flags), 1) + certs.stack, flags), 1)
                          + -
                          [docs]def load_pkcs7(p7file): # type: (AnyStr) -> PKCS7 bio = m2.bio_new_file(p7file, 'r') - if bio is None: + if bio is None: raise BIO.BIOError(Err.get_error()) try: @@ -138,15 +129,15 @@ finally: m2.bio_free(bio) - if p7_ptr is None: + if p7_ptr is None: raise PKCS7_Error(Err.get_error()) - return PKCS7(p7_ptr, 1) + return PKCS7(p7_ptr, 1)
                          + -
                          [docs]def load_pkcs7_der(p7file): # type: (AnyStr) -> PKCS7 bio = m2.bio_new_file(p7file, 'r') - if bio is None: + if bio is None: raise BIO.BIOError(Err.get_error()) try: @@ -154,31 +145,31 @@ finally: m2.bio_free(bio) - if p7_ptr is None: + if p7_ptr is None: raise PKCS7_Error(Err.get_error()) - return PKCS7(p7_ptr, 1) + return PKCS7(p7_ptr, 1)
                          + -
                          [docs]def load_pkcs7_bio(p7_bio): # type: (BIO.BIO) -> PKCS7 p7_ptr = m2.pkcs7_read_bio(p7_bio._ptr()) - if p7_ptr is None: + if p7_ptr is None: raise PKCS7_Error(Err.get_error()) - return PKCS7(p7_ptr, 1) + return PKCS7(p7_ptr, 1)
                          + -
                          [docs]def load_pkcs7_bio_der(p7_bio): # type: (BIO.BIO) -> PKCS7 p7_ptr = m2.pkcs7_read_bio_der(p7_bio._ptr()) - if p7_ptr is None: + if p7_ptr is None: raise PKCS7_Error(Err.get_error()) - return PKCS7(p7_ptr, 1) + return PKCS7(p7_ptr, 1)
                          + -
                          [docs]def smime_load_pkcs7(p7file): # type: (AnyStr) -> PKCS7 bio = m2.bio_new_file(p7file, 'r') - if bio is None: + if bio is None: raise BIO.BIOError(Err.get_error()) try: @@ -186,97 +177,97 @@ finally: m2.bio_free(bio) - if p7_ptr is None: + if p7_ptr is None: raise SMIME_Error(Err.get_error()) - if bio_ptr is None: - return PKCS7(p7_ptr, 1), None + if bio_ptr is None: + return PKCS7(p7_ptr, 1), None else: - return PKCS7(p7_ptr, 1), BIO.BIO(bio_ptr, 1) + return PKCS7(p7_ptr, 1), BIO.BIO(bio_ptr, 1)
                          + -
                          [docs]def smime_load_pkcs7_bio(p7_bio): # type: (BIO.BIO) -> PKCS7 p7_ptr, bio_ptr = m2.smime_read_pkcs7(p7_bio._ptr()) - if p7_ptr is None: + if p7_ptr is None: raise SMIME_Error(Err.get_error()) - if bio_ptr is None: - return PKCS7(p7_ptr, 1), None + if bio_ptr is None: + return PKCS7(p7_ptr, 1), None else: - return PKCS7(p7_ptr, 1), BIO.BIO(bio_ptr, 1) + return PKCS7(p7_ptr, 1), BIO.BIO(bio_ptr, 1)
                          - -
                          [docs]class Cipher: +
                          [docs]class Cipher: """Object interface to EVP_CIPHER without all the frills of M2Crypto.EVP.Cipher. """ def __init__(self, algo): # type: (str) -> None - cipher = getattr(m2, algo, None) - if cipher is None: + cipher = getattr(m2, algo, None) + if cipher is None: raise ValueError('unknown cipher', algo) self.cipher = cipher() def _ptr(self): - return self.cipher + return self.cipher
                          + -
                          [docs]class SMIME_Error(Exception): # noqa - pass -
                          + pass + m2.smime_init(SMIME_Error) + # FIXME class has no __init__ method
                          [docs]class SMIME: -
                          [docs] def load_key(self, keyfile, certfile=None, +
                          [docs] def load_key(self, keyfile, certfile=None, callback=util.passphrase_callback): # type: (AnyStr, Optional[AnyStr], Callable) -> None - if certfile is None: + if certfile is None: certfile = keyfile self.pkey = EVP.load_key(keyfile, callback) - self.x509 = X509.load_cert(certfile) -
                          -
                          [docs] def load_key_bio(self, keybio, certbio=None, + self.x509 = X509.load_cert(certfile)
                          + +
                          [docs] def load_key_bio(self, keybio, certbio=None, callback=util.passphrase_callback): # type: (BIO.BIO, Optional[BIO.BIO], Callable) -> None - if certbio is None: + if certbio is None: certbio = keybio self.pkey = EVP.load_key_bio(keybio, callback) - self.x509 = X509.load_cert_bio(certbio) -
                          + self.x509 = X509.load_cert_bio(certbio)
                          +
                          [docs] def set_x509_stack(self, stack): # type: (X509.X509_Stack) -> None assert isinstance(stack, X509.X509_Stack) - self.x509_stack = stack -
                          + self.x509_stack = stack
                          +
                          [docs] def set_x509_store(self, store): # type: (X509.X509_Store) -> None assert isinstance(store, X509.X509_Store) - self.x509_store = store -
                          + self.x509_store = store +
                          [docs] def set_cipher(self, cipher): # type: (Cipher) -> None assert isinstance(cipher, Cipher) - self.cipher = cipher -
                          + self.cipher = cipher +
                          [docs] def unset_key(self): # type: () -> None del self.pkey - del self.x509 -
                          + del self.x509 +
                          [docs] def unset_x509_stack(self): # type: () -> None - del self.x509_stack -
                          + del self.x509_stack +
                          [docs] def unset_x509_store(self): # type: () -> None - del self.x509_store -
                          + del self.x509_store +
                          [docs] def unset_cipher(self): # type: () -> None - del self.cipher -
                          + del self.cipher +
                          [docs] def encrypt(self, data_bio, flags=0): # type: (BIO.BIO, int) -> PKCS7 if not hasattr(self, 'cipher'): @@ -285,10 +276,10 @@ raise SMIME_Error('no recipient certs: use set_x509_stack()') pkcs7 = m2.pkcs7_encrypt(self.x509_stack._ptr(), data_bio._ptr(), self.cipher._ptr(), flags) - if pkcs7 is None: + if pkcs7 is None: raise SMIME_Error(Err.get_error()) - return PKCS7(pkcs7, 1) -
                          + return PKCS7(pkcs7, 1) +
                          [docs] def decrypt(self, pkcs7, flags=0): # type: (PKCS7, int) -> Optional[bytes] if not hasattr(self, 'pkey'): @@ -297,35 +288,35 @@ raise SMIME_Error('no certificate: load_key() used incorrectly?') blob = m2.pkcs7_decrypt(pkcs7._ptr(), self.pkey._ptr(), self.x509._ptr(), flags) - if blob is None: + if blob is None: raise SMIME_Error(Err.get_error()) - return blob -
                          + return blob +
                          [docs] def sign(self, data_bio, flags=0, algo='sha1'): # type: (BIO.BIO, int, Optional[str]) -> PKCS7 if not hasattr(self, 'pkey'): raise SMIME_Error('no private key: use load_key()') - hash = getattr(m2, algo, None) + hash = getattr(m2, algo, None) - if hash is None: + if hash is None: raise SMIME_Error('no such hash algorithm %s' % algo) if hasattr(self, 'x509_stack'): pkcs7 = m2.pkcs7_sign1(self.x509._ptr(), self.pkey._ptr(), self.x509_stack._ptr(), data_bio._ptr(), hash(), flags) - if pkcs7 is None: + if pkcs7 is None: raise SMIME_Error(Err.get_error()) return PKCS7(pkcs7, 1) else: pkcs7 = m2.pkcs7_sign0(self.x509._ptr(), self.pkey._ptr(), data_bio._ptr(), hash(), flags) - if pkcs7 is None: + if pkcs7 is None: raise SMIME_Error(Err.get_error()) - return PKCS7(pkcs7, 1) -
                          -
                          [docs] def verify(self, pkcs7, data_bio=None, flags=0): + return PKCS7(pkcs7, 1)
                          + +
                          [docs] def verify(self, pkcs7, data_bio=None, flags=0): # type: (PKCS7, BIO.BIO, int) -> Optional[bytes] if not hasattr(self, 'x509_stack'): raise SMIME_Error('no signer certs: use set_x509_stack()') @@ -333,27 +324,27 @@ raise SMIME_Error('no x509 cert store: use set_x509_store()') assert isinstance(pkcs7, PKCS7), 'pkcs7 not an instance of PKCS7' p7 = pkcs7._ptr() - if data_bio is None: + if data_bio is None: blob = m2.pkcs7_verify0(p7, self.x509_stack._ptr(), self.x509_store._ptr(), flags) else: blob = m2.pkcs7_verify1(p7, self.x509_stack._ptr(), self.x509_store._ptr(), data_bio._ptr(), flags) - if blob is None: + if blob is None: raise SMIME_Error(Err.get_error()) - return blob -
                          -
                          [docs] def write(self, out_bio, pkcs7, data_bio=None, flags=0): + return blob
                          + +
                          [docs] def write(self, out_bio, pkcs7, data_bio=None, flags=0): # type: (BIO.BIO, PKCS7, Optional[BIO.BIO], int) -> int assert isinstance(pkcs7, PKCS7) - if data_bio is None: + if data_bio is None: return m2.smime_write_pkcs7(out_bio._ptr(), pkcs7._ptr(), flags) else: return m2.smime_write_pkcs7_multi(out_bio._ptr(), pkcs7._ptr(), - data_bio._ptr(), flags) + data_bio._ptr(), flags)
                          + -
                          [docs]def text_crlf(text): # type: (bytes) -> bytes bio_in = BIO.MemoryBuffer(text) @@ -361,9 +352,9 @@ if m2.smime_crlf_copy(bio_in._ptr(), bio_out._ptr()): return bio_out.read() else: - raise SMIME_Error(Err.get_error()) + raise SMIME_Error(Err.get_error())
                          + -
                          [docs]def text_crlf_bio(bio_in): # type: (BIO.BIO) -> BIO.BIO bio_out = BIO.MemoryBuffer() @@ -376,41 +367,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/SSL.html b/doc/html/_modules/M2Crypto/SSL.html index 6659f09..a7db7e9 100644 --- a/doc/html/_modules/M2Crypto/SSL.html +++ b/doc/html/_modules/M2Crypto/SSL.html @@ -1,55 +1,45 @@ - - - - M2Crypto.SSL — M2Crypto documentation - - + M2Crypto.SSL — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.SSL

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """M2Crypto SSL services.
                           
                          @@ -58,26 +48,26 @@
                           import socket
                           
                           # M2Crypto
                          -from M2Crypto import m2
                          +from M2Crypto import _m2crypto as m2
                           
                           
                           
                          [docs]class SSLError(Exception): - pass + pass
                          + -
                          [docs]class SSLTimeoutError(SSLError, socket.timeout): - pass -
                          + pass
                          + m2.ssl_init(SSLError, SSLTimeoutError) # M2Crypto.SSL -from M2Crypto.SSL.Cipher import Cipher, Cipher_Stack -from M2Crypto.SSL.Connection import Connection -from M2Crypto.SSL.Context import Context -from M2Crypto.SSL.SSLServer import (ForkingSSLServer, SSLServer, +from M2Crypto.SSL.Cipher import Cipher, Cipher_Stack +from M2Crypto.SSL.Connection import Connection +from M2Crypto.SSL.Context import Context +from M2Crypto.SSL.SSLServer import (ForkingSSLServer, SSLServer, ThreadingSSLServer) -from M2Crypto.SSL.ssl_dispatcher import ssl_dispatcher -from M2Crypto.SSL.timeout import timeout +from M2Crypto.SSL.ssl_dispatcher import ssl_dispatcher +from M2Crypto.SSL.timeout import timeout verify_none = m2.SSL_VERIFY_NONE # type: int verify_peer = m2.SSL_VERIFY_PEER # type: int @@ -94,41 +84,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/SSL/Checker.html b/doc/html/_modules/M2Crypto/SSL/Checker.html index 98338bb..93b884c 100644 --- a/doc/html/_modules/M2Crypto/SSL/Checker.html +++ b/doc/html/_modules/M2Crypto/SSL/Checker.html @@ -1,53 +1,42 @@ - - - - M2Crypto.SSL.Checker — M2Crypto documentation - - + M2Crypto.SSL.Checker — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.SSL.Checker

                           """
                          @@ -65,23 +54,23 @@
                           import re
                           import socket
                           
                          -from M2Crypto import X509, m2, util  # noqa
                          +from M2Crypto import X509, m2, util  # noqa
                           if util.py27plus:
                          -    from typing import AnyStr, Optional  # noqa
                          +    from typing import AnyStr, Optional  # noqa
                           
                           
                           
                          [docs]class SSLVerificationError(Exception): - pass + pass
                          + -
                          [docs]class NoCertificate(SSLVerificationError): - pass + pass
                          + -
                          [docs]class WrongCertificate(SSLVerificationError): - pass + pass
                          + -
                          [docs]class WrongHost(SSLVerificationError): def __init__(self, expectedHost, actualHost, fieldName='commonName'): # type: (str, AnyStr, str) -> None @@ -102,7 +91,7 @@ 'Unknown fieldName, should be either commonName ' + 'or subjectAltName') - SSLVerificationError.__init__(self) + SSLVerificationError.__init__(self) self.expectedHost = expectedHost self.actualHost = actualHost self.fieldName = fieldName @@ -111,27 +100,27 @@ # type: () -> str s = 'Peer certificate %s does not match host, expected %s, got %s' \ % (self.fieldName, self.expectedHost, self.actualHost) - return util.py3str(s) + return util.py3str(s)
                          + -
                          [docs]class Checker: numericIpMatch = re.compile('^[0-9]+(\.[0-9]+)*$') - def __init__(self, host=None, peerCertHash=None, peerCertDigest='sha1'): + def __init__(self, host=None, peerCertHash=None, peerCertDigest='sha1'): # type: (Optional[str], Optional[bytes], str) -> None self.host = host - if peerCertHash is not None: + if peerCertHash is not None: peerCertHash = util.py3bytes(peerCertHash) self.fingerprint = peerCertHash self.digest = peerCertDigest # type: str - def __call__(self, peerCert, host=None): + def __call__(self, peerCert, host=None): # type: (X509.X509, Optional[str]) -> bool - if peerCert is None: + if peerCert is None: raise NoCertificate('peer did not return certificate') - if host is not None: + if host is not None: self.host = host # type: str if self.fingerprint: @@ -143,13 +132,13 @@ elif self.digest == 'md5': expected_len = 32 else: - raise ValueError('Unexpected digest {0}'.format(self.digest)) + raise ValueError('Unexpected digest {0}'.format(self.digest)) if len(self.fingerprint) != expected_len: raise WrongCertificate( ('peer certificate fingerprint length does not match\n' + - 'fingerprint: {0}\nexpected = {1}\n' + - 'observed = {2}').format(self.fingerprint, + 'fingerprint: {0}\nexpected = {1}\n' + + 'observed = {2}').format(self.fingerprint, expected_len, len(self.fingerprint))) @@ -158,19 +147,19 @@ if observed_fingerprint != expected_fingerprint: raise WrongCertificate( ('peer certificate fingerprint does not match\n' + - 'expected = {0},\n' + - 'observed = {1}').format(expected_fingerprint, + 'expected = {0},\n' + + 'observed = {1}').format(expected_fingerprint, observed_fingerprint)) if self.host: - hostValidationPassed = False - self.useSubjectAltNameOnly = False + hostValidationPassed = False + self.useSubjectAltNameOnly = False # subjectAltName=DNS:somehost[, ...]* try: subjectAltName = peerCert.get_ext('subjectAltName').get_value() if self._splitSubjectAltName(self.host, subjectAltName): - hostValidationPassed = True + hostValidationPassed = True elif self.useSubjectAltNameOnly: raise WrongHost(expectedHost=self.host, actualHost=subjectAltName, @@ -180,18 +169,18 @@ # commonName=somehost[, ...]* if not hostValidationPassed: - hasCommonName = False + hasCommonName = False commonNames = '' for entry in peerCert.get_subject().get_entries_by_nid( m2.NID_commonName): - hasCommonName = True + hasCommonName = True commonName = entry.get_data().as_text() if not commonNames: commonNames = commonName else: commonNames += ',' + commonName if self._match(self.host, commonName): - hostValidationPassed = True + hostValidationPassed = True break if not hasCommonName: @@ -202,7 +191,7 @@ actualHost=commonNames, fieldName='commonName') - return True + return True def _splitSubjectAltName(self, host, subjectAltName): # type: (AnyStr, AnyStr) -> bool @@ -245,18 +234,18 @@ >>> check.useSubjectAltNameOnly False """ - self.useSubjectAltNameOnly = False + self.useSubjectAltNameOnly = False for certHost in subjectAltName.split(','): certHost = certHost.lower().strip() if certHost[:4] == 'dns:': - self.useSubjectAltNameOnly = True + self.useSubjectAltNameOnly = True if self._match(host, certHost[4:]): - return True + return True elif certHost[:11] == 'ip address:': - self.useSubjectAltNameOnly = True + self.useSubjectAltNameOnly = True if self._matchIPAddress(host, certHost[11:]): - return True - return False + return True + return False def _match(self, host, certHost): # type: (str, str) -> bool @@ -288,30 +277,30 @@ certHost = certHost.lower() if host == certHost: - return True + return True if certHost.count('*') > 1: # Not sure about this, but being conservative - return False + return False if self.numericIpMatch.match(host) or \ self.numericIpMatch.match(certHost.replace('*', '')): # Not sure if * allowed in numeric IP, but think not. - return False + return False if certHost.find('\\') > -1: # Not sure about this, maybe some encoding might have these. # But being conservative for now, because regex below relies # on this. - return False + return False # Massage certHost so that it can be used in regex certHost = certHost.replace('.', '\.') certHost = certHost.replace('*', '[^\.]*') if re.compile('^%s$' % certHost).match(host): - return True + return True - return False + return False def _matchIPAddress(self, host, certHost): # type: (AnyStr, AnyStr) -> bool @@ -340,11 +329,11 @@ socket.SOCK_STREAM, 0, socket.AI_NUMERICHOST) except: - return False - return canonical == certCanonical + return False + return canonical == certCanonical
                          -
                          -if __name__ == '__main__': + +if __name__ == '__main__': import doctest doctest.testmod()
                          @@ -352,42 +341,43 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/SSL/Cipher.html b/doc/html/_modules/M2Crypto/SSL/Cipher.html index 754babf..1f8ca81 100644 --- a/doc/html/_modules/M2Crypto/SSL/Cipher.html +++ b/doc/html/_modules/M2Crypto/SSL/Cipher.html @@ -1,53 +1,42 @@ - - - - M2Crypto.SSL.Cipher — M2Crypto documentation - - + M2Crypto.SSL.Cipher — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.SSL.Cipher

                           """SSL Ciphers
                          @@ -56,9 +45,9 @@
                           
                           __all__ = ['Cipher', 'Cipher_Stack']
                           
                          -from M2Crypto import m2, util
                          +from M2Crypto import m2, util
                           if util.py27plus:
                          -    from typing import Iterable  # noqa
                          +    from typing import Iterable  # noqa
                           
                           
                           
                          [docs]class Cipher: @@ -80,13 +69,13 @@
                          [docs] def version(self): # type: () -> int - return m2.ssl_cipher_get_version(self.cipher) -
                          + return m2.ssl_cipher_get_version(self.cipher)
                          +
                          [docs] def name(self): # type: () -> str - return util.py3str(m2.ssl_cipher_get_name(self.cipher)) + return util.py3str(m2.ssl_cipher_get_name(self.cipher))
                          + -
                          [docs]class Cipher_Stack: # noqa def __init__(self, stack): # type: (bytes) -> None @@ -108,49 +97,50 @@ def __iter__(self): # type: () -> Iterable - for i in xrange(m2.sk_ssl_cipher_num(self.stack)): + for i in range(m2.sk_ssl_cipher_num(self.stack)): yield self[i]
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/SSL/Connection.html b/doc/html/_modules/M2Crypto/SSL/Connection.html index a1fb4c8..68462e0 100644 --- a/doc/html/_modules/M2Crypto/SSL/Connection.html +++ b/doc/html/_modules/M2Crypto/SSL/Connection.html @@ -1,56 +1,45 @@ - - - - M2Crypto.SSL.Connection — M2Crypto documentation - - + M2Crypto.SSL.Connection — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.SSL.Connection

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """SSL Connection aka socket
                           
                          @@ -65,28 +54,27 @@
                           import logging
                           import socket
                           
                          -from M2Crypto import BIO, X509, m2, util  # noqa
                          -from M2Crypto.SSL import Checker, Context, timeout  # noqa
                          -from M2Crypto.SSL import SSLError
                          -from M2Crypto.SSL.Cipher import Cipher, Cipher_Stack
                          -from M2Crypto.SSL.Session import Session
                          +from M2Crypto import BIO, Err, X509, m2, six, util  # noqa
                          +from M2Crypto.SSL import Checker, Context, timeout  # noqa
                          +from M2Crypto.SSL import SSLError
                          +from M2Crypto.SSL.Cipher import Cipher, Cipher_Stack
                          +from M2Crypto.SSL.Session import Session
                           if util.py27plus:
                          -    from typing import Any, AnyStr, Callable, Dict, List, Optional, Tuple, Union  # noqa
                          +    from typing import Any, AnyStr, Callable, Dict, List, Optional, Tuple, Union  # noqa
                           
                           __all__ = ['Connection',
                                      'timeout',  # XXX Not really, but for documentation purposes
                                      ]
                           
                          -log = logging.getLogger(__name__)
                          +log = logging.getLogger(__name__)
                           
                           
                           def _serverPostConnectionCheck(*args, **kw):
                          -    # type: (*List[Any], **Dict[Any, Any]) -> int
                          +    # type: (*Any, **Any) -> int
                               return 1
                           
                           
                           
                          [docs]class Connection: - """An SSL connection.""" clientPostConnectionCheck = Checker.Checker() @@ -95,7 +83,7 @@ m2_bio_free = m2.bio_free m2_ssl_free = m2.ssl_free - def __init__(self, ctx, sock=None, family=socket.AF_INET): + def __init__(self, ctx, sock=None, family=socket.AF_INET): # type: (Context, socket.socket, int) -> None """ @@ -104,8 +92,8 @@ :param family: socket family """ self.ctx = ctx - self.ssl = m2.ssl_new(self.ctx.ctx) - if sock is not None: + self.ssl = m2.ssl_new(self.ctx.ctx) # type: bytes + if sock is not None: self.socket = sock else: self.socket = socket.socket(family, socket.SOCK_STREAM) @@ -113,30 +101,33 @@ self._fileno = self.socket.fileno() self._timeout = self.socket.gettimeout() - if self._timeout is None: + if self._timeout is None: self._timeout = -1.0 self.ssl_close_flag = m2.bio_noclose - if self.ctx.post_connection_check is not None: + if self.ctx.post_connection_check is not None: self.set_post_connection_check_callback( self.ctx.post_connection_check) def __del__(self): # type: () -> None - if getattr(self, 'sslbio', None): + if getattr(self, 'sslbio', None): self.m2_bio_free(self.sslbio) - if getattr(self, 'sockbio', None): + if getattr(self, 'sockbio', None): self.m2_bio_free(self.sockbio) - if self.ssl_close_flag == m2.bio_noclose and \ - getattr(self, 'ssl', None): + # in __del__ method we have to check whether m2.bio_noclose + # exists at all. + if m2 is not None and m2.bio_noclose and \ + self.ssl_close_flag == m2.bio_noclose and \ + getattr(self, 'ssl', None): self.m2_ssl_free(self.ssl) self.socket.close()
                          [docs] def close(self): # type: () -> None - m2.ssl_shutdown(self.ssl) -
                          + m2.ssl_shutdown(self.ssl)
                          +
                          [docs] def clear(self): # type: () -> int """ @@ -144,8 +135,8 @@ than close() to end it, so that bad sessions will be cleared from cache. """ - return m2.ssl_clear(self.ssl) -
                          + return m2.ssl_clear(self.ssl)
                          +
                          [docs] def set_shutdown(self, mode): # type: (int) -> None """Sets the shutdown state of the Connection to mode. @@ -169,25 +160,25 @@ :param mode: set the mode bitmask. """ - m2.ssl_set_shutdown1(self.ssl, mode) -
                          + m2.ssl_set_shutdown1(self.ssl, mode)
                          +
                          [docs] def get_shutdown(self): # type: () -> None """Get the current shutdown mode of the Connection.""" - return m2.ssl_get_shutdown(self.ssl) -
                          + return m2.ssl_get_shutdown(self.ssl)
                          +
                          [docs] def bind(self, addr): # type: (util.AddrType) -> None - self.socket.bind(addr) -
                          + self.socket.bind(addr)
                          +
                          [docs] def listen(self, qlen=5): # type: (int) -> None - self.socket.listen(qlen) -
                          + self.socket.listen(qlen)
                          +
                          [docs] def ssl_get_error(self, ret): # type: (int) -> int - return m2.ssl_get_error(self.ssl, ret) -
                          + return m2.ssl_get_error(self.ssl, ret)
                          +
                          [docs] def set_bio(self, readbio, writebio): # type: (BIO.BIO, BIO.BIO) -> None """Explicitly set read and write bios @@ -206,8 +197,8 @@ :param readbio: BIO for reading :param writebio: BIO for writing. """ - m2.ssl_set_bio(self.ssl, readbio._ptr(), writebio._ptr()) -
                          + m2.ssl_set_bio(self.ssl, readbio._ptr(), writebio._ptr())
                          +
                          [docs] def set_client_CA_list_from_file(self, cafile): # type: (AnyStr) -> None """Set the acceptable client CA list. @@ -226,8 +217,8 @@ 1 The operation succeeded. """ - m2.ssl_set_client_CA_list_from_file(self.ssl, cafile) -
                          + m2.ssl_set_client_CA_list_from_file(self.ssl, cafile)
                          +
                          [docs] def set_client_CA_list_from_context(self): # type: () -> None """ @@ -237,12 +228,12 @@ Makes sense only for servers. """ - m2.ssl_set_client_CA_list_from_context(self.ssl, self.ctx.ctx) -
                          + m2.ssl_set_client_CA_list_from_context(self.ssl, self.ctx.ctx)
                          +
                          [docs] def setup_addr(self, addr): # type: (util.AddrType) -> None - self.addr = addr -
                          + self.addr = addr
                          +
                          [docs] def set_ssl_close_flag(self, flag): # type: (int) -> None """ @@ -253,8 +244,8 @@ """ if flag not in (m2.bio_close, m2.bio_noclose): raise ValueError("flag must be m2.bio_close or m2.bio_noclose") - self.ssl_close_flag = flag -
                          + self.ssl_close_flag = flag
                          +
                          [docs] def setup_ssl(self): # type: () -> None # Make a BIO_s_socket. @@ -264,8 +255,8 @@ # Make a BIO_f_ssl. self.sslbio = m2.bio_new(m2.bio_f_ssl()) # Link BIO_f_ssl with the SSL struct. - m2.bio_set_ssl(self.sslbio, self.ssl, m2.bio_noclose) -
                          + m2.bio_set_ssl(self.sslbio, self.ssl, m2.bio_noclose) + def _setup_ssl(self, addr): # type: (util.AddrType) -> None """Deprecated""" @@ -275,8 +266,8 @@
                          [docs] def set_accept_state(self): # type: () -> None """Sets Connection to work in the server mode.""" - m2.ssl_set_accept_state(self.ssl) -
                          + m2.ssl_set_accept_state(self.ssl) +
                          [docs] def accept_ssl(self): # type: () -> Optional[int] """Waits for a TLS/SSL client to initiate the TLS/SSL handshake. @@ -300,8 +291,8 @@ get_error() with the return value ret to find out the reason. """ - return m2.ssl_accept(self.ssl, self._timeout) -
                          + return m2.ssl_accept(self.ssl, self._timeout) +
                          [docs] def accept(self): # type: () -> Tuple[Connection, util.AddrType] """Accept an SSL connection. @@ -324,21 +315,21 @@ ssl.accept_ssl() check = getattr(self, 'postConnectionCheck', self.serverPostConnectionCheck) - if check is not None: + if check is not None: if not check(ssl.get_peer_cert(), ssl.addr[0]): raise Checker.SSLVerificationError( 'post connection check failed') - return ssl, addr -
                          + return ssl, addr +
                          [docs] def set_connect_state(self): # type: () -> None """Sets Connection to work in the client mode.""" - m2.ssl_set_connect_state(self.ssl) -
                          + m2.ssl_set_connect_state(self.ssl) +
                          [docs] def connect_ssl(self): # type: () -> Optional[int] - return m2.ssl_connect(self.ssl, self._timeout) -
                          + return m2.ssl_connect(self.ssl, self._timeout) +
                          [docs] def connect(self, addr): # type: (util.AddrType) -> int """Overloading socket.connect() @@ -354,26 +345,26 @@ ret = self.connect_ssl() check = getattr(self, 'postConnectionCheck', self.clientPostConnectionCheck) - if check is not None: + if check is not None: if not check(self.get_peer_cert(), self.addr[0]): raise Checker.SSLVerificationError( 'post connection check failed') - return ret -
                          + return ret +
                          [docs] def shutdown(self, how): # type: (int) -> None - m2.ssl_set_shutdown(self.ssl, how) -
                          + m2.ssl_set_shutdown(self.ssl, how) +
                          [docs] def renegotiate(self): # type: () -> int """Renegotiate this connection's SSL parameters.""" - return m2.ssl_renegotiate(self.ssl) -
                          + return m2.ssl_renegotiate(self.ssl) +
                          [docs] def pending(self): # type: () -> int """Return the numbers of octets that can be read from the connection.""" - return m2.ssl_pending(self.ssl) -
                          + return m2.ssl_pending(self.ssl) + def _write_bio(self, data): # type: (bytes) -> int return m2.ssl_write(self.ssl, data, self._timeout) @@ -401,6 +392,33 @@ return self._write_nbio(data) sendall = send = write + def _decref_socketios(self): + pass + +
                          [docs] def recv_into(self, buff, nbytes=0): + # type: (bytearray, int) -> int + """ + A version of recv() that stores its data into a buffer rather + than creating a new string. Receive up to buffersize bytes from + the socket. If buffersize is not specified (or 0), receive up + to the size available in the given buffer. + + @param buffer: a buffer for the received bytes + @param nbytes: maximum number of bytes to read + @return: number of bytes added + + See recv() for documentation about the flags. + """ + n = len(buff) if nbytes == 0 else nbytes + + if n <= 0: + raise ValueError('size <= 0') + buff_bytes = m2.ssl_read(self.ssl, n, self._timeout) + buff[:] = b'' + buff.extend(buff_bytes) + + return len(buff)
                          +
                          [docs] def read(self, size=1024): # type: (int) -> bytes if self._timeout != 0.0: @@ -427,21 +445,21 @@ if mode: self._timeout = -1.0 else: - self._timeout = 0.0 -
                          + self._timeout = 0.0 +
                          [docs] def settimeout(self, timeout): # type: (float) -> None """Set this connection's underlying socket's timeout to _timeout_.""" self.socket.settimeout(timeout) self._timeout = timeout - if self._timeout is None: - self._timeout = -1.0 -
                          + if self._timeout is None: + self._timeout = -1.0 +
                          [docs] def fileno(self): # type: () -> int - return self.socket.fileno() -
                          -
                          [docs] def getsockopt(self, level, optname, buflen=None): + return self.socket.fileno()
                          + +
                          [docs] def getsockopt(self, level, optname, buflen=None): # type: (int, int, Optional[int]) -> Union[int, bytes] """Get the value of the given socket option. @@ -458,43 +476,43 @@ described in the Unix man page getsockopt(2)). The needed symbolic constants (SO_* etc.) are defined in the socket module. - + :param buflen: If it is absent, an integer option is assumed and its integer value is returned by the function. If buflen is present, it specifies the maximum length of the buffer used to receive the option in, and this buffer is returned as a bytes object. - + :return: Either integer or bytes value of the option. It is up to the caller to decode the contents of the buffer (see the optional built-in module struct for a way to decode C structures encoded as byte strings). """ - return self.socket.getsockopt(level, optname, buflen) -
                          -
                          [docs] def setsockopt(self, level, optname, value=None): + return self.socket.getsockopt(level, optname, buflen)
                          + +
                          [docs] def setsockopt(self, level, optname, value=None): # type: (int, int, Union[int, bytes, None]) -> Optional[bytes] """Set the value of the given socket option. :param level: same as with getsockopt() above - + :param optname: same as with getsockopt() above - + :param value: an integer or a string representing a buffer. In the latter case it is up to the caller to ensure that the string contains the proper bits (see the optional built-in module struct for a way to encode C structures as strings). - + :return: None for success or the error handler for failure. """ - return self.socket.setsockopt(level, optname, value) -
                          + return self.socket.setsockopt(level, optname, value) +
                          [docs] def get_context(self): - # type: () -> SSL.Context - """Return the SSL.Context object associated with this connection.""" - return m2.ssl_get_ssl_ctx(self.ssl) -
                          + # type: () -> Context + """Return the Context object associated with this connection.""" + return m2.ssl_get_ssl_ctx(self.ssl) +
                          [docs] def get_state(self): # type: () -> bytes """Return the SSL state of this connection. @@ -508,27 +526,27 @@ :return: 6 letter string indicating the current state of the SSL object ssl. """ - return m2.ssl_get_state(self.ssl) -
                          + return m2.ssl_get_state(self.ssl) +
                          [docs] def verify_ok(self): # type: () -> bool - return (m2.ssl_get_verify_result(self.ssl) == m2.X509_V_OK) -
                          + return (m2.ssl_get_verify_result(self.ssl) == m2.X509_V_OK) +
                          [docs] def get_verify_mode(self): # type: () -> int """Return the peer certificate verification mode.""" - return m2.ssl_get_verify_mode(self.ssl) -
                          + return m2.ssl_get_verify_mode(self.ssl) +
                          [docs] def get_verify_depth(self): # type: () -> int """Return the peer certificate verification depth.""" - return m2.ssl_get_verify_depth(self.ssl) -
                          + return m2.ssl_get_verify_depth(self.ssl) +
                          [docs] def get_verify_result(self): # type: () -> int """Return the peer certificate verification result.""" - return m2.ssl_get_verify_result(self.ssl) -
                          + return m2.ssl_get_verify_result(self.ssl) +
                          [docs] def get_peer_cert(self): # type: () -> X509.X509 """Return the peer certificate. @@ -536,11 +554,11 @@ If the peer did not provide a certificate, return None. """ c = m2.ssl_get_peer_cert(self.ssl) - if c is None: - return None + if c is None: + return None # Need to free the pointer coz OpenSSL doesn't. - return X509.X509(c, 1) -
                          + return X509.X509(c, 1) +
                          [docs] def get_peer_cert_chain(self): # type: () -> Optional[X509.X509_Stack] """Return the peer certificate chain; if the peer did not provide @@ -551,46 +569,49 @@ gets freed, the chain will be freed as well. """ c = m2.ssl_get_peer_cert_chain(self.ssl) - if c is None: - return None + if c is None: + return None # No need to free the pointer coz OpenSSL does. - return X509.X509_Stack(c) -
                          + return X509.X509_Stack(c) +
                          [docs] def get_cipher(self): - # type: () -> Optional[SSL.Cipher] + # type: () -> Optional[Cipher] """Return an M2Crypto.SSL.Cipher object for this connection; if the connection has not been initialised with a cipher suite, return None. """ c = m2.ssl_get_current_cipher(self.ssl) - if c is None: - return None - return Cipher(c) -
                          + if c is None: + return None + return Cipher(c) +
                          [docs] def get_ciphers(self): - # type: () -> Optional[SSL:Cipher_Stack] + # type: () -> Optional[Cipher_Stack] """Return an M2Crypto.SSL.Cipher_Stack object for this connection; if the connection has not been initialised with cipher suites, return None. """ c = m2.ssl_get_ciphers(self.ssl) - if c is None: - return None - return Cipher_Stack(c) -
                          + if c is None: + return None + return Cipher_Stack(c) +
                          [docs] def get_cipher_list(self, idx=0): # type: (int) -> str """Return the cipher suites for this connection as a string object.""" - return m2.ssl_get_cipher_list(self.ssl, idx) -
                          + return util.py3str(m2.ssl_get_cipher_list(self.ssl, idx)) +
                          [docs] def set_cipher_list(self, cipher_list): # type: (str) -> int """Set the cipher suites for this connection.""" - return m2.ssl_set_cipher_list(self.ssl, cipher_list) -
                          + return m2.ssl_set_cipher_list(self.ssl, cipher_list) +
                          [docs] def makefile(self, mode='rb', bufsize=-1): # type: (AnyStr, int) -> socket._fileobject - return socket._fileobject(self, mode, bufsize) -
                          + if six.PY3: + return socket.SocketIO(self, mode) + else: + return socket._fileobject(self, mode, bufsize) +
                          [docs] def getsockname(self): # type: () -> util.AddrType """Return the socket's own address. @@ -601,8 +622,8 @@ :return:socket's address as addr type """ - return self.socket.getsockname() -
                          + return self.socket.getsockname() +
                          [docs] def getpeername(self): # type: () -> util.AddrType """Return the remote address to which the socket is connected. @@ -613,60 +634,60 @@ :return: """ - return self.socket.getpeername() -
                          + return self.socket.getpeername() +
                          [docs] def set_session_id_ctx(self, id): # type: (bytes) -> int ret = m2.ssl_set_session_id_context(self.ssl, id) if not ret: - raise SSLError(m2.err_reason_error_string(m2.err_get_error())) -
                          + raise SSLError(Err.get_error_message()) +
                          [docs] def get_session(self): - # type: () -> SSL.Session + # type: () -> Session sess = m2.ssl_get_session(self.ssl) - return Session(sess) -
                          + return Session(sess) +
                          [docs] def set_session(self, session): - # type: (SSL.Session) -> None - m2.ssl_set_session(self.ssl, session._ptr()) -
                          + # type: (Session) -> None + m2.ssl_set_session(self.ssl, session._ptr()) +
                          [docs] def get_default_session_timeout(self): # type: () -> int - return m2.ssl_get_default_session_timeout(self.ssl) -
                          + return m2.ssl_get_default_session_timeout(self.ssl) +
                          [docs] def get_socket_read_timeout(self): - # type: () -> SSL.timeout + # type: () -> timeout return timeout.struct_to_timeout( self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_RCVTIMEO, - timeout.struct_size())) -
                          + timeout.struct_size())) +
                          [docs] def get_socket_write_timeout(self): - # type: () -> SSL.timeout + # type: () -> timeout return timeout.struct_to_timeout( self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_SNDTIMEO, - timeout.struct_size())) -
                          + timeout.struct_size())) +
                          [docs] def set_socket_read_timeout(self, timeo): - # type: (SSL.timeout) -> None + # type: (timeout) -> None assert isinstance(timeo, timeout.timeout) self.socket.setsockopt( - socket.SOL_SOCKET, socket.SO_RCVTIMEO, timeo.pack()) -
                          + socket.SOL_SOCKET, socket.SO_RCVTIMEO, timeo.pack()) +
                          [docs] def set_socket_write_timeout(self, timeo): - # type: (SSL.timeout) -> None + # type: (timeout) -> None assert isinstance(timeo, timeout.timeout) self.socket.setsockopt( - socket.SOL_SOCKET, socket.SO_SNDTIMEO, timeo.pack()) -
                          + socket.SOL_SOCKET, socket.SO_SNDTIMEO, timeo.pack()) +
                          [docs] def get_version(self): # type: () -> str - """Return the TLS/SSL protocol version for this connection.""" - return m2.ssl_get_version(self.ssl) -
                          + "Return the TLS/SSL protocol version for this connection." + return util.py3str(m2.ssl_get_version(self.ssl)) +
                          [docs] def set_post_connection_check_callback(self, postConnectionCheck): # noqa # type: (Callable) -> None - self.postConnectionCheck = postConnectionCheck -
                          + self.postConnectionCheck = postConnectionCheck +
                          [docs] def set_tlsext_host_name(self, name): # type: (bytes) -> None """Set the requested hostname for the SNI (Server Name Indication) @@ -678,42 +699,43 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/SSL/Context.html b/doc/html/_modules/M2Crypto/SSL/Context.html index 1a377ba..d15f92c 100644 --- a/doc/html/_modules/M2Crypto/SSL/Context.html +++ b/doc/html/_modules/M2Crypto/SSL/Context.html @@ -1,73 +1,62 @@ - - - - M2Crypto.SSL.Context — M2Crypto documentation - - + M2Crypto.SSL.Context — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.SSL.Context

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """SSL Context
                           
                           Copyright (c) 1999-2004 Ng Pheng Siong. All rights reserved."""
                           
                          -from M2Crypto import BIO, Err, RSA, X509, m2, util  # noqa
                          -from M2Crypto.SSL import cb  # noqa
                          -from M2Crypto.SSL.Session import Session  # noqa
                          -from weakref import WeakValueDictionary
                          +from M2Crypto import BIO, Err, RSA, X509, m2, util  # noqa
                          +from M2Crypto.SSL import cb  # noqa
                          +from M2Crypto.SSL.Session import Session  # noqa
                          +from weakref import WeakValueDictionary
                           if util.py27plus:
                          -    from typing import Any, AnyStr, Callable, Optional, Union  # noqa
                          +    from typing import Any, AnyStr, Callable, Optional, Union  # noqa
                           
                           __all__ = ['ctxmap', 'Context', 'map']
                           
                           
                           class _ctxmap:  # noqa
                          -    singleton = None  # type: Optional[_ctxmap]
                          +    singleton = None  # type: Optional[_ctxmap]
                           
                               def __init__(self):
                                   # type: () -> None
                          @@ -90,10 +79,10 @@
                           
                           
                          [docs]def ctxmap(): # type: () -> _ctxmap - if _ctxmap.singleton is None: + if _ctxmap.singleton is None: _ctxmap.singleton = _ctxmap() - return _ctxmap.singleton -# deprecated!!!
                          + return _ctxmap.singleton
                          +# deprecated!!! map = ctxmap @@ -103,11 +92,11 @@ m2_ssl_ctx_free = m2.ssl_ctx_free - def __init__(self, protocol='tls', weak_crypto=None, - post_connection_check=None): + def __init__(self, protocol='tls', weak_crypto=None, + post_connection_check=None): # type: (str, Optional[int], Optional[Callable]) -> None - proto = getattr(m2, protocol + '_method', None) - if proto is None: + proto = getattr(m2, protocol + '_method', None) + if proto is None: # default is 'sslv23' for older versions of OpenSSL if protocol == 'tls': proto = getattr(m2, 'sslv23_method') @@ -118,20 +107,20 @@ self.post_connection_check = post_connection_check ctxmap()[int(self.ctx)] = self m2.ssl_ctx_set_cache_size(self.ctx, 128) - if weak_crypto is None and protocol in ('sslv23', 'tls'): + if weak_crypto is None and protocol in ('sslv23', 'tls'): self.set_options(m2.SSL_OP_ALL | m2.SSL_OP_NO_SSLv2 | m2.SSL_OP_NO_SSLv3) def __del__(self): # type: () -> None - if getattr(self, 'ctx', None): + if getattr(self, 'ctx', None): self.m2_ssl_ctx_free(self.ctx)
                          [docs] def close(self): # type: () -> None - del ctxmap()[int(self.ctx)] -
                          -
                          [docs] def load_cert(self, certfile, keyfile=None, + del ctxmap()[int(self.ctx)]
                          + +
                          [docs] def load_cert(self, certfile, keyfile=None, callback=util.passphrase_callback): # type: (AnyStr, Optional[AnyStr], Callable) -> None """Load certificate and private key into the context. @@ -150,9 +139,9 @@ keyfile = certfile m2.ssl_ctx_use_privkey(self.ctx, keyfile) if not m2.ssl_ctx_check_privkey(self.ctx): - raise ValueError('public/private key mismatch') -
                          -
                          [docs] def load_cert_chain(self, certchainfile, keyfile=None, + raise ValueError('public/private key mismatch')
                          + +
                          [docs] def load_cert_chain(self, certchainfile, keyfile=None, callback=util.passphrase_callback): # type: (AnyStr, Optional[AnyStr], Callable) -> None """Load certificate chain and private key into the context. @@ -173,8 +162,8 @@ keyfile = certchainfile m2.ssl_ctx_use_privkey(self.ctx, keyfile) if not m2.ssl_ctx_check_privkey(self.ctx): - raise ValueError('public/private key mismatch') -
                          + raise ValueError('public/private key mismatch')
                          +
                          [docs] def set_client_CA_list_from_file(self, cafile): # type: (AnyStr) -> None """Load CA certs into the context. These CA certs are sent to the @@ -183,12 +172,12 @@ :param cafile: File object containing one or more PEM-encoded CA certificates concatenated together. """ - m2.ssl_ctx_set_client_CA_list_from_file(self.ctx, cafile) + m2.ssl_ctx_set_client_CA_list_from_file(self.ctx, cafile)
                          - # Deprecated.
                          + # Deprecated. load_client_CA = load_client_ca = set_client_CA_list_from_file -
                          [docs] def load_verify_locations(self, cafile=None, capath=None): +
                          [docs] def load_verify_locations(self, cafile=None, capath=None): # type: (Optional[AnyStr], Optional[AnyStr]) -> int """Load CA certs into the context. @@ -207,11 +196,11 @@ 1 The operation succeeded. """ - if cafile is None and capath is None: + if cafile is None and capath is None: raise ValueError("cafile and capath can not both be None.") - return m2.ssl_ctx_load_verify_locations(self.ctx, cafile, capath) + return m2.ssl_ctx_load_verify_locations(self.ctx, cafile, capath)
                          - # Deprecated.
                          + # Deprecated. load_verify_info = load_verify_locations
                          [docs] def set_session_id_ctx(self, id): @@ -233,8 +222,8 @@ """ ret = m2.ssl_ctx_set_session_id_context(self.ctx, id) if not ret: - raise Err.SSLError(Err.get_error_code(), '') -
                          + raise Err.SSLError(Err.get_error_code(), '')
                          +
                          [docs] def set_default_verify_paths(self): # type: () -> int """ @@ -256,8 +245,8 @@ """ ret = m2.ssl_ctx_set_default_verify_paths(self.ctx) if not ret: - raise ValueError('Cannot use default SSL certificate store!') -
                          + raise ValueError('Cannot use default SSL certificate store!')
                          +
                          [docs] def set_allow_unknown_ca(self, ok): # type: (Union[int, bool]) -> None """Set the context to accept/reject a peer certificate if the @@ -265,8 +254,8 @@ :param ok: True to accept, False to reject. """ - self.allow_unknown_ca = ok -
                          + self.allow_unknown_ca = ok
                          +
                          [docs] def get_allow_unknown_ca(self): # type: () -> Union[int, bool] """Get the context's setting that accepts/rejects a peer @@ -274,9 +263,9 @@ FIXME 2Bconverted to bool """ - return self.allow_unknown_ca -
                          -
                          [docs] def set_verify(self, mode, depth, callback=None): + return self.allow_unknown_ca
                          + +
                          [docs] def set_verify(self, mode, depth, callback=None): # type: (int, int, Optional[Callable]) -> None """ Set verify options. Most applications will need to call this @@ -290,21 +279,21 @@ :param callback: Callable that can be used to specify custom verification checks. """ - if callback is None: + if callback is None: m2.ssl_ctx_set_verify_default(self.ctx, mode) else: m2.ssl_ctx_set_verify(self.ctx, mode, callback) - m2.ssl_ctx_set_verify_depth(self.ctx, depth) -
                          + m2.ssl_ctx_set_verify_depth(self.ctx, depth)
                          +
                          [docs] def get_verify_mode(self): # type: () -> int - return m2.ssl_ctx_get_verify_mode(self.ctx) -
                          + return m2.ssl_ctx_get_verify_mode(self.ctx)
                          +
                          [docs] def get_verify_depth(self): # type: () -> int """Returns the verification mode currently set in the SSL Context.""" - return m2.ssl_ctx_get_verify_depth(self.ctx) -
                          + return m2.ssl_ctx_get_verify_depth(self.ctx) +
                          [docs] def set_tmp_dh(self, dhpfile): # type: (AnyStr) -> int """Load ephemeral DH parameters into the context. @@ -314,17 +303,17 @@ """ f = BIO.openfile(dhpfile) dhp = m2.dh_read_parameters(f.bio_ptr()) - return m2.ssl_ctx_set_tmp_dh(self.ctx, dhp) -
                          -
                          [docs] def set_tmp_dh_callback(self, callback=None): + return m2.ssl_ctx_set_tmp_dh(self.ctx, dhp)
                          + +
                          [docs] def set_tmp_dh_callback(self, callback=None): # type: (Optional[Callable]) -> None """Sets the callback function for SSL.Context. :param callback: Callable to be used when a DH parameters are required. """ - if callback is not None: - m2.ssl_ctx_set_tmp_dh_callback(self.ctx, callback) -
                          + if callback is not None: + m2.ssl_ctx_set_tmp_dh_callback(self.ctx, callback) +
                          [docs] def set_tmp_rsa(self, rsa): # type: (RSA.RSA) -> int """Load ephemeral RSA key into the context. @@ -334,16 +323,16 @@ if isinstance(rsa, RSA.RSA): return m2.ssl_ctx_set_tmp_rsa(self.ctx, rsa.rsa) else: - raise TypeError("Expected an instance of RSA.RSA, got %s." % rsa) -
                          -
                          [docs] def set_tmp_rsa_callback(self, callback=None): + raise TypeError("Expected an instance of RSA.RSA, got %s." % rsa)
                          + +
                          [docs] def set_tmp_rsa_callback(self, callback=None): # type: (Optional[Callable]) -> None """Sets the callback function to be used when a temporary/ephemeral RSA key is required. """ - if callback is not None: - m2.ssl_ctx_set_tmp_rsa_callback(self.ctx, callback) -
                          + if callback is not None: + m2.ssl_ctx_set_tmp_rsa_callback(self.ctx, callback) +
                          [docs] def set_info_callback(self, callback=cb.ssl_info_callback): # type: (Callable) -> None """Set a callback function to get state information. @@ -354,8 +343,8 @@ :param callback: Callback function. The default prints information to stderr. """ - m2.ssl_ctx_set_info_callback(self.ctx, callback) -
                          + m2.ssl_ctx_set_info_callback(self.ctx, callback) +
                          [docs] def set_cipher_list(self, cipher_list): # type: (str) -> int """Sets the list of available ciphers. @@ -365,8 +354,8 @@ :return: 1 if any cipher could be selected and 0 on complete failure. """ - return m2.ssl_ctx_set_cipher_list(self.ctx, cipher_list) -
                          + return m2.ssl_ctx_set_cipher_list(self.ctx, cipher_list) +
                          [docs] def add_session(self, session): # type: (Session) -> int """Add the session to the context. @@ -378,8 +367,8 @@ 1 The operation succeeded. """ - return m2.ssl_ctx_add_session(self.ctx, session._ptr()) -
                          + return m2.ssl_ctx_add_session(self.ctx, session._ptr()) +
                          [docs] def remove_session(self, session): # type: (Session) -> int """Remove the session from the context. @@ -391,8 +380,8 @@ 1 The operation succeeded. """ - return m2.ssl_ctx_remove_session(self.ctx, session._ptr()) -
                          + return m2.ssl_ctx_remove_session(self.ctx, session._ptr()) +
                          [docs] def get_session_timeout(self): # type: () -> int """Get current session timeout. @@ -422,8 +411,8 @@ :return: the currently set timeout value. """ - return m2.ssl_ctx_get_session_timeout(self.ctx) -
                          + return m2.ssl_ctx_get_session_timeout(self.ctx) +
                          [docs] def set_session_timeout(self, timeout): # type: (int) -> int """Set new session timeout. @@ -435,8 +424,8 @@ :return: the previously set timeout value. """ - return m2.ssl_ctx_set_session_timeout(self.ctx, timeout) -
                          + return m2.ssl_ctx_set_session_timeout(self.ctx, timeout) +
                          [docs] def set_session_cache_mode(self, mode): # type: (int) -> int """Enables/disables session caching. @@ -447,8 +436,8 @@ :return: the previously set cache mode value. """ - return m2.ssl_ctx_set_session_cache_mode(self.ctx, mode) -
                          + return m2.ssl_ctx_set_session_cache_mode(self.ctx, mode) +
                          [docs] def get_session_cache_mode(self): # type: () -> int """Gets the current session caching. @@ -457,8 +446,8 @@ :return: the previously set cache mode value. """ - return m2.ssl_ctx_get_session_cache_mode(self.ctx) -
                          + return m2.ssl_ctx_get_session_cache_mode(self.ctx) +
                          [docs] def set_options(self, op): # type: (int) -> int """Adds the options set via bitmask in options to the Context. @@ -485,8 +474,8 @@ :return: the new options bitmask after adding options. """ - return m2.ssl_ctx_set_options(self.ctx, op) -
                          + return m2.ssl_ctx_set_options(self.ctx, op) +
                          [docs] def get_cert_store(self): # type: () -> X509.X509 """ @@ -501,42 +490,43 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/SSL/SSLServer.html b/doc/html/_modules/M2Crypto/SSL/SSLServer.html index 898c32a..301630f 100644 --- a/doc/html/_modules/M2Crypto/SSL/SSLServer.html +++ b/doc/html/_modules/M2Crypto/SSL/SSLServer.html @@ -1,85 +1,75 @@ - - - - M2Crypto.SSL.SSLServer — M2Crypto documentation - - + M2Crypto.SSL.SSLServer — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.SSL.SSLServer

                          -from __future__ import absolute_import, print_function
                          +from __future__ import absolute_import, print_function
                           
                           """SSLServer
                           
                           Copyright (c) 1999-2002 Ng Pheng Siong. All rights reserved."""
                           
                          +
                           # M2Crypto
                          -from M2Crypto.SSL import SSLError
                          -from M2Crypto.SSL.Connection import Connection
                          -from M2Crypto.SSL.Context import Context  # noqa
                          -from M2Crypto import six  # noqa
                          -from M2Crypto import util  # noqa
                          -from M2Crypto.six.moves.socketserver import (BaseServer, ForkingMixIn,
                          +from M2Crypto.SSL import SSLError
                          +from M2Crypto.SSL.Connection import Connection
                          +from M2Crypto.SSL.Context import Context  # noqa
                          +from M2Crypto import six  # noqa
                          +from M2Crypto import util  # noqa
                          +from M2Crypto.six.moves.socketserver import (BaseServer, ForkingMixIn,
                                                                        TCPServer, ThreadingMixIn)
                          -from socket import socket  # noqa
                          +from socket import socket  # noqa
                           if util.py27plus:
                          -    from typing import Union  # noqa
                          +    from typing import Union  # noqa
                           
                           __all__ = ['SSLServer', 'ForkingSSLServer', 'ThreadingSSLServer']
                           
                           
                           
                          [docs]class SSLServer(TCPServer): def __init__(self, server_address, RequestHandlerClass, ssl_context, # noqa - bind_and_activate=True): + bind_and_activate=True): # type: (util.AddrType, socketserver.BaseRequestHandler, Context, bool) -> None """ Superclass says: Constructor. May be extended, do not override. This class says: Ho-hum. """ - BaseServer.__init__(self, server_address, RequestHandlerClass) + BaseServer.__init__(self, server_address, RequestHandlerClass) self.ssl_ctx = ssl_context self.socket = Connection(self.ssl_ctx) if bind_and_activate: @@ -88,27 +78,27 @@
                          [docs] def handle_request(self): # type: () -> None - request = None - client_address = None + request = None + client_address = None try: request, client_address = self.get_request() if self.verify_request(request, client_address): self.process_request(request, client_address) except SSLError: - self.handle_error(request, client_address) -
                          + self.handle_error(request, client_address)
                          +
                          [docs] def handle_error(self, request, client_address): # type: (Union[socket, Connection], util.AddrType) -> None - print('-' * 40) + print('-' * 40) import traceback traceback.print_exc() - print('-' * 40) + print('-' * 40)
                          + -
                          [docs]class ForkingSSLServer(ForkingMixIn, SSLServer): - pass + pass
                          + -
                          [docs]class ThreadingSSLServer(ThreadingMixIn, SSLServer): pass
                          @@ -116,42 +106,43 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/SSL/Session.html b/doc/html/_modules/M2Crypto/SSL/Session.html index cd54906..0673387 100644 --- a/doc/html/_modules/M2Crypto/SSL/Session.html +++ b/doc/html/_modules/M2Crypto/SSL/Session.html @@ -1,53 +1,42 @@ - - - - M2Crypto.SSL.Session — M2Crypto documentation - - + M2Crypto.SSL.Session — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.SSL.Session

                           """SSL Session
                          @@ -56,10 +45,10 @@
                           
                           __all__ = ['Session', 'load_session']
                           
                          -from M2Crypto import BIO, Err, m2, util
                          -from M2Crypto.SSL import SSLError
                          +from M2Crypto import BIO, Err, m2, util
                          +from M2Crypto.SSL import SSLError
                           if util.py27plus:
                          -    from typing import AnyStr  # noqa
                          +    from typing import AnyStr  # noqa
                           
                           
                           
                          [docs]class Session: @@ -68,7 +57,7 @@ def __init__(self, session, _pyfree=0): # type: (bytes, int) -> None - assert session is not None + assert session is not None self.session = session self._pyfree = _pyfree @@ -85,40 +74,40 @@ # type: () -> bytes buf = BIO.MemoryBuffer() m2.ssl_session_print(buf.bio_ptr(), self.session) - return buf.read_all() -
                          + return buf.read_all()
                          +
                          [docs] def as_der(self): # type: () -> bytes buf = BIO.MemoryBuffer() m2.i2d_ssl_session(buf.bio_ptr(), self.session) - return buf.read_all() -
                          + return buf.read_all()
                          +
                          [docs] def write_bio(self, bio): # type: (BIO.BIO) -> int - return m2.ssl_session_write_bio(bio.bio_ptr(), self.session) -
                          + return m2.ssl_session_write_bio(bio.bio_ptr(), self.session)
                          +
                          [docs] def get_time(self): # type: () -> int - return m2.ssl_session_get_time(self.session) -
                          + return m2.ssl_session_get_time(self.session)
                          +
                          [docs] def set_time(self, t): # type: (int) -> int - return m2.ssl_session_set_time(self.session, t) -
                          + return m2.ssl_session_set_time(self.session, t)
                          +
                          [docs] def get_timeout(self): # type: () -> int - return m2.ssl_session_get_timeout(self.session) -
                          + return m2.ssl_session_get_timeout(self.session)
                          +
                          [docs] def set_timeout(self, t): # type: (int) -> int - return m2.ssl_session_set_timeout(self.session, t) + return m2.ssl_session_set_timeout(self.session, t)
                          + -
                          [docs]def load_session(pemfile): # type: (AnyStr) -> Session with BIO.openfile(pemfile) as f: cptr = m2.ssl_session_read_pem(f.bio_ptr()) - if cptr is None: + if cptr is None: raise SSLError(Err.get_error()) return Session(cptr, 1)
                          @@ -126,42 +115,43 @@ -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/SSL/TwistedProtocolWrapper.html b/doc/html/_modules/M2Crypto/SSL/TwistedProtocolWrapper.html index c0b7245..56561fb 100644 --- a/doc/html/_modules/M2Crypto/SSL/TwistedProtocolWrapper.html +++ b/doc/html/_modules/M2Crypto/SSL/TwistedProtocolWrapper.html @@ -1,53 +1,42 @@ - - - - M2Crypto.SSL.TwistedProtocolWrapper — M2Crypto documentation - - + M2Crypto.SSL.TwistedProtocolWrapper — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.SSL.TwistedProtocolWrapper

                           """
                          @@ -66,19 +55,21 @@
                           
                           import logging
                           
                          +from functools import partial
                          +
                           import twisted.internet.reactor
                          -import twisted.protocols.policies as policies
                          +import twisted.protocols.policies as policies
                           
                          -from M2Crypto import BIO, X509, m2, util
                          -from M2Crypto.SSL.Checker import Checker, SSLVerificationError
                          +from M2Crypto import BIO, X509, m2, util
                          +from M2Crypto.SSL.Checker import Checker, SSLVerificationError
                           
                          -from twisted.internet.interfaces import ITLSTransport
                          -from twisted.protocols.policies import ProtocolWrapper
                          +from twisted.internet.interfaces import ITLSTransport
                          +from twisted.protocols.policies import ProtocolWrapper
                           if util.py27plus:
                          -    from typing import AnyStr, Callable, Optional  # noqa
                          -    from zope.interface import implementer
                          +    from typing import AnyStr, Callable, Iterable, Optional  # noqa
                          +    from zope.interface import implementer
                           
                          -log = logging.getLogger(__name__)
                          +log = logging.getLogger(__name__)
                           
                           
                           def _alwaysSucceedsPostConnectionCheck(peerX509, expectedHost):
                          @@ -86,7 +77,7 @@
                           
                           
                           
                          [docs]def connectSSL(host, port, factory, contextFactory, timeout=30, - bindAddress=None, + bindAddress=None, reactor=twisted.internet.reactor, postConnectionCheck=Checker()): # type: (str, int, object, object, int, Optional[str], twisted.internet.reactor, Checker) -> reactor.connectTCP @@ -103,10 +94,10 @@ client=1, contextFactory=contextFactory, postConnectionCheck=postConnectionCheck) - return reactor.connectTCP(host, port, wrappingFactory, timeout, bindAddress) + return reactor.connectTCP(host, port, wrappingFactory, timeout, bindAddress)
                          -
                          -
                          [docs]def connectTCP(host, port, factory, timeout=30, bindAddress=None, + +
                          [docs]def connectTCP(host, port, factory, timeout=30, bindAddress=None, reactor=twisted.internet.reactor, postConnectionCheck=Checker()): # type: (str, int, object, int, Optional[util.AddrType], object, Callable) -> object @@ -123,11 +114,11 @@ wrappedProtocol, startPassThrough=1, client=1, - contextFactory=None, + contextFactory=None, postConnectionCheck=postConnectionCheck) - return reactor.connectTCP(host, port, wrappingFactory, timeout, bindAddress) + return reactor.connectTCP(host, port, wrappingFactory, timeout, bindAddress)
                          + -
                          [docs]def listenSSL(port, factory, contextFactory, backlog=5, interface='', reactor=twisted.internet.reactor, postConnectionCheck=_alwaysSucceedsPostConnectionCheck): @@ -144,12 +135,12 @@ client=0, contextFactory=contextFactory, postConnectionCheck=postConnectionCheck) - return reactor.listenTCP(port, wrappingFactory, backlog, interface) + return reactor.listenTCP(port, wrappingFactory, backlog, interface)
                          + -
                          [docs]def listenTCP(port, factory, backlog=5, interface='', reactor=twisted.internet.reactor, - postConnectionCheck=None): + postConnectionCheck=None): """ A convenience function to listen for TCP connections using Twisted. @@ -163,11 +154,11 @@ wrappedProtocol, startPassThrough=1, client=0, - contextFactory=None, + contextFactory=None, postConnectionCheck=postConnectionCheck) - return reactor.listenTCP(port, wrappingFactory, backlog, interface) + return reactor.listenTCP(port, wrappingFactory, backlog, interface)
                          + -
                          class _BioProxy: """ The purpose of this class is to eliminate the __del__ method from @@ -183,7 +174,7 @@ return self.bio def __del__(self): - if self.bio is not None: + if self.bio is not None: self.m2_bio_free_all(self.bio) @@ -202,12 +193,12 @@ return self.ssl def __del__(self): - if self.ssl is not None: + if self.ssl is not None: self.m2_ssl_free(self.ssl) -@implementer(ITLSTransport) -
                          [docs]class TLSProtocolWrapper(ProtocolWrapper): +
                          [docs]@implementer(ITLSTransport) +class TLSProtocolWrapper(ProtocolWrapper): """ A SSL/TLS protocol wrapper to be used with Twisted. Typically you would not use this class directly. Use connectTCP, @@ -217,6 +208,7 @@ def __init__(self, factory, wrappedProtocol, startPassThrough, client, contextFactory, postConnectionCheck): + # type: policies.WrappingFactory, object, int, int, object, Checker """ :param factory: :param wrappedProtocol: @@ -245,13 +237,13 @@ # wrappedProtocol == client/server instance # factory.wrappedFactory == client/server factory - self.data = b'' # Clear text to encrypt and send - self.encrypted = b'' # Encrypted data we need to decrypt and pass on + self.data = b'' # Clear text to encrypt and send + self.encrypted = b'' # Encrypted data we need to decrypt and pass on self.tlsStarted = 0 # SSL/TLS mode or pass through self.checked = 0 # Post connection check done or not self.isClient = client self.helloDone = 0 # True when hello has been sent - if postConnectionCheck is None: + if postConnectionCheck is None: self.postConnectionCheck = _alwaysSucceedsPostConnectionCheck else: self.postConnectionCheck = postConnectionCheck @@ -264,19 +256,19 @@ Clear this instance, after which it is ready for reuse. """ if getattr(self, 'tlsStarted', 0): - self.sslBio = None - self.ssl = None - self.internalBio = None - self.networkBio = None - self.data = '' - self.encrypted = '' + self.sslBio = None + self.ssl = None + self.internalBio = None + self.networkBio = None + self.data = b'' + self.encrypted = b'' self.tlsStarted = 0 self.checked = 0 self.isClient = 1 - self.helloDone = 0 + self.helloDone = 0
                          # We can reuse self.ctx and it will be deleted automatically # when this instance dies -
                          +
                          [docs] def startTLS(self, ctx): """ Start SSL/TLS. If this is not called, this instance just passes data @@ -315,9 +307,10 @@ m2.SSL_MODE_ENABLE_PARTIAL_WRITE | m2.SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER) - self.tlsStarted = 1 -
                          + self.tlsStarted = 1
                          +
                          [docs] def write(self, data): + # type: (bytes) -> None if not self.tlsStarted: ProtocolWrapper.write(self, data) return @@ -330,25 +323,27 @@ # See http://www.openssl.org/docs/apps/verify.html#DIAGNOSTICS # for the error codes returned by SSL_get_verify_result. e.args = (m2.ssl_get_verify_result(self.ssl._ptr()), e.args[0]) - raise e -
                          + raise e
                          +
                          [docs] def writeSequence(self, data): + # type: (Iterable[bytes]) -> None if not self.tlsStarted: - ProtocolWrapper.writeSequence(self, ''.join(data)) + ProtocolWrapper.writeSequence(self, b''.join(data)) return - self.write(''.join(data)) -
                          + self.write(b''.join(data))
                          +
                          [docs] def loseConnection(self): # XXX Do we need to do m2.ssl_shutdown(self.ssl._ptr())? - ProtocolWrapper.loseConnection(self) -
                          + ProtocolWrapper.loseConnection(self)
                          +
                          [docs] def connectionMade(self): ProtocolWrapper.connectionMade(self) if self.tlsStarted and self.isClient and not self.helloDone: - self._clientHello() -
                          + self._clientHello()
                          +
                          [docs] def dataReceived(self, data): + # type: (bytes) -> None if not self.tlsStarted: ProtocolWrapper.dataReceived(self, data) return @@ -366,23 +361,23 @@ ProtocolWrapper.dataReceived(self, decryptedData) - if decryptedData == '' and encryptedData == '': + if decryptedData == b'' and encryptedData == b'': break except BIO.BIOError as e: # See http://www.openssl.org/docs/apps/verify.html#DIAGNOSTICS # for the error codes returned by SSL_get_verify_result. e.args = (m2.ssl_get_verify_result(self.ssl._ptr()), e.args[0]) - raise e -
                          + raise e +
                          [docs] def connectionLost(self, reason): # type: (AnyStr) -> None self.clear() - ProtocolWrapper.connectionLost(self, reason) -
                          + ProtocolWrapper.connectionLost(self, reason) + def _check(self): if not self.checked and m2.ssl_is_init_finished(self.ssl._ptr()): x509 = m2.ssl_get_peer_cert(self.ssl._ptr()) - if x509 is not None: + if x509 is not None: x509 = X509.X509(x509, 1) if self.isClient: host = self.transport.addr[0] @@ -405,69 +400,132 @@ e.args = (m2.ssl_get_verify_result(self.ssl._ptr()), e.args[0]) raise e - def _encrypt(self, data='', clientHello=0): - # XXX near mirror image of _decrypt - refactor - encryptedData = '' + # Optimizations to reduce attribute accesses + + @property + def _get_wr_guar_ssl(self): + # type: () -> Callable[[], int] + """Return max. length of data can be written to the BIO. + + Writes larger than this value will return a value from + BIO_write() less than the amount requested or if the buffer is + full request a retry. + """ + return partial(m2.bio_ctrl_get_write_guarantee, + self.sslBio._ptr()) + + @property + def _get_wr_guar_net(self): + # type: () -> Callable[[], int] + return partial(m2.bio_ctrl_get_write_guarantee, + self.networkBio._ptr()) + + @property + def _shoud_retry_ssl(self): + # type: () -> Callable[[], int] + # BIO_should_retry() is true if the call that produced this + # condition should then be retried at a later time. + return partial(m2.bio_should_retry, self.sslBio._ptr()) + + @property + def _shoud_retry_net(self): + # type: () -> Callable[[], int] + return partial(m2.bio_should_retry, self.networkBio._ptr()) + + @property + def _ctrl_pend_ssl(self): + # type: () -> Callable[[], int] + # size_t BIO_ctrl_pending(BIO *b); + # BIO_ctrl_pending() return the number of pending characters in + # the BIOs read and write buffers. + return partial(m2.bio_ctrl_pending, self.sslBio._ptr()) + + @property + def _ctrl_pend_net(self): + # type: () -> Callable[[], int] + return partial(m2.bio_ctrl_pending, self.networkBio._ptr()) + + @property + def _write_ssl(self): + # type: () -> Callable[[bytes], int] + # All these functions return either the amount of data + # successfully read or written (if the return value is + # positive) or that no data was successfully read or written + # if the result is 0 or -1. If the return value is -2 then + # the operation is not implemented in the specific BIO type. + return partial(m2.bio_write, self.sslBio._ptr()) + + @property + def _write_net(self): + # type: () -> Callable[[bytes], int] + return partial(m2.bio_write, self.networkBio._ptr()) + + @property + def _read_ssl(self): + # type: () -> Callable[[int], Optional[bytes]] + return partial(m2.bio_read, self.sslBio._ptr()) + + @property + def _read_net(self): + # type: () -> Callable[[int], Optional[bytes]] + return partial(m2.bio_read, self.networkBio._ptr()) + + def _encrypt(self, data=b'', clientHello=0): + # type: (bytes, int) -> bytes + """ + @param data: + @param clientHello: + @return: + """ + encryptedData = b'' self.data += data - # Optimizations to reduce attribute accesses - sslBioPtr = self.sslBio._ptr() - networkBio = self.networkBio._ptr() - m2bio_ctrl_get_write_guarantee = m2.bio_ctrl_get_write_guarantee - m2bio_write = m2.bio_write - m2bio_should_retry = m2.bio_should_retry - m2bio_ctrl_pending = m2.bio_ctrl_pending - m2bio_read = m2.bio_read while 1: - g = m2bio_ctrl_get_write_guarantee(sslBioPtr) - if g > 0 and self.data != '' or clientHello: - r = m2bio_write(sslBioPtr, self.data) + if (self._get_wr_guar_ssl() > 0 and self.data != b'') or clientHello: + r = self._write_ssl(self.data) if r <= 0: - assert(m2bio_should_retry(sslBioPtr)) + if not self._shoud_retry_ssl(): + raise IOError( + ('Data left to be written to {}, ' + + 'but cannot retry SSL connection!').format(self.sslBio)) else: assert self.checked self.data = self.data[r:] - pending = m2bio_ctrl_pending(networkBio) + pending = self._ctrl_pend_net() if pending: - d = m2bio_read(networkBio, pending) - if d is not None: # This is strange, but d can be None + d = self._read_net(pending) + if d is not None: # This is strange, but d can be None encryptedData += d else: - assert(m2bio_should_retry(networkBio)) + assert(self._shoud_retry_net()) else: break return encryptedData - def _decrypt(self, data=''): - # XXX near mirror image of _encrypt - refactor + def _decrypt(self, data=b''): + # type: (bytes) -> bytes self.encrypted += data - decryptedData = '' - # Optimizations to reduce attribute accesses - sslBioPtr = self.sslBio._ptr() - networkBio = self.networkBio._ptr() - m2bio_ctrl_get_write_guarantee = m2.bio_ctrl_get_write_guarantee - m2bio_write = m2.bio_write - m2bio_should_retry = m2.bio_should_retry - m2bio_ctrl_pending = m2.bio_ctrl_pending - m2bio_read = m2.bio_read + decryptedData = b'' while 1: - g = m2bio_ctrl_get_write_guarantee(networkBio) - if g > 0 and self.encrypted != '': - r = m2bio_write(networkBio, self.encrypted) + if self._get_wr_guar_ssl() > 0 and self.encrypted != b'': + r = self._write_net(self.encrypted) if r <= 0: - assert(m2bio_should_retry(networkBio)) + if not self._shoud_retry_net(): + raise IOError( + ('Data left to be written to {}, ' + + 'but cannot retry SSL connection!').format(self.networkBio)) else: self.encrypted = self.encrypted[r:] - pending = m2bio_ctrl_pending(sslBioPtr) + pending = self._ctrl_pend_ssl() if pending: - d = m2bio_read(sslBioPtr, pending) - if d is not None: # This is strange, but d can be None + d = self._read_ssl(pending) + if d is not None: # This is strange, but d can be None decryptedData += d else: - assert(m2bio_should_retry(sslBioPtr)) + assert(self._shoud_retry_ssl()) else: break @@ -477,42 +535,43 @@ -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/SSL/cb.html b/doc/html/_modules/M2Crypto/SSL/cb.html index 73d515a..6d113d3 100644 --- a/doc/html/_modules/M2Crypto/SSL/cb.html +++ b/doc/html/_modules/M2Crypto/SSL/cb.html @@ -1,56 +1,45 @@ - - - - M2Crypto.SSL.cb — M2Crypto documentation - - + M2Crypto.SSL.cb — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.SSL.cb

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """SSL callbacks
                           
                          @@ -58,9 +47,9 @@
                           
                           import sys
                           
                          -from M2Crypto import m2, util
                          +from M2Crypto import m2, util
                           if util.py27plus:
                          -    from typing import Any, List  # noqa
                          +    from typing import Any, List  # noqa
                           
                           __all__ = ['unknown_issuer', 'ssl_verify_callback_stub', 'ssl_verify_callback',
                                      'ssl_verify_callback_allow_unknown_ca', 'ssl_info_callback']
                          @@ -68,9 +57,9 @@
                           
                           
                          [docs]def ssl_verify_callback_stub(ssl_ctx_ptr, x509_ptr, errnum, errdepth, ok): # Deprecated - return ok -
                          -unknown_issuer = [ # type: List[int] + return ok
                          + +unknown_issuer = [ m2.X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT, m2.X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY, m2.X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE, @@ -82,7 +71,7 @@ # type: (bytes, bytes, int, int, int) -> int # Deprecated - from M2Crypto.SSL.Context import Context + from M2Crypto.SSL.Context import Context ssl_ctx = Context.ctxmap()[int(ssl_ctx_ptr)] if errnum in unknown_issuer: if ssl_ctx.get_allow_unknown_ca(): @@ -96,18 +85,18 @@ ok = 1 else: ok = 0 - return ok + return ok
                          + -
                          [docs]def ssl_verify_callback_allow_unknown_ca(ok, store): # type: (int, Any) -> int errnum = store.get_error() if errnum in unknown_issuer: ok = 1 - return ok + return ok
                          -# Cribbed from OpenSSL's apps/s_cb.c.
                          +# Cribbed from OpenSSL's apps/s_cb.c.
                          [docs]def ssl_info_callback(where, ret, ssl_ptr): # type: (int, int, bytes) -> None @@ -151,42 +140,43 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/SSL/ssl_dispatcher.html b/doc/html/_modules/M2Crypto/SSL/ssl_dispatcher.html index 73709e3..e8dfd8d 100644 --- a/doc/html/_modules/M2Crypto/SSL/ssl_dispatcher.html +++ b/doc/html/_modules/M2Crypto/SSL/ssl_dispatcher.html @@ -1,56 +1,45 @@ - - - - M2Crypto.SSL.ssl_dispatcher — M2Crypto documentation - - + M2Crypto.SSL.ssl_dispatcher — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.SSL.ssl_dispatcher

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """SSL dispatcher
                           
                          @@ -61,9 +50,9 @@
                           import socket
                           
                           # M2Crypto
                          -from M2Crypto import util  # noqa
                          -from M2Crypto.SSL.Connection import Connection
                          -from M2Crypto.SSL.Context import Context  # noqa
                          +from M2Crypto import util  # noqa
                          +from M2Crypto.SSL.Connection import Connection
                          +from M2Crypto.SSL.Context import Context  # noqa
                           
                           __all__ = ['ssl_dispatcher']
                           
                          @@ -76,64 +65,65 @@
                                   self.ssl_ctx = ssl_context
                                   self.socket = Connection(self.ssl_ctx)
                                   # self.socket.setblocking(0)
                          -        self.add_channel()
                          -
                          + self.add_channel()
                          +
                          [docs] def connect(self, addr): # type: (util.AddrType) -> None self.socket.setblocking(1) self.socket.connect(addr) - self.socket.setblocking(0) -
                          + self.socket.setblocking(0)
                          +
                          [docs] def recv(self, buffer_size=4096): # type: (int) -> bytes """Receive data over SSL.""" - return self.socket.recv(buffer_size) -
                          -
                          [docs] def send(self, buffer): + return self.socket.recv(buffer_size)
                          + +
                          [docs] def send(self, buffer): # type: (bytes) -> int """Send data over SSL.""" - return self.socket.send(buffer)
                          + return self.socket.send(buffer)
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/SSL/timeout.html b/doc/html/_modules/M2Crypto/SSL/timeout.html index 849ae6d..73ed18a 100644 --- a/doc/html/_modules/M2Crypto/SSL/timeout.html +++ b/doc/html/_modules/M2Crypto/SSL/timeout.html @@ -1,53 +1,42 @@ - - - - M2Crypto.SSL.timeout — M2Crypto documentation - - + M2Crypto.SSL.timeout — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.SSL.timeout

                           """Support for SSL socket timeouts.
                          @@ -64,7 +53,7 @@
                           DEFAULT_TIMEOUT = 600  # type: int
                           
                           
                          -
                          [docs]class timeout: +
                          [docs]class timeout: # noqa def __init__(self, sec=DEFAULT_TIMEOUT, microsec=0): # type: (int, int) -> None @@ -72,15 +61,15 @@ self.microsec = microsec
                          [docs] def pack(self): - return struct.pack('ll', self.sec, self.microsec) + return struct.pack('ll', self.sec, self.microsec)
                          + -
                          [docs]def struct_to_timeout(binstr): # type: (bytes) -> timeout (s, ms) = struct.unpack('ll', binstr) - return timeout(s, ms) + return timeout(s, ms)
                          + -
                          [docs]def struct_size(): # type: () -> int return struct.calcsize('ll')
                          @@ -89,42 +78,43 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/X509.html b/doc/html/_modules/M2Crypto/X509.html index 4682200..53e6fa5 100644 --- a/doc/html/_modules/M2Crypto/X509.html +++ b/doc/html/_modules/M2Crypto/X509.html @@ -1,55 +1,45 @@ - - - - M2Crypto.X509 — M2Crypto documentation - - + M2Crypto.X509 — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.X509

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """M2Crypto wrapper for OpenSSL X509 API.
                           
                          @@ -63,19 +53,19 @@
                           import binascii
                           import logging
                           
                          -from M2Crypto import ASN1, BIO, EVP, Err, m2, util  # noqa
                          +from M2Crypto import ASN1, BIO, EVP, Err, m2, util  # noqa
                           if util.py27plus:
                          -    from typing import AnyStr, Optional  # noqa
                          +    from typing import AnyStr, Optional  # noqa
                           
                           FORMAT_DER = 0
                           FORMAT_PEM = 1
                           
                          -log = logging.getLogger(__name__)
                          +log = logging.getLogger(__name__)
                           
                           
                           
                          [docs]class X509Error(Exception): - pass -
                          + pass
                          + m2.x509_init(X509Error) V_OK = m2.X509_V_OK # type: int @@ -83,9 +73,9 @@
                          [docs]def x509_store_default_cb(ok, ctx): # type: (int, X509_Store_Context) -> int - return ok + return ok
                          + -
                          [docs]def new_extension(name, value, critical=0, _pyfree=1): # type: (str, bytes, int, int) -> X509_Extension """ @@ -95,19 +85,19 @@ value.strip('0123456789abcdefABCDEF:') is not '': raise ValueError('value must be precomputed hash') ctx = m2.x509v3_set_nconf() - if ctx is None: + if ctx is None: raise MemoryError( 'Not enough memory when creating a new X509 extension') - x509_ext_ptr = m2.x509v3_ext_conf(None, ctx, name, value) - if x509_ext_ptr is None: + x509_ext_ptr = m2.x509v3_ext_conf(None, ctx, name, value) + if x509_ext_ptr is None: raise X509Error( "Cannot create X509_Extension with name '%s' and value '%s'" % (name, value)) x509_ext = X509_Extension(x509_ext_ptr, _pyfree) x509_ext.set_critical(critical) - return x509_ext + return x509_ext
                          + -
                          [docs]class X509_Extension: # noqa """ X509 Extension @@ -115,7 +105,7 @@ m2_x509_extension_free = m2.x509_extension_free - def __init__(self, x509_ext_ptr=None, _pyfree=1): + def __init__(self, x509_ext_ptr=None, _pyfree=1): # type: (Optional[bytes], int) -> None self.x509_ext = x509_ext_ptr self._pyfree = _pyfree @@ -140,8 +130,8 @@ set this extension to critical. :return: 1 for success, 0 for failure """ - return m2.x509_extension_set_critical(self.x509_ext, critical) -
                          + return m2.x509_extension_set_critical(self.x509_ext, critical)
                          +
                          [docs] def get_critical(self): # type: () -> int """ @@ -149,15 +139,15 @@ :return: Nonzero if this is a critical extension. """ - return m2.x509_extension_get_critical(self.x509_ext) -
                          + return m2.x509_extension_get_critical(self.x509_ext)
                          +
                          [docs] def get_name(self): # type: () -> str """ Get the extension name, for example 'subjectAltName'. """ - return util.py3str(m2.x509_extension_get_name(self.x509_ext)) -
                          + return util.py3str(m2.x509_extension_get_name(self.x509_ext))
                          +
                          [docs] def get_value(self, flag=0, indent=0): # type: (int, int) -> str """ @@ -168,9 +158,9 @@ """ buf = BIO.MemoryBuffer() m2.x509_ext_print(buf.bio_ptr(), self.x509_ext, flag, indent) - return util.py3str(buf.read_all()) + return util.py3str(buf.read_all())
                          + -
                          [docs]class X509_Extension_Stack: # noqa """ X509 Extension Stack @@ -185,9 +175,9 @@ m2_sk_x509_extension_free = m2.sk_x509_extension_free - def __init__(self, stack=None, _pyfree=0): + def __init__(self, stack=None, _pyfree=0): # type: (Optional[bytes], int) -> None - if stack is not None: + if stack is not None: self.stack = stack self._pyfree = _pyfree num = m2.sk_x509_extension_num(self.stack) @@ -233,8 +223,8 @@ self.pystack.append(x509_ext) ret = m2.sk_x509_extension_push(self.stack, x509_ext._ptr()) assert ret == len(self.pystack) - return ret -
                          + return ret
                          +
                          [docs] def pop(self): # type: () -> X509_Extension """ @@ -243,12 +233,12 @@ :return: X509_Extension popped """ x509_ext_ptr = m2.sk_x509_extension_pop(self.stack) - if x509_ext_ptr is None: + if x509_ext_ptr is None: assert len(self.pystack) == 0 - return None - return self.pystack.pop() + return None + return self.pystack.pop()
                          + -
                          [docs]class X509_Name_Entry: # noqa """ X509 Name Entry @@ -283,8 +273,8 @@ :return: 0 on failure, 1 on success """ return m2.x509_name_entry_set_object(self.x509_name_entry, - asn1obj._ptr()) -
                          + asn1obj._ptr()) +
                          [docs] def set_data(self, data, type=ASN1.MBSTRING_ASC): # type: (bytes, int) -> int """ @@ -293,24 +283,23 @@ :param data: data in a binary form to be set :return: 0 on failure, 1 on success """ - return m2.x509_name_entry_set_data(self.x509_name_entry, - type, util.py3bytes(data)) -
                          + return m2.x509_name_entry_set_data(self.x509_name_entry, type, data) +
                          [docs] def get_object(self): # type: () -> ASN1.ASN1_Object return ASN1.ASN1_Object( - m2.x509_name_entry_get_object(self.x509_name_entry)) -
                          + m2.x509_name_entry_get_object(self.x509_name_entry)) +
                          [docs] def get_data(self): # type: () -> ASN1.ASN1_String return ASN1.ASN1_String( - m2.x509_name_entry_get_data(self.x509_name_entry)) -
                          + m2.x509_name_entry_get_data(self.x509_name_entry)) +
                          [docs] def create_by_txt(self, field, type, entry, len): return m2.x509_name_entry_create_by_txt(self.x509_name_entry._ptr(), - field, type, entry, len) + field, type, entry, len)
                          + -
                          [docs]class X509_Name: # noqa """ X509 Name @@ -339,13 +328,13 @@ m2_x509_name_free = m2.x509_name_free - def __init__(self, x509_name=None, _pyfree=0): + def __init__(self, x509_name=None, _pyfree=0): # type: (bytes, int) -> None """ :param x509_name: this should be OpenSSL X509_NAME binary :param _pyfree: """ - if x509_name is not None: + if x509_name is not None: assert m2.x509_name_type_check(x509_name), "'x509_name' type error" self.x509_name = x509_name self._pyfree = _pyfree @@ -371,8 +360,8 @@ "'x509_name' type error" return util.py3str(m2.x509_name_by_nid(self.x509_name, self.nid[attr])) - if attr in self.__dict__: - return self.__dict__[attr] + if attr in self.__dict__: + return self.__dict__[attr] raise AttributeError(self, attr) @@ -387,7 +376,7 @@ return m2.x509_name_set_by_nid(self.x509_name, self.nid[attr], util.py3bytes(value)) - self.__dict__[attr] = value + self.__dict__[attr] = value def __len__(self): # type: () -> int @@ -438,13 +427,13 @@ :return: 1 for success of 0 if an error occurred. """ return m2.x509_name_add_entry_by_txt(self.x509_name, - util.py3bytes(field), type, - entry, len, loc, set) -
                          + util.py3str(field), type, + entry, len, loc, set) +
                          [docs] def entry_count(self): # type: () -> int - return m2.x509_name_entry_count(self.x509_name) -
                          + return m2.x509_name_entry_count(self.x509_name) +
                          [docs] def get_entries_by_nid(self, nid): # type: (int) -> List[X509_Name_Entry] """ @@ -457,7 +446,7 @@ ret = [] lastpos = -1 - while True: + while True: lastpos = m2.x509_name_get_index_by_nid(self.x509_name, nid, lastpos) if lastpos == -1: @@ -465,8 +454,8 @@ ret.append(self[lastpos]) - return ret -
                          + return ret +
                          [docs] def as_text(self, indent=0, flags=m2.XN_FLAG_COMPAT): # type: (int, int) -> str """ @@ -480,21 +469,21 @@ "'x509_name' type error" buf = BIO.MemoryBuffer() m2.x509_name_print_ex(buf.bio_ptr(), self.x509_name, indent, flags) - return util.py3str(buf.read_all()) -
                          + return util.py3str(buf.read_all()) +
                          [docs] def as_der(self): # type: () -> bytes assert m2.x509_name_type_check(self.x509_name), \ "'x509_name' type error" - return m2.x509_name_get_der(self.x509_name) -
                          + return m2.x509_name_get_der(self.x509_name) +
                          [docs] def as_hash(self): # type: () -> int assert m2.x509_name_type_check(self.x509_name), \ "'x509_name' type error" - return m2.x509_name_hash(self.x509_name) + return m2.x509_name_hash(self.x509_name)
                          + -
                          [docs]class X509: """ X.509 Certificate @@ -502,14 +491,14 @@ m2_x509_free = m2.x509_free - def __init__(self, x509=None, _pyfree=0): + def __init__(self, x509=None, _pyfree=0): # type: (Optional[bytes], int) -> None """ :param x509: binary representation of the underlying OpenSSL X509 object. :param _pyfree: """ - if x509 is not None: + if x509 is not None: assert m2.x509_type_check(x509), "'x509' type error" self.x509 = x509 self._pyfree = _pyfree @@ -532,19 +521,19 @@ assert m2.x509_type_check(self.x509), "'x509' type error" buf = BIO.MemoryBuffer() m2.x509_print(buf.bio_ptr(), self.x509) - return util.py3str(buf.read_all()) -
                          + return util.py3str(buf.read_all()) +
                          [docs] def as_der(self): # type: () -> bytes assert m2.x509_type_check(self.x509), "'x509' type error" - return m2.i2d_x509(self.x509) -
                          + return m2.i2d_x509(self.x509) +
                          [docs] def as_pem(self): # type: () -> bytes buf = BIO.MemoryBuffer() m2.x509_write_pem(buf.bio_ptr(), self.x509) - return buf.read_all() -
                          + return buf.read_all() +
                          [docs] def save_pem(self, filename): # type: (AnyStr) -> int """ @@ -552,9 +541,9 @@ :return: 1 for success or 0 for failure """ with BIO.openfile(filename, 'wb') as bio: - return m2.x509_write_pem(bio.bio_ptr(), self.x509) -
                          -
                          [docs] def save(self, filename, format=FORMAT_PEM): + return m2.x509_write_pem(bio.bio_ptr(), self.x509)
                          + +
                          [docs] def save(self, filename, format=FORMAT_PEM): # type: (AnyStr, int) -> int """ Saves X.509 certificate to a file. Default output @@ -566,18 +555,18 @@ Either FORMAT_PEM or FORMAT_DER to save in PEM or DER format. Raises a ValueError if an unknow format is used. - + :return: 1 for success or 0 for failure """ with BIO.openfile(filename, 'wb') as bio: - if format == FORMAT_PEM: + if format == FORMAT_PEM: return m2.x509_write_pem(bio.bio_ptr(), self.x509) - elif format == FORMAT_DER: + elif format == FORMAT_DER: return m2.i2d_x509_bio(bio.bio_ptr(), self.x509) else: raise ValueError( - "Unknown filetype. Must be either FORMAT_PEM or FORMAT_DER") -
                          + "Unknown filetype. Must be either FORMAT_PEM or FORMAT_DER") +
                          [docs] def set_version(self, version): # type: (int) -> int """ @@ -587,51 +576,51 @@ :return: Returns 0 on failure. """ assert m2.x509_type_check(self.x509), "'x509' type error" - return m2.x509_set_version(self.x509, version) -
                          + return m2.x509_set_version(self.x509, version) +
                          [docs] def set_not_before(self, asn1_time): # type: (ASN1.ASN1_TIME) -> int """ :return: 1 on success, 0 on failure """ assert m2.x509_type_check(self.x509), "'x509' type error" - return m2.x509_set_not_before(self.x509, asn1_time._ptr()) -
                          + return m2.x509_set_not_before(self.x509, asn1_time._ptr()) +
                          [docs] def set_not_after(self, asn1_time): # type: (ASN1.ASN1_TIME) -> int """ :return: 1 on success, 0 on failure """ assert m2.x509_type_check(self.x509), "'x509' type error" - return m2.x509_set_not_after(self.x509, asn1_time._ptr()) -
                          + return m2.x509_set_not_after(self.x509, asn1_time._ptr()) +
                          [docs] def set_subject_name(self, name): # type: (X509_Name) -> int """ :return: 1 on success, 0 on failure """ assert m2.x509_type_check(self.x509), "'x509' type error" - return m2.x509_set_subject_name(self.x509, name.x509_name) -
                          + return m2.x509_set_subject_name(self.x509, name.x509_name) +
                          [docs] def set_issuer_name(self, name): # type: (X509_Name) -> int """ :return: 1 on success, 0 on failure """ assert m2.x509_type_check(self.x509), "'x509' type error" - return m2.x509_set_issuer_name(self.x509, name.x509_name) -
                          + return m2.x509_set_issuer_name(self.x509, name.x509_name) +
                          [docs] def get_version(self): # type: () -> int assert m2.x509_type_check(self.x509), "'x509' type error" - return m2.x509_get_version(self.x509) -
                          + return m2.x509_get_version(self.x509) +
                          [docs] def get_serial_number(self): # type: () -> ASN1.ASN1_Integer assert m2.x509_type_check(self.x509), "'x509' type error" asn1_integer = m2.x509_get_serial_number(self.x509) - return m2.asn1_integer_get(asn1_integer) -
                          + return m2.asn1_integer_get(asn1_integer) +
                          [docs] def set_serial_number(self, serial): # type: (ASN1.ASN1_Integer) -> int """ @@ -645,17 +634,17 @@ # This "magically" changes serial since asn1_integer # is C pointer to x509's internal serial number. asn1_integer = m2.x509_get_serial_number(self.x509) - return m2.asn1_integer_set(asn1_integer, serial) + return m2.asn1_integer_set(asn1_integer, serial)
                          # XXX Or should I do this? # asn1_integer = m2.asn1_integer_new() # m2.asn1_integer_set(asn1_integer, serial) # return m2.x509_set_serial_number(self.x509, asn1_integer) - +
                          [docs] def get_not_before(self): # type: () -> ASN1.ASN1_TIME assert m2.x509_type_check(self.x509), "'x509' type error" - return ASN1.ASN1_TIME(m2.x509_get_not_before(self.x509)) -
                          + return ASN1.ASN1_TIME(m2.x509_get_not_before(self.x509)) +
                          [docs] def get_not_after(self): # type: () -> ASN1.ASN1_TIME assert m2.x509_type_check(self.x509), "'x509' type error" @@ -665,30 +654,30 @@ '''M2Crypto cannot handle dates after year 2050. See RFC 5280 4.1.2.5 for more information. ''') - return out -
                          + return out +
                          [docs] def get_pubkey(self): # type: () -> EVP.PKey assert m2.x509_type_check(self.x509), "'x509' type error" - return EVP.PKey(m2.x509_get_pubkey(self.x509), _pyfree=1) -
                          + return EVP.PKey(m2.x509_get_pubkey(self.x509), _pyfree=1) +
                          [docs] def set_pubkey(self, pkey): # type: (EVP.PKey) -> int """ Set the public key for the certificate :param pkey: Public key - + :return 1 for success and 0 for failure """ assert m2.x509_type_check(self.x509), "'x509' type error" - return m2.x509_set_pubkey(self.x509, pkey.pkey) -
                          + return m2.x509_set_pubkey(self.x509, pkey.pkey) +
                          [docs] def get_issuer(self): # type: () -> X509_Name assert m2.x509_type_check(self.x509), "'x509' type error" - return X509_Name(m2.x509_get_issuer_name(self.x509)) -
                          + return X509_Name(m2.x509_get_issuer_name(self.x509)) +
                          [docs] def set_issuer(self, name): # type: (X509_Name) -> int """ @@ -699,25 +688,25 @@ :return 1 for success and 0 for failure """ assert m2.x509_type_check(self.x509), "'x509' type error" - return m2.x509_set_issuer_name(self.x509, name.x509_name) -
                          + return m2.x509_set_issuer_name(self.x509, name.x509_name) +
                          [docs] def get_subject(self): # type: () -> X509_Name assert m2.x509_type_check(self.x509), "'x509' type error" - return X509_Name(m2.x509_get_subject_name(self.x509)) -
                          + return X509_Name(m2.x509_get_subject_name(self.x509)) +
                          [docs] def set_subject(self, name): # type: (X509_Name) -> int """ Set subject name. :param name: subjectName field. - + :return 1 for success and 0 for failure """ assert m2.x509_type_check(self.x509), "'x509' type error" - return m2.x509_set_subject_name(self.x509, name.x509_name) -
                          + return m2.x509_set_subject_name(self.x509, name.x509_name) +
                          [docs] def add_ext(self, ext): # type: (X509_Extension) -> int """ @@ -728,8 +717,8 @@ :return 1 for success and 0 for failure """ assert m2.x509_type_check(self.x509), "'x509' type error" - return m2.x509_add_ext(self.x509, ext.x509_ext, -1) -
                          + return m2.x509_add_ext(self.x509, ext.x509_ext, -1) +
                          [docs] def get_ext(self, name): # type: (str) -> X509_Extension """ @@ -750,8 +739,8 @@ if m2x509_extension_get_name(ext_ptr) == name: return X509_Extension(ext_ptr, _pyfree=0) - raise LookupError -
                          + raise LookupError +
                          [docs] def get_ext_at(self, index): # type: (int) -> X509_Extension """ @@ -765,41 +754,41 @@ raise IndexError return X509_Extension(m2.x509_get_ext(self.x509, index), - _pyfree=0) -
                          + _pyfree=0) +
                          [docs] def get_ext_count(self): # type: () -> int """ Get X509 extension count. """ - return m2.x509_get_ext_count(self.x509) -
                          + return m2.x509_get_ext_count(self.x509) +
                          [docs] def sign(self, pkey, md): # type: (EVP.PKey, str) -> int """ Sign the certificate. :param pkey: Public key - + :param md: Message digest algorithm to use for signing, for example 'sha1'. - + :return int """ assert m2.x509_type_check(self.x509), "'x509' type error" - mda = getattr(m2, md, None) - if mda is None: + mda = getattr(m2, md, None) + if mda is None: raise ValueError('unknown message digest', md) - return m2.x509_sign(self.x509, pkey.pkey, mda()) -
                          -
                          [docs] def verify(self, pkey=None): + return m2.x509_sign(self.x509, pkey.pkey, mda())
                          + +
                          [docs] def verify(self, pkey=None): # type: (Optional[EVP.PKey]) -> int assert m2.x509_type_check(self.x509), "'x509' type error" if pkey: return m2.x509_verify(self.x509, pkey.pkey) else: - return m2.x509_verify(self.x509, self.get_pubkey().pkey) -
                          + return m2.x509_verify(self.x509, self.get_pubkey().pkey) +
                          [docs] def check_ca(self): # type: () -> int """ @@ -809,90 +798,86 @@ :requires: OpenSSL 0.9.8 or newer """ - return m2.x509_check_ca(self.x509) -
                          + return m2.x509_check_ca(self.x509) +
                          [docs] def check_purpose(self, id, ca): # type: (int, int) -> int """ Check if the certificate's purpose matches the asked purpose. :param id: Purpose id. See X509_PURPOSE_* constants. - + :param ca: 1 if the certificate should be CA, 0 otherwise. - + :return: 0 if the certificate purpose does not match, nonzero otherwise. """ - return m2.x509_check_purpose(self.x509, id, ca) -
                          + return m2.x509_check_purpose(self.x509, id, ca) +
                          [docs] def get_fingerprint(self, md='md5'): # type: (str) -> str """ Get the fingerprint of the certificate. :param md: Message digest algorithm to use. - + :return: String containing the fingerprint in hex format. """ der = self.as_der() md = EVP.MessageDigest(md) md.update(der) digest = md.final() - return util.py3str(binascii.hexlify(digest).upper()) + return util.py3str(binascii.hexlify(digest).upper())
                          + - -
                          [docs]def load_cert(file, format=FORMAT_PEM): +
                          [docs]def load_cert(file, format=FORMAT_PEM): # type: (AnyStr, int) -> X509 """ Load certificate from file. :param file: Name of file containing certificate in either DER or PEM format. - + :param format: Describes the format of the file to be loaded, either PEM or DER. :return: M2Crypto.X509.X509 object. """ - with BIO.openfile(file) as bio: - if format == FORMAT_PEM: + with BIO.openfile(file) as bio: + if format == FORMAT_PEM: return load_cert_bio(bio) - elif format == FORMAT_DER: + elif format == FORMAT_DER: cptr = m2.d2i_x509(bio._ptr()) - if cptr is None: - raise X509Error(Err.get_error()) return X509(cptr, _pyfree=1) else: raise ValueError( - "Unknown format. Must be either FORMAT_DER or FORMAT_PEM") + "Unknown format. Must be either FORMAT_DER or FORMAT_PEM")
                          -
                          -
                          [docs]def load_cert_bio(bio, format=FORMAT_PEM): + +
                          [docs]def load_cert_bio(bio, format=FORMAT_PEM): # type: (BIO.BIO, int) -> X509 """ Load certificate from a bio. :param bio: BIO pointing at a certificate in either DER or PEM format. - + :param format: Describes the format of the cert to be loaded, either PEM or DER (via constants FORMAT_PEM and FORMAT_FORMAT_DER) :return: M2Crypto.X509.X509 object. """ - if format == FORMAT_PEM: + if format == FORMAT_PEM: cptr = m2.x509_read_pem(bio._ptr()) - elif format == FORMAT_DER: + elif format == FORMAT_DER: cptr = m2.d2i_x509(bio._ptr()) else: raise ValueError( "Unknown format. Must be either FORMAT_DER or FORMAT_PEM") - if cptr is None: - raise X509Error(Err.get_error()) - return X509(cptr, _pyfree=1) + return X509(cptr, _pyfree=1)
                          -
                          -
                          [docs]def load_cert_string(string, format=FORMAT_PEM): + +
                          [docs]def load_cert_string(string, format=FORMAT_PEM): # type: (AnyStr, int) -> X509 """ Load certificate from a string. @@ -902,31 +887,29 @@ :param format: Describes the format of the cert to be loaded, either PEM or DER (via constants FORMAT_PEM and FORMAT_FORMAT_DER) - + :return: M2Crypto.X509.X509 object. """ string = util.py3bytes(string) bio = BIO.MemoryBuffer(string) - return load_cert_bio(bio, format) + return load_cert_bio(bio, format)
                          + -
                          [docs]def load_cert_der_string(string): # type: (AnyStr) -> X509 """ Load certificate from a string. :param string: String containing a certificate in DER format. - + :return: M2Crypto.X509.X509 object. """ string = util.py3bytes(string) bio = BIO.MemoryBuffer(string) cptr = m2.d2i_x509(bio._ptr()) - if cptr is None: - raise X509Error(Err.get_error()) - return X509(cptr, _pyfree=1) + return X509(cptr, _pyfree=1)
                          + -
                          [docs]class X509_Store_Context: # noqa """ X509 Store Context @@ -964,22 +947,22 @@ rely on it being valid once the store context goes away or is modified. """ - return X509(m2.x509_store_ctx_get_current_cert(self.ctx), _pyfree=0) -
                          + return X509(m2.x509_store_ctx_get_current_cert(self.ctx), _pyfree=0) +
                          [docs] def get_error(self): # type: () -> int """ Get error code. """ - return m2.x509_store_ctx_get_error(self.ctx) -
                          + return m2.x509_store_ctx_get_error(self.ctx) +
                          [docs] def get_error_depth(self): # type: () -> int """ Get error depth. """ - return m2.x509_store_ctx_get_error_depth(self.ctx) -
                          + return m2.x509_store_ctx_get_error_depth(self.ctx) +
                          [docs] def get1_chain(self): # type: () -> X509_Stack """ @@ -988,9 +971,9 @@ :return: Reference counted (i.e. safe to use even after the store context goes away) stack of certificates in the chain. """ - return X509_Stack(m2.x509_store_ctx_get1_chain(self.ctx), 1, 1) + return X509_Stack(m2.x509_store_ctx_get1_chain(self.ctx), 1, 1)
                          + -
                          [docs]class X509_Store: # noqa """ X509 Store @@ -998,12 +981,12 @@ m2_x509_store_free = m2.x509_store_free - def __init__(self, store=None, _pyfree=0): + def __init__(self, store=None, _pyfree=0): # type: (Optional[bytes], int) -> None """ :param store: binary data for OpenSSL X509_STORE_CTX type. """ - if store is not None: + if store is not None: self.store = store self._pyfree = _pyfree else: @@ -1018,26 +1001,24 @@ def _ptr(self): return self.store -
                          [docs] def load_info(self, file): +
                          [docs] def load_info(self, file): # type: (AnyStr) -> int """ :param file: filename - + :return: 1 on success, 0 on failure """ - ret = m2.x509_store_load_locations(self.store, file) - if ret < 1: - raise X509Error(Err.get_error()) - return ret -
                          + ret = m2.x509_store_load_locations(self.store, file) + return ret
                          + load_locations = load_info
                          [docs] def add_x509(self, x509): # type: (X509) -> int assert isinstance(x509, X509) - return m2.x509_store_add_cert(self.store, x509._ptr()) -
                          -
                          [docs] def set_verify_cb(self, callback=None): + return m2.x509_store_add_cert(self.store, x509._ptr())
                          + +
                          [docs] def set_verify_cb(self, callback=None): # type: (Optional[callable]) -> None """ Set callback which will be called when the store is verified. @@ -1047,26 +1028,26 @@ Type of the callable must be: (int, X509_Store_Context) -> int. If None: set the standard options. - + :note: compile-time or run-time errors in the callback would result in mysterious errors during verification, which could be hard to trace. :note: Python exceptions raised in callbacks do not propagate to verify() call. - + :return: None """ - if callback is None: + if callback is None: return self.set_verify_cb(x509_store_default_cb) - if not callable(callback): + if not callable(callback): raise X509Error("set_verify(): callback is not callable") - return m2.x509_store_set_verify_cb(self.store, callback) -
                          - add_cert = add_x509 + return m2.x509_store_set_verify_cb(self.store, callback)
                          + + add_cert = add_x509 + -
                          [docs]class X509_Stack: # noqa """ X509 Stack @@ -1081,9 +1062,9 @@ m2_sk_x509_free = m2.sk_x509_free - def __init__(self, stack=None, _pyfree=0, _pyfree_x509=0): + def __init__(self, stack=None, _pyfree=0, _pyfree_x509=0): # type: (bytes, int, int) -> None - if stack is not None: + if stack is not None: self.stack = stack self._pyfree = _pyfree self.pystack = [] # This must be kept in sync with self.stack @@ -1122,15 +1103,15 @@ push an X509 certificate onto the stack. :param x509: X509 object. - + :return: The number of X509 objects currently on the stack. """ assert isinstance(x509, X509) self.pystack.append(x509) ret = m2.sk_x509_push(self.stack, x509._ptr()) assert ret == len(self.pystack) - return ret -
                          + return ret +
                          [docs] def pop(self): # type: () -> X509 """ @@ -1140,19 +1121,19 @@ nothing to pop. """ x509_ptr = m2.sk_x509_pop(self.stack) - if x509_ptr is None: + if x509_ptr is None: assert len(self.pystack) == 0 - return None - return self.pystack.pop() -
                          + return None + return self.pystack.pop() +
                          [docs] def as_der(self): # type: () -> bytes """ Return the stack as a DER encoded string """ - return m2.get_der_encoding_stack(self.stack) + return m2.get_der_encoding_stack(self.stack)
                          + -
                          [docs]def new_stack_from_der(der_string): # type: (bytes) -> X509_Stack """ @@ -1162,11 +1143,9 @@ """ der_string = util.py3bytes(der_string) stack_ptr = m2.make_stack_from_der_sequence(der_string) - if stack_ptr is None: - raise X509Error(Err.get_error()) - return X509_Stack(stack_ptr, 1, 1) + return X509_Stack(stack_ptr, 1, 1)
                          + -
                          [docs]class Request: """ X509 Certificate Request. @@ -1174,9 +1153,9 @@ m2_x509_req_free = m2.x509_req_free - def __init__(self, req=None, _pyfree=0): + def __init__(self, req=None, _pyfree=0): # type: (Optional[int], int) -> None - if req is not None: + if req is not None: self.req = req self._pyfree = _pyfree else: @@ -1193,26 +1172,26 @@ # type: () -> str buf = BIO.MemoryBuffer() m2.x509_req_print(buf.bio_ptr(), self.req) - return util.py3str(buf.read_all()) -
                          + return util.py3str(buf.read_all()) +
                          [docs] def as_pem(self): # type: () -> bytes buf = BIO.MemoryBuffer() m2.x509_req_write_pem(buf.bio_ptr(), self.req) - return buf.read_all() -
                          + return buf.read_all() +
                          [docs] def as_der(self): # type: () -> bytes buf = BIO.MemoryBuffer() m2.i2d_x509_req_bio(buf.bio_ptr(), self.req) - return buf.read_all() -
                          + return buf.read_all() +
                          [docs] def save_pem(self, filename): # type: (AnyStr) -> int with BIO.openfile(filename, 'wb') as bio: - return m2.x509_req_write_pem(bio.bio_ptr(), self.req) -
                          -
                          [docs] def save(self, filename, format=FORMAT_PEM): + return m2.x509_req_write_pem(bio.bio_ptr(), self.req)
                          + +
                          [docs] def save(self, filename, format=FORMAT_PEM): # type: (AnyStr, int) -> int """ Saves X.509 certificate request to a file. Default output @@ -1229,14 +1208,14 @@ The error code can be obtained by ERR_get_error. """ with BIO.openfile(filename, 'wb') as bio: - if format == FORMAT_PEM: + if format == FORMAT_PEM: return m2.x509_req_write_pem(bio.bio_ptr(), self.req) - elif format == FORMAT_DER: + elif format == FORMAT_DER: return m2.i2d_x509_req_bio(bio.bio_ptr(), self.req) else: raise ValueError( - "Unknown filetype. Must be either FORMAT_DER or FORMAT_PEM") -
                          + "Unknown filetype. Must be either FORMAT_DER or FORMAT_PEM") +
                          [docs] def get_pubkey(self): # type: () -> EVP.PKey """ @@ -1244,8 +1223,8 @@ :return: Public key from the request. """ - return EVP.PKey(m2.x509_req_get_pubkey(self.req), _pyfree=1) -
                          + return EVP.PKey(m2.x509_req_get_pubkey(self.req), _pyfree=1) +
                          [docs] def set_pubkey(self, pkey): # type: (EVP.PKey) -> int """ @@ -1255,8 +1234,8 @@ :return: Return 1 for success and 0 for failure. """ - return m2.x509_req_set_pubkey(self.req, pkey.pkey) -
                          + return m2.x509_req_set_pubkey(self.req, pkey.pkey) +
                          [docs] def get_version(self): # type: () -> int """ @@ -1264,8 +1243,8 @@ :return: Returns version. """ - return m2.x509_req_get_version(self.req) -
                          + return m2.x509_req_get_version(self.req) +
                          [docs] def set_version(self, version): # type: (int) -> int """ @@ -1274,12 +1253,12 @@ :param version: Version number. :return: Returns 0 on failure. """ - return m2.x509_req_set_version(self.req, version) -
                          + return m2.x509_req_set_version(self.req, version) +
                          [docs] def get_subject(self): # type: () -> X509_Name - return X509_Name(m2.x509_req_get_subject_name(self.req)) -
                          + return X509_Name(m2.x509_req_get_subject_name(self.req)) +
                          [docs] def set_subject_name(self, name): # type: (X509_Name) -> int """ @@ -1288,8 +1267,8 @@ :param name: subjectName field. :return: 1 for success and 0 for failure """ - return m2.x509_req_set_subject_name(self.req, name.x509_name) -
                          + return m2.x509_req_set_subject_name(self.req, name.x509_name) + set_subject = set_subject_name
                          [docs] def add_extensions(self, ext_stack): @@ -1300,8 +1279,8 @@ :param ext_stack: Stack of extensions to add. :return: 1 for success and 0 for failure """ - return m2.x509_req_add_extensions(self.req, ext_stack._ptr()) -
                          + return m2.x509_req_add_extensions(self.req, ext_stack._ptr()) +
                          [docs] def verify(self, pkey): # type: (EVP.PKey) -> int """ @@ -1309,8 +1288,8 @@ :param pkey: PKey to be verified :return: 1 for success and 0 for failure """ - return m2.x509_req_verify(self.req, pkey.pkey) -
                          + return m2.x509_req_verify(self.req, pkey.pkey) +
                          [docs] def sign(self, pkey, md): # type: (EVP.PKey, str) -> int """ @@ -1319,13 +1298,13 @@ :param md: used algorigthm :return: 1 for success and 0 for failure """ - mda = getattr(m2, md, None) - if mda is None: + mda = getattr(m2, md, None) + if mda is None: raise ValueError('unknown message digest', md) - return m2.x509_req_sign(self.req, pkey.pkey, mda()) + return m2.x509_req_sign(self.req, pkey.pkey, mda())
                          - -
                          [docs]def load_request(file, format=FORMAT_PEM): + +
                          [docs]def load_request(file, format=FORMAT_PEM): # type: (AnyStr, int) -> Request """ Load certificate request from file. @@ -1337,21 +1316,21 @@ and FORMAT_DER) :return: Request object. """ - with BIO.openfile(file) as f: - if format == FORMAT_PEM: + with BIO.openfile(file) as f: + if format == FORMAT_PEM: cptr = m2.x509_req_read_pem(f.bio_ptr()) - elif format == FORMAT_DER: + elif format == FORMAT_DER: cptr = m2.d2i_x509_req(f.bio_ptr()) else: raise ValueError( "Unknown filetype. Must be either FORMAT_PEM or FORMAT_DER") - if cptr is None: + if cptr is None: raise X509Error(Err.get_error()) - return Request(cptr, 1) + return Request(cptr, 1)
                          -
                          -
                          [docs]def load_request_bio(bio, format=FORMAT_PEM): + +
                          [docs]def load_request_bio(bio, format=FORMAT_PEM): # type: (BIO.BIO, int) -> Request """ Load certificate request from a bio. @@ -1363,19 +1342,19 @@ and FORMAT_DER) :return: M2Crypto.X509.Request object. """ - if format == FORMAT_PEM: + if format == FORMAT_PEM: cptr = m2.x509_req_read_pem(bio._ptr()) - elif format == FORMAT_DER: + elif format == FORMAT_DER: cptr = m2.d2i_x509_req(bio._ptr()) else: raise ValueError( "Unknown format. Must be either FORMAT_DER or FORMAT_PEM") - if cptr is None: + if cptr is None: raise X509Error(Err.get_error()) - return Request(cptr, _pyfree=1) + return Request(cptr, _pyfree=1)
                          -
                          -
                          [docs]def load_request_string(string, format=FORMAT_PEM): + +
                          [docs]def load_request_string(string, format=FORMAT_PEM): # type: (AnyStr, int) -> Request """ Load certificate request from a string. @@ -1390,9 +1369,9 @@ """ string = util.py3bytes(string) bio = BIO.MemoryBuffer(string) - return load_request_bio(bio, format) + return load_request_bio(bio, format)
                          + -
                          [docs]def load_request_der_string(string): # type: (AnyStr) -> Request """ @@ -1403,9 +1382,9 @@ """ string = util.py3bytes(string) bio = BIO.MemoryBuffer(string) - return load_request_bio(bio, FORMAT_DER) + return load_request_bio(bio, FORMAT_DER)
                          + -
                          [docs]class CRL: """ X509 Certificate Revocation List @@ -1413,14 +1392,14 @@ m2_x509_crl_free = m2.x509_crl_free - def __init__(self, crl=None, _pyfree=0): + def __init__(self, crl=None, _pyfree=0): # type: (Optional[bytes], int) -> None """ :param crl: binary representation of the underlying OpenSSL X509_CRL object. """ - if crl is not None: + if crl is not None: self.crl = crl self._pyfree = _pyfree else: @@ -1441,10 +1420,10 @@ """ buf = BIO.MemoryBuffer() m2.x509_crl_print(buf.bio_ptr(), self.crl) - return util.py3str(buf.read_all()) + return util.py3str(buf.read_all())
                          - -
                          [docs]def load_crl(file): + +
                          [docs]def load_crl(file): # type: (AnyStr) -> CRL """ Load CRL from file. @@ -1453,10 +1432,10 @@ :return: M2Crypto.X509.CRL object. """ - with BIO.openfile(file) as f: + with BIO.openfile(file) as f: cptr = m2.x509_crl_read_pem(f.bio_ptr()) - if cptr is None: + if cptr is None: raise X509Error(Err.get_error()) return CRL(cptr, 1)
                          @@ -1464,41 +1443,41 @@ -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/ftpslib.html b/doc/html/_modules/M2Crypto/ftpslib.html index d1877a1..4a4e4f0 100644 --- a/doc/html/_modules/M2Crypto/ftpslib.html +++ b/doc/html/_modules/M2Crypto/ftpslib.html @@ -1,55 +1,45 @@ - - - - M2Crypto.ftpslib — M2Crypto documentation - - + M2Crypto.ftpslib — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.ftpslib

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """M2Crypto client-side FTP/TLS.
                           
                          @@ -86,23 +76,23 @@
                           
                           # We want to import whole stdlib ftplib objects, because our users want
                           # to use them.
                          -from ftplib import *  # noqa
                          +from ftplib import *  # noqa
                           
                           # M2Crypto
                          -from M2Crypto import SSL
                          +from M2Crypto import SSL
                           
                           
                           
                          [docs]class FTP_TLS(FTP): # noqa """Python OO interface to client-side FTP/TLS.""" - def __init__(self, host=None, ssl_ctx=None): + def __init__(self, host=None, ssl_ctx=None): """Initialise the client. If 'host' is supplied, connect to it.""" - if ssl_ctx is not None: + if ssl_ctx is not None: self.ssl_ctx = ssl_ctx else: self.ssl_ctx = SSL.Context() - FTP.__init__(self, host) + FTP.__init__(self, host) self.prot = 0
                          [docs] def auth_tls(self): @@ -113,24 +103,24 @@ s.set_connect_state() s.connect_ssl() self.sock = s - self.file = self.sock.makefile() -
                          + self.file = self.sock.makefile()
                          +
                          [docs] def auth_ssl(self): """Secure the control connection per AUTH SSL, aka AUTH TLS-P.""" - raise NotImplementedError -
                          + raise NotImplementedError
                          +
                          [docs] def prot_p(self): """Set up secure data connection.""" self.voidcmd('PBSZ 0') self.voidcmd('PROT P') - self.prot = 1 -
                          + self.prot = 1
                          +
                          [docs] def prot_c(self): """Set up data connection in the clear.""" self.voidcmd('PROT C') - self.prot = 0 -
                          -
                          [docs] def ntransfercmd(self, cmd, rest=None): + self.prot = 0
                          + +
                          [docs] def ntransfercmd(self, cmd, rest=None): """Initiate a data transfer.""" conn, size = FTP.ntransfercmd(self, cmd, rest) if self.prot: @@ -145,41 +135,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/httpslib.html b/doc/html/_modules/M2Crypto/httpslib.html index e8ab639..d9b35d3 100644 --- a/doc/html/_modules/M2Crypto/httpslib.html +++ b/doc/html/_modules/M2Crypto/httpslib.html @@ -1,55 +1,47 @@ - - - - M2Crypto.httpslib — M2Crypto documentation - - + M2Crypto.httpslib — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.httpslib

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                          +
                          +import warnings
                           
                           """M2Crypto support for Python's httplib.
                           
                          @@ -58,13 +50,13 @@
                           import base64
                           import socket
                           
                          -from M2Crypto import SSL, six, util
                          -from M2Crypto.six.moves.urllib_parse import urlsplit, urlunsplit
                          -from M2Crypto.six.moves.http_client import *  # noqa
                          +from M2Crypto import SSL, six, util
                          +from M2Crypto.six.moves.urllib_parse import urlsplit, urlunsplit
                          +from M2Crypto.six.moves.http_client import *  # noqa
                           # This is not imported with just '*'
                          -from M2Crypto.six.moves.http_client import HTTPS_PORT
                          +from M2Crypto.six.moves.http_client import HTTPS_PORT
                           if util.py27plus:
                          -    from typing import Any, AnyStr, Callable, Dict, List, Optional  # noqa
                          +    from typing import Any, AnyStr, Callable, Dict, List, Optional  # noqa
                           
                           
                           
                          [docs]class HTTPSConnection(HTTPConnection): @@ -75,8 +67,8 @@ default_port = HTTPS_PORT - def __init__(self, host, port=None, strict=None, **ssl): - # type: (str, Optional[int], Optional[bool], **Dict[Any, Any]) -> None + def __init__(self, host, port=None, strict=None, **ssl): + # type: (str, Optional[int], Optional[bool], **Any) -> None """ Represents one transaction with an HTTP server over the SSL connection. @@ -91,7 +83,7 @@ to be included with SSL.Context; if it is not default ``'sslv23'`` is substituted). """ - self.session = None # type: bytes + self.session = None # type: bytes self.host = host self.port = port keys = set(ssl.keys()) - set(('key_file', 'cert_file', 'ssl_context')) @@ -102,38 +94,42 @@ assert isinstance(self.ssl_ctx, SSL.Context), self.ssl_ctx except KeyError: self.ssl_ctx = SSL.Context() - HTTPConnection.__init__(self, host, port, strict) + HTTPConnection.__init__(self, host, port, strict)
                          [docs] def connect(self): # type: () -> None - error = None + error = None # We ignore the returned sockaddr because SSL.Connection.connect needs # a host name. for (family, _, _, _, _) in \ socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): - sock = None + sock = None try: sock = SSL.Connection(self.ssl_ctx, family=family) - if self.session is not None: + + # set SNI server name since we know it at this point + sock.set_tlsext_host_name(self.host) + + if self.session is not None: sock.set_session(self.session) sock.connect((self.host, self.port)) self.sock = sock - sock = None + sock = None return except socket.error as e: # Other exception are probably SSL-related, in that case we # abort and the exception is forwarded to the caller. error = e finally: - if sock is not None: + if sock is not None: sock.close() - if error is None: + if error is None: raise AssertionError("Empty list returned by getaddrinfo") - raise error -
                          + raise error
                          +
                          [docs] def close(self): # type: () -> None # This kludges around line 545 of httplib.py, @@ -150,17 +146,17 @@ # XXX 05-Jan-2002: This module works with Python 2.2, # XXX but I've not investigated if the above conditions # XXX remain. - pass -
                          + pass
                          +
                          [docs] def get_session(self): # type: () -> SSL.Session.Session - return self.sock.get_session() -
                          + return self.sock.get_session()
                          +
                          [docs] def set_session(self, session): # type: (SSL.Session.Session) -> None - self.session = session + self.session = session
                          + -
                          [docs]class ProxyHTTPSConnection(HTTPSConnection): """ An HTTPS Connection that uses a proxy and the CONNECT request. @@ -178,9 +174,9 @@ _AUTH_HEADER = "Proxy-Authorization" _UA_HEADER = "User-Agent" - def __init__(self, host, port=None, strict=None, username=None, - password=None, **ssl): - # type: (str, Optional[int], Optional[bool], Optional[AnyStr], Optional[AnyStr], **Dict[Any, Any]) -> None + def __init__(self, host, port=None, strict=None, username=None, + password=None, **ssl): + # type: (str, Optional[int], Optional[bool], Optional[AnyStr], Optional[AnyStr], **Any) -> None """ Create the ProxyHTTPSConnection object. @@ -202,14 +198,14 @@ to be included with SSL.Context; if it is not default ``'sslv23'`` is substituted). """ - HTTPSConnection.__init__(self, host, port, strict, **ssl) + HTTPSConnection.__init__(self, host, port, strict, **ssl) self._username = username.encode('utf8') \ if isinstance(username, six.string_types) else username self._password = password.encode('utf8') \ if isinstance(password, six.string_types) else password - self._proxy_auth = None # type: str - self._proxy_UA = None # type: str + self._proxy_auth = None # type: str + self._proxy_UA = None # type: str
                          [docs] def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0): # type: (AnyStr, AnyStr, int, int) -> None @@ -240,10 +236,10 @@ self._real_host = host # type: str self._real_port = port # type: int - rest = urlunsplit((None, None, path, query, fragment)) + rest = urlunsplit((None, None, path, query, fragment)) HTTPSConnection.putrequest(self, method, rest, skip_host, - skip_accept_encoding) -
                          + skip_accept_encoding)
                          +
                          [docs] def putheader(self, header, value): # type: (AnyStr, AnyStr) -> None # Store the auth header if passed in. @@ -252,18 +248,18 @@ if header.lower() == self._AUTH_HEADER.lower(): self._proxy_auth = value else: - HTTPSConnection.putheader(self, header, value) -
                          + HTTPSConnection.putheader(self, header, value)
                          +
                          [docs] def endheaders(self, *args, **kwargs): - # type: (*List[Any], **Dict[Any, Any]) -> None + # type: (*Any, **Any) -> None # We've recieved all of hte headers. Use the supplied username # and password for authorization, possibly overriding the authstring # supplied in the headers. if not self._proxy_auth: self._proxy_auth = self._encode_auth() - HTTPSConnection.endheaders(self, *args, **kwargs) -
                          + HTTPSConnection.endheaders(self, *args, **kwargs)
                          +
                          [docs] def connect(self): # type: () -> None HTTPConnection.connect(self) @@ -279,8 +275,8 @@ self.close() raise socket.error("Proxy connection failed: %d" % code) - self._start_ssl() -
                          + self._start_ssl()
                          + def _get_connect_msg(self): # type: () -> bytes """ Return an HTTP CONNECT request to send to the proxy. """ @@ -305,51 +301,53 @@ # type: () -> Optional[bytes] """ Encode the username and password for use in the auth header. """ if not (self._username and self._password): - return None + return None # Authenticated proxy userpass = "%s:%s" % (self._username, self._password) - enc_userpass = base64.encodestring(userpass).replace("\n", "") + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + enc_userpass = base64.encodestring(userpass).replace("\n", "") return util.py3bytes("Basic %s" % enc_userpass)
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/m2crypto.html b/doc/html/_modules/M2Crypto/m2crypto.html index 00852dc..8454683 100644 --- a/doc/html/_modules/M2Crypto/m2crypto.html +++ b/doc/html/_modules/M2Crypto/m2crypto.html @@ -49,11 +49,11 @@

                          Source code for M2Crypto.m2crypto

                          -# This file was automatically generated by SWIG (http://www.swig.org).
                          -# Version 2.0.10
                          -#
                          -# Do not make changes to this file unless you know what you are doing--modify
                          -# the SWIG interface file instead.
                          +# This file was automatically generated by SWIG (http://www.swig.org).
                          +# Version 2.0.10
                          +#
                          +# Do not make changes to this file unless you know what you are doing--modify
                          +# the SWIG interface file instead.
                           
                           
                           
                          @@ -64,13 +64,13 @@
                                   import imp
                                   fp = None
                                   try:
                          -            fp, pathname, description = imp.find_module('_m2crypto', [dirname(__file__)])
                          +            fp, pathname, description = imp.find_module('_m2crypto', [dirname(__file__)])
                                   except ImportError:
                                       import _m2crypto
                                       return _m2crypto
                                   if fp is not None:
                                       try:
                          -                _mod = imp.load_module('_m2crypto', fp, pathname, description)
                          +                _mod = imp.load_module('_m2crypto', fp, pathname, description)
                                       finally:
                                           fp.close()
                                       return _mod
                          @@ -83,11 +83,11 @@
                           try:
                               _swig_property = property
                           except NameError:
                          -    pass # Python < 2.2 doesn't have 'property'.
                          +    pass # Python < 2.2 doesn't have 'property'.
                           def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
                          -    if (name == "thisown"): return self.this.own(value)
                          -    if (name == "this"):
                          -        if type(value).__name__ == 'SwigPyObject':
                          +    if (name == "thisown"): return self.this.own(value)
                          +    if (name == "this"):
                          +        if type(value).__name__ == 'SwigPyObject':
                                       self.__dict__[name] = value
                                       return
                               method = class_type.__swig_setmethods__.get(name,None)
                          @@ -95,21 +95,21 @@
                               if (not static):
                                   self.__dict__[name] = value
                               else:
                          -        raise AttributeError("You cannot add attributes to %s" % self)
                          +        raise AttributeError("You cannot add attributes to %s" % self)
                           
                           def _swig_setattr(self,class_type,name,value):
                               return _swig_setattr_nondynamic(self,class_type,name,value,0)
                           
                           def _swig_getattr(self,class_type,name):
                          -    if (name == "thisown"): return self.this.own()
                          +    if (name == "thisown"): return self.this.own()
                               method = class_type.__swig_getmethods__.get(name,None)
                               if method: return method(self)
                               raise AttributeError(name)
                           
                           def _swig_repr(self):
                          -    try: strthis = "proxy of " + self.this.__repr__()
                          -    except: strthis = ""
                          -    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
                          +    try: strthis = "proxy of " + self.this.__repr__()
                          +    except: strthis = ""
                          +    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
                           
                           try:
                               _object = object
                          @@ -121,11 +121,11 @@
                           
                           def _swig_setattr_nondynamic_method(set):
                               def set_attr(self,name,value):
                          -        if (name == "thisown"): return self.this.own(value)
                          -        if hasattr(self,name) or (name == "this"):
                          +        if (name == "thisown"): return self.this.own(value)
                          +        if hasattr(self,name) or (name == "this"):
                                       set(self,name,value)
                                   else:
                          -            raise AttributeError("You cannot add attributes to %s" % self)
                          +            raise AttributeError("You cannot add attributes to %s" % self)
                               return set_attr
                           
                          diff --git a/doc/html/_modules/M2Crypto/m2urllib.html b/doc/html/_modules/M2Crypto/m2urllib.html index 44d3ac7..6c3ee9f 100644 --- a/doc/html/_modules/M2Crypto/m2urllib.html +++ b/doc/html/_modules/M2Crypto/m2urllib.html @@ -1,55 +1,45 @@ - - - - M2Crypto.m2urllib — M2Crypto documentation - - + M2Crypto.m2urllib — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.m2urllib

                          -from __future__ import absolute_import, print_function
                          +from __future__ import absolute_import, print_function
                           
                           """M2Crypto enhancement to Python's urllib for handling
                           'https' url's.
                          @@ -59,22 +49,25 @@
                           
                           Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
                           
                          -from M2Crypto import SSL, httpslib, six, util
                          +import base64
                          +import warnings
                          +
                          +from M2Crypto import SSL, httpslib, six, util
                           
                          -from M2Crypto.six.moves.urllib_response import addinfourl
                          +from M2Crypto.six.moves.urllib_response import addinfourl
                           if util.py27plus:
                          -    from typing import AnyStr, Optional  # noqa
                          +    from typing import AnyStr, Optional  # noqa
                           
                           # six.moves doesn't support star imports
                           if six.PY3:
                          -    from urllib.request import *  # noqa for other modules to import
                          -    from urllib.parse import *  # noqa for other modules to import
                          -    from urllib.error import *  # noqa for other modules to import
                          +    from urllib.request import *  # noqa for other modules to import
                          +    from urllib.parse import *  # noqa for other modules to import
                          +    from urllib.error import *  # noqa for other modules to import
                           else:
                          -    from urllib import *  # noqa
                          +    from urllib import *  # noqa
                           
                           
                          -
                          [docs]def open_https(self, url, data=None, ssl_context=None): +
                          [docs]def open_https(self, url, data=None, ssl_context=None): # type: (AnyStr, Optional[bytes], Optional[SSL.Context]) -> addinfourl """ Open URL over the SSL connection. @@ -84,11 +77,14 @@ :param ssl_context: SSL.Context to be used :return: """ - if ssl_context is not None and isinstance(ssl_context, SSL.Context): + if six.PY3: + warnings.warn('URLOpener has been deprecated in Py3k', DeprecationWarning) + + if ssl_context is not None and isinstance(ssl_context, SSL.Context): self.ctx = ssl_context else: self.ctx = SSL.Context() - user_passwd = None + user_passwd = None if isinstance(url, six.string_types): try: # python 2 # http://pydoc.org/2.5.1/urllib.html @@ -102,18 +98,18 @@ parsed = urlparse(url) host = parsed.hostname if parsed.port: - host += ":{0}".format(parsed.port) - user_passwd = parsed.username + host += ":{0}".format(parsed.port) + user_passwd = parsed.password if parsed.password: - user_passwd += ":{0}".format(parsed.password) + user_passwd += ":{0}".format(parsed.password) selector = parsed.path else: host, selector = url urltype, rest = splittype(selector) url = rest - user_passwd = None + user_passwd = None if urltype.lower() != 'http': - realhost = None + realhost = None else: try: # python 2 realhost, rest = splithost(rest) @@ -125,23 +121,24 @@ parsed = urlparse(rest) host = parsed.hostname if parsed.port: - host += ":{0}".format(parsed.port) + host += ":{0}".format(parsed.port) user_passwd = parsed.username if parsed.password: - user_passwd += ":{0}".format(parsed.password) + user_passwd += ":{0}".format(parsed.password) # print("proxy via http:", host, selector) if not host: raise IOError('http error', 'no host given') if user_passwd: - import base64 - auth = base64.encodestring(user_passwd).strip() + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + auth = base64.encodestring(user_passwd).strip() else: - auth = None + auth = None # Start here! h = httpslib.HTTPSConnection(host=host, ssl_context=self.ctx) # h.set_debuglevel(1) # Stop here! - if data is not None: + if data is not None: h.putrequest('POST', selector) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) @@ -152,56 +149,56 @@ for args in self.addheaders: h.putheader(*args) # for python3 - used to use apply h.endheaders() - if data is not None: + if data is not None: h.send(data + '\r\n') # Here again! resp = h.getresponse() fp = resp.fp - return addinfourl(fp, resp.msg, "https:" + url) + return addinfourl(fp, resp.msg, "https:" + url)
                          # Stop again. -# Minor brain surgery.
                          +# Minor brain surgery. URLopener.open_https = open_https
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/m2urllib2.html b/doc/html/_modules/M2Crypto/m2urllib2.html index 2b18152..f2897c8 100644 --- a/doc/html/_modules/M2Crypto/m2urllib2.html +++ b/doc/html/_modules/M2Crypto/m2urllib2.html @@ -1,55 +1,45 @@ - - - - M2Crypto.m2urllib2 — M2Crypto documentation - - + M2Crypto.m2urllib2 — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.m2urllib2

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """
                           M2Crypto enhancement to Python's urllib2 for handling
                          @@ -66,19 +56,19 @@
                           
                           import socket
                           
                          -from M2Crypto import SSL, httpslib, six, util
                          +from M2Crypto import SSL, httpslib, six, util
                           
                          -from M2Crypto.six.moves.urllib_parse import urldefrag, urlparse as url_parse
                          -from M2Crypto.six.moves.urllib_response import addinfourl
                          +from M2Crypto.six.moves.urllib_parse import urldefrag, urlparse as url_parse
                          +from M2Crypto.six.moves.urllib_response import addinfourl
                           if util.py27plus:
                          -    from typing import List, Optional  # noqa
                          +    from typing import List, Optional  # noqa
                           
                           # six.moves doesn't support star imports
                           if six.PY3:
                          -    from urllib.request import *  # noqa other modules want to import
                          -    from urllib.error import *  # noqa other modules want to import
                          +    from urllib.request import *  # noqa other modules want to import
                          +    from urllib.error import *  # noqa other modules want to import
                           else:
                          -    from urllib2 import *  # noqa
                          +    from urllib2 import *  # noqa
                           
                           
                           try:
                          @@ -103,11 +93,11 @@
                           
                           
                           
                          [docs]class HTTPSHandler(AbstractHTTPHandler): - def __init__(self, ssl_context=None): + def __init__(self, ssl_context=None): # type: (SSL.Context) -> None - AbstractHTTPHandler.__init__(self) + AbstractHTTPHandler.__init__(self) - if ssl_context is not None: + if ssl_context is not None: assert isinstance(ssl_context, SSL.Context), ssl_context self.ctx = ssl_context else: @@ -175,21 +165,27 @@ # for Windows. That adapter calls recv(), so delegate recv() # to read(). This weird wrapping allows the returned object to # have readline() and readlines() methods. - r.recv = r.read - fp = socket._fileobject(r, close=True) + if six.PY2: + fp = socket._fileobject(r, close=True) + else: + r._decref_socketios = lambda: None + r.ssl = h.sock.ssl + r._timeout = -1.0 + r.recv_into = lambda b: SSL.Connection.recv_into(r, b) + fp = socket.SocketIO(r, 'rb') resp = addinfourl(fp, r.msg, req.get_full_url()) resp.code = r.status resp.msg = r.reason - return resp -
                          - https_request = AbstractHTTPHandler.do_request_ + return resp
                          + + https_request = AbstractHTTPHandler.do_request_
                          -# Copied from urllib2 with modifications for ssl
                          -
                          [docs]def build_opener(ssl_context=None, *handlers): - # type: (Optional[SSL.Context], *List[object]) -> OpenerDirector +# Copied from urllib2 with modifications for ssl +
                          [docs]def build_opener(ssl_context=None, *handlers): + # type: (Optional[SSL.Context], *object) -> OpenerDirector """Create an opener object from a list of handlers. The opener will use several default handlers, including support @@ -234,41 +230,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/m2xmlrpclib.html b/doc/html/_modules/M2Crypto/m2xmlrpclib.html index 7869083..2bb0a87 100644 --- a/doc/html/_modules/M2Crypto/m2xmlrpclib.html +++ b/doc/html/_modules/M2Crypto/m2xmlrpclib.html @@ -1,55 +1,45 @@ - - - - M2Crypto.m2xmlrpclib — M2Crypto documentation - - + M2Crypto.m2xmlrpclib — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.m2xmlrpclib

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """M2Crypto enhancement to xmlrpclib.
                           
                          @@ -59,16 +49,16 @@
                           
                           import M2Crypto
                           
                          -from M2Crypto import SSL, httpslib, m2urllib, six, util
                          +from M2Crypto import SSL, httpslib, m2urllib, six, util
                           if util.py27plus:
                          -    from typing import Any, AnyStr, Callable, Optional  # noqa
                          +    from typing import Any, AnyStr, Callable, Optional  # noqa
                           
                          -from M2Crypto.six.moves.xmlrpc_client import ProtocolError, Transport
                          +from M2Crypto.six.moves.xmlrpc_client import ProtocolError, Transport
                           # six.moves doesn't support star imports
                           if six.PY3:
                          -    from xmlrpc.client import *  # noqa
                          +    from xmlrpc.client import *  # noqa
                           else:
                          -    from xmlrpclib import *  # noqa
                          +    from xmlrpclib import *  # noqa
                           
                           __version__ = M2Crypto.__version__
                           
                          @@ -78,10 +68,10 @@
                               user_agent = "M2Crypto_XMLRPC/%s - %s" % (__version__,
                                                                         Transport.user_agent)
                           
                          -    def __init__(self, ssl_context=None, *args, **kw):
                          -        # type: (Optional[SSL.Context], *List[Any], **Dict[Any, Any]) -> None
                          -        Transport.__init__(self, *args, **kw)
                          -        if ssl_context is None:
                          +    def __init__(self, ssl_context=None, *args, **kw):
                          +        # type: (Optional[SSL.Context], *Any, **Any) -> None
                          +        Transport.__init__(self, *args, **kw)
                          +        if ssl_context is None:
                                       self.ssl_ctx = SSL.Context()
                                   else:
                                       self.ssl_ctx = ssl_context
                          @@ -108,7 +98,7 @@
                                   h.putheader("Content-Length", str(len(request_body)))
                           
                                   # Authorisation.
                          -        if user_passwd is not None:
                          +        if user_passwd is not None:
                                       auth = base64.encodestring(user_passwd).strip()
                                       h.putheader('Authorization', 'Basic %s' % auth)
                           
                          @@ -133,41 +123,41 @@
                                     
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/threading.html b/doc/html/_modules/M2Crypto/threading.html index 41edb54..113c6e1 100644 --- a/doc/html/_modules/M2Crypto/threading.html +++ b/doc/html/_modules/M2Crypto/threading.html @@ -1,55 +1,45 @@ - - - - M2Crypto.threading — M2Crypto documentation - - + M2Crypto.threading — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.threading

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           
                           """
                           M2Crypto threading support, required for multithreaded applications.
                          @@ -57,7 +47,7 @@
                           Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
                           
                           # M2Crypto
                          -from M2Crypto import m2
                          +from M2Crypto import m2
                           
                           
                           
                          [docs]def init(): @@ -65,9 +55,9 @@ """ Initialize threading support. """ - m2.threading_init() + m2.threading_init()
                          + -
                          [docs]def cleanup(): # type: () -> None """ @@ -79,41 +69,41 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/M2Crypto/util.html b/doc/html/_modules/M2Crypto/util.html index 0667b9f..8303b88 100644 --- a/doc/html/_modules/M2Crypto/util.html +++ b/doc/html/_modules/M2Crypto/util.html @@ -1,55 +1,45 @@ - - - - M2Crypto.util — M2Crypto documentation - - + M2Crypto.util — M2Crypto documentation + - - - + + + + + + + + - +
                          -
                          +

                          Source code for M2Crypto.util

                          -from __future__ import absolute_import
                          +from __future__ import absolute_import
                           """
                               M2Crypto utility routines.
                           
                          @@ -66,9 +56,9 @@
                           # This means "Python 2.7 or higher" so it is True for py3k as well
                           py27plus = sys.version_info[:2] > (2, 6)  # type: bool
                           
                          -from M2Crypto import m2, six
                          +from M2Crypto import m2, six
                           if py27plus:
                          -    from typing import AnyStr, Tuple, Union  # noqa
                          +    from typing import AnyStr, Tuple, Union  # noqa
                               # see https://github.com/python/typeshed/issues/222
                               AddrType = Union[Tuple[str, int], str]
                           
                          @@ -76,45 +66,49 @@
                           
                           
                           
                          [docs]class UtilError(Exception): - pass -
                          + pass
                          + m2.util_init(UtilError)
                          [docs]def pkcs5_pad(data, blklen=8): # type: (str, int) -> str pad = (8 - (len(data) % 8)) - return data + chr(pad) * pad + return data + chr(pad) * pad
                          + -
                          [docs]def pkcs7_pad(data, blklen): # type: (str, int) -> str if blklen > 255: raise ValueError('illegal block size') pad = (blklen - (len(data) % blklen)) - return data + chr(pad) * pad + return data + chr(pad) * pad
                          # before the introduction of py3{bytes,str}, python2 code -# was just using args as-is
                          +# was just using args as-is if six.PY2: def py3bytes(x): # type: (AnyStr) -> Optional[bytes,bytearray] - if isinstance(x, unicode): + if isinstance(x, unicode): return x.encode('utf8') elif isinstance(x, (bytearray, str)): return x else: - raise TypeError('No string argument provided') + raise TypeError( + 'No string argument provided (type of x is %s)' % + type(x)) def py3str(x): # type: (Optional[str,bytearray]) -> str if isinstance(x, bytearray): return str(x) - elif isinstance(x, (str, unicode)): + elif isinstance(x, (str, unicode)): return x else: - raise TypeError('No string argument provided') + raise TypeError( + 'No string argument provided (type of x is %s)' % + type(x)) else:
                          [docs] def py3bytes(x): # type: (AnyStr) -> Optional[bytes,bytearray] @@ -123,8 +117,10 @@ elif isinstance(x, (bytes, bytearray)): return x else: - raise TypeError('No string argument provided') -
                          + raise TypeError( + 'No string argument provided (type of x is %s)' % + type(x))
                          +
                          [docs] def py3str(x): # type: (Optional[AnyStr,bytearray]) -> str if isinstance(x, (bytes, bytearray)): @@ -132,35 +128,37 @@ elif isinstance(x, str): return x else: - raise TypeError('No string argument provided') + raise TypeError( + 'No string argument provided (type of x is %s)' % + type(x))
                          + -
                          [docs]def bin_to_hex(b): # type: (bytes) -> str - return py3str(binascii.b2a_base64(b)[:-1]) + return py3str(binascii.b2a_base64(b)[:-1])
                          + -
                          [docs]def octx_to_num(x): # type: (bytes) -> int - return int(binascii.hexlify(x), 16) + return int(binascii.hexlify(x), 16)
                          + -
                          [docs]def genparam_callback(p, n, out=sys.stdout): # type: (int, Any, file) -> None ch = ['.', '+', '*', '\n'] out.write(ch[p]) - out.flush() + out.flush()
                          + -
                          [docs]def quiet_genparam_callback(p, n, out): # type: (Any, Any, Any) -> None - pass + pass
                          + -
                          [docs]def passphrase_callback(v, prompt1='Enter passphrase:', prompt2='Verify passphrase:'): # type: (bool, str, str) -> Optional[str] - from getpass import getpass + from getpass import getpass while 1: try: p1 = getpass(prompt1) @@ -171,53 +169,53 @@ else: break except KeyboardInterrupt: - return None - return p1 + return None + return p1
                          + -
                          [docs]def no_passphrase_callback(*args): - # type: (List[Any]) -> str + # type: (*Any) -> str return ''
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/index.html b/doc/html/_modules/index.html index 872a977..83a3756 100644 --- a/doc/html/_modules/index.html +++ b/doc/html/_modules/index.html @@ -1,50 +1,42 @@ - - - - Overview: module code — M2Crypto documentation - - + Overview: module code — M2Crypto documentation + - - + + + + + + + + - +
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/_modules/urllib2.html b/doc/html/_modules/urllib2.html new file mode 100644 index 0000000..bf30410 --- /dev/null +++ b/doc/html/_modules/urllib2.html @@ -0,0 +1,1575 @@ + + + + + + + urllib2 — M2Crypto documentation + + + + + + + + + + + + + + + + + + +
                          +
                          +
                          +
                          + +

                          Source code for urllib2

                          +"""An extensible library for opening URLs using a variety of protocols
                          +
                          +The simplest way to use this module is to call the urlopen function,
                          +which accepts a string containing a URL or a Request object (described
                          +below).  It opens the URL and returns the results as file-like
                          +object; the returned object has some extra methods described below.
                          +
                          +The OpenerDirector manages a collection of Handler objects that do
                          +all the actual work.  Each Handler implements a particular protocol or
                          +option.  The OpenerDirector is a composite object that invokes the
                          +Handlers needed to open the requested URL.  For example, the
                          +HTTPHandler performs HTTP GET and POST requests and deals with
                          +non-error returns.  The HTTPRedirectHandler automatically deals with
                          +HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler
                          +deals with digest authentication.
                          +
                          +urlopen(url, data=None) -- Basic usage is the same as original
                          +urllib.  pass the url and optionally data to post to an HTTP URL, and
                          +get a file-like object back.  One difference is that you can also pass
                          +a Request instance instead of URL.  Raises a URLError (subclass of
                          +IOError); for HTTP errors, raises an HTTPError, which can also be
                          +treated as a valid response.
                          +
                          +build_opener -- Function that creates a new OpenerDirector instance.
                          +Will install the default handlers.  Accepts one or more Handlers as
                          +arguments, either instances or Handler classes that it will
                          +instantiate.  If one of the argument is a subclass of the default
                          +handler, the argument will be installed instead of the default.
                          +
                          +install_opener -- Installs a new opener as the default opener.
                          +
                          +objects of interest:
                          +
                          +OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages
                          +the Handler classes, while dealing with requests and responses.
                          +
                          +Request -- An object that encapsulates the state of a request.  The
                          +state can be as simple as the URL.  It can also include extra HTTP
                          +headers, e.g. a User-Agent.
                          +
                          +BaseHandler --
                          +
                          +exceptions:
                          +URLError -- A subclass of IOError, individual protocols have their own
                          +specific subclass.
                          +
                          +HTTPError -- Also a valid HTTP response, so you can treat an HTTP error
                          +as an exceptional event or valid response.
                          +
                          +internals:
                          +BaseHandler and parent
                          +_call_chain conventions
                          +
                          +Example usage:
                          +
                          +import urllib2
                          +
                          +# set up authentication info
                          +authinfo = urllib2.HTTPBasicAuthHandler()
                          +authinfo.add_password(realm='PDQ Application',
                          +                      uri='https://mahler:8092/site-updates.py',
                          +                      user='klem',
                          +                      passwd='geheim$parole')
                          +
                          +proxy_support = urllib2.ProxyHandler({"http" : "http://ahad-haam:3128"})
                          +
                          +# build a new opener that adds authentication and caching FTP handlers
                          +opener = urllib2.build_opener(proxy_support, authinfo, urllib2.CacheFTPHandler)
                          +
                          +# install it
                          +urllib2.install_opener(opener)
                          +
                          +f = urllib2.urlopen('http://www.python.org/')
                          +
                          +
                          +"""
                          +
                          +# XXX issues:
                          +# If an authentication error handler that tries to perform
                          +# authentication for some reason but fails, how should the error be
                          +# signalled?  The client needs to know the HTTP error code.  But if
                          +# the handler knows that the problem was, e.g., that it didn't know
                          +# that hash algo that requested in the challenge, it would be good to
                          +# pass that information along to the client, too.
                          +# ftp errors aren't handled cleanly
                          +# check digest against correct (i.e. non-apache) implementation
                          +
                          +# Possible extensions:
                          +# complex proxies  XXX not sure what exactly was meant by this
                          +# abstract factory for opener
                          +
                          +import base64
                          +import hashlib
                          +import httplib
                          +import mimetools
                          +import os
                          +import posixpath
                          +import random
                          +import re
                          +import socket
                          +import sys
                          +import time
                          +import urlparse
                          +import bisect
                          +import warnings
                          +
                          +try:
                          +    from cStringIO import StringIO
                          +except ImportError:
                          +    from StringIO import StringIO
                          +
                          +# check for SSL
                          +try:
                          +    import ssl
                          +except ImportError:
                          +    _have_ssl = False
                          +else:
                          +    _have_ssl = True
                          +
                          +from urllib import (unwrap, unquote, splittype, splithost, quote,
                          +     addinfourl, splitport, splittag, toBytes,
                          +     splitattr, ftpwrapper, splituser, splitpasswd, splitvalue)
                          +
                          +# support for FileHandler, proxies via environment variables
                          +from urllib import localhost, url2pathname, getproxies, proxy_bypass
                          +
                          +# used in User-Agent header sent
                          +__version__ = sys.version[:3]
                          +
                          +_opener = None
                          +def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
                          +            cafile=None, capath=None, cadefault=False, context=None):
                          +    global _opener
                          +    if cafile or capath or cadefault:
                          +        if context is not None:
                          +            raise ValueError(
                          +                "You can't pass both context and any of cafile, capath, and "
                          +                "cadefault"
                          +            )
                          +        if not _have_ssl:
                          +            raise ValueError('SSL support not available')
                          +        context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH,
                          +                                             cafile=cafile,
                          +                                             capath=capath)
                          +        https_handler = HTTPSHandler(context=context)
                          +        opener = build_opener(https_handler)
                          +    elif context:
                          +        https_handler = HTTPSHandler(context=context)
                          +        opener = build_opener(https_handler)
                          +    elif _opener is None:
                          +        _opener = opener = build_opener()
                          +    else:
                          +        opener = _opener
                          +    return opener.open(url, data, timeout)
                          +
                          +def install_opener(opener):
                          +    global _opener
                          +    _opener = opener
                          +
                          +# do these error classes make sense?
                          +# make sure all of the IOError stuff is overridden.  we just want to be
                          +# subtypes.
                          +
                          +class URLError(IOError):
                          +    # URLError is a sub-type of IOError, but it doesn't share any of
                          +    # the implementation.  need to override __init__ and __str__.
                          +    # It sets self.args for compatibility with other EnvironmentError
                          +    # subclasses, but args doesn't have the typical format with errno in
                          +    # slot 0 and strerror in slot 1.  This may be better than nothing.
                          +    def __init__(self, reason):
                          +        self.args = reason,
                          +        self.reason = reason
                          +
                          +    def __str__(self):
                          +        return '<urlopen error %s>' % self.reason
                          +
                          +class HTTPError(URLError, addinfourl):
                          +    """Raised when HTTP error occurs, but also acts like non-error return"""
                          +    __super_init = addinfourl.__init__
                          +
                          +    def __init__(self, url, code, msg, hdrs, fp):
                          +        self.code = code
                          +        self.msg = msg
                          +        self.hdrs = hdrs
                          +        self.fp = fp
                          +        self.filename = url
                          +        # The addinfourl classes depend on fp being a valid file
                          +        # object.  In some cases, the HTTPError may not have a valid
                          +        # file object.  If this happens, the simplest workaround is to
                          +        # not initialize the base classes.
                          +        if fp is not None:
                          +            self.__super_init(fp, hdrs, url, code)
                          +
                          +    def __str__(self):
                          +        return 'HTTP Error %s: %s' % (self.code, self.msg)
                          +
                          +    # since URLError specifies a .reason attribute, HTTPError should also
                          +    #  provide this attribute. See issue13211 fo discussion.
                          +    @property
                          +    def reason(self):
                          +        return self.msg
                          +
                          +    def info(self):
                          +        return self.hdrs
                          +
                          +# copied from cookielib.py
                          +_cut_port_re = re.compile(r":\d+$")
                          +def request_host(request):
                          +    """Return request-host, as defined by RFC 2965.
                          +
                          +    Variation from RFC: returned value is lowercased, for convenient
                          +    comparison.
                          +
                          +    """
                          +    url = request.get_full_url()
                          +    host = urlparse.urlparse(url)[1]
                          +    if host == "":
                          +        host = request.get_header("Host", "")
                          +
                          +    # remove port, if present
                          +    host = _cut_port_re.sub("", host, 1)
                          +    return host.lower()
                          +
                          +class Request:
                          +
                          +    def __init__(self, url, data=None, headers={},
                          +                 origin_req_host=None, unverifiable=False):
                          +        # unwrap('<URL:type://host/path>') --> 'type://host/path'
                          +        self.__original = unwrap(url)
                          +        self.__original, self.__fragment = splittag(self.__original)
                          +        self.type = None
                          +        # self.__r_type is what's left after doing the splittype
                          +        self.host = None
                          +        self.port = None
                          +        self._tunnel_host = None
                          +        self.data = data
                          +        self.headers = {}
                          +        for key, value in headers.items():
                          +            self.add_header(key, value)
                          +        self.unredirected_hdrs = {}
                          +        if origin_req_host is None:
                          +            origin_req_host = request_host(self)
                          +        self.origin_req_host = origin_req_host
                          +        self.unverifiable = unverifiable
                          +
                          +    def __getattr__(self, attr):
                          +        # XXX this is a fallback mechanism to guard against these
                          +        # methods getting called in a non-standard order.  this may be
                          +        # too complicated and/or unnecessary.
                          +        # XXX should the __r_XXX attributes be public?
                          +        if attr in ('_Request__r_type', '_Request__r_host'):
                          +            getattr(self, 'get_' + attr[12:])()
                          +            return self.__dict__[attr]
                          +        raise AttributeError, attr
                          +
                          +    def get_method(self):
                          +        if self.has_data():
                          +            return "POST"
                          +        else:
                          +            return "GET"
                          +
                          +    # XXX these helper methods are lame
                          +
                          +    def add_data(self, data):
                          +        self.data = data
                          +
                          +    def has_data(self):
                          +        return self.data is not None
                          +
                          +    def get_data(self):
                          +        return self.data
                          +
                          +    def get_full_url(self):
                          +        if self.__fragment:
                          +            return '%s#%s' % (self.__original, self.__fragment)
                          +        else:
                          +            return self.__original
                          +
                          +    def get_type(self):
                          +        if self.type is None:
                          +            self.type, self.__r_type = splittype(self.__original)
                          +            if self.type is None:
                          +                raise ValueError, "unknown url type: %s" % self.__original
                          +        return self.type
                          +
                          +    def get_host(self):
                          +        if self.host is None:
                          +            self.host, self.__r_host = splithost(self.__r_type)
                          +            if self.host:
                          +                self.host = unquote(self.host)
                          +        return self.host
                          +
                          +    def get_selector(self):
                          +        return self.__r_host
                          +
                          +    def set_proxy(self, host, type):
                          +        if self.type == 'https' and not self._tunnel_host:
                          +            self._tunnel_host = self.host
                          +        else:
                          +            self.type = type
                          +            self.__r_host = self.__original
                          +
                          +        self.host = host
                          +
                          +    def has_proxy(self):
                          +        return self.__r_host == self.__original
                          +
                          +    def get_origin_req_host(self):
                          +        return self.origin_req_host
                          +
                          +    def is_unverifiable(self):
                          +        return self.unverifiable
                          +
                          +    def add_header(self, key, val):
                          +        # useful for something like authentication
                          +        self.headers[key.capitalize()] = val
                          +
                          +    def add_unredirected_header(self, key, val):
                          +        # will not be added to a redirected request
                          +        self.unredirected_hdrs[key.capitalize()] = val
                          +
                          +    def has_header(self, header_name):
                          +        return (header_name in self.headers or
                          +                header_name in self.unredirected_hdrs)
                          +
                          +    def get_header(self, header_name, default=None):
                          +        return self.headers.get(
                          +            header_name,
                          +            self.unredirected_hdrs.get(header_name, default))
                          +
                          +    def header_items(self):
                          +        hdrs = self.unredirected_hdrs.copy()
                          +        hdrs.update(self.headers)
                          +        return hdrs.items()
                          +
                          +class OpenerDirector:
                          +    def __init__(self):
                          +        client_version = "Python-urllib/%s" % __version__
                          +        self.addheaders = [('User-agent', client_version)]
                          +        # self.handlers is retained only for backward compatibility
                          +        self.handlers = []
                          +        # manage the individual handlers
                          +        self.handle_open = {}
                          +        self.handle_error = {}
                          +        self.process_response = {}
                          +        self.process_request = {}
                          +
                          +    def add_handler(self, handler):
                          +        if not hasattr(handler, "add_parent"):
                          +            raise TypeError("expected BaseHandler instance, got %r" %
                          +                            type(handler))
                          +
                          +        added = False
                          +        for meth in dir(handler):
                          +            if meth in ["redirect_request", "do_open", "proxy_open"]:
                          +                # oops, coincidental match
                          +                continue
                          +
                          +            i = meth.find("_")
                          +            protocol = meth[:i]
                          +            condition = meth[i+1:]
                          +
                          +            if condition.startswith("error"):
                          +                j = condition.find("_") + i + 1
                          +                kind = meth[j+1:]
                          +                try:
                          +                    kind = int(kind)
                          +                except ValueError:
                          +                    pass
                          +                lookup = self.handle_error.get(protocol, {})
                          +                self.handle_error[protocol] = lookup
                          +            elif condition == "open":
                          +                kind = protocol
                          +                lookup = self.handle_open
                          +            elif condition == "response":
                          +                kind = protocol
                          +                lookup = self.process_response
                          +            elif condition == "request":
                          +                kind = protocol
                          +                lookup = self.process_request
                          +            else:
                          +                continue
                          +
                          +            handlers = lookup.setdefault(kind, [])
                          +            if handlers:
                          +                bisect.insort(handlers, handler)
                          +            else:
                          +                handlers.append(handler)
                          +            added = True
                          +
                          +        if added:
                          +            bisect.insort(self.handlers, handler)
                          +            handler.add_parent(self)
                          +
                          +    def close(self):
                          +        # Only exists for backwards compatibility.
                          +        pass
                          +
                          +    def _call_chain(self, chain, kind, meth_name, *args):
                          +        # Handlers raise an exception if no one else should try to handle
                          +        # the request, or return None if they can't but another handler
                          +        # could.  Otherwise, they return the response.
                          +        handlers = chain.get(kind, ())
                          +        for handler in handlers:
                          +            func = getattr(handler, meth_name)
                          +
                          +            result = func(*args)
                          +            if result is not None:
                          +                return result
                          +
                          +    def open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
                          +        # accept a URL or a Request object
                          +        if isinstance(fullurl, basestring):
                          +            req = Request(fullurl, data)
                          +        else:
                          +            req = fullurl
                          +            if data is not None:
                          +                req.add_data(data)
                          +
                          +        req.timeout = timeout
                          +        protocol = req.get_type()
                          +
                          +        # pre-process request
                          +        meth_name = protocol+"_request"
                          +        for processor in self.process_request.get(protocol, []):
                          +            meth = getattr(processor, meth_name)
                          +            req = meth(req)
                          +
                          +        response = self._open(req, data)
                          +
                          +        # post-process response
                          +        meth_name = protocol+"_response"
                          +        for processor in self.process_response.get(protocol, []):
                          +            meth = getattr(processor, meth_name)
                          +            response = meth(req, response)
                          +
                          +        return response
                          +
                          +    def _open(self, req, data=None):
                          +        result = self._call_chain(self.handle_open, 'default',
                          +                                  'default_open', req)
                          +        if result:
                          +            return result
                          +
                          +        protocol = req.get_type()
                          +        result = self._call_chain(self.handle_open, protocol, protocol +
                          +                                  '_open', req)
                          +        if result:
                          +            return result
                          +
                          +        return self._call_chain(self.handle_open, 'unknown',
                          +                                'unknown_open', req)
                          +
                          +    def error(self, proto, *args):
                          +        if proto in ('http', 'https'):
                          +            # XXX http[s] protocols are special-cased
                          +            dict = self.handle_error['http'] # https is not different than http
                          +            proto = args[2]  # YUCK!
                          +            meth_name = 'http_error_%s' % proto
                          +            http_err = 1
                          +            orig_args = args
                          +        else:
                          +            dict = self.handle_error
                          +            meth_name = proto + '_error'
                          +            http_err = 0
                          +        args = (dict, proto, meth_name) + args
                          +        result = self._call_chain(*args)
                          +        if result:
                          +            return result
                          +
                          +        if http_err:
                          +            args = (dict, 'default', 'http_error_default') + orig_args
                          +            return self._call_chain(*args)
                          +
                          +# XXX probably also want an abstract factory that knows when it makes
                          +# sense to skip a superclass in favor of a subclass and when it might
                          +# make sense to include both
                          +
                          +def build_opener(*handlers):
                          +    """Create an opener object from a list of handlers.
                          +
                          +    The opener will use several default handlers, including support
                          +    for HTTP, FTP and when applicable, HTTPS.
                          +
                          +    If any of the handlers passed as arguments are subclasses of the
                          +    default handlers, the default handlers will not be used.
                          +    """
                          +    import types
                          +    def isclass(obj):
                          +        return isinstance(obj, (types.ClassType, type))
                          +
                          +    opener = OpenerDirector()
                          +    default_classes = [ProxyHandler, UnknownHandler, HTTPHandler,
                          +                       HTTPDefaultErrorHandler, HTTPRedirectHandler,
                          +                       FTPHandler, FileHandler, HTTPErrorProcessor]
                          +    if hasattr(httplib, 'HTTPS'):
                          +        default_classes.append(HTTPSHandler)
                          +    skip = set()
                          +    for klass in default_classes:
                          +        for check in handlers:
                          +            if isclass(check):
                          +                if issubclass(check, klass):
                          +                    skip.add(klass)
                          +            elif isinstance(check, klass):
                          +                skip.add(klass)
                          +    for klass in skip:
                          +        default_classes.remove(klass)
                          +
                          +    for klass in default_classes:
                          +        opener.add_handler(klass())
                          +
                          +    for h in handlers:
                          +        if isclass(h):
                          +            h = h()
                          +        opener.add_handler(h)
                          +    return opener
                          +
                          +class BaseHandler:
                          +    handler_order = 500
                          +
                          +    def add_parent(self, parent):
                          +        self.parent = parent
                          +
                          +    def close(self):
                          +        # Only exists for backwards compatibility
                          +        pass
                          +
                          +    def __lt__(self, other):
                          +        if not hasattr(other, "handler_order"):
                          +            # Try to preserve the old behavior of having custom classes
                          +            # inserted after default ones (works only for custom user
                          +            # classes which are not aware of handler_order).
                          +            return True
                          +        return self.handler_order < other.handler_order
                          +
                          +
                          +class HTTPErrorProcessor(BaseHandler):
                          +    """Process HTTP error responses."""
                          +    handler_order = 1000  # after all other processing
                          +
                          +    def http_response(self, request, response):
                          +        code, msg, hdrs = response.code, response.msg, response.info()
                          +
                          +        # According to RFC 2616, "2xx" code indicates that the client's
                          +        # request was successfully received, understood, and accepted.
                          +        if not (200 <= code < 300):
                          +            response = self.parent.error(
                          +                'http', request, response, code, msg, hdrs)
                          +
                          +        return response
                          +
                          +    https_response = http_response
                          +
                          +class HTTPDefaultErrorHandler(BaseHandler):
                          +    def http_error_default(self, req, fp, code, msg, hdrs):
                          +        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
                          +
                          +class HTTPRedirectHandler(BaseHandler):
                          +    # maximum number of redirections to any single URL
                          +    # this is needed because of the state that cookies introduce
                          +    max_repeats = 4
                          +    # maximum total number of redirections (regardless of URL) before
                          +    # assuming we're in a loop
                          +    max_redirections = 10
                          +
                          +    def redirect_request(self, req, fp, code, msg, headers, newurl):
                          +        """Return a Request or None in response to a redirect.
                          +
                          +        This is called by the http_error_30x methods when a
                          +        redirection response is received.  If a redirection should
                          +        take place, return a new Request to allow http_error_30x to
                          +        perform the redirect.  Otherwise, raise HTTPError if no-one
                          +        else should try to handle this url.  Return None if you can't
                          +        but another Handler might.
                          +        """
                          +        m = req.get_method()
                          +        if (code in (301, 302, 303, 307) and m in ("GET", "HEAD")
                          +            or code in (301, 302, 303) and m == "POST"):
                          +            # Strictly (according to RFC 2616), 301 or 302 in response
                          +            # to a POST MUST NOT cause a redirection without confirmation
                          +            # from the user (of urllib2, in this case).  In practice,
                          +            # essentially all clients do redirect in this case, so we
                          +            # do the same.
                          +            # be conciliant with URIs containing a space
                          +            newurl = newurl.replace(' ', '%20')
                          +            newheaders = dict((k,v) for k,v in req.headers.items()
                          +                              if k.lower() not in ("content-length", "content-type")
                          +                             )
                          +            return Request(newurl,
                          +                           headers=newheaders,
                          +                           origin_req_host=req.get_origin_req_host(),
                          +                           unverifiable=True)
                          +        else:
                          +            raise HTTPError(req.get_full_url(), code, msg, headers, fp)
                          +
                          +    # Implementation note: To avoid the server sending us into an
                          +    # infinite loop, the request object needs to track what URLs we
                          +    # have already seen.  Do this by adding a handler-specific
                          +    # attribute to the Request object.
                          +    def http_error_302(self, req, fp, code, msg, headers):
                          +        # Some servers (incorrectly) return multiple Location headers
                          +        # (so probably same goes for URI).  Use first header.
                          +        if 'location' in headers:
                          +            newurl = headers.getheaders('location')[0]
                          +        elif 'uri' in headers:
                          +            newurl = headers.getheaders('uri')[0]
                          +        else:
                          +            return
                          +
                          +        # fix a possible malformed URL
                          +        urlparts = urlparse.urlparse(newurl)
                          +        if not urlparts.path and urlparts.netloc:
                          +            urlparts = list(urlparts)
                          +            urlparts[2] = "/"
                          +        newurl = urlparse.urlunparse(urlparts)
                          +
                          +        newurl = urlparse.urljoin(req.get_full_url(), newurl)
                          +
                          +        # For security reasons we do not allow redirects to protocols
                          +        # other than HTTP, HTTPS or FTP.
                          +        newurl_lower = newurl.lower()
                          +        if not (newurl_lower.startswith('http://') or
                          +                newurl_lower.startswith('https://') or
                          +                newurl_lower.startswith('ftp://')):
                          +            raise HTTPError(newurl, code,
                          +                            msg + " - Redirection to url '%s' is not allowed" %
                          +                            newurl,
                          +                            headers, fp)
                          +
                          +        # XXX Probably want to forget about the state of the current
                          +        # request, although that might interact poorly with other
                          +        # handlers that also use handler-specific request attributes
                          +        new = self.redirect_request(req, fp, code, msg, headers, newurl)
                          +        if new is None:
                          +            return
                          +
                          +        # loop detection
                          +        # .redirect_dict has a key url if url was previously visited.
                          +        if hasattr(req, 'redirect_dict'):
                          +            visited = new.redirect_dict = req.redirect_dict
                          +            if (visited.get(newurl, 0) >= self.max_repeats or
                          +                len(visited) >= self.max_redirections):
                          +                raise HTTPError(req.get_full_url(), code,
                          +                                self.inf_msg + msg, headers, fp)
                          +        else:
                          +            visited = new.redirect_dict = req.redirect_dict = {}
                          +        visited[newurl] = visited.get(newurl, 0) + 1
                          +
                          +        # Don't close the fp until we are sure that we won't use it
                          +        # with HTTPError.
                          +        fp.read()
                          +        fp.close()
                          +
                          +        return self.parent.open(new, timeout=req.timeout)
                          +
                          +    http_error_301 = http_error_303 = http_error_307 = http_error_302
                          +
                          +    inf_msg = "The HTTP server returned a redirect error that would " \
                          +              "lead to an infinite loop.\n" \
                          +              "The last 30x error message was:\n"
                          +
                          +
                          +def _parse_proxy(proxy):
                          +    """Return (scheme, user, password, host/port) given a URL or an authority.
                          +
                          +    If a URL is supplied, it must have an authority (host:port) component.
                          +    According to RFC 3986, having an authority component means the URL must
                          +    have two slashes after the scheme:
                          +
                          +    >>> _parse_proxy('file:/ftp.example.com/')
                          +    Traceback (most recent call last):
                          +    ValueError: proxy URL with no authority: 'file:/ftp.example.com/'
                          +
                          +    The first three items of the returned tuple may be None.
                          +
                          +    Examples of authority parsing:
                          +
                          +    >>> _parse_proxy('proxy.example.com')
                          +    (None, None, None, 'proxy.example.com')
                          +    >>> _parse_proxy('proxy.example.com:3128')
                          +    (None, None, None, 'proxy.example.com:3128')
                          +
                          +    The authority component may optionally include userinfo (assumed to be
                          +    username:password):
                          +
                          +    >>> _parse_proxy('joe:password@proxy.example.com')
                          +    (None, 'joe', 'password', 'proxy.example.com')
                          +    >>> _parse_proxy('joe:password@proxy.example.com:3128')
                          +    (None, 'joe', 'password', 'proxy.example.com:3128')
                          +
                          +    Same examples, but with URLs instead:
                          +
                          +    >>> _parse_proxy('http://proxy.example.com/')
                          +    ('http', None, None, 'proxy.example.com')
                          +    >>> _parse_proxy('http://proxy.example.com:3128/')
                          +    ('http', None, None, 'proxy.example.com:3128')
                          +    >>> _parse_proxy('http://joe:password@proxy.example.com/')
                          +    ('http', 'joe', 'password', 'proxy.example.com')
                          +    >>> _parse_proxy('http://joe:password@proxy.example.com:3128')
                          +    ('http', 'joe', 'password', 'proxy.example.com:3128')
                          +
                          +    Everything after the authority is ignored:
                          +
                          +    >>> _parse_proxy('ftp://joe:password@proxy.example.com/rubbish:3128')
                          +    ('ftp', 'joe', 'password', 'proxy.example.com')
                          +
                          +    Test for no trailing '/' case:
                          +
                          +    >>> _parse_proxy('http://joe:password@proxy.example.com')
                          +    ('http', 'joe', 'password', 'proxy.example.com')
                          +
                          +    """
                          +    scheme, r_scheme = splittype(proxy)
                          +    if not r_scheme.startswith("/"):
                          +        # authority
                          +        scheme = None
                          +        authority = proxy
                          +    else:
                          +        # URL
                          +        if not r_scheme.startswith("//"):
                          +            raise ValueError("proxy URL with no authority: %r" % proxy)
                          +        # We have an authority, so for RFC 3986-compliant URLs (by ss 3.
                          +        # and 3.3.), path is empty or starts with '/'
                          +        end = r_scheme.find("/", 2)
                          +        if end == -1:
                          +            end = None
                          +        authority = r_scheme[2:end]
                          +    userinfo, hostport = splituser(authority)
                          +    if userinfo is not None:
                          +        user, password = splitpasswd(userinfo)
                          +    else:
                          +        user = password = None
                          +    return scheme, user, password, hostport
                          +
                          +class ProxyHandler(BaseHandler):
                          +    # Proxies must be in front
                          +    handler_order = 100
                          +
                          +    def __init__(self, proxies=None):
                          +        if proxies is None:
                          +            proxies = getproxies()
                          +        assert hasattr(proxies, 'has_key'), "proxies must be a mapping"
                          +        self.proxies = proxies
                          +        for type, url in proxies.items():
                          +            setattr(self, '%s_open' % type,
                          +                    lambda r, proxy=url, type=type, meth=self.proxy_open: \
                          +                    meth(r, proxy, type))
                          +
                          +    def proxy_open(self, req, proxy, type):
                          +        orig_type = req.get_type()
                          +        proxy_type, user, password, hostport = _parse_proxy(proxy)
                          +
                          +        if proxy_type is None:
                          +            proxy_type = orig_type
                          +
                          +        req.get_host()
                          +
                          +        if req.host and proxy_bypass(req.host):
                          +            return None
                          +
                          +        if user and password:
                          +            user_pass = '%s:%s' % (unquote(user), unquote(password))
                          +            creds = base64.b64encode(user_pass).strip()
                          +            req.add_header('Proxy-authorization', 'Basic ' + creds)
                          +        hostport = unquote(hostport)
                          +        req.set_proxy(hostport, proxy_type)
                          +
                          +        if orig_type == proxy_type or orig_type == 'https':
                          +            # let other handlers take care of it
                          +            return None
                          +        else:
                          +            # need to start over, because the other handlers don't
                          +            # grok the proxy's URL type
                          +            # e.g. if we have a constructor arg proxies like so:
                          +            # {'http': 'ftp://proxy.example.com'}, we may end up turning
                          +            # a request for http://acme.example.com/a into one for
                          +            # ftp://proxy.example.com/a
                          +            return self.parent.open(req, timeout=req.timeout)
                          +
                          +class HTTPPasswordMgr:
                          +
                          +    def __init__(self):
                          +        self.passwd = {}
                          +
                          +    def add_password(self, realm, uri, user, passwd):
                          +        # uri could be a single URI or a sequence
                          +        if isinstance(uri, basestring):
                          +            uri = [uri]
                          +        if not realm in self.passwd:
                          +            self.passwd[realm] = {}
                          +        for default_port in True, False:
                          +            reduced_uri = tuple(
                          +                [self.reduce_uri(u, default_port) for u in uri])
                          +            self.passwd[realm][reduced_uri] = (user, passwd)
                          +
                          +    def find_user_password(self, realm, authuri):
                          +        domains = self.passwd.get(realm, {})
                          +        for default_port in True, False:
                          +            reduced_authuri = self.reduce_uri(authuri, default_port)
                          +            for uris, authinfo in domains.iteritems():
                          +                for uri in uris:
                          +                    if self.is_suburi(uri, reduced_authuri):
                          +                        return authinfo
                          +        return None, None
                          +
                          +    def reduce_uri(self, uri, default_port=True):
                          +        """Accept authority or URI and extract only the authority and path."""
                          +        # note HTTP URLs do not have a userinfo component
                          +        parts = urlparse.urlsplit(uri)
                          +        if parts[1]:
                          +            # URI
                          +            scheme = parts[0]
                          +            authority = parts[1]
                          +            path = parts[2] or '/'
                          +        else:
                          +            # host or host:port
                          +            scheme = None
                          +            authority = uri
                          +            path = '/'
                          +        host, port = splitport(authority)
                          +        if default_port and port is None and scheme is not None:
                          +            dport = {"http": 80,
                          +                     "https": 443,
                          +                     }.get(scheme)
                          +            if dport is not None:
                          +                authority = "%s:%d" % (host, dport)
                          +        return authority, path
                          +
                          +    def is_suburi(self, base, test):
                          +        """Check if test is below base in a URI tree
                          +
                          +        Both args must be URIs in reduced form.
                          +        """
                          +        if base == test:
                          +            return True
                          +        if base[0] != test[0]:
                          +            return False
                          +        common = posixpath.commonprefix((base[1], test[1]))
                          +        if len(common) == len(base[1]):
                          +            return True
                          +        return False
                          +
                          +
                          +class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr):
                          +
                          +    def find_user_password(self, realm, authuri):
                          +        user, password = HTTPPasswordMgr.find_user_password(self, realm,
                          +                                                            authuri)
                          +        if user is not None:
                          +            return user, password
                          +        return HTTPPasswordMgr.find_user_password(self, None, authuri)
                          +
                          +
                          +class AbstractBasicAuthHandler:
                          +
                          +    # XXX this allows for multiple auth-schemes, but will stupidly pick
                          +    # the last one with a realm specified.
                          +
                          +    # allow for double- and single-quoted realm values
                          +    # (single quotes are a violation of the RFC, but appear in the wild)
                          +    rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+'
                          +                    'realm=(["\']?)([^"\']*)\\2', re.I)
                          +
                          +    # XXX could pre-emptively send auth info already accepted (RFC 2617,
                          +    # end of section 2, and section 1.2 immediately after "credentials"
                          +    # production).
                          +
                          +    def __init__(self, password_mgr=None):
                          +        if password_mgr is None:
                          +            password_mgr = HTTPPasswordMgr()
                          +        self.passwd = password_mgr
                          +        self.add_password = self.passwd.add_password
                          +
                          +
                          +    def http_error_auth_reqed(self, authreq, host, req, headers):
                          +        # host may be an authority (without userinfo) or a URL with an
                          +        # authority
                          +        # XXX could be multiple headers
                          +        authreq = headers.get(authreq, None)
                          +
                          +        if authreq:
                          +            mo = AbstractBasicAuthHandler.rx.search(authreq)
                          +            if mo:
                          +                scheme, quote, realm = mo.groups()
                          +                if quote not in ['"', "'"]:
                          +                    warnings.warn("Basic Auth Realm was unquoted",
                          +                                  UserWarning, 2)
                          +                if scheme.lower() == 'basic':
                          +                    return self.retry_http_basic_auth(host, req, realm)
                          +
                          +    def retry_http_basic_auth(self, host, req, realm):
                          +        user, pw = self.passwd.find_user_password(realm, host)
                          +        if pw is not None:
                          +            raw = "%s:%s" % (user, pw)
                          +            auth = 'Basic %s' % base64.b64encode(raw).strip()
                          +            if req.get_header(self.auth_header, None) == auth:
                          +                return None
                          +            req.add_unredirected_header(self.auth_header, auth)
                          +            return self.parent.open(req, timeout=req.timeout)
                          +        else:
                          +            return None
                          +
                          +
                          +class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler):
                          +
                          +    auth_header = 'Authorization'
                          +
                          +    def http_error_401(self, req, fp, code, msg, headers):
                          +        url = req.get_full_url()
                          +        response = self.http_error_auth_reqed('www-authenticate',
                          +                                              url, req, headers)
                          +        return response
                          +
                          +
                          +class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler):
                          +
                          +    auth_header = 'Proxy-authorization'
                          +
                          +    def http_error_407(self, req, fp, code, msg, headers):
                          +        # http_error_auth_reqed requires that there is no userinfo component in
                          +        # authority.  Assume there isn't one, since urllib2 does not (and
                          +        # should not, RFC 3986 s. 3.2.1) support requests for URLs containing
                          +        # userinfo.
                          +        authority = req.get_host()
                          +        response = self.http_error_auth_reqed('proxy-authenticate',
                          +                                          authority, req, headers)
                          +        return response
                          +
                          +
                          +def randombytes(n):
                          +    """Return n random bytes."""
                          +    # Use /dev/urandom if it is available.  Fall back to random module
                          +    # if not.  It might be worthwhile to extend this function to use
                          +    # other platform-specific mechanisms for getting random bytes.
                          +    if os.path.exists("/dev/urandom"):
                          +        f = open("/dev/urandom")
                          +        s = f.read(n)
                          +        f.close()
                          +        return s
                          +    else:
                          +        L = [chr(random.randrange(0, 256)) for i in range(n)]
                          +        return "".join(L)
                          +
                          +class AbstractDigestAuthHandler:
                          +    # Digest authentication is specified in RFC 2617.
                          +
                          +    # XXX The client does not inspect the Authentication-Info header
                          +    # in a successful response.
                          +
                          +    # XXX It should be possible to test this implementation against
                          +    # a mock server that just generates a static set of challenges.
                          +
                          +    # XXX qop="auth-int" supports is shaky
                          +
                          +    def __init__(self, passwd=None):
                          +        if passwd is None:
                          +            passwd = HTTPPasswordMgr()
                          +        self.passwd = passwd
                          +        self.add_password = self.passwd.add_password
                          +        self.retried = 0
                          +        self.nonce_count = 0
                          +        self.last_nonce = None
                          +
                          +    def reset_retry_count(self):
                          +        self.retried = 0
                          +
                          +    def http_error_auth_reqed(self, auth_header, host, req, headers):
                          +        authreq = headers.get(auth_header, None)
                          +        if self.retried > 5:
                          +            # Don't fail endlessly - if we failed once, we'll probably
                          +            # fail a second time. Hm. Unless the Password Manager is
                          +            # prompting for the information. Crap. This isn't great
                          +            # but it's better than the current 'repeat until recursion
                          +            # depth exceeded' approach <wink>
                          +            raise HTTPError(req.get_full_url(), 401, "digest auth failed",
                          +                            headers, None)
                          +        else:
                          +            self.retried += 1
                          +        if authreq:
                          +            scheme = authreq.split()[0]
                          +            if scheme.lower() == 'digest':
                          +                return self.retry_http_digest_auth(req, authreq)
                          +
                          +    def retry_http_digest_auth(self, req, auth):
                          +        token, challenge = auth.split(' ', 1)
                          +        chal = parse_keqv_list(parse_http_list(challenge))
                          +        auth = self.get_authorization(req, chal)
                          +        if auth:
                          +            auth_val = 'Digest %s' % auth
                          +            if req.headers.get(self.auth_header, None) == auth_val:
                          +                return None
                          +            req.add_unredirected_header(self.auth_header, auth_val)
                          +            resp = self.parent.open(req, timeout=req.timeout)
                          +            return resp
                          +
                          +    def get_cnonce(self, nonce):
                          +        # The cnonce-value is an opaque
                          +        # quoted string value provided by the client and used by both client
                          +        # and server to avoid chosen plaintext attacks, to provide mutual
                          +        # authentication, and to provide some message integrity protection.
                          +        # This isn't a fabulous effort, but it's probably Good Enough.
                          +        dig = hashlib.sha1("%s:%s:%s:%s" % (self.nonce_count, nonce, time.ctime(),
                          +                                            randombytes(8))).hexdigest()
                          +        return dig[:16]
                          +
                          +    def get_authorization(self, req, chal):
                          +        try:
                          +            realm = chal['realm']
                          +            nonce = chal['nonce']
                          +            qop = chal.get('qop')
                          +            algorithm = chal.get('algorithm', 'MD5')
                          +            # mod_digest doesn't send an opaque, even though it isn't
                          +            # supposed to be optional
                          +            opaque = chal.get('opaque', None)
                          +        except KeyError:
                          +            return None
                          +
                          +        H, KD = self.get_algorithm_impls(algorithm)
                          +        if H is None:
                          +            return None
                          +
                          +        user, pw = self.passwd.find_user_password(realm, req.get_full_url())
                          +        if user is None:
                          +            return None
                          +
                          +        # XXX not implemented yet
                          +        if req.has_data():
                          +            entdig = self.get_entity_digest(req.get_data(), chal)
                          +        else:
                          +            entdig = None
                          +
                          +        A1 = "%s:%s:%s" % (user, realm, pw)
                          +        A2 = "%s:%s" % (req.get_method(),
                          +                        # XXX selector: what about proxies and full urls
                          +                        req.get_selector())
                          +        if qop == 'auth':
                          +            if nonce == self.last_nonce:
                          +                self.nonce_count += 1
                          +            else:
                          +                self.nonce_count = 1
                          +                self.last_nonce = nonce
                          +
                          +            ncvalue = '%08x' % self.nonce_count
                          +            cnonce = self.get_cnonce(nonce)
                          +            noncebit = "%s:%s:%s:%s:%s" % (nonce, ncvalue, cnonce, qop, H(A2))
                          +            respdig = KD(H(A1), noncebit)
                          +        elif qop is None:
                          +            respdig = KD(H(A1), "%s:%s" % (nonce, H(A2)))
                          +        else:
                          +            # XXX handle auth-int.
                          +            raise URLError("qop '%s' is not supported." % qop)
                          +
                          +        # XXX should the partial digests be encoded too?
                          +
                          +        base = 'username="%s", realm="%s", nonce="%s", uri="%s", ' \
                          +               'response="%s"' % (user, realm, nonce, req.get_selector(),
                          +                                  respdig)
                          +        if opaque:
                          +            base += ', opaque="%s"' % opaque
                          +        if entdig:
                          +            base += ', digest="%s"' % entdig
                          +        base += ', algorithm="%s"' % algorithm
                          +        if qop:
                          +            base += ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce)
                          +        return base
                          +
                          +    def get_algorithm_impls(self, algorithm):
                          +        # algorithm should be case-insensitive according to RFC2617
                          +        algorithm = algorithm.upper()
                          +        # lambdas assume digest modules are imported at the top level
                          +        if algorithm == 'MD5':
                          +            H = lambda x: hashlib.md5(x).hexdigest()
                          +        elif algorithm == 'SHA':
                          +            H = lambda x: hashlib.sha1(x).hexdigest()
                          +        # XXX MD5-sess
                          +        else:
                          +            raise ValueError("Unsupported digest authentication "
                          +                             "algorithm %r" % algorithm.lower())
                          +        KD = lambda s, d: H("%s:%s" % (s, d))
                          +        return H, KD
                          +
                          +    def get_entity_digest(self, data, chal):
                          +        # XXX not implemented yet
                          +        return None
                          +
                          +
                          +class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
                          +    """An authentication protocol defined by RFC 2069
                          +
                          +    Digest authentication improves on basic authentication because it
                          +    does not transmit passwords in the clear.
                          +    """
                          +
                          +    auth_header = 'Authorization'
                          +    handler_order = 490  # before Basic auth
                          +
                          +    def http_error_401(self, req, fp, code, msg, headers):
                          +        host = urlparse.urlparse(req.get_full_url())[1]
                          +        retry = self.http_error_auth_reqed('www-authenticate',
                          +                                           host, req, headers)
                          +        self.reset_retry_count()
                          +        return retry
                          +
                          +
                          +class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
                          +
                          +    auth_header = 'Proxy-Authorization'
                          +    handler_order = 490  # before Basic auth
                          +
                          +    def http_error_407(self, req, fp, code, msg, headers):
                          +        host = req.get_host()
                          +        retry = self.http_error_auth_reqed('proxy-authenticate',
                          +                                           host, req, headers)
                          +        self.reset_retry_count()
                          +        return retry
                          +
                          +class AbstractHTTPHandler(BaseHandler):
                          +
                          +    def __init__(self, debuglevel=0):
                          +        self._debuglevel = debuglevel
                          +
                          +    def set_http_debuglevel(self, level):
                          +        self._debuglevel = level
                          +
                          +    def do_request_(self, request):
                          +        host = request.get_host()
                          +        if not host:
                          +            raise URLError('no host given')
                          +
                          +        if request.has_data():  # POST
                          +            data = request.get_data()
                          +            if not request.has_header('Content-type'):
                          +                request.add_unredirected_header(
                          +                    'Content-type',
                          +                    'application/x-www-form-urlencoded')
                          +            if not request.has_header('Content-length'):
                          +                request.add_unredirected_header(
                          +                    'Content-length', '%d' % len(data))
                          +
                          +        sel_host = host
                          +        if request.has_proxy():
                          +            scheme, sel = splittype(request.get_selector())
                          +            sel_host, sel_path = splithost(sel)
                          +
                          +        if not request.has_header('Host'):
                          +            request.add_unredirected_header('Host', sel_host)
                          +        for name, value in self.parent.addheaders:
                          +            name = name.capitalize()
                          +            if not request.has_header(name):
                          +                request.add_unredirected_header(name, value)
                          +
                          +        return request
                          +
                          +    def do_open(self, http_class, req, **http_conn_args):
                          +        """Return an addinfourl object for the request, using http_class.
                          +
                          +        http_class must implement the HTTPConnection API from httplib.
                          +        The addinfourl return value is a file-like object.  It also
                          +        has methods and attributes including:
                          +            - info(): return a mimetools.Message object for the headers
                          +            - geturl(): return the original request URL
                          +            - code: HTTP status code
                          +        """
                          +        host = req.get_host()
                          +        if not host:
                          +            raise URLError('no host given')
                          +
                          +        # will parse host:port
                          +        h = http_class(host, timeout=req.timeout, **http_conn_args)
                          +        h.set_debuglevel(self._debuglevel)
                          +
                          +        headers = dict(req.unredirected_hdrs)
                          +        headers.update(dict((k, v) for k, v in req.headers.items()
                          +                            if k not in headers))
                          +
                          +        # We want to make an HTTP/1.1 request, but the addinfourl
                          +        # class isn't prepared to deal with a persistent connection.
                          +        # It will try to read all remaining data from the socket,
                          +        # which will block while the server waits for the next request.
                          +        # So make sure the connection gets closed after the (only)
                          +        # request.
                          +        headers["Connection"] = "close"
                          +        headers = dict(
                          +            (name.title(), val) for name, val in headers.items())
                          +
                          +        if req._tunnel_host:
                          +            tunnel_headers = {}
                          +            proxy_auth_hdr = "Proxy-Authorization"
                          +            if proxy_auth_hdr in headers:
                          +                tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr]
                          +                # Proxy-Authorization should not be sent to origin
                          +                # server.
                          +                del headers[proxy_auth_hdr]
                          +            h.set_tunnel(req._tunnel_host, headers=tunnel_headers)
                          +
                          +        try:
                          +            h.request(req.get_method(), req.get_selector(), req.data, headers)
                          +        except socket.error, err: # XXX what error?
                          +            h.close()
                          +            raise URLError(err)
                          +        else:
                          +            try:
                          +                r = h.getresponse(buffering=True)
                          +            except TypeError: # buffering kw not supported
                          +                r = h.getresponse()
                          +
                          +        # Pick apart the HTTPResponse object to get the addinfourl
                          +        # object initialized properly.
                          +
                          +        # Wrap the HTTPResponse object in socket's file object adapter
                          +        # for Windows.  That adapter calls recv(), so delegate recv()
                          +        # to read().  This weird wrapping allows the returned object to
                          +        # have readline() and readlines() methods.
                          +
                          +        # XXX It might be better to extract the read buffering code
                          +        # out of socket._fileobject() and into a base class.
                          +
                          +        r.recv = r.read
                          +        fp = socket._fileobject(r, close=True)
                          +
                          +        resp = addinfourl(fp, r.msg, req.get_full_url())
                          +        resp.code = r.status
                          +        resp.msg = r.reason
                          +        return resp
                          +
                          +
                          +class HTTPHandler(AbstractHTTPHandler):
                          +
                          +    def http_open(self, req):
                          +        return self.do_open(httplib.HTTPConnection, req)
                          +
                          +    http_request = AbstractHTTPHandler.do_request_
                          +
                          +if hasattr(httplib, 'HTTPS'):
                          +    class HTTPSHandler(AbstractHTTPHandler):
                          +
                          +        def __init__(self, debuglevel=0, context=None):
                          +            AbstractHTTPHandler.__init__(self, debuglevel)
                          +            self._context = context
                          +
                          +        def https_open(self, req):
                          +            return self.do_open(httplib.HTTPSConnection, req,
                          +                context=self._context)
                          +
                          +        https_request = AbstractHTTPHandler.do_request_
                          +
                          +class HTTPCookieProcessor(BaseHandler):
                          +    def __init__(self, cookiejar=None):
                          +        import cookielib
                          +        if cookiejar is None:
                          +            cookiejar = cookielib.CookieJar()
                          +        self.cookiejar = cookiejar
                          +
                          +    def http_request(self, request):
                          +        self.cookiejar.add_cookie_header(request)
                          +        return request
                          +
                          +    def http_response(self, request, response):
                          +        self.cookiejar.extract_cookies(response, request)
                          +        return response
                          +
                          +    https_request = http_request
                          +    https_response = http_response
                          +
                          +class UnknownHandler(BaseHandler):
                          +    def unknown_open(self, req):
                          +        type = req.get_type()
                          +        raise URLError('unknown url type: %s' % type)
                          +
                          +def parse_keqv_list(l):
                          +    """Parse list of key=value strings where keys are not duplicated."""
                          +    parsed = {}
                          +    for elt in l:
                          +        k, v = elt.split('=', 1)
                          +        if v[0] == '"' and v[-1] == '"':
                          +            v = v[1:-1]
                          +        parsed[k] = v
                          +    return parsed
                          +
                          +def parse_http_list(s):
                          +    """Parse lists as described by RFC 2068 Section 2.
                          +
                          +    In particular, parse comma-separated lists where the elements of
                          +    the list may include quoted-strings.  A quoted-string could
                          +    contain a comma.  A non-quoted string could have quotes in the
                          +    middle.  Neither commas nor quotes count if they are escaped.
                          +    Only double-quotes count, not single-quotes.
                          +    """
                          +    res = []
                          +    part = ''
                          +
                          +    escape = quote = False
                          +    for cur in s:
                          +        if escape:
                          +            part += cur
                          +            escape = False
                          +            continue
                          +        if quote:
                          +            if cur == '\\':
                          +                escape = True
                          +                continue
                          +            elif cur == '"':
                          +                quote = False
                          +            part += cur
                          +            continue
                          +
                          +        if cur == ',':
                          +            res.append(part)
                          +            part = ''
                          +            continue
                          +
                          +        if cur == '"':
                          +            quote = True
                          +
                          +        part += cur
                          +
                          +    # append last part
                          +    if part:
                          +        res.append(part)
                          +
                          +    return [part.strip() for part in res]
                          +
                          +def _safe_gethostbyname(host):
                          +    try:
                          +        return socket.gethostbyname(host)
                          +    except socket.gaierror:
                          +        return None
                          +
                          +class FileHandler(BaseHandler):
                          +    # Use local file or FTP depending on form of URL
                          +    def file_open(self, req):
                          +        url = req.get_selector()
                          +        if url[:2] == '//' and url[2:3] != '/' and (req.host and
                          +                req.host != 'localhost'):
                          +            req.type = 'ftp'
                          +            return self.parent.open(req)
                          +        else:
                          +            return self.open_local_file(req)
                          +
                          +    # names for the localhost
                          +    names = None
                          +    def get_names(self):
                          +        if FileHandler.names is None:
                          +            try:
                          +                FileHandler.names = tuple(
                          +                    socket.gethostbyname_ex('localhost')[2] +
                          +                    socket.gethostbyname_ex(socket.gethostname())[2])
                          +            except socket.gaierror:
                          +                FileHandler.names = (socket.gethostbyname('localhost'),)
                          +        return FileHandler.names
                          +
                          +    # not entirely sure what the rules are here
                          +    def open_local_file(self, req):
                          +        import email.utils
                          +        import mimetypes
                          +        host = req.get_host()
                          +        filename = req.get_selector()
                          +        localfile = url2pathname(filename)
                          +        try:
                          +            stats = os.stat(localfile)
                          +            size = stats.st_size
                          +            modified = email.utils.formatdate(stats.st_mtime, usegmt=True)
                          +            mtype = mimetypes.guess_type(filename)[0]
                          +            headers = mimetools.Message(StringIO(
                          +                'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' %
                          +                (mtype or 'text/plain', size, modified)))
                          +            if host:
                          +                host, port = splitport(host)
                          +            if not host or \
                          +                (not port and _safe_gethostbyname(host) in self.get_names()):
                          +                if host:
                          +                    origurl = 'file://' + host + filename
                          +                else:
                          +                    origurl = 'file://' + filename
                          +                return addinfourl(open(localfile, 'rb'), headers, origurl)
                          +        except OSError, msg:
                          +            # urllib2 users shouldn't expect OSErrors coming from urlopen()
                          +            raise URLError(msg)
                          +        raise URLError('file not on local host')
                          +
                          +class FTPHandler(BaseHandler):
                          +    def ftp_open(self, req):
                          +        import ftplib
                          +        import mimetypes
                          +        host = req.get_host()
                          +        if not host:
                          +            raise URLError('ftp error: no host given')
                          +        host, port = splitport(host)
                          +        if port is None:
                          +            port = ftplib.FTP_PORT
                          +        else:
                          +            port = int(port)
                          +
                          +        # username/password handling
                          +        user, host = splituser(host)
                          +        if user:
                          +            user, passwd = splitpasswd(user)
                          +        else:
                          +            passwd = None
                          +        host = unquote(host)
                          +        user = user or ''
                          +        passwd = passwd or ''
                          +
                          +        try:
                          +            host = socket.gethostbyname(host)
                          +        except socket.error, msg:
                          +            raise URLError(msg)
                          +        path, attrs = splitattr(req.get_selector())
                          +        dirs = path.split('/')
                          +        dirs = map(unquote, dirs)
                          +        dirs, file = dirs[:-1], dirs[-1]
                          +        if dirs and not dirs[0]:
                          +            dirs = dirs[1:]
                          +        try:
                          +            fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout)
                          +            type = file and 'I' or 'D'
                          +            for attr in attrs:
                          +                attr, value = splitvalue(attr)
                          +                if attr.lower() == 'type' and \
                          +                   value in ('a', 'A', 'i', 'I', 'd', 'D'):
                          +                    type = value.upper()
                          +            fp, retrlen = fw.retrfile(file, type)
                          +            headers = ""
                          +            mtype = mimetypes.guess_type(req.get_full_url())[0]
                          +            if mtype:
                          +                headers += "Content-type: %s\n" % mtype
                          +            if retrlen is not None and retrlen >= 0:
                          +                headers += "Content-length: %d\n" % retrlen
                          +            sf = StringIO(headers)
                          +            headers = mimetools.Message(sf)
                          +            return addinfourl(fp, headers, req.get_full_url())
                          +        except ftplib.all_errors, msg:
                          +            raise URLError, ('ftp error: %s' % msg), sys.exc_info()[2]
                          +
                          +    def connect_ftp(self, user, passwd, host, port, dirs, timeout):
                          +        fw = ftpwrapper(user, passwd, host, port, dirs, timeout,
                          +                        persistent=False)
                          +##        fw.ftp.set_debuglevel(1)
                          +        return fw
                          +
                          +class CacheFTPHandler(FTPHandler):
                          +    # XXX would be nice to have pluggable cache strategies
                          +    # XXX this stuff is definitely not thread safe
                          +    def __init__(self):
                          +        self.cache = {}
                          +        self.timeout = {}
                          +        self.soonest = 0
                          +        self.delay = 60
                          +        self.max_conns = 16
                          +
                          +    def setTimeout(self, t):
                          +        self.delay = t
                          +
                          +    def setMaxConns(self, m):
                          +        self.max_conns = m
                          +
                          +    def connect_ftp(self, user, passwd, host, port, dirs, timeout):
                          +        key = user, host, port, '/'.join(dirs), timeout
                          +        if key in self.cache:
                          +            self.timeout[key] = time.time() + self.delay
                          +        else:
                          +            self.cache[key] = ftpwrapper(user, passwd, host, port, dirs, timeout)
                          +            self.timeout[key] = time.time() + self.delay
                          +        self.check_cache()
                          +        return self.cache[key]
                          +
                          +    def check_cache(self):
                          +        # first check for old ones
                          +        t = time.time()
                          +        if self.soonest <= t:
                          +            for k, v in self.timeout.items():
                          +                if v < t:
                          +                    self.cache[k].close()
                          +                    del self.cache[k]
                          +                    del self.timeout[k]
                          +        self.soonest = min(self.timeout.values())
                          +
                          +        # then check the size
                          +        if len(self.cache) == self.max_conns:
                          +            for k, v in self.timeout.items():
                          +                if v == self.soonest:
                          +                    del self.cache[k]
                          +                    del self.timeout[k]
                          +                    break
                          +            self.soonest = min(self.timeout.values())
                          +
                          +    def clear_cache(self):
                          +        for conn in self.cache.values():
                          +            conn.close()
                          +        self.cache.clear()
                          +        self.timeout.clear()
                          +
                          + +
                          +
                          +
                          + +
                          +
                          + + + + + + + \ No newline at end of file diff --git a/doc/html/_sources/M2Crypto.PGP.txt b/doc/html/_sources/M2Crypto.PGP.txt deleted file mode 100644 index 5396b5d..0000000 --- a/doc/html/_sources/M2Crypto.PGP.txt +++ /dev/null @@ -1,51 +0,0 @@ -PGP Package -=========== - -:mod:`PGP` Package ------------------- - -.. automodule:: M2Crypto.PGP - :members: - :undoc-members: - :show-inheritance: - -:mod:`PublicKey` Module ------------------------ - -.. automodule:: M2Crypto.PGP.PublicKey - :members: - :undoc-members: - :show-inheritance: - -:mod:`PublicKeyRing` Module ---------------------------- - -.. automodule:: M2Crypto.PGP.PublicKeyRing - :members: - :undoc-members: - :show-inheritance: - -:mod:`RSA` Module ------------------ - -.. automodule:: M2Crypto.PGP.RSA - :members: - :undoc-members: - :show-inheritance: - -:mod:`constants` Module ------------------------ - -.. automodule:: M2Crypto.PGP.constants - :members: - :undoc-members: - :show-inheritance: - -:mod:`packet` Module --------------------- - -.. automodule:: M2Crypto.PGP.packet - :members: - :undoc-members: - :show-inheritance: - diff --git a/doc/html/_sources/M2Crypto.SSL.rst.txt b/doc/html/_sources/M2Crypto.SSL.rst.txt new file mode 100644 index 0000000..233c1eb --- /dev/null +++ b/doc/html/_sources/M2Crypto.SSL.rst.txt @@ -0,0 +1,91 @@ +SSL Package +=========== + +:mod:`SSL` Package +------------------ + +.. automodule:: M2Crypto.SSL + :members: + :undoc-members: + :show-inheritance: + +:mod:`Checker` Module +--------------------- + +.. automodule:: M2Crypto.SSL.Checker + :members: + :undoc-members: + :show-inheritance: + +:mod:`Cipher` Module +-------------------- + +.. automodule:: M2Crypto.SSL.Cipher + :members: + :undoc-members: + :show-inheritance: + +:mod:`Connection` Module +------------------------ + +.. automodule:: M2Crypto.SSL.Connection + :members: + :undoc-members: + :show-inheritance: + +:mod:`Context` Module +--------------------- + +.. automodule:: M2Crypto.SSL.Context + :members: + :undoc-members: + :show-inheritance: + +:mod:`SSLServer` Module +----------------------- + +.. automodule:: M2Crypto.SSL.SSLServer + :members: + :undoc-members: + :show-inheritance: + +:mod:`Session` Module +--------------------- + +.. automodule:: M2Crypto.SSL.Session + :members: + :undoc-members: + :show-inheritance: + +:mod:`TwistedProtocolWrapper` Module +------------------------------------ + +.. automodule:: M2Crypto.SSL.TwistedProtocolWrapper + :members: + :undoc-members: + :show-inheritance: + +:mod:`cb` Module +---------------- + +.. automodule:: M2Crypto.SSL.cb + :members: + :undoc-members: + :show-inheritance: + +:mod:`ssl_dispatcher` Module +---------------------------- + +.. automodule:: M2Crypto.SSL.ssl_dispatcher + :members: + :undoc-members: + :show-inheritance: + +:mod:`timeout` Module +--------------------- + +.. automodule:: M2Crypto.SSL.timeout + :members: + :undoc-members: + :show-inheritance: + diff --git a/doc/html/_sources/M2Crypto.rst.txt b/doc/html/_sources/M2Crypto.rst.txt new file mode 100644 index 0000000..dc6c706 --- /dev/null +++ b/doc/html/_sources/M2Crypto.rst.txt @@ -0,0 +1,218 @@ +M2Crypto Package +================ + +:mod:`M2Crypto` Package +----------------------- + +.. automodule:: M2Crypto.__init__ + :members: + :undoc-members: + :show-inheritance: + +:mod:`ASN1` Module +------------------ + +.. automodule:: M2Crypto.ASN1 + :members: + :undoc-members: + :show-inheritance: + +:mod:`AuthCookie` Module +------------------------ + +.. automodule:: M2Crypto.AuthCookie + :members: + :undoc-members: + :show-inheritance: + +:mod:`BIO` Module +----------------- + +.. automodule:: M2Crypto.BIO + :members: + :undoc-members: + :show-inheritance: + +:mod:`BN` Module +---------------- + +.. automodule:: M2Crypto.BN + :members: + :undoc-members: + :show-inheritance: + +:mod:`DH` Module +---------------- + +.. automodule:: M2Crypto.DH + :members: + :undoc-members: + :show-inheritance: + +:mod:`DSA` Module +----------------- + +.. automodule:: M2Crypto.DSA + :members: + :undoc-members: + :show-inheritance: + +:mod:`EC` Module +---------------- + +.. automodule:: M2Crypto.EC + :members: + :undoc-members: + :show-inheritance: + +:mod:`EVP` Module +----------------- + +.. automodule:: M2Crypto.EVP + :members: + :undoc-members: + :show-inheritance: + +:mod:`Engine` Module +-------------------- + +.. automodule:: M2Crypto.Engine + :members: + :undoc-members: + :show-inheritance: + +:mod:`Err` Module +----------------- + +.. automodule:: M2Crypto.Err + :members: + :undoc-members: + :show-inheritance: + +:mod:`RC4` Module +----------------- + +.. automodule:: M2Crypto.RC4 + :members: + :undoc-members: + :show-inheritance: + +:mod:`RSA` Module +----------------- + +.. automodule:: M2Crypto.RSA + :members: + :undoc-members: + :show-inheritance: + +:mod:`Rand` Module +------------------ + +.. automodule:: M2Crypto.Rand + :members: + :undoc-members: + :show-inheritance: + +:mod:`SMIME` Module +------------------- + +.. automodule:: M2Crypto.SMIME + :members: + :undoc-members: + :show-inheritance: + +:mod:`X509` Module +------------------ + +.. automodule:: M2Crypto.X509 + :members: + :undoc-members: + :show-inheritance: + +:mod:`callback` Module +---------------------- + +.. automodule:: M2Crypto.callback + :members: + :undoc-members: + :show-inheritance: + +:mod:`ftpslib` Module +--------------------- + +.. automodule:: M2Crypto.ftpslib + :members: + :undoc-members: + :show-inheritance: + +:mod:`httpslib` Module +---------------------- + +.. automodule:: M2Crypto.httpslib + :members: + :undoc-members: + :show-inheritance: + +:mod:`m2` Module +---------------- + +.. automodule:: M2Crypto.m2 + :members: + :undoc-members: + :show-inheritance: + +:mod:`m2crypto` Module +---------------------- + +.. automodule:: M2Crypto.m2crypto + :members: + :undoc-members: + :show-inheritance: + +:mod:`m2urllib` Module +---------------------- + +.. automodule:: M2Crypto.m2urllib + :members: + :undoc-members: + :show-inheritance: + +:mod:`m2urllib2` Module +----------------------- + +.. automodule:: M2Crypto.m2urllib2 + :members: + :undoc-members: + :show-inheritance: + +:mod:`m2xmlrpclib` Module +------------------------- + +.. automodule:: M2Crypto.m2xmlrpclib + :members: + :undoc-members: + :show-inheritance: + +:mod:`threading` Module +----------------------- + +.. automodule:: M2Crypto.threading + :members: + :undoc-members: + :show-inheritance: + +:mod:`util` Module +------------------ + +.. automodule:: M2Crypto.util + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + + M2Crypto.SSL + diff --git a/doc/html/_sources/M2Crypto.txt b/doc/html/_sources/M2Crypto.txt index 31a03ad..dc6c706 100644 --- a/doc/html/_sources/M2Crypto.txt +++ b/doc/html/_sources/M2Crypto.txt @@ -214,6 +214,5 @@ Subpackages .. toctree:: - M2Crypto.PGP M2Crypto.SSL diff --git a/doc/html/_sources/ZServerSSL-HOWTO.rst.txt b/doc/html/_sources/ZServerSSL-HOWTO.rst.txt new file mode 100644 index 0000000..91ef5af --- /dev/null +++ b/doc/html/_sources/ZServerSSL-HOWTO.rst.txt @@ -0,0 +1,239 @@ +:orphan: + +.. _zserverssl-howto: + +ZServerSSL-HOWTO +################ + +:author: Pheng Siong Ng +:copyright: © 2000, 2001 by Ng Pheng Siong. +:date: 2003-06-22 + +.. contents:: + :backlinks: entry + +.. sectnum:: + :suffix: . + +Introduction +============ + +ZServerSSL adds to Zope's ZServer the following: + +- HTTPS server +- WebDAV-source-over-HTTPS server + +With the HTTPS server, ZServerSSL also provides WebDAV-over-HTTPS and +XMLRPC-over-HTTPS access to Zope. + +These instructions apply to both Un\*x and Windows installations of Zope +2.6.1. To avoid cluttering the presentation, Windows pathnames are shown +in Un\*x fashion. + +Preparation +=========== + +#. Download M2Crypto 0.11, contained in the file ``m2crypto-0.11.zip``. +#. Unpack ``m2crypto-0.11.zip``. This will create a directory + ``m2crypto-0.11``. Henceforth, we refer to this directory as ``$M2``. +#. Install M2Crypto per the instructions in ``$M2/INSTALL``. + +The ZServerSSL distribution is in ``$M2/demo/Zope``. We shall refer to +this directory as ``$ZSSL``. + +Installation +============ + +Below, we refer to your Zope top-level directory as ``$ZOPE``. + +#. Copy ``$ZSSL/z2s.py`` into ``$ZOPE``. + +#. Depending on your operating system, modify ``$ZOPE/start`` or + ``$ZOPE/start.bat`` to invoke ``$ZOPE/z2s.py``, instead of + ``$ZOPE/z2.py``. The files ``$ZSSL/starts`` and ``$ZSSL/starts.bat`` + serve as examples. + +#. Copy ``$ZSSL/dh1024.pem`` into ``$ZOPE``. This file contains + Diffie-Hellman parameters for use by the SSL protocol. + +#. Copy ``$ZSSL/randpool.dat`` into ``$ZOPE``. This file contains seed + material for the OpenSSL PRNG. Alternatively, create + ``$ZOPE/randpool.dat`` thusly:: + + $ dd if=/dev/urandom of=randpool.dat bs=1024 count=1 + +#. Copy ``$ZSSL/ca.pem`` to ``$ZOPE``. This file contains an + example Certification Authority (CA) certificate. For + information on operating your own CA, see :ref:`howto-ca` or + one of numerous similar documents available on the web. + +#. Copy ``$ZSSL/server.pem`` to ``$ZOPE``. This file contains an RSA key + pair and its X.509v3 certificate issued by the above CA. You may also + create your own key/certificate bundle. + +#. Copy ``$ZSSL/ZServer/HTTPS_Server.py`` to ``$ZOPE/ZServer``. + +#. Copy ``$ZSSL/ZServer/__init__.py`` to ``$ZOPE/ZServer``. This + overwrites the existing ``$ZOPE/ZServer/__init__.py``. Alternatively, + apply the following patch to ``$ZOPE/ZServer/__init__.py``:: + + --- __init__.py.org Sat Jun 21 23:20:41 2003 + +++ __init__.py Tue Jan 7 23:30:53 2003 + @@ -84,6 +84,7 @@ + import asyncore + from medusa import resolver, logger + from HTTPServer import zhttp_server, zhttp_handler + +from HTTPS_Server import zhttps_server, zhttps_handler + from PCGIServer import PCGIServer + from FCGIServer import FCGIServer + from FTPServer import FTPServer + +#. Copy ``$ZSSL/ZServer/medusa/https_server.py`` to + ``$ZOPE/ZServer/medusa``. + +#. Stop Zope, if it is running. + +#. Start Zope with ZServerSSL thusly:: + + ./starts -X -f 9021 -w 9080 -W 9081 -y 9443 -Y 9444 + + This starts the following: + + - an FTP server on port 9021 + - a HTTP server on port 9080 + - a WebDAV-source server on port 9081 + - a HTTPS server on port 9443 + - a WebDAV-source-over-HTTPS server on port 9444 + +Testing +======= + +Below, we assume your Zope server is running on ``localhost``. + +HTTPS +===== + +This testing is done with Mozilla 1.1 on FreeBSD. + +#. With a browser, connect to https://localhost:9443/. Browse around. + Check out your browser's HTTPS informational screens. +#. Connect to https://localhost:9443/manage. Verify that you can access + Zope's management functionality. + +WebDAV-over-HTTPS +================= + +This testing is done with Cadaver 0.21.0 on FreeBSD.:: + + $ cadaver https://localhost:9443/ + WARNING: Untrusted server certificate presented: + Issued to: M2Crypto, SG + Issued by: M2Crypto, SG + Do you wish to accept the certificate? (y/n) y + dav:/> ls + Listing collection `/': succeeded. + Coll: Channels 0 Jun 19 00:04 + Coll: Control_Panel 0 Jun 6 00:13 + Coll: Examples 0 Jun 6 00:12 + Coll: catalog 0 Jun 12 11:53 + Coll: ngps 0 Jun 16 15:34 + Coll: portal 0 Jun 21 15:21 + Coll: skunk 0 Jun 18 21:18 + Coll: temp_folder 0 Jun 22 17:57 + Coll: zope 0 Jun 20 15:27 + acl_users 0 Dec 30 1998 + browser_id_manager 0 Jun 6 00:12 + default.css 3037 Jun 21 16:38 + error_log 0 Jun 6 00:12 + index_html 313 Jun 12 13:36 + portal0 0 Jun 21 15:21 + session_data_manager 0 Jun 6 00:12 + standard_error_message 1365 Jan 21 2001 + standard_html_footer 50 Jun 12 12:30 + standard_html_header 80 Jan 21 2001 + standard_template.pt 282 Jun 6 00:12 + zsyncer 0 Jun 17 15:28 + dav:/> quit + Connection to `localhost' closed. + $ + + +WebDAV-Source-over-HTTPS +======================== + +This testing is done with Mozilla 1.1 on FreeBSD. + +#. Open the Mozilla Composer window. +#. Click "File", "Open Web Location". A dialog box appears. +#. Enter ``https://localhost:9444/index_html`` for the URL. +#. Select "Open in new Composer window." +#. Click "Open". A new Composer window will open with ``index_html`` + loaded. + +Python with M2Crypto +==================== + +This testing is done with M2Crypto 0.11 and Python 2.2.2 on FreeBSD. + +HTTPS +===== + +:: + + >>> from M2Crypto import Rand, SSL, m2urllib + >>> url = m2urllib.FancyURLopener() + >>> url.addheader('Connection', 'close') + >>> u = url.open('https://127.0.0.1:9443/') + send: 'GET / HTTP/1.1\r\nHost: 127.0.0.1:9443\r\nAccept-Encoding: identity\r\nUser-agent: Python-urllib/1.15\r\nConnection: close\r\n\r\n' + reply: 'HTTP/1.1 200 OK\r\n' + header: Server: ZServerSSL/0.11 + header: Date: Sun, 22 Jun 2003 13:42:34 GMT + header: Connection: close + header: Content-Type: text/html + header: Etag: + header: Content-Length: 535 + >>> while 1: + ... data = u.read() + ... if not data: break + ... print(data) + ... + +:: + + + + Zope + +

                          NgPS Desktop Portal

                          + +   So many hacks.
                          +   So little time.
                          + +

                          Link Farm

                          + + +
                          Powered by Zope + +:: + + >>> u.close() + >>> + +XMLRPC-over-HTTPS +================= + +:: + + >>> from M2Crypto.m2xmlrpclib import Server, SSL_Transport + >>> zs = Server('https://127.0.0.1:9443/', SSL_Transport()) + >>> print(zs.propertyMap()) + [{'type': 'string', 'id': 'title', 'mode': 'w'}] + >>> + +Conclusion +========== + +Well, it works! ;-) diff --git a/doc/html/_sources/howto.ca.rst.txt b/doc/html/_sources/howto.ca.rst.txt new file mode 100644 index 0000000..e950b59 --- /dev/null +++ b/doc/html/_sources/howto.ca.rst.txt @@ -0,0 +1,370 @@ +:orphan: + +.. _howto-ca: + +HOWTO: Creating your own CA with OpenSSL +######################################## + +:author: Pheng Siong Ng +:copyright: © 2000, 2001 by Ng Pheng Siong. + +Introduction +============ + +This is a HOWTO on creating your own *certification authority* (*CA*) +with OpenSSL. + +I last created a CA about a year ago, when I began work on +`M2Crypto `__ and needed +certificates for the SSL bits. I accepted the tools' default +settings then, e.g., certificate validity of 365 days; this meant +that my certificates, including my CA's certificate, have now +expired. + +Since I am using these certificates for M2Crypto's demonstration +programs (and I have forgotten the passphrase to the CA's private +key), I decided to discard the old CA and start afresh. I also +decided to document the process, hence this HOWTO. + +The Procedure +============= + +I use ``CA.pl``, a Perl program written by Steve Hanson and bundled with +OpenSSL. + +The following are the steps to create a CA: + +1. Choose a directory to do your CA work. All commands are executed + within this directory. Let's call the directory ``demo``. + +2. Copy ``CA.pl`` and ``openssl.cnf`` into ``demo``. + +3. Apply the following patch to ``CA.pl``, which allows it to generate a + CA certificate with a validity period of 1095 days, i.e., + 3 years:: + + --- CA.pl.org Sat Mar 31 12:40:13 2001 + +++ CA.pl Sat Mar 31 12:41:15 2001 + @@ -97,7 +97,7 @@ + } else { + print "Making CA certificate ...\n"; + system ("$REQ -new -x509 -keyout " . + - "${CATOP}/private/$CAKEY -out ${CATOP}/$CACERT $DAYS"); + + "${CATOP}/private/$CAKEY -out ${CATOP}/$CACERT -days 1095"); + $RET=$?; + } + } + + +4. Create a new CA like this:: + + ./CA.pl -newca + + A certificate filename (or enter to create) + + Making CA certificate ... + Using configuration from openssl.cnf + Generating a 1024 bit RSA private key + ............++++++ + ......................++++++ + writing new private key to './demoCA/private/cakey.pem' + Enter PEM pass phrase: + Verifying password - Enter PEM pass phrase: + ----- + You are about to be asked to enter information that will be incorporated + into your certificate request. + What you are about to enter is what is called a Distinguished Name or a DN. + There are quite a few fields but you can leave some blank + For some fields there will be a default value, + If you enter '.', the field will be left blank. + ----- + Country Name (2 letter code) [AU]:SG + State or Province Name (full name) [Some-State]:. + Locality Name (eg, city) []:.. + Organization Name (eg, company) [Internet Widgits Pty Ltd]:DemoCA + Organizational Unit Name (eg, section) []:. + Common Name (eg, YOUR name) []:DemoCA Certificate Master + Email Address []:certmaster@democa.dom + + This creates a new CA in the directory ``demoCA``. The CA's + self-signed certificate is in ``demoCA/cacert.pem`` and its RSA key + pair is in ``demoCA/private/cakey.pem``. + + ``demoCA/private/cakey.pem`` looks like this:: + + cat demoCA/private/cakey.pem + + -----BEGIN RSA PRIVATE KEY----- + Proc-Type: 4,ENCRYPTED + DEK-Info: DES-EDE3-CBC,19973A9DBBB601BA + + eOq9WFScNiI4/UWEUaSnGTKpJv2JYuMD3HwQox2Q3Cd4zGqVjJ6gF3exa5126cKf + X/bMVnwbPpuFZPiAIvaLyCjT6pYeXTBbSzs7/GQnvEOv+nYnDUFWi0Qm92qLk0uy + pFi/M1aWheN3vir2ZlAw+DW0bOOZhj8tC7Co7lMYb0YE271b6/YRPZCwQ3GXAHUJ + +aMYxlUDrK45aCUa/1CZDzTgk7h9cDgx2QJSIvYMYytCfI3zsuZMJS8/4OXLL0bI + lKmAc1dwB3DqGJt5XK4WJesiNfdxeCNEgAcYtEAgYZTPIApU+kTgTCIxJl2nMW7j + ax+Q1z7g+4MpgG20WD633D4z4dTlDdz+dnLi0rvuvxiwt+dUhrqiML1tyi+Z6EBH + jU4/cLBWev3rYfrlp4x8J9mDte0YKOk3t0wQOHqRetTsIfdtjnFp/Hu3qDmTCWjD + z/g7PPoO/bg/B877J9WBPbL/1hXXFYo88M+2aGlPOgDcFdiOqbLb2DCscohMbbVr + A4mgiy2kwWfIE73qiyV7yyG8FlRvr1iib+jbT3LTGf743utYAAs7HNGuOUObhoyt + jYvBD7ACn35P5YX7KTqvqErwdijxYCaNBCnvmRtmYSaNw9Kv1UJTxc5Vx7YLwIPk + E9KyBgKI7vPOjWBZ27+zOvNycmv1ciNtpALAw4bWtXnhCDVTHaVDy34OkheMzNCg + 2cjcBFzOkMIjcI03KbTQXOFIQGlsTWXGzkNf/zBQ+KksT1MCj+zBXSCvlDASMckg + kef21pGgUqPF14gKGfWX3sV4bjc1vbrRwq6zlG3nMuYqR5MtJJY9eQ== + -----END RSA PRIVATE KEY----- + + +5. Next, generate a certificate request:: + + ./CA.pl -newreq + + Using configuration from openssl.cnf + Generating a 1024 bit RSA private key + ..........++++++ + ..............++++++ + writing new private key to 'newreq.pem' + Enter PEM pass phrase: + Verifying password - Enter PEM pass phrase: + ----- + You are about to be asked to enter information that will be incorporated + into your certificate request. + What you are about to enter is what is called a Distinguished Name or a DN. + There are quite a few fields but you can leave some blank + For some fields there will be a default value, + If you enter '.', the field will be left blank. + ----- + Country Name (2 letter code) [AU]:SG + State or Province Name (full name) [Some-State]:.. + Locality Name (eg, city) []:. + Organization Name (eg, company) [Internet Widgits Pty Ltd]:M2Crypto + Organizational Unit Name (eg, section) []:. + Common Name (eg, YOUR name) []:localhost + Email Address []:admin@server.example.dom + + Please enter the following 'extra' attributes + to be sent with your certificate request + A challenge password []: + An optional company name []: + Request (and private key) is in newreq.pem + +\ + + The certificate request and private key in ``newreq.pem`` looks like + this:: + + cat newreq.pem + + -----BEGIN RSA PRIVATE KEY----- + Proc-Type: 4,ENCRYPTED + DEK-Info: DES-EDE3-CBC,41B2874DF3D02DD4 + + mg611EoVkLEooSTv+qTM0Ddmm/M1jE/Jy5RD/sc3LSMhuGu9xc26OgsTJmkQuIAh + J/B4lAw8G59VTG6DykeEtrG0rUBx4bggc7PKbFuiN423YjJODWcHvVgnPOzXMQt+ + lY4tPl5+217MRHyx2NsWGrpkQNdu3GeSPOVMl3jeQiaXupONbwQ7rj42+X/VtAJP + W4D1NNwu8aGCPyShsEXHc/fI1WDpphYWke97pOjIZVQESFZOPty5HjIYZux4U+td + W81xODtq2ecJXc8fn2Wpa9y5VD1LT7oJksOuL1+Z04OVaeUe4x0swM17HlBm2kVt + fe/C/L6kN27MwZhE331VjtTjSGl4/gknqQDbLOtqT06f3OISsDJETm2itllyhgzv + C6Fi3N03rGFmKectijC+tws5k+P+HRG6sai33usk8xPokJqA+HYSWPz1XVlpRmv4 + kdjQOdST7ovU62mOTgf3ARcduPPwuzTfxOlYONe5NioO1APVHBrInQwcpLkpOTQR + vI4roIN+b75/nihUWGUJn/nbbBa2Yl0N5Gs1Tyiy9Z+CcRT2TfWKBBFlEUIFl7Mb + J9fTV3DI+k+akbR4il1NkQ8EcSmCr3WpA0I9n0EHI7ZVpVaHxc0sqaPFl8YGdFHq + 1Qk53C/w6+qPpDzT3yKFmG2LZytAAM1czvb6RbNRJJP2ZrpBwn/h99sUTo/yPfxY + nueYmFJDm0uVNtG0icXGNUfSfnjKNTtHPAgyKGetRIC3kgJz/bo2w7EI6iEjBAzK + l5TRm4x6ZJxwuXXMiJCehMMd8TC8ybwWO4AO19B3ebFFeTVsUgxSGA== + -----END RSA PRIVATE KEY----- + -----BEGIN CERTIFICATE REQUEST----- + MIIBnTCCAQYCAQAwXTELMAkGA1UEBhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRvMRIw + EAYDVQQDEwlsb2NhbGhvc3QxJzAlBgkqhkiG9w0BCQEWGGFkbWluQHNlcnZlci5l + eGFtcGxlLmRvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAr1nYY1Qrll1r + uB/FqlCRrr5nvupdIN+3wF7q915tvEQoc74bnu6b8IbbGRMhzdzmvQ4SzFfVEAuM + MuTHeybPq5th7YDrTNizKKxOBnqE2KYuX9X22A1Kh49soJJFg6kPb9MUgiZBiMlv + tb7K3CHfgw5WagWnLl8Lb+ccvKZZl+8CAwEAAaAAMA0GCSqGSIb3DQEBBAUAA4GB + AHpoRp5YS55CZpy+wdigQEwjL/wSluvo+WjtpvP0YoBMJu4VMKeZi405R7o8oEwi + PdlrrliKNknFmHKIaCKTLRcU59ScA6ADEIWUzqmUzP5Cs6jrSRo3NKfg1bd09D1K + 9rsQkRc9Urv9mRBIsredGnYECNeRaK5R1yzpOowninXC + -----END CERTIFICATE REQUEST----- + +\ + + Decoding the certificate request gives the following:: + + openssl req -text -noout < newreq.pem + + Using configuration from /usr/local/pkg/openssl/openssl.cnf + Certificate Request: + Data: + Version: 0 (0x0) + Subject: C=SG, O=M2Crypto, CN=localhost/Email=admin@server.example.dom + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:af:59:d8:63:54:2b:96:5d:6b:b8:1f:c5:aa:50: + 91:ae:be:67:be:ea:5d:20:df:b7:c0:5e:ea:f7:5e: + 6d:bc:44:28:73:be:1b:9e:ee:9b:f0:86:db:19:13: + 21:cd:dc:e6:bd:0e:12:cc:57:d5:10:0b:8c:32:e4: + c7:7b:26:cf:ab:9b:61:ed:80:eb:4c:d8:b3:28:ac: + 4e:06:7a:84:d8:a6:2e:5f:d5:f6:d8:0d:4a:87:8f: + 6c:a0:92:45:83:a9:0f:6f:d3:14:82:26:41:88:c9: + 6f:b5:be:ca:dc:21:df:83:0e:56:6a:05:a7:2e:5f: + 0b:6f:e7:1c:bc:a6:59:97:ef + Exponent: 65537 (0x10001) + Attributes: + a0:00 + Signature Algorithm: md5WithRSAEncryption + 7a:68:46:9e:58:4b:9e:42:66:9c:be:c1:d8:a0:40:4c:23:2f: + fc:12:96:eb:e8:f9:68:ed:a6:f3:f4:62:80:4c:26:ee:15:30: + a7:99:8b:8d:39:47:ba:3c:a0:4c:22:3d:d9:6b:ae:58:8a:36: + 49:c5:98:72:88:68:22:93:2d:17:14:e7:d4:9c:03:a0:03:10: + 85:94:ce:a9:94:cc:fe:42:b3:a8:eb:49:1a:37:34:a7:e0:d5: + b7:74:f4:3d:4a:f6:bb:10:91:17:3d:52:bb:fd:99:10:48:b2: + b7:9d:1a:76:04:08:d7:91:68:ae:51:d7:2c:e9:3a:8c:27:8a: + 75:c2 + +6. Now, sign the certificate request:: + + ./CA.pl -sign + + Using configuration from openssl.cnf + Enter PEM pass phrase: + Check that the request matches the signature + Signature ok + The Subjects Distinguished Name is as follows + countryName :PRINTABLE:'SG' + organizationName :PRINTABLE:'M2Crypto' + commonName :PRINTABLE:'localhost' + emailAddress :IA5STRING:'admin@server.example.dom' + Certificate is to be certified until Mar 31 02:57:30 2002 GMT (365 days) + Sign the certificate? [y/n]:y + + + 1 out of 1 certificate requests certified, commit? [y/n]y + Write out database with 1 new entries + Data Base Updated + Signed certificate is in newcert.pem + +\ + + ``newcert.pem`` looks like this:: + + cat newcert.pem + + Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=SG, O=DemoCA, CN=DemoCA Certificate Master/Email=certmaster@democa.dom + Validity + Not Before: Mar 31 02:57:30 2001 GMT + Not After : Mar 31 02:57:30 2002 GMT + Subject: C=SG, O=M2Crypto, CN=localhost/Email=admin@server.example.dom + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:af:59:d8:63:54:2b:96:5d:6b:b8:1f:c5:aa:50: + 91:ae:be:67:be:ea:5d:20:df:b7:c0:5e:ea:f7:5e: + 6d:bc:44:28:73:be:1b:9e:ee:9b:f0:86:db:19:13: + 21:cd:dc:e6:bd:0e:12:cc:57:d5:10:0b:8c:32:e4: + c7:7b:26:cf:ab:9b:61:ed:80:eb:4c:d8:b3:28:ac: + 4e:06:7a:84:d8:a6:2e:5f:d5:f6:d8:0d:4a:87:8f: + 6c:a0:92:45:83:a9:0f:6f:d3:14:82:26:41:88:c9: + 6f:b5:be:ca:dc:21:df:83:0e:56:6a:05:a7:2e:5f: + 0b:6f:e7:1c:bc:a6:59:97:ef + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=SG, O=DemoCA, CN=DemoCA Certificate Master/Email=certmaster@democa.dom + Validity + Not Before: Mar 31 02:57:30 2001 GMT + Not After : Mar 31 02:57:30 2002 GMT + Subject: C=SG, O=M2Crypto, CN=localhost/Email=admin@server.example.dom + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:af:59:d8:63:54:2b:96:5d:6b:b8:1f:c5:aa:50: + 91:ae:be:67:be:ea:5d:20:df:b7:c0:5e:ea:f7:5e: + 6d:bc:44:28:73:be:1b:9e:ee:9b:f0:86:db:19:13: + 21:cd:dc:e6:bd:0e:12:cc:57:d5:10:0b:8c:32:e4: + c7:7b:26:cf:ab:9b:61:ed:80:eb:4c:d8:b3:28:ac: + 4e:06:7a:84:d8:a6:2e:5f:d5:f6:d8:0d:4a:87:8f: + 6c:a0:92:45:83:a9:0f:6f:d3:14:82:26:41:88:c9: + 6f:b5:be:ca:dc:21:df:83:0e:56:6a:05:a7:2e:5f: + 0b:6f:e7:1c:bc:a6:59:97:ef + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Comment: + OpenSSL Generated Certificate + X509v3 Subject Key Identifier: + B3:D6:89:88:2F:B1:15:40:EC:0A:C0:30:35:3A:B7:DA:72:73:1B:4D + X509v3 Authority Key Identifier: + keyid:F9:6A:A6:34:97:6B:BC:BB:5A:17:0D:19:FC:62:21:0B:00:B5:0E:29 + DirName:/C=SG/O=DemoCA/CN=DemoCA Certificate Master/Email=certmaster@democa.dom + serial:00 + + Signature Algorithm: md5WithRSAEncryption + +7. In certain situations, e.g., where your certificate and private key + are to be used in an unattended SSL server, you may wish to not + encrypt the private key, i.e., leave the key in the clear. This + decision should be governed by your site's security policy and threat + model, of course:: + + openssl rsa < newkey.pem > newkey2.pem + + read RSA key + Enter PEM pass phrase: + writing RSA key + + ``newkey2.pem`` looks like this:: + + cat newkey2.pem + + -----BEGIN RSA PRIVATE KEY----- + MIICXgIBAAKBgQCvWdhjVCuWXWu4H8WqUJGuvme+6l0g37fAXur3Xm28RChzvhue + 7pvwhtsZEyHN3Oa9DhLMV9UQC4wy5Md7Js+rm2HtgOtM2LMorE4GeoTYpi5f1fbY + DUqHj2ygkkWDqQ9v0xSCJkGIyW+1vsrcId+DDlZqBacuXwtv5xy8plmX7wIDAQAB + AoGAbAkU8w3W1Qu15Hle1bJSL7GMReoreqeblOBmMAZz4by0l6sXZXJpjWXo86f/ + +dASMYTMPC4ZTYtv06N07AFbjL+kDfqDMTfzQkYMHp1LAq1Ihbq1rHWSBH5n3ekq + KiY8JKpv8DR5Po1iKaXJFuDByGDENJwYbSRSpSK3P+vkWWECQQDkEUE/ZPqqqZkQ + 2iWRPAsCbEID8SAraQl3DdCLYs/GgARfmmj4yUHEwkys9Jo1H8k4BdxugmaUwNi5 + YQ/CVzrXAkEAxNO80ArbGxPUmr11GHG/bGBYj1DUBkHZSc7dgxZdtUCLGNxQnNsg + Iwq3n6j1sUzS3UW6abQ8bivYNOUcMKJAqQJBANQxFaLU4b/NQaODQ3aoBZpAfP9L + 5eFdvbet+7zjt2r5CpikgkwOfAmDuXEltx/8LevY0CllW+nErx9zJgVrwUsCQQCu + 76H5JiznPBDSF2FjgHWqVVdgyW4owY3mU739LHvNBLicN/RN9VPy0Suy8/CqzKT9 + lWPBXzf2k3FuUdNkRlFBAkEAmpXoybuiFR2S5Bma/ax96lVs0/VihhfC1zZP/X/F + Br77+h9dIul+2DnyOl50zu0Sdzst1/7ay4JSDHyiBCMGSQ== + -----END RSA PRIVATE KEY----- + + +That's it! The certificate, ``newcert.pem``, and the private key - +``newkey.pem`` (encrypted) or ``newkey2.pem`` (unencrypted) - are now +ready to be used. You may wish to rename the files to more intuitive +names. + +You should also keep the CA's certificate ``demo/cacert.pem`` handy +for use when developing and deploying SSL or S/MIME applications. + +Conclusion +========== + +We've walked through the basic steps in the creation of a CA and +certificates using the tools that come with OpenSSL. We did not cover +more advanced topics such as constraining a certificate to be SSL-only +or S/MIME-only. + +There exist several HOWTOs similar to this one on the net. This one is +written specifically to facilitate discussions in my other HOWTOs on +developing SSL and S/MIME applications in +`Python `__ using +`M2Crypto `__. + diff --git a/doc/html/_sources/howto.smime.rst.txt b/doc/html/_sources/howto.smime.rst.txt new file mode 100644 index 0000000..715e7c4 --- /dev/null +++ b/doc/html/_sources/howto.smime.rst.txt @@ -0,0 +1,778 @@ +:orphan: + +.. _howto-smime: + +HOWTO: Programming S/MIME in Python with M2Crypto +================================================= + +:author: Pheng Siong Ng +:copyright: © 2000, 2001 by Ng Pheng Siong. + +Introduction +============ + +`M2Crypto `__ is a +`Python `__ interface to +`OpenSSL `__. It makes available to the Python +programmer SSL functionality to implement clients and servers, S/MIME +v2, RSA, DSA, DH, symmetric ciphers, message digests and HMACs. + +This document demonstrates programming S/MIME with M2Crypto. + +S/MIME +====== + +S/MIME - Secure Multipurpose Internet Mail Extensions [RFC 2311, RFC +2312] - provides a consistent way to send and receive secure MIME data. +Based on the popular Internet MIME standard, S/MIME provides the +following cryptographic security services for electronic messaging +applications - *authentication*, *message integrity* and +*non-repudiation of origin* (using *digital signatures*), and *privacy* +and *data security* (using *encryption*). + +Keys and Certificates +===================== + +To create an S/MIME-signed message, you need an RSA key pair (this +consists of a public key and a private key) and an X.509 certificate of +said public key. + +To create an S/MIME-encrypted message, you need an X.509 certificate for +each recipient. + +To create an S/MIME-signed *and* -encrypted message, first create a +signed message, then encrypt the signed message with the recipients' +certificates. + +You may generate key pairs and obtain certificates by using a commercial +*certification authority* service. + +You can also do so using freely-available software. For many purposes, +e.g., automated S/MIME messaging by system administration processes, +this approach is cheap and effective. + +We now work through using OpenSSL to generate key pairs and +certificates. This assumes you have OpenSSL installed properly on your +system. + +First, we generate an X.509 certificate to be used for signing:: + + openssl req -newkey rsa:1024 -nodes -x509 -days 365 -out signer.pem + + Using configuration from /usr/local/pkg/openssl/openssl.cnf + Generating a 1024 bit RSA private key + ..++++++ + ....................++++++ + writing new private key to 'privkey.pem' + ----- + You are about to be asked to enter information that will be incorporated + into your certificate request. + What you are about to enter is what is called a Distinguished Name or a DN. + There are quite a few fields but you can leave some blank + For some fields there will be a default value, + If you enter '.', the field will be left blank. + ----- + Country Name (2 letter code) [AU]:SG + State or Province Name (full name) [Some-State]:. + Locality Name (eg, city) []:. + Organization Name (eg, company) [Internet Widgits Pty Ltd]:M2Crypto + Organizational Unit Name (eg, section) []:. + Common Name (eg, YOUR name) []:S/MIME Sender + Email Address []:sender@example.dom + + +This generates a 1024-bit RSA key pair, unencrypted, into +``privkey.pem``; it also generates a self-signed X.509 certificate for +the public key into ``signer.pem``. The certificate is valid for 365 +days, i.e., a year. + +Let's rename ``privkey.pem`` so that we know it is a companion of +``signer.pem``'s:: + + mv privkey.pem signer_key.pem + +To verify the content of ``signer.pem``, execute the following:: + + openssl x509 -noout -text -in signer.pem + + Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=SG, O=M2Crypto, CN=S/MIME Sender/Email=sender@example.dom + Validity + Not Before: Mar 24 12:56:16 2001 GMT + Not After : Mar 24 12:56:16 2002 GMT + Subject: C=SG, O=M2Crypto, CN=S/MIME Sender/Email=sender@example.dom + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:a9:d6:e2:b5:11:3b:ae:3c:e2:17:31:70:e1:6e: + 01:f4:19:6d:bd:2a:42:36:2b:37:34:e2:83:1d:0d: + 11:2e:b4:99:44:db:10:67:be:97:5f:5b:1a:26:33: + 46:23:2f:95:04:7a:35:da:9d:f9:26:88:39:9e:17: + cd:3e:eb:a8:19:8d:a8:2a:f1:43:da:55:a9:2e:2c: + 65:ed:04:71:42:ce:73:53:b8:ea:7e:c7:f0:23:c6: + 63:c5:5e:68:96:64:a7:b4:2a:94:26:76:eb:79:ea: + e3:4e:aa:82:09:4f:44:87:4a:12:62:b5:d7:1f:ca: + f2:ce:d5:ba:7e:1f:48:fd:b9 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 29:FB:38:B6:BF:E2:40:BB:FF:D5:71:D7:D5:C4:F0:83:1A:2B:C7:99 + X509v3 Authority Key Identifier: + keyid:29:FB:38:B6:BF:E2:40:BB:FF:D5:71:D7:D5:C4:F0:83:1A:2B:C7:99 + DirName:/C=SG/O=M2Crypto/CN=S/MIME Sender/Email=sender@example.dom + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + 68:c8:6b:1b:fa:7c:9a:39:35:76:18:15:c9:fd:89:97:62:db: + 7a:b0:2d:13:dd:97:e8:1b:7a:9f:22:27:83:24:9d:2e:56:ec: + 97:89:3c:ef:16:55:80:5a:18:7c:22:d0:f6:bb:e3:a4:e8:59: + 30:ff:99:5a:93:3e:ea:bc:ee:7f:8d:d6:7d:37:8c:ac:3d:74: + 80:ce:7a:99:ba:27:b9:2a:a3:71:fa:a5:25:ba:47:17:df:07: + 56:96:36:fd:60:b9:6c:96:06:e8:e3:7b:9f:4b:6a:95:71:a8: + 34:fc:fc:b5:88:8b:c4:3f:1e:24:f6:52:47:b2:7d:44:67:d9: + 83:e8 + +Next, we generate a self-signed X.509 certificate for the recipient. +Note that ``privkey.pem`` will be recreated:: + + openssl req -newkey rsa:1024 -nodes -x509 -days 365 -out recipient.pem + + Using configuration from /usr/local/pkg/openssl/openssl.cnf + Generating a 1024 bit RSA private key + .....................................++++++ + .................++++++ + writing new private key to 'privkey.pem' + ----- + You are about to be asked to enter information that will be incorporated + into your certificate request. + What you are about to enter is what is called a Distinguished Name or a DN. + There are quite a few fields but you can leave some blank + For some fields there will be a default value, + If you enter '.', the field will be left blank. + ----- + Country Name (2 letter code) [AU]:SG + State or Province Name (full name) [Some-State]:. + Locality Name (eg, city) []:. + Organization Name (eg, company) [Internet Widgits Pty Ltd]:M2Crypto + Organizational Unit Name (eg, section) []:. + Common Name (eg, YOUR name) []:S/MIME Recipient + Email Address []:recipient@example.dom + +Again, rename ``privkey.pem``:: + + mv privkey.pem recipient_key.pem + + +In the examples to follow, S/MIME Sender, ````, +shall be the sender of S/MIME messages, while S/MIME Recipient, +````, shall be the recipient of S/MIME messages. + +Armed with the key pairs and certificates, we are now ready to begin +programming S/MIME in Python. + + **Note:** The private keys generated above are *not + passphrase-protected*, i.e., they are *in the clear*. Anyone who has + access to such a key can generate S/MIME-signed messages with it, + and decrypt S/MIME messages encrypted to it's corresponding public + key. + + We may passphrase-protect the keys, if we so choose. M2Crypto will + prompt the user for the passphrase when such a key is being loaded. + +M2Crypto.SMIME +============== + +The Python programmer accesses M2Crypto's S/MIME functionality through +class ``SMIME`` in the module ``M2Crypto.SMIME``. Typically, an +``SMIME`` object is instantiated; the object is then set up for the +intended operation: sign, encrypt, decrypt or verify; finally, the +operation is invoked on the object. + +``M2Crypto.SMIME`` makes extensive use of ``M2Crypto.BIO``: +``M2Crypto.BIO`` is a Python abstraction of the ``BIO`` abstraction in +OpenSSL. A commonly used ``BIO`` abstraction in M2Crypto is +``M2Crypto.BIO.MemoryBuffer``, which implements a memory-based file-like +object, similar to Python's own ``StringIO``. + +Sign +==== + +The following code demonstrates how to generate an S/MIME-signed +message. ``randpool.dat`` contains random data which is used to seed +OpenSSL's pseudo-random number generator via M2Crypto:: + + from M2Crypto import BIO, Rand, SMIME + + def makebuf(text): + return BIO.MemoryBuffer(text) + + # Make a MemoryBuffer of the message. + buf = makebuf('a sign of our times') + + # Seed the PRNG. + Rand.load_file('randpool.dat', -1) + + # Instantiate an SMIME object; set it up; sign the buffer. + s = SMIME.SMIME() + s.load_key('signer_key.pem', 'signer.pem') + p7 = s.sign(buf, SMIME.PKCS7_DETACHED) + + +``p7`` now contains a *PKCS #7 signature blob* wrapped in an +``M2Crypto.SMIME.PKCS7`` object. Note that ``buf`` has been consumed by +``sign()`` and has to be recreated if it is to be used again. + +We may now send the signed message via SMTP. In these examples, we shall +not do so; instead, we'll render the S/MIME output in mail-friendly +format, and pretend that our messages are sent and received +correctly:: + + # Recreate buf. + buf = makebuf('a sign of our times') + + # Output p7 in mail-friendly format. + out = BIO.MemoryBuffer() + out.write('From: sender@example.dom\n') + out.write('To: recipient@example.dom\n') + out.write('Subject: M2Crypto S/MIME testing\n') + s.write(out, p7, buf) + + print(out.read()) + + # Save the PRNG's state. + Rand.save_file('randpool.dat') + +Here's the output:: + + From: sender@example.dom + To: recipient@example.dom + Subject: M2Crypto S/MIME testing + MIME-Version: 1.0 + Content-Type: multipart/signed ; protocol="application/x-pkcs7-signature" ; micalg=sha1 ; boundary="----3C93156FC7B4EBF49FE9C7DB7F503087" + + This is an S/MIME signed message + + ------3C93156FC7B4EBF49FE9C7DB7F503087 + a sign of our times + ------3C93156FC7B4EBF49FE9C7DB7F503087 + Content-Type: application/x-pkcs7-signature; name="smime.p7s" + Content-Transfer-Encoding: base64 + Content-Disposition: attachment; filename="smime.p7s" + + MIIE8AYJKoZIhvcNAQcCoIIE4TCCBN0CAQExCzAJBgUrDgMCGgUAMCIGCSqGSIb3 + DQEHAaAVBBNhIHNpZ24gb2Ygb3VyIHRpbWVzoIIC5zCCAuMwggJMoAMCAQICAQAw + DQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRv + MRYwFAYDVQQDEw1TL01JTUUgU2VuZGVyMSEwHwYJKoZIhvcNAQkBFhJzZW5kZXJA + ZXhhbXBsZS5kb20wHhcNMDEwMzMxMTE0MDMzWhcNMDIwMzMxMTE0MDMzWjBbMQsw + CQYDVQQGEwJTRzERMA8GA1UEChMITTJDcnlwdG8xFjAUBgNVBAMTDVMvTUlNRSBT + ZW5kZXIxITAfBgkqhkiG9w0BCQEWEnNlbmRlckBleGFtcGxlLmRvbTCBnzANBgkq + hkiG9w0BAQEFAAOBjQAwgYkCgYEA5c5Tj1CHTSOxa1q2q0FYiwMWYHptJpJcvtZm + UwrgU5sHrA8OnCM0cDXEj0KPf3cfNjHffB8HWMzI4UEgNmFXQNsxoGZ+iqwxLlNj + y9Mh7eFW/Bjq5hNXbouSlQ0rWBRkoxV64y+t6lQehb32WfYXQbKFxFJSXzSxOx3R + 8YhSPd0CAwEAAaOBtjCBszAdBgNVHQ4EFgQUXOyolL1t4jaBwZFRM7MS8nBLzUow + gYMGA1UdIwR8MHqAFFzsqJS9beI2gcGRUTOzEvJwS81KoV+kXTBbMQswCQYDVQQG + EwJTRzERMA8GA1UEChMITTJDcnlwdG8xFjAUBgNVBAMTDVMvTUlNRSBTZW5kZXIx + ITAfBgkqhkiG9w0BCQEWEnNlbmRlckBleGFtcGxlLmRvbYIBADAMBgNVHRMEBTAD + AQH/MA0GCSqGSIb3DQEBBAUAA4GBAHo3DrCHR86fSTVAvfiXdSswWqKtCEhUHRdC + TLFGl4hDk2GyZxaFuqZwiURz/H7nMicymI2wkz8H/wyHFg8G3BIehURpj2v/ZWXY + eovbgS7EZALVVkDj4hNl/IIHWd6Gtv1UODf7URbxtl3hQ9/eTWITrefT1heuPnar + 8czydsOLMYIBujCCAbYCAQEwYDBbMQswCQYDVQQGEwJTRzERMA8GA1UEChMITTJD + cnlwdG8xFjAUBgNVBAMTDVMvTUlNRSBTZW5kZXIxITAfBgkqhkiG9w0BCQEWEnNl + bmRlckBleGFtcGxlLmRvbQIBADAJBgUrDgMCGgUAoIGxMBgGCSqGSIb3DQEJAzEL + BgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTAxMDMzMTExNDUwMlowIwYJKoZI + hvcNAQkEMRYEFOoeRUd8ExIYXfQq8BTFuKWrSP3iMFIGCSqGSIb3DQEJDzFFMEMw + CgYIKoZIhvcNAwcwDgYIKoZIhvcNAwICAgCAMA0GCCqGSIb3DQMCAgFAMAcGBSsO + AwIHMA0GCCqGSIb3DQMCAgEoMA0GCSqGSIb3DQEBAQUABIGAQpU8hFUtLCF6hO2t + ec9EYJ/Imqqiiw+BxWxkUUVT81Vbjwdn9JST6+sztM5JRP2ZW+b4txEjZriYC8f3 + kv95YMTGbIsuWkJ93GrbvqoJ/CxO23r9WWRnZEm/1EZN9ZmlrYqzBTxnNRmP3Dhj + cW8kzZwH+2/2zz2G7x1HxRWH95A= + + ------3C93156FC7B4EBF49FE9C7DB7F503087-- + + +Verify +====== + +Assume the above output has been saved into ``sign.p7``. Let's now +verify the signature:: + + from M2Crypto import SMIME, X509 + + # Instantiate an SMIME object. + s = SMIME.SMIME() + + # Load the signer's cert. + x509 = X509.load_cert('signer.pem') + sk = X509.X509_Stack() + sk.push(x509) + s.set_x509_stack(sk) + + # Load the signer's CA cert. In this case, because the signer's + # cert is self-signed, it is the signer's cert itself. + st = X509.X509_Store() + st.load_info('signer.pem') + s.set_x509_store(st) + + # Load the data, verify it. + p7, data = SMIME.smime_load_pkcs7('sign.p7') + v = s.verify(p7, data) + print(v) + print(data) + print(data.read()) + +Here's the output of the above program:: + + a sign of our times + + a sign of our times + +Suppose, instead of loading ``signer.pem`` above, we load +``recipient.pem``. That is, we do a global substitution of +``recipient.pem`` for ``signer.pem`` in the above program. Here's the +modified program's output:: + + Traceback (most recent call last): + File "./verify.py", line 22, in ? + v = s.verify(p7) + File "/usr/local/home/ngps/prog/m2/M2Crypto/SMIME.py", line 205, in verify + raise SMIME_Error, Err.get_error() + M2Crypto.SMIME.SMIME_Error: 312:error:21075075:PKCS7 routines:PKCS7_verify:certificate verify error:pk7_smime.c:213:Verify error:self signed certificate + + +As displayed, the error is generated by line 213 of OpenSSL's +``pk7_smime.c`` (as of OpenSSL 0.9.6); if you are a C programmer, you +may wish to look up the C source to explore OpenSSL's S/MIME +implementation and understand why the error message is worded thus. + +Encrypt +======= + +We now demonstrate how to generate an S/MIME-encrypted message:: + + from M2Crypto import BIO, Rand, SMIME, X509 + + def makebuf(text): + return BIO.MemoryBuffer(text) + + # Make a MemoryBuffer of the message. + buf = makebuf('a sign of our times') + + # Seed the PRNG. + Rand.load_file('randpool.dat', -1) + + # Instantiate an SMIME object. + s = SMIME.SMIME() + + # Load target cert to encrypt to. + x509 = X509.load_cert('recipient.pem') + sk = X509.X509_Stack() + sk.push(x509) + s.set_x509_stack(sk) + + # Set cipher: 3-key triple-DES in CBC mode. + s.set_cipher(SMIME.Cipher('des_ede3_cbc')) + + # Encrypt the buffer. + p7 = s.encrypt(buf) + + # Output p7 in mail-friendly format. + out = BIO.MemoryBuffer() + out.write('From: sender@example.dom\n') + out.write('To: recipient@example.dom\n') + out.write('Subject: M2Crypto S/MIME testing\n') + s.write(out, p7) + + print(out.read()) + + # Save the PRNG's state. + Rand.save_file('randpool.dat') + +Here's the output of the above program:: + + From: sender@example.dom + To: recipient@example.dom + Subject: M2Crypto S/MIME testing + MIME-Version: 1.0 + Content-Disposition: attachment; filename="smime.p7m" + Content-Type: application/x-pkcs7-mime; name="smime.p7m" + Content-Transfer-Encoding: base64 + + MIIBVwYJKoZIhvcNAQcDoIIBSDCCAUQCAQAxggEAMIH9AgEAMGYwYTELMAkGA1UE + BhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRvMRkwFwYDVQQDExBTL01JTUUgUmVjaXBp + ZW50MSQwIgYJKoZIhvcNAQkBFhVyZWNpcGllbnRAZXhhbXBsZS5kb20CAQAwDQYJ + KoZIhvcNAQEBBQAEgYCBaXZ+qjpBEZwdP7gjfzfAtQitESyMwo3i+LBOw6sSDir6 + FlNDPCnkrTvqDX3Rt6X6vBtTCYOm+qiN7ujPkOU61cN7h8dvHR8YW9+0IPY80/W0 + lZ/HihSRgwTNd7LnxUUcPx8YV1id0dlmP0Hz+Lg+mHf6rqaR//JcYhX9vW4XvjA7 + BgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECMN+qya6ADywgBgHr9Jkhwn5Gsdu7BwX + nIQfYTYcdL9I5Sk= + + +Decrypt +======= + +Assume the above output has been saved into ``encrypt.p7``. Decrypt the +message thusly:: + + from M2Crypto import BIO, SMIME, X509 + + # Instantiate an SMIME object. + s = SMIME.SMIME() + + # Load private key and cert. + s.load_key('recipient_key.pem', 'recipient.pem') + + # Load the encrypted data. + p7, data = SMIME.smime_load_pkcs7('encrypt.p7') + + # Decrypt p7. + out = s.decrypt(p7) + + print(out) + +Here's the output:: + + a sign of our times + + +Sign and Encrypt +================ + +Here's how to generate an S/MIME-signed/encrypted message:: + + from M2Crypto import BIO, Rand, SMIME, X509 + + def makebuf(text): + return BIO.MemoryBuffer(text) + + # Make a MemoryBuffer of the message. + buf = makebuf('a sign of our times') + + # Seed the PRNG. + Rand.load_file('randpool.dat', -1) + + # Instantiate an SMIME object. + s = SMIME.SMIME() + + # Load signer's key and cert. Sign the buffer. + s.load_key('signer_key.pem', 'signer.pem') + p7 = s.sign(buf) + + # Load target cert to encrypt the signed message to. + x509 = X509.load_cert('recipient.pem') + sk = X509.X509_Stack() + sk.push(x509) + s.set_x509_stack(sk) + + # Set cipher: 3-key triple-DES in CBC mode. + s.set_cipher(SMIME.Cipher('des_ede3_cbc')) + + # Create a temporary buffer. + tmp = BIO.MemoryBuffer() + + # Write the signed message into the temporary buffer. + s.write(tmp, p7) + + # Encrypt the temporary buffer. + p7 = s.encrypt(tmp) + + # Output p7 in mail-friendly format. + out = BIO.MemoryBuffer() + out.write('From: sender@example.dom\n') + out.write('To: recipient@example.dom\n') + out.write('Subject: M2Crypto S/MIME testing\n') + s.write(out, p7) + + print(out.read()) + + # Save the PRNG's state. + Rand.save_file('randpool.dat') + +Here's the output of the above program:: + + From: sender@example.dom + To: recipient@example.dom + Subject: M2Crypto S/MIME testing + MIME-Version: 1.0 + Content-Disposition: attachment; filename="smime.p7m" + Content-Type: application/x-pkcs7-mime; name="smime.p7m" + Content-Transfer-Encoding: base64 + + MIIIwwYJKoZIhvcNAQcDoIIItDCCCLACAQAxggEAMIH9AgEAMGYwYTELMAkGA1UE + BhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRvMRkwFwYDVQQDExBTL01JTUUgUmVjaXBp + ZW50MSQwIgYJKoZIhvcNAQkBFhVyZWNpcGllbnRAZXhhbXBsZS5kb20CAQAwDQYJ + KoZIhvcNAQEBBQAEgYBlZlGupFphwhsGtIAPvDExN61qisz3oem88xoXkUW0SzoR + B9zJFFAuQTWzdNJgrKKYikhWjDojaAc/PFl1K5dYxRgtZLB36ULJD/v/yWmxnjz8 + TvtK+Wbal2P/MH2pZ4LVERXa/snTElhCawUlwtiFz/JvY5CiF/dcwd+AwFQq4jCC + B6UGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIRF525UfwszaAggeA85RmX6AXQMxb + eBDz/LJeCgc3RqU1UwIsbKMquIs1S46Ebbm5nP75izPnujOkJ2hv+LNzqOWADmOl + +CnGEq1qxTyduIgUDA2nBgCL/gVyVy+/XC9dtImUUTxtxLgYtB0ujkBNsOaENOlM + fv4SGM3jkR+K/xlYG6HHzZGbfYyNGj2Y7yMZ1rL1m8SnRNmkCysKGTrudeNf6wT9 + J6wO9DzLTioz3ZnVr3LjsSKIb4tIp4ugqNJaLuW7m3FtZ3MAgxN68hBbJs8TZ8tL + V/0jwUqS+grcgZEb9ymfcedxahtDUfHjRkpDpsxZzVVGkSBNcbQu92oByQVnRQ8m + wrYLp3/eawM5AvuV7HNpTT5ZR+1t8luishHN9899IMP2Vyg0Ub67FqFypYmM2cm2 + sjAI4KpfvT00XFNvgLuYwYEKs9syGTO7hiHNQKcF44F5LYv6nTFwmFQB11dAtY9V + ull4D2CLDx9OvyNyKwdEZB5dyV0r/uKIdkhST60V2Q9KegpzgFpoZtSKM/HPYSVH + 1Bc9f3Q/GqZCvNZZCMx8UvRjQR8dRWDSmPJ0VXG1+wJ+fCmSPP3AuQ1/VsgPRqx2 + 56VrpGPpGut40hV8xQFbWIZ2whwWLKPFAHj8B79ZtFUzUrU6Z2rNpvv8inHc/+S/ + b6GR5s8/gucRblvd7n3OFNX5UJmPmcw9zWbu/1Dr9DY8l0nAQh21y5FGSS8B1wdE + oD2M3Lp7JbwjQbRtnDhImqul2S4yu+m+wDD1aR2K4k3GAI7KKgOBWT0+BDClcn8A + 4Ju6/YUbj33YlMPJgnGijLnolFy0hNW7TmWqR+8tSI3wO5eNKg4qwBnarqc3vgCV + quVxINAXyGQCO9lzdw6hudk8/+BlweGdqhONaIWbK5z1L/SfQo6LC9MTsj7FJydq + bc+kEbfZS8aSq7uc9axW6Ti0eAPJ8EVHtwhSBgZQRweKFBXs6HbbhMIdc4N0M7Oq + UiFXaF6s4n2uihVP6TqXtHEjTpZoC7pC+HCYiuKXUJtaqtXBOh+y3KLvHk09YL6D + XmTDg+UTiFsh4jKKm/BhdelbR5JbpJcj5AId76Mfr8+F/1g9ePOvsWHpQr/oIQTo + xEkaxCmzEgP0b6caMWfMUQrbVGxBBNcqKc/ir9fGGOPHATzzq/xLcQYvK1tZhd/D + ah/gpMPndsyvVCEuFPluWyDiM0VkwHgC2/3pJIYFHaxK64IutmPsy393rHMEB4kN + AHau6kWK+yL9qEVH1pP2zvswQ12P7gjt3T/G3bGsmvlXkEfztfjkXo6XnjcBNf5y + G+974AKLcjnk1gzIgarz+lAMY57Gkw4oNDMrTqVQ2OJQlvOSbllPXzH+aAiavB8W + ZPECLLwHxD4B1AuaiAArgKl935u/TOB+yQOR8JgGsUzROyJqHJ/SC51HkebgCkL1 + aggtjgPlIBEXLZAlhpWLZ9lAQyrQpvCVJYwaOvfMmvRav4NAFNoZ2/Q7S4Tn1z+U + XX+f+GD58P4MPMhU5IKnz4yH4nlHnAiTEvcs85TZUAXze9g/uBOwZITeGtyLi52S + aETIr4v7SgXMepX7ThQ1Pv/jddsK/u4j2F34u0XktwCP+UrbfkE2mocdXvdzxbmd + tZSznK2qwgVSsPOs9MhUaepbnjmNBFFBrULhrUtSglM/VX/rWNiyh0aw4XYyHhIt + 9ZNlfEjKjJ67VEMBxBJ/ieUCouRGCxPYD1j65VT7oB3ZiyPu2F2nlUIcYNqPg1Sd + QBCrdaOXdJ0uLwyTAUeVE+wMbgscLvWsfZcCCJHAvw9NHFMUcnrdWxAYMVETNUOn + uryVAK7VfOldaz6z3NOSOi6nonNeHpR/sipBa4ik5xCRLT9e0S2QJgRvO9GyfAqz + 3DIzHtxIGePFzTiUYUTxS3i2gnMX2PEe3ChTLlYWD3jNeAKz0iOzpDphIF2xHLLQ + 1tCAqBmq/vUzALyDFFdFuTIqQZys4z/u4Dmyq9uXs421eN3v2hkVHvDy8uT2Ot29 + lg4Q5YezR1EjaW//9guL1BXbcKrTEdtxeNqtem7SpZOMTSwD2lhB8z65GrX90Cyt + EMmaRSGYEdf5h1afL1SmKOMskbqxe1D2jG/vsXC7XX7xO/ioy0BdiJcYN1JiMOHJ + EOzFol5I20YkiV6j+cenfQFwc/NkaSxEkR8AUHJSbvUmRQRl6r0nnsFpZdR1w7pv + wkaT+eOpZynO4mY/ZtF6MpXJsixi6L4ZYXEbS6yHf+XGFfB0okILylmwv2bf6+Mq + nqXlmGj3Jwq7X9/+2BDqvfpFFX5lSmItKZAobLdssjFR6roJxOqRsGia2aZ+0+U5 + VhgdITtnElgtHBaeZU5rHDswgdeLVBP+rGWnKxpJ+pLtNNi25sPYRcWFL6Erd25u + eXiY8GEIr+u7rqBWpc9HR34sAPRs3ubbCUleT748keCbx247ImBtiDctZxcc1O86 + +0QjHP6HUT7FSo/FmT7a120S3Gd2jixGh06l/9ij5Z6mJa7Rm7TTbSjup/XISnOT + MKWcbI1nfVOhCv3xDq2eLae+s0oVoc041ceRazqFM2TL/Z6UXRME + + +Decrypt and Verify +================== + +Suppose the above output has been saved into ``se.p7``. The following +demonstrates how to decrypt and verify it:: + + from M2Crypto import BIO, SMIME, X509 + + # Instantiate an SMIME object. + s = SMIME.SMIME() + + # Load private key and cert. + s.load_key('recipient_key.pem', 'recipient.pem') + + # Load the signed/encrypted data. + p7, data = SMIME.smime_load_pkcs7('se.p7') + + # After the above step, 'data' == None. + # Decrypt p7. 'out' now contains a PKCS #7 signed blob. + out = s.decrypt(p7) + + # Load the signer's cert. + x509 = X509.load_cert('signer.pem') + sk = X509.X509_Stack() + sk.push(x509) + s.set_x509_stack(sk) + + # Load the signer's CA cert. In this case, because the signer's + # cert is self-signed, it is the signer's cert itself. + st = X509.X509_Store() + st.load_info('signer.pem') + s.set_x509_store(st) + + # Recall 'out' contains a PKCS #7 blob. + # Transform 'out'; verify the resulting PKCS #7 blob. + p7_bio = BIO.MemoryBuffer(out) + p7, data = SMIME.smime_load_pkcs7_bio(p7_bio) + v = s.verify(p7) + + print(v) + + +The output is as follows:: + + a sign of our times + + +Sending S/MIME messages via SMTP +================================ + +In the above examples, we've assumed that our S/MIME messages are sent +and received automagically. The following is a Python function that +generates S/MIME-signed/encrypted messages and sends them via +SMTP:: + + from M2Crypto import BIO, SMIME, X509 + import smtplib, string, sys + + def sendsmime(from_addr, to_addrs, subject, msg, from_key, from_cert=None, to_certs=None, smtpd='localhost'): + + msg_bio = BIO.MemoryBuffer(msg) + sign = from_key + encrypt = to_certs + + s = SMIME.SMIME() + if sign: + s.load_key(from_key, from_cert) + if encrypt: + p7 = s.sign(msg_bio, flags=SMIME.PKCS7_TEXT) + else: + p7 = s.sign(msg_bio, flags=SMIME.PKCS7_TEXT|SMIME.PKCS7_DETACHED) + msg_bio = BIO.MemoryBuffer(msg) # Recreate coz sign() has consumed it. + + if encrypt: + sk = X509.X509_Stack() + for x in to_certs: + sk.push(X509.load_cert(x)) + s.set_x509_stack(sk) + s.set_cipher(SMIME.Cipher('des_ede3_cbc')) + tmp_bio = BIO.MemoryBuffer() + if sign: + s.write(tmp_bio, p7) + else: + tmp_bio.write(msg) + p7 = s.encrypt(tmp_bio) + + out = BIO.MemoryBuffer() + out.write('From: %s\r\n' % from_addr) + out.write('To: %s\r\n' % string.join(to_addrs, ", ")) + out.write('Subject: %s\r\n' % subject) + if encrypt: + s.write(out, p7) + else: + if sign: + s.write(out, p7, msg_bio, SMIME.PKCS7_TEXT) + else: + out.write('\r\n') + out.write(msg) + out.close() + + smtp = smtplib.SMTP() + smtp.connect(smtpd) + smtp.sendmail(from_addr, to_addrs, out.read()) + smtp.quit() + + +This function sends plain, S/MIME-signed, S/MIME-encrypted, and +S/MIME-signed/encrypted messages, depending on the parameters +``from_key`` and ``to_certs``. The function's output interoperates with +Netscape Messenger. + +Verifying origin of S/MIME messages +=================================== + +In our examples above that decrypt or verify messages, we skipped a +step: verifying that the ``from`` address of the message matches the +``email address`` attribute in the sender's certificate. + +The premise of current X.509 certification practice is that the CA is +supposed to verify your identity, and to issue a certificate with +``email address`` that matches your actual mail address. (Verisign's +March 2001 failure in identity verification resulting in Microsoft +certificates being issued to spoofers notwithstanding.) + +If you run your own CA, your certification practice is up to you, of +course, and it would probably be part of your security policy. + +Whether your S/MIME messaging application needs to verify the ``from`` +addresses of S/MIME messages depends on your security policy and your +system's threat model, as always. + +Interoperating with Netscape Messenger +====================================== + +Suppose S/MIME Recipient uses Netscape Messenger. To enable Messenger to +handle S/MIME messages from S/MIME Sender, S/MIME Recipient needs to +configure Messenger with his private key and certificate, as well as +S/MIME Sender's certificate. + + **Note:** Configuring Messenger's POP or IMAP settings so that it + retrieves mail correctly is beyond the scope of this HOWTO. + +The following steps demonstrate how to import S/MIME Recipient's private +key and certificate for Messenger: + +1. Transform S/MIME Recipient's private key and certificate into *PKCS + #12* format:: + + openssl pkcs12 -export -in recipient.pem -inkey recipient_key.pem \ + -name "S/MIME Recipient" -out recipient.p12 + + Enter Export Password: + Verifying password - Enter Export Password: + +2. Start Messenger. + +3. Click on the (open) "lock" icon at the bottom left corner of + Messenger's window. This brings up the "Security Info" dialog box. + +4. Click on "Yours" under "Certificates". + +5. Select "Import a certificate", then pick ``recipient.p12`` from the + ensuing file selection dialog box. + +Next, you need to import ``signer.pem`` as a CA certificate, so that +Messenger will mark messages signed by S/MIME Sender as "trusted": + +1. Create a DER encoding of ``signer.pem``:: + + openssl x509 -inform pem -outform der -in signer.pem -out signer.der + +2. Install ``signer.der`` into Messenger as MIME type + ``application/x-x509-ca-cert``. You do this by downloading + ``signer.der`` via Navigator from a HTTP or HTTPS server, with the + correct MIME type mapping. (You may use ``demo/ssl/https_srv.py``, + bundled with M2Crypto, for this purpose.) Follow the series of dialog + boxes to accept ``signer.der`` as a CA for certifying email users. + +S/MIME Recipient is now able to decrypt and read S/MIME Sender's +messages with Messenger. Messenger will indicate that S/MIME Sender's +messages are signed, encrypted, or encrypted *and* signed, as the case +may be, via the "stamp" icon on the message window's top right corner. + +Clicking on the "stamp" icon brings you to the Security Info dialog box. +Messenger informs you that the message is, say, encrypted with 168-bit +DES-EDE3-CBC and that it is digitally signed by the private key +corresponding to the public key contained in the certificate +``signer.pem``. + +Interoperating with Microsoft Outlook +===================================== + +I do not know how to do this, as I do not use Outlook. (Nor do I use +Netscape Messenger, actually. I use Mutt, top dog of MUAs. ;-) +Information on how to configure Outlook with keys and certificates so +that it handles S/MIME mail is gratefully accepted. + +ZSmime +====== + +ZSmime is a `Zope `__ *product* that enables Zope +to generate S/MIME-signed/encrypted messages. ZSmime demonstrates how to +invoke M2Crypto in a web application server extension. + +ZSmime has its own +`HOWTO `__ +explaining its usage. (That HOWTO has some overlap in content with this +document.) + +Resources +========= + +- IETF S/MIME Working Group - http://www.imc.org/ietf-smime + +- S/MIME and OpenPGP - http://www.imc.org/smime-pgpmime.html + +- S/MIME Freeware Library - + http://www.getronicsgov.com/hot/sfl_home.htm + +- Mozilla Network Security Services - + http://www.mozilla.org/projects/security/pkg/nss + +- S/MIME Cracking Screen Saver - http://www.counterpane.com/smime.html diff --git a/doc/html/_sources/howto.ssl.rst.txt b/doc/html/_sources/howto.ssl.rst.txt new file mode 100644 index 0000000..7f3278c --- /dev/null +++ b/doc/html/_sources/howto.ssl.rst.txt @@ -0,0 +1,131 @@ +:orphan: + +.. _howto-ssl: + +HOWTO: Programming SSL in Python with M2Crypto +============================================== + +:author: Pheng Siong Ng and Heikki Toivonen (heikki@osafoundation.org) +:copyright: © 2000, 2001 by Ng Pheng Siong, + portions © 2006 by Open Source Applications Foundation + +Introduction +============ + +`M2Crypto `__ is a +`Python `__ interface to +`OpenSSL `__. It makes available to the Python +programmer SSL functionality to implement clients and servers, S/MIME +v2, RSA, DSA, DH, symmetric ciphers, message digests and HMACs. + +This document demonstrates programming HTTPS with M2Crypto. + +A bit of history +================ + +M2Crypto was created during the time of Python 1.5, which features a +module httplib providing client-side HTTP functionality. M2Crypto sports +a httpslib based on httplib. + +Beginning with version 2.0, Python's socket module provided +(rudimentary) SSL support. Also in the same version, httplib was +enhanced with class HTTPConnection, which is more sophisticated than the +old class HTTP, and HTTPSConnection, which does HTTPS. + +Subsequently, M2Crypto.httpslib grew a compatible (but not identical) +class HTTPSConnection. + +The primary interface difference between the two HTTPSConnection classes +is that M2Crypto's version accepts an M2Crypto.SSL.Context instance as a +parameter, whereas Python 2.x's SSL support does not permit Pythonic +control of the SSL context. + +Within the implementations, Python's ``HTTPSConnection`` employs a +``FakeSocket`` object, which collects all input from the SSL connection +before returning it to the application as a ``StringIO`` buffer, whereas +M2Crypto's ``HTTPSConnection`` uses a buffering +``M2Crypto.BIO.IOBuffer`` object that works over the underlying +M2Crypto.SSL.Connection directly. + +Since then M2Crypto has gained a Twisted wrapper that allows securing +Twisted SSL connections with M2Crypto. + +Secure SSL +========== + +It is recommended that you read the book Network Security with OpenSSL +by John Viega, Matt Messier and Pravir Chandra, ISBN 059600270X. + +Using M2Crypto does not automatically make an SSL connection secure. +There are various steps that need to be made before we can make that +claim. Let's see how a simple client can establish a secure +connection:: + + ctx = SSL.Context() + ctx.set_verify(SSL.verify_peer | SSL.verify_fail_if_no_peer_cert, depth=9) + if ctx.load_verify_locations('ca.pem') != 1: raise Exception('No CA certs') + s = SSL.Connection(ctx) + s.connect(server_address) + # Normal protocol (for example HTTP) commands follow + +The first line creates an SSL context. The defaults allow any SSL +version (except SSL version 2 which has known weaknesses) and sets the +allowed ciphers to secure ones. + +The second line tells M2Crypto to perform certificate validation. The +flags shown above are typical for clients, and requires the server to +send a certificate. The depth parameter tells how long certificate +chains are allowed - 9 is pretty common default, although probably too +long in practice. + +The third line loads the allowed root (certificate authority or CA) +certificates. Most Linux distributions come with CA certificates in +suitable format. You could also download the +`certdata.txt `__ +file from the +`NSS `__ project and +convert it with the little M2Crypto utility script +`demo/x509/certdata2pem.py `__. + +The fourth line creates an SSL connection object with the secure +context. + +The fifth line connects to the server. During this time we perform the +last security step: just after connection, but before exchanging any +data, we compare the commonName (or subjectAltName DNS field) field in +the certificate the server returned to the server address we tried to +connect to. This happens automatically with SSL.Connection and the +Twisted wrapper class, and anything that uses those. In all other cases +you must do the check manually. It is recommended you call the +SSL.Checker to do the actual check. + +SSL servers are different in that they typically do not require the +client to send a certificate, so there is usually no certificate +checking. Also, it is typically useless to perform host name checking. + +Code Samples +============ + +The best samples of how to use the various SSL objects are in the tests +directory, and the test\_ssl.py file specifically. There are additional +samples in the demo directory, but they are not quaranteed to be up to +date. + +NOTE: The tests and demos may not be secure as is. Use the information +above on how to make them secure. + +ssldump +======= + +ssldump "is an SSLv3/TLS network protocol analyser. It identifies TCP +connections on the chosen network interface and attempts to interpret +them as SSLv3/TLS traffic. When it identifies SSLv3/TLS traffic, it +decodes the records and displays them in a textual form to stdout. If +provided with the appropriate keying material, it will also decrypt the +connections and display the application data traffic. + +If linked with OpenSSL, ssldump can display certificates in decoded form +and decrypt traffic (provided that it has the appropriate keying +material)." + +ssldump is written by Eric Rescorla. diff --git a/doc/html/_sources/index.rst.txt b/doc/html/_sources/index.rst.txt new file mode 100644 index 0000000..a472668 --- /dev/null +++ b/doc/html/_sources/index.rst.txt @@ -0,0 +1,30 @@ +Welcome to M2Crypto's documentation! +==================================== + +Contents: + +.. toctree:: + :maxdepth: 4 + + M2Crypto + + +HOWTOs +====== + +* :ref:`howto-ca` + +* :ref:`howto-ssl` + +* :ref:`howto-smime` + +* :ref:`zserverssl-howto` + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/doc/html/_static/alabaster.css b/doc/html/_static/alabaster.css new file mode 100644 index 0000000..a88ce29 --- /dev/null +++ b/doc/html/_static/alabaster.css @@ -0,0 +1,693 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +@import url("basic.css"); + +/* -- page layout ----------------------------------------------------------- */ + +body { + font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif; + font-size: 17px; + background-color: #fff; + color: #000; + margin: 0; + padding: 0; +} + + +div.document { + width: 940px; + margin: 30px auto 0 auto; +} + +div.documentwrapper { + float: left; + width: 100%; +} + +div.bodywrapper { + margin: 0 0 0 220px; +} + +div.sphinxsidebar { + width: 220px; + font-size: 14px; + line-height: 1.5; +} + +hr { + border: 1px solid #B1B4B6; +} + +div.body { + background-color: #fff; + color: #3E4349; + padding: 0 30px 0 30px; +} + +div.body > .section { + text-align: left; +} + +div.footer { + width: 940px; + margin: 20px auto 30px auto; + font-size: 14px; + color: #888; + text-align: right; +} + +div.footer a { + color: #888; +} + +p.caption { + font-family: inherit; + font-size: inherit; +} + + +div.relations { + display: none; +} + + +div.sphinxsidebar a { + color: #444; + text-decoration: none; + border-bottom: 1px dotted #999; +} + +div.sphinxsidebar a:hover { + border-bottom: 1px solid #999; +} + +div.sphinxsidebarwrapper { + padding: 18px 10px; +} + +div.sphinxsidebarwrapper p.logo { + padding: 0; + margin: -10px 0 0 0px; + text-align: center; +} + +div.sphinxsidebarwrapper h1.logo { + margin-top: -10px; + text-align: center; + margin-bottom: 5px; + text-align: left; +} + +div.sphinxsidebarwrapper h1.logo-name { + margin-top: 0px; +} + +div.sphinxsidebarwrapper p.blurb { + margin-top: 0; + font-style: normal; +} + +div.sphinxsidebar h3, +div.sphinxsidebar h4 { + font-family: 'Garamond', 'Georgia', serif; + color: #444; + font-size: 24px; + font-weight: normal; + margin: 0 0 5px 0; + padding: 0; +} + +div.sphinxsidebar h4 { + font-size: 20px; +} + +div.sphinxsidebar h3 a { + color: #444; +} + +div.sphinxsidebar p.logo a, +div.sphinxsidebar h3 a, +div.sphinxsidebar p.logo a:hover, +div.sphinxsidebar h3 a:hover { + border: none; +} + +div.sphinxsidebar p { + color: #555; + margin: 10px 0; +} + +div.sphinxsidebar ul { + margin: 10px 0; + padding: 0; + color: #000; +} + +div.sphinxsidebar ul li.toctree-l1 > a { + font-size: 120%; +} + +div.sphinxsidebar ul li.toctree-l2 > a { + font-size: 110%; +} + +div.sphinxsidebar input { + border: 1px solid #CCC; + font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif; + font-size: 1em; +} + +div.sphinxsidebar hr { + border: none; + height: 1px; + color: #AAA; + background: #AAA; + + text-align: left; + margin-left: 0; + width: 50%; +} + +/* -- body styles ----------------------------------------------------------- */ + +a { + color: #004B6B; + text-decoration: underline; +} + +a:hover { + color: #6D4100; + text-decoration: underline; +} + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + font-family: 'Garamond', 'Georgia', serif; + font-weight: normal; + margin: 30px 0px 10px 0px; + padding: 0; +} + +div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; } +div.body h2 { font-size: 180%; } +div.body h3 { font-size: 150%; } +div.body h4 { font-size: 130%; } +div.body h5 { font-size: 100%; } +div.body h6 { font-size: 100%; } + +a.headerlink { + color: #DDD; + padding: 0 4px; + text-decoration: none; +} + +a.headerlink:hover { + color: #444; + background: #EAEAEA; +} + +div.body p, div.body dd, div.body li { + line-height: 1.4em; +} + +div.admonition { + margin: 20px 0px; + padding: 10px 30px; + background-color: #EEE; + border: 1px solid #CCC; +} + +div.admonition tt.xref, div.admonition code.xref, div.admonition a tt { + background-color: ; + border-bottom: 1px solid #fafafa; +} + +dd div.admonition { + margin-left: -60px; + padding-left: 60px; +} + +div.admonition p.admonition-title { + font-family: 'Garamond', 'Georgia', serif; + font-weight: normal; + font-size: 24px; + margin: 0 0 10px 0; + padding: 0; + line-height: 1; +} + +div.admonition p.last { + margin-bottom: 0; +} + +div.highlight { + background-color: #fff; +} + +dt:target, .highlight { + background: #FAF3E8; +} + +div.warning { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.danger { + background-color: #FCC; + border: 1px solid #FAA; + -moz-box-shadow: 2px 2px 4px #D52C2C; + -webkit-box-shadow: 2px 2px 4px #D52C2C; + box-shadow: 2px 2px 4px #D52C2C; +} + +div.error { + background-color: #FCC; + border: 1px solid #FAA; + -moz-box-shadow: 2px 2px 4px #D52C2C; + -webkit-box-shadow: 2px 2px 4px #D52C2C; + box-shadow: 2px 2px 4px #D52C2C; +} + +div.caution { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.attention { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.important { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.note { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.tip { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.hint { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.seealso { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.topic { + background-color: #EEE; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + +pre, tt, code { + font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; + font-size: 0.9em; +} + +.hll { + background-color: #FFC; + margin: 0 -12px; + padding: 0 12px; + display: block; +} + +img.screenshot { +} + +tt.descname, tt.descclassname, code.descname, code.descclassname { + font-size: 0.95em; +} + +tt.descname, code.descname { + padding-right: 0.08em; +} + +img.screenshot { + -moz-box-shadow: 2px 2px 4px #EEE; + -webkit-box-shadow: 2px 2px 4px #EEE; + box-shadow: 2px 2px 4px #EEE; +} + +table.docutils { + border: 1px solid #888; + -moz-box-shadow: 2px 2px 4px #EEE; + -webkit-box-shadow: 2px 2px 4px #EEE; + box-shadow: 2px 2px 4px #EEE; +} + +table.docutils td, table.docutils th { + border: 1px solid #888; + padding: 0.25em 0.7em; +} + +table.field-list, table.footnote { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} + +table.footnote { + margin: 15px 0; + width: 100%; + border: 1px solid #EEE; + background: #FDFDFD; + font-size: 0.9em; +} + +table.footnote + table.footnote { + margin-top: -15px; + border-top: none; +} + +table.field-list th { + padding: 0 0.8em 0 0; +} + +table.field-list td { + padding: 0; +} + +table.field-list p { + margin-bottom: 0.8em; +} + +table.footnote td.label { + width: .1px; + padding: 0.3em 0 0.3em 0.5em; +} + +table.footnote td { + padding: 0.3em 0.5em; +} + +dl { + margin: 0; + padding: 0; +} + +dl dd { + margin-left: 30px; +} + +blockquote { + margin: 0 0 0 30px; + padding: 0; +} + +ul, ol { + /* Matches the 30px from the narrow-screen "li > ul" selector below */ + margin: 10px 0 10px 30px; + padding: 0; +} + +pre { + background: #EEE; + padding: 7px 30px; + margin: 15px 0px; + line-height: 1.3em; +} + +div.viewcode-block:target { + background: #ffd; +} + +dl pre, blockquote pre, li pre { + margin-left: 0; + padding-left: 30px; +} + +dl dl pre { + margin-left: -90px; + padding-left: 90px; +} + +tt, code { + background-color: #ecf0f3; + color: #222; + /* padding: 1px 2px; */ +} + +tt.xref, code.xref, a tt { + background-color: #FBFBFB; + border-bottom: 1px solid #fff; +} + +a.reference { + text-decoration: none; + border-bottom: 1px dotted #004B6B; +} + +/* Don't put an underline on images */ +a.image-reference, a.image-reference:hover { + border-bottom: none; +} + +a.reference:hover { + border-bottom: 1px solid #6D4100; +} + +a.footnote-reference { + text-decoration: none; + font-size: 0.7em; + vertical-align: top; + border-bottom: 1px dotted #004B6B; +} + +a.footnote-reference:hover { + border-bottom: 1px solid #6D4100; +} + +a:hover tt, a:hover code { + background: #EEE; +} + + +@media screen and (max-width: 870px) { + + div.sphinxsidebar { + display: none; + } + + div.document { + width: 100%; + + } + + div.documentwrapper { + margin-left: 0; + margin-top: 0; + margin-right: 0; + margin-bottom: 0; + } + + div.bodywrapper { + margin-top: 0; + margin-right: 0; + margin-bottom: 0; + margin-left: 0; + } + + ul { + margin-left: 0; + } + + li > ul { + /* Matches the 30px from the "ul, ol" selector above */ + margin-left: 30px; + } + + .document { + width: auto; + } + + .footer { + width: auto; + } + + .bodywrapper { + margin: 0; + } + + .footer { + width: auto; + } + + .github { + display: none; + } + + + +} + + + +@media screen and (max-width: 875px) { + + body { + margin: 0; + padding: 20px 30px; + } + + div.documentwrapper { + float: none; + background: #fff; + } + + div.sphinxsidebar { + display: block; + float: none; + width: 102.5%; + margin: 50px -30px -20px -30px; + padding: 10px 20px; + background: #333; + color: #FFF; + } + + div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p, + div.sphinxsidebar h3 a { + color: #fff; + } + + div.sphinxsidebar a { + color: #AAA; + } + + div.sphinxsidebar p.logo { + display: none; + } + + div.document { + width: 100%; + margin: 0; + } + + div.footer { + display: none; + } + + div.bodywrapper { + margin: 0; + } + + div.body { + min-height: 0; + padding: 0; + } + + .rtd_doc_footer { + display: none; + } + + .document { + width: auto; + } + + .footer { + width: auto; + } + + .footer { + width: auto; + } + + .github { + display: none; + } +} + + +/* misc. */ + +.revsys-inline { + display: none!important; +} + +/* Make nested-list/multi-paragraph items look better in Releases changelog + * pages. Without this, docutils' magical list fuckery causes inconsistent + * formatting between different release sub-lists. + */ +div#changelog > div.section > ul > li > p:only-child { + margin-bottom: 0; +} + +/* Hide fugly table cell borders in ..bibliography:: directive output */ +table.docutils.citation, table.docutils.citation td, table.docutils.citation th { + border: none; + /* Below needed in some edge cases; if not applied, bottom shadows appear */ + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} \ No newline at end of file diff --git a/doc/html/_static/basic.css b/doc/html/_static/basic.css index 43e8baf..6df76b0 100644 --- a/doc/html/_static/basic.css +++ b/doc/html/_static/basic.css @@ -4,7 +4,7 @@ * * Sphinx stylesheet -- basic theme. * - * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -52,6 +52,8 @@ div.sphinxsidebar { width: 230px; margin-left: -100%; font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; } div.sphinxsidebar ul { @@ -83,12 +85,9 @@ div.sphinxsidebar #searchbox input[type="text"] { width: 170px; } -div.sphinxsidebar #searchbox input[type="submit"] { - width: 30px; -} - img { border: 0; + max-width: 100%; } /* -- search page ----------------------------------------------------------- */ @@ -123,6 +122,8 @@ ul.keywordmatches li.goodmatch a { table.contentstable { width: 90%; + margin-left: auto; + margin-right: auto; } table.contentstable p.biglink { @@ -150,9 +151,14 @@ table.indextable td { vertical-align: top; } -table.indextable dl, table.indextable dd { +table.indextable ul { margin-top: 0; margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; } table.indextable tr.pcap { @@ -184,8 +190,22 @@ div.genindex-jumpbox { padding: 0.4em; } +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + /* -- general body styles --------------------------------------------------- */ +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + a.headerlink { visibility: hidden; } @@ -196,7 +216,10 @@ h3:hover > a.headerlink, h4:hover > a.headerlink, h5:hover > a.headerlink, h6:hover > a.headerlink, -dt:hover > a.headerlink { +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { visibility: visible; } @@ -208,10 +231,6 @@ div.body td { text-align: left; } -.field-list ul { - padding-left: 1em; -} - .first { margin-top: 0 !important; } @@ -313,6 +332,13 @@ table.docutils { border-collapse: collapse; } +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + table.docutils td, table.docutils th { padding: 1px 8px 1px 5px; border-top: 0; @@ -321,10 +347,6 @@ table.docutils td, table.docutils th { border-bottom: 1px solid #aaa; } -table.field-list td, table.field-list th { - border: 0 !important; -} - table.footnote td, table.footnote th { border: 0 !important; } @@ -343,6 +365,46 @@ table.citation td { border-bottom: none; } +/* -- figures --------------------------------------------------------------- */ + +div.figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + /* -- other body styles ----------------------------------------------------- */ ol.arabic { @@ -392,23 +454,14 @@ dl.glossary dt { font-size: 1.1em; } -.field-list ul { - margin: 0; - padding-left: 1em; -} - -.field-list p { - margin: 0; -} - -.refcount { - color: #060; -} - .optional { font-size: 1.3em; } +.sig-paren { + font-size: larger; +} + .versionmodified { font-style: italic; } @@ -459,6 +512,13 @@ pre { overflow-y: hidden; /* fixes display issues on Chrome browsers */ } +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; +} + td.linenos pre { padding: 5px 0px; border: 0; @@ -474,22 +534,51 @@ table.highlighttable td { padding: 0 0.5em 0 0.5em; } -tt.descname { +div.code-block-caption { + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +div.code-block-caption + div > div.highlight > pre { + margin-top: 0; +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + padding: 1em 1em 0; +} + +div.literal-block-wrapper div.highlight { + margin: 0; +} + +code.descname { background-color: transparent; font-weight: bold; font-size: 1.2em; } -tt.descclassname { +code.descclassname { background-color: transparent; } -tt.xref, a tt { +code.xref, a code { background-color: transparent; font-weight: bold; } -h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { background-color: transparent; } @@ -521,6 +610,16 @@ span.eqno { float: right; } +span.eqno a.headerlink { + position: relative; + left: 0px; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + /* -- printout stylesheet --------------------------------------------------- */ @media print { diff --git a/doc/html/_static/comment-bright.png b/doc/html/_static/comment-bright.png index 551517b..15e27ed 100644 Binary files a/doc/html/_static/comment-bright.png and b/doc/html/_static/comment-bright.png differ diff --git a/doc/html/_static/comment-close.png b/doc/html/_static/comment-close.png index 09b54be..4d91bcf 100644 Binary files a/doc/html/_static/comment-close.png and b/doc/html/_static/comment-close.png differ diff --git a/doc/html/_static/comment.png b/doc/html/_static/comment.png index 92feb52..dfbc0cb 100644 Binary files a/doc/html/_static/comment.png and b/doc/html/_static/comment.png differ diff --git a/doc/html/_static/custom.css b/doc/html/_static/custom.css new file mode 100644 index 0000000..2a924f1 --- /dev/null +++ b/doc/html/_static/custom.css @@ -0,0 +1 @@ +/* This file intentionally left blank. */ diff --git a/doc/html/_static/doctools.js b/doc/html/_static/doctools.js index d4619fd..5654977 100644 --- a/doc/html/_static/doctools.js +++ b/doc/html/_static/doctools.js @@ -4,7 +4,7 @@ * * Sphinx JavaScript utilities for all documentation. * - * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -32,7 +32,7 @@ if (!window.console || !console.firebug) { */ jQuery.urldecode = function(x) { return decodeURIComponent(x).replace(/\+/g, ' '); -} +}; /** * small helper function to urlencode strings @@ -61,18 +61,6 @@ jQuery.getQueryParameters = function(s) { return result; }; -/** - * small function to check if an array contains - * a given item. - */ -jQuery.contains = function(arr, item) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] == item) - return true; - } - return false; -}; - /** * highlight a given string on a jquery object by wrapping it in * span elements with the given class name. @@ -103,6 +91,30 @@ jQuery.fn.highlightText = function(text, className) { }); }; +/* + * backward compatibility for jQuery.browser + * This will be supported until firefox bug is fixed. + */ +if (!jQuery.browser) { + jQuery.uaMatch = function(ua) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + /(webkit)[ \/]([\w.]+)/.exec(ua) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || + /(msie) ([\w.]+)/.exec(ua) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + jQuery.browser = {}; + jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; +} + /** * Small JavaScript module for the documentation. */ @@ -112,6 +124,7 @@ var Documentation = { this.fixFirefoxAnchorBug(); this.highlightSearchWords(); this.initIndexTable(); + }, /** @@ -164,9 +177,10 @@ var Documentation = { /** * workaround a firefox stupidity + * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 */ fixFirefoxAnchorBug : function() { - if (document.location.hash && $.browser.mozilla) + if (document.location.hash) window.setTimeout(function() { document.location.href += ''; }, 10); @@ -180,6 +194,9 @@ var Documentation = { var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; if (terms.length) { var body = $('div.body'); + if (!body.length) { + body = $('body'); + } window.setTimeout(function() { $.each(terms, function() { body.highlightText(this.toLowerCase(), 'highlighted'); @@ -236,6 +253,29 @@ var Documentation = { }); var url = parts.join('/'); return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + }, + + initOnKeyListeners: function() { + $(document).keyup(function(event) { + var activeElementType = document.activeElement.tagName; + // don't navigate when in search box or textarea + if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { + switch (event.keyCode) { + case 37: // left + var prevHref = $('link[rel="prev"]').prop('href'); + if (prevHref) { + window.location.href = prevHref; + return false; + } + case 39: // right + var nextHref = $('link[rel="next"]').prop('href'); + if (nextHref) { + window.location.href = nextHref; + return false; + } + } + } + }); } }; @@ -244,4 +284,4 @@ _ = Documentation.gettext; $(document).ready(function() { Documentation.init(); -}); +}); \ No newline at end of file diff --git a/doc/html/_static/down-pressed.png b/doc/html/_static/down-pressed.png index 6f7ad78..5756c8c 100644 Binary files a/doc/html/_static/down-pressed.png and b/doc/html/_static/down-pressed.png differ diff --git a/doc/html/_static/down.png b/doc/html/_static/down.png index 3003a88..1b3bdad 100644 Binary files a/doc/html/_static/down.png and b/doc/html/_static/down.png differ diff --git a/doc/html/_static/file.png b/doc/html/_static/file.png index d18082e..a858a41 100644 Binary files a/doc/html/_static/file.png and b/doc/html/_static/file.png differ diff --git a/doc/html/_static/jquery-3.1.0.js b/doc/html/_static/jquery-3.1.0.js new file mode 100644 index 0000000..f2fc274 --- /dev/null +++ b/doc/html/_static/jquery-3.1.0.js @@ -0,0 +1,10074 @@ +/*eslint-disable no-unused-vars*/ +/*! + * jQuery JavaScript Library v3.1.0 + * https://jquery.com/ + * + * Includes Sizzle.js + * https://sizzlejs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2016-07-07T21:44Z + */ +( function( global, factory ) { + + "use strict"; + + if ( typeof module === "object" && typeof module.exports === "object" ) { + + // For CommonJS and CommonJS-like environments where a proper `window` + // is present, execute the factory and get jQuery. + // For environments that do not have a `window` with a `document` + // (such as Node.js), expose a factory as module.exports. + // This accentuates the need for the creation of a real `window`. + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info. + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 +// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode +// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common +// enough that all such attempts are guarded in a try block. +"use strict"; + +var arr = []; + +var document = window.document; + +var getProto = Object.getPrototypeOf; + +var slice = arr.slice; + +var concat = arr.concat; + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var fnToString = hasOwn.toString; + +var ObjectFunctionString = fnToString.call( Object ); + +var support = {}; + + + + function DOMEval( code, doc ) { + doc = doc || document; + + var script = doc.createElement( "script" ); + + script.text = code; + doc.head.appendChild( script ).parentNode.removeChild( script ); + } +/* global Symbol */ +// Defining this global in .eslintrc would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module + + + +var + version = "3.1.0", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Support: Android <=4.0 only + // Make sure we trim BOM and NBSP + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; + +jQuery.fn = jQuery.prototype = { + + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num != null ? + + // Return just the one element from the set + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : + + // Return all the elements in a clean array + slice.call( this ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + each: function( callback ) { + return jQuery.each( this, callback ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map( this, function( elem, i ) { + return callback.call( elem, i, elem ); + } ) ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[ 0 ] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + + // Only deal with non-null/undefined values + if ( ( options = arguments[ i ] ) != null ) { + + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject( copy ) || + ( copyIsArray = jQuery.isArray( copy ) ) ) ) { + + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray( src ) ? src : []; + + } else { + clone = src && jQuery.isPlainObject( src ) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend( { + + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + isFunction: function( obj ) { + return jQuery.type( obj ) === "function"; + }, + + isArray: Array.isArray, + + isWindow: function( obj ) { + return obj != null && obj === obj.window; + }, + + isNumeric: function( obj ) { + + // As of jQuery 3.0, isNumeric is limited to + // strings and numbers (primitives or objects) + // that can be coerced to finite numbers (gh-2662) + var type = jQuery.type( obj ); + return ( type === "number" || type === "string" ) && + + // parseFloat NaNs numeric-cast false positives ("") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + !isNaN( obj - parseFloat( obj ) ); + }, + + isPlainObject: function( obj ) { + var proto, Ctor; + + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { + return false; + } + + proto = getProto( obj ); + + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; + } + + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + }, + + isEmptyObject: function( obj ) { + + /* eslint-disable no-unused-vars */ + // See https://github.com/eslint/eslint/issues/6125 + var name; + + for ( name in obj ) { + return false; + } + return true; + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android <=2.3 only (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; + }, + + // Evaluates a script in a global context + globalEval: function( code ) { + DOMEval( code ); + }, + + // Convert dashed to camelCase; used by the css and data modules + // Support: IE <=9 - 11, Edge 12 - 13 + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + each: function( obj, callback ) { + var length, i = 0; + + if ( isArrayLike( obj ) ) { + length = obj.length; + for ( ; i < length; i++ ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } else { + for ( i in obj ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } + + return obj; + }, + + // Support: Android <=4.0 only + trim: function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArrayLike( Object( arr ) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var length, value, + i = 0, + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArrayLike( elems ) ) { + length = elems.length; + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: Date.now, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +} ); + +if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; +} + +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), +function( i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +} ); + +function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v2.3.0 + * https://sizzlejs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2016-01-04 + */ +(function( window ) { + +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + 1 * new Date(), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf as it's faster than native + // https://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { + var i = 0, + len = list.length; + for ( ; i < len; i++ ) { + if ( list[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + + // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + identifier + ")" ), + "CLASS": new RegExp( "^\\.(" + identifier + ")" ), + "TAG": new RegExp( "^(" + identifier + "|[*])" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + + // CSS escapes + // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // CSS string/identifier serialization + // https://drafts.csswg.org/cssom/#common-serializing-idioms + rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g, + fcssescape = function( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + } + + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); + }, + + disabledAncestor = addCombinator( + function( elem ) { + return elem.disabled === true; + }, + { dir: "parentNode", next: "legend" } + ); + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var m, i, elem, nid, match, groups, newSelector, + newContext = context && context.ownerDocument, + + // nodeType defaults to 9, since context defaults to document + nodeType = context ? context.nodeType : 9; + + results = results || []; + + // Return early from calls with invalid selector or context + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + + return results; + } + + // Try to shortcut find operations (as opposed to filters) in HTML documents + if ( !seed ) { + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + context = context || document; + + if ( documentIsHTML ) { + + // If the selector is sufficiently simple, try using a "get*By*" DOM method + // (excepting DocumentFragment context, where the methods don't exist) + if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { + + // ID selector + if ( (m = match[1]) ) { + + // Document context + if ( nodeType === 9 ) { + if ( (elem = context.getElementById( m )) ) { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + + // Element context + } else { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( newContext && (elem = newContext.getElementById( m )) && + contains( context, elem ) && + elem.id === m ) { + + results.push( elem ); + return results; + } + } + + // Type selector + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Class selector + } else if ( (m = match[3]) && support.getElementsByClassName && + context.getElementsByClassName ) { + + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // Take advantage of querySelectorAll + if ( support.qsa && + !compilerCache[ selector + " " ] && + (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + + if ( nodeType !== 1 ) { + newContext = context; + newSelector = selector; + + // qSA looks outside Element context, which is not what we want + // Thanks to Andrew Dupont for this workaround technique + // Support: IE <=8 + // Exclude object elements + } else if ( context.nodeName.toLowerCase() !== "object" ) { + + // Capture the context ID, setting it first if necessary + if ( (nid = context.getAttribute( "id" )) ) { + nid = nid.replace( rcssescape, fcssescape ); + } else { + context.setAttribute( "id", (nid = expando) ); + } + + // Prefix every selector in the list + groups = tokenize( selector ); + i = groups.length; + while ( i-- ) { + groups[i] = "#" + nid + " " + toSelector( groups[i] ); + } + newSelector = groups.join( "," ); + + // Expand context for sibling selectors + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || + context; + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch ( qsaError ) { + } finally { + if ( nid === expando ) { + context.removeAttribute( "id" ); + } + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {function(string, object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created element and returns a boolean result + */ +function assert( fn ) { + var el = document.createElement("fieldset"); + + try { + return !!fn( el ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( el.parentNode ) { + el.parentNode.removeChild( el ); + } + // release memory in IE + el = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = arr.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + a.sourceIndex - b.sourceIndex; + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for :enabled/:disabled + * @param {Boolean} disabled true for :disabled; false for :enabled + */ +function createDisabledPseudo( disabled ) { + // Known :disabled false positives: + // IE: *[disabled]:not(button, input, select, textarea, optgroup, option, menuitem, fieldset) + // not IE: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable + return function( elem ) { + + // Check form elements and option elements for explicit disabling + return "label" in elem && elem.disabled === disabled || + "form" in elem && elem.disabled === disabled || + + // Check non-disabled form elements for fieldset[disabled] ancestors + "form" in elem && elem.disabled === false && ( + // Support: IE6-11+ + // Ancestry is covered for us + elem.isDisabled === disabled || + + // Otherwise, assume any non-
                          or other required elements. + thead: [ 1, "
                          Parameters:
                            -
                          • url – URL to be opened
                          • -
                          • data – data for the POST request
                          • -
                          • ssl_context – SSL.Context to be used
                          • +
                          • url – URL to be opened
                          • +
                          • data – data for the POST request
                          • +
                          • ssl_context – SSL.Context to be used
                          ", "
                          " ], + col: [ 2, "", "
                          " ], + tr: [ 2, "", "
                          " ], + td: [ 3, "", "
                          " ], + + _default: [ 0, "", "" ] +}; + +// Support: IE <=9 only +wrapMap.optgroup = wrapMap.option; + +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + + +function getAll( context, tag ) { + + // Support: IE <=9 - 11 only + // Use typeof to avoid zero-argument method invocation on host objects (#15151) + var ret = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== "undefined" ? + context.querySelectorAll( tag || "*" ) : + []; + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], ret ) : + ret; +} + + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + dataPriv.set( + elems[ i ], + "globalEval", + !refElements || dataPriv.get( refElements[ i ], "globalEval" ) + ); + } +} + + +var rhtml = /<|&#?\w+;/; + +function buildFragment( elems, context, scripts, selection, ignored ) { + var elem, tmp, tag, wrap, contains, j, + fragment = context.createDocumentFragment(), + nodes = [], + i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; + + // Descend through wrappers to the right content + j = wrap[ 0 ]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, tmp.childNodes ); + + // Remember the top-level container + tmp = fragment.firstChild; + + // Ensure the created nodes are orphaned (#12392) + tmp.textContent = ""; + } + } + } + + // Remove wrapper from fragment + fragment.textContent = ""; + + i = 0; + while ( ( elem = nodes[ i++ ] ) ) { + + // Skip elements already in the context collection (trac-4087) + if ( selection && jQuery.inArray( elem, selection ) > -1 ) { + if ( ignored ) { + ignored.push( elem ); + } + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( fragment.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( ( elem = tmp[ j++ ] ) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + return fragment; +} + + +( function() { + var fragment = document.createDocumentFragment(), + div = fragment.appendChild( document.createElement( "div" ) ), + input = document.createElement( "input" ); + + // Support: Android 4.0 - 4.3 only + // Check state lost if the name is set (#11217) + // Support: Windows Web Apps (WWA) + // `name` and `type` must use .setAttribute for WWA (#14901) + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + + // Support: Android <=4.1 only + // Older WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE <=11 only + // Make sure textarea (and checkbox) defaultValue is properly cloned + div.innerHTML = ""; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; +} )(); +var documentElement = document.documentElement; + + + +var + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +// Support: IE <=9 only +// See #13393 for more info +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +function on( elem, types, selector, data, fn, one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + on( elem, type, selector, data, types[ type ], one ); + } + return elem; + } + + if ( data == null && fn == null ) { + + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return elem; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return elem.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + } ); +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + + var handleObjIn, eventHandle, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.get( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Ensure that invalid selectors throw exceptions at attach time + // Evaluate against documentElement in case elem is a non-element node (e.g., document) + if ( selector ) { + jQuery.find.matchesSelector( documentElement, selector ); + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !( events = elemData.events ) ) { + events = elemData.events = {}; + } + if ( !( eventHandle = elemData.handle ) ) { + eventHandle = elemData.handle = function( e ) { + + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? + jQuery.event.dispatch.apply( elem, arguments ) : undefined; + }; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend( { + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join( "." ) + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !( handlers = events[ type ] ) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener if the special events handler returns false + if ( !special.setup || + special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var j, origCount, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); + + if ( !elemData || !( events = elemData.events ) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[ 2 ] && + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || + selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || + special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove data and the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + dataPriv.remove( elem, "handle events" ); + } + }, + + dispatch: function( nativeEvent ) { + + // Make a writable jQuery.Event from the native event object + var event = jQuery.event.fix( nativeEvent ); + + var i, j, ret, matched, handleObj, handlerQueue, + args = new Array( arguments.length ), + handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[ 0 ] = event; + + for ( i = 1; i < arguments.length; i++ ) { + args[ i ] = arguments[ i ]; + } + + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( ( handleObj = matched.handlers[ j++ ] ) && + !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or 2) have namespace(s) + // a subset or equal to those in the bound event (both can have no namespace). + if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || + handleObj.handler ).apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( ( event.result = ret ) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, matches, sel, handleObj, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Support: IE <=9 + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // + // Support: Firefox <=42 + // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) + if ( delegateCount && cur.nodeType && + ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { + + for ( ; cur !== this; cur = cur.parentNode || this ) { + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) > -1 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push( { elem: cur, handlers: matches } ); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); + } + + return handlerQueue; + }, + + addProp: function( name, hook ) { + Object.defineProperty( jQuery.Event.prototype, name, { + enumerable: true, + configurable: true, + + get: jQuery.isFunction( hook ) ? + function() { + if ( this.originalEvent ) { + return hook( this.originalEvent ); + } + } : + function() { + if ( this.originalEvent ) { + return this.originalEvent[ name ]; + } + }, + + set: function( value ) { + Object.defineProperty( this, name, { + enumerable: true, + configurable: true, + writable: true, + value: value + } ); + } + } ); + }, + + fix: function( originalEvent ) { + return originalEvent[ jQuery.expando ] ? + originalEvent : + new jQuery.Event( originalEvent ); + }, + + special: { + load: { + + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + this.focus(); + return false; + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + click: { + + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return jQuery.nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + } +}; + +jQuery.removeEvent = function( elem, type, handle ) { + + // This "if" is needed for plain objects + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle ); + } +}; + +jQuery.Event = function( src, props ) { + + // Allow instantiation without the 'new' keyword + if ( !( this instanceof jQuery.Event ) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + + // Support: Android <=2.3 only + src.returnValue === false ? + returnTrue : + returnFalse; + + // Create target properties + // Support: Safari <=6 - 7 only + // Target should not be a text node (#504, #13143) + this.target = ( src.target && src.target.nodeType === 3 ) ? + src.target.parentNode : + src.target; + + this.currentTarget = src.currentTarget; + this.relatedTarget = src.relatedTarget; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + constructor: jQuery.Event, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + isSimulated: false, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + + if ( e && !this.isSimulated ) { + e.preventDefault(); + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopPropagation(); + } + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Includes all common event props including KeyEvent and MouseEvent specific props +jQuery.each( { + altKey: true, + bubbles: true, + cancelable: true, + changedTouches: true, + ctrlKey: true, + detail: true, + eventPhase: true, + metaKey: true, + pageX: true, + pageY: true, + shiftKey: true, + view: true, + "char": true, + charCode: true, + key: true, + keyCode: true, + button: true, + buttons: true, + clientX: true, + clientY: true, + offsetX: true, + offsetY: true, + pointerId: true, + pointerType: true, + screenX: true, + screenY: true, + targetTouches: true, + toElement: true, + touches: true, + + which: function( event ) { + var button = event.button; + + // Add which for key events + if ( event.which == null && rkeyEvent.test( event.type ) ) { + return event.charCode != null ? event.charCode : event.keyCode; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { + return ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event.which; + } +}, jQuery.event.addProp ); + +// Create mouseenter/leave events using mouseover/out and event-time checks +// so that event delegation works in jQuery. +// Do the same for pointerenter/pointerleave and pointerover/pointerout +// +// Support: Safari 7 only +// Safari sends mouseenter too often; see: +// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 +// for the description of the bug (it existed in older Chrome versions as well). +jQuery.each( { + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mouseenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +} ); + +jQuery.fn.extend( { + + on: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn ); + }, + one: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? + handleObj.origType + "." + handleObj.namespace : + handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each( function() { + jQuery.event.remove( this, types, fn, selector ); + } ); + } +} ); + + +var + + /* eslint-disable max-len */ + + // See https://github.com/eslint/eslint/issues/3229 + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, + + /* eslint-enable */ + + // Support: IE <=10 - 11, Edge 12 - 13 + // In IE/Edge using regex groups here causes severe slowdowns. + // See https://connect.microsoft.com/IE/feedback/details/1736512/ + rnoInnerhtml = /\s*$/g; + +function manipulationTarget( elem, content ) { + if ( jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { + + return elem.getElementsByTagName( "tbody" )[ 0 ] || elem; + } + + return elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + + if ( match ) { + elem.type = match[ 1 ]; + } else { + elem.removeAttribute( "type" ); + } + + return elem; +} + +function cloneCopyEvent( src, dest ) { + var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; + + if ( dest.nodeType !== 1 ) { + return; + } + + // 1. Copy private data: events, handlers, etc. + if ( dataPriv.hasData( src ) ) { + pdataOld = dataPriv.access( src ); + pdataCur = dataPriv.set( dest, pdataOld ); + events = pdataOld.events; + + if ( events ) { + delete pdataCur.handle; + pdataCur.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + } + + // 2. Copy user data + if ( dataUser.hasData( src ) ) { + udataOld = dataUser.access( src ); + udataCur = jQuery.extend( {}, udataOld ); + + dataUser.set( dest, udataCur ); + } +} + +// Fix IE bugs, see support tests +function fixInput( src, dest ) { + var nodeName = dest.nodeName.toLowerCase(); + + // Fails to persist the checked state of a cloned checkbox or radio button. + if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + dest.checked = src.checked; + + // Fails to return the selected option to the default selected state when cloning options + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +function domManip( collection, args, callback, ignored ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = collection.length, + iNoClone = l - 1, + value = args[ 0 ], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return collection.each( function( index ) { + var self = collection.eq( index ); + if ( isFunction ) { + args[ 0 ] = value.call( this, index, self.html() ); + } + domManip( self, args, callback, ignored ); + } ); + } + + if ( l ) { + fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + // Require either new content or an interest in ignored elements to invoke the callback + if ( first || ignored ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item + // instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( collection[ i ], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !dataPriv.access( node, "globalEval" ) && + jQuery.contains( doc, node ) ) { + + if ( node.src ) { + + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); + } + } + } + } + } + } + + return collection; +} + +function remove( elem, selector, keepData ) { + var node, + nodes = selector ? jQuery.filter( selector, elem ) : elem, + i = 0; + + for ( ; ( node = nodes[ i ] ) != null; i++ ) { + if ( !keepData && node.nodeType === 1 ) { + jQuery.cleanData( getAll( node ) ); + } + + if ( node.parentNode ) { + if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { + setGlobalEval( getAll( node, "script" ) ); + } + node.parentNode.removeChild( node ); + } + } + + return elem; +} + +jQuery.extend( { + htmlPrefilter: function( html ) { + return html.replace( rxhtmlTag, "<$1>" ); + }, + + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var i, l, srcElements, destElements, + clone = elem.cloneNode( true ), + inPage = jQuery.contains( elem.ownerDocument, elem ); + + // Fix IE cloning issues + if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && + !jQuery.isXMLDoc( elem ) ) { + + // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + fixInput( srcElements[ i ], destElements[ i ] ); + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + cloneCopyEvent( srcElements[ i ], destElements[ i ] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + // Return the cloned set + return clone; + }, + + cleanData: function( elems ) { + var data, elem, type, + special = jQuery.event.special, + i = 0; + + for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { + if ( acceptData( elem ) ) { + if ( ( data = elem[ dataPriv.expando ] ) ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataPriv.expando ] = undefined; + } + if ( elem[ dataUser.expando ] ) { + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataUser.expando ] = undefined; + } + } + } + } +} ); + +jQuery.fn.extend( { + detach: function( selector ) { + return remove( this, selector, true ); + }, + + remove: function( selector ) { + return remove( this, selector ); + }, + + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().each( function() { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.textContent = value; + } + } ); + }, null, value, arguments.length ); + }, + + append: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + } ); + }, + + prepend: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + } ); + }, + + before: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + } ); + }, + + after: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + } ); + }, + + empty: function() { + var elem, + i = 0; + + for ( ; ( elem = this[ i ] ) != null; i++ ) { + if ( elem.nodeType === 1 ) { + + // Prevent memory leaks + jQuery.cleanData( getAll( elem, false ) ); + + // Remove any remaining nodes + elem.textContent = ""; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + } ); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined && elem.nodeType === 1 ) { + return elem.innerHTML; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { + + value = jQuery.htmlPrefilter( value ); + + try { + for ( ; i < l; i++ ) { + elem = this[ i ] || {}; + + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch ( e ) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var ignored = []; + + // Make the changes, replacing each non-ignored context element with the new content + return domManip( this, arguments, function( elem ) { + var parent = this.parentNode; + + if ( jQuery.inArray( this, ignored ) < 0 ) { + jQuery.cleanData( getAll( this ) ); + if ( parent ) { + parent.replaceChild( elem, this ); + } + } + + // Force callback invocation + }, ignored ); + } +} ); + +jQuery.each( { + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1, + i = 0; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone( true ); + jQuery( insert[ i ] )[ original ]( elems ); + + // Support: Android <=4.0 only, PhantomJS 1 only + // .get() because push.apply(_, arraylike) throws on ancient WebKit + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +} ); +var rmargin = ( /^margin/ ); + +var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); + +var getStyles = function( elem ) { + + // Support: IE <=11 only, Firefox <=30 (#15098, #14150) + // IE throws on elements created in popups + // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" + var view = elem.ownerDocument.defaultView; + + if ( !view || !view.opener ) { + view = window; + } + + return view.getComputedStyle( elem ); + }; + + + +( function() { + + // Executing both pixelPosition & boxSizingReliable tests require only one layout + // so they're executed at the same time to save the second computation. + function computeStyleTests() { + + // This is a singleton, we need to execute it only once + if ( !div ) { + return; + } + + div.style.cssText = + "box-sizing:border-box;" + + "position:relative;display:block;" + + "margin:auto;border:1px;padding:1px;" + + "top:1%;width:50%"; + div.innerHTML = ""; + documentElement.appendChild( container ); + + var divStyle = window.getComputedStyle( div ); + pixelPositionVal = divStyle.top !== "1%"; + + // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 + reliableMarginLeftVal = divStyle.marginLeft === "2px"; + boxSizingReliableVal = divStyle.width === "4px"; + + // Support: Android 4.0 - 4.3 only + // Some styles come back with percentage values, even though they shouldn't + div.style.marginRight = "50%"; + pixelMarginRightVal = divStyle.marginRight === "4px"; + + documentElement.removeChild( container ); + + // Nullify the div so it wouldn't be stored in the memory and + // it will also be a sign that checks already performed + div = null; + } + + var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, + container = document.createElement( "div" ), + div = document.createElement( "div" ); + + // Finish early in limited (non-browser) environments + if ( !div.style ) { + return; + } + + // Support: IE <=9 - 11 only + // Style of cloned element affects source element cloned (#8908) + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + + "padding:0;margin-top:1px;position:absolute"; + container.appendChild( div ); + + jQuery.extend( support, { + pixelPosition: function() { + computeStyleTests(); + return pixelPositionVal; + }, + boxSizingReliable: function() { + computeStyleTests(); + return boxSizingReliableVal; + }, + pixelMarginRight: function() { + computeStyleTests(); + return pixelMarginRightVal; + }, + reliableMarginLeft: function() { + computeStyleTests(); + return reliableMarginLeftVal; + } + } ); +} )(); + + +function curCSS( elem, name, computed ) { + var width, minWidth, maxWidth, ret, + style = elem.style; + + computed = computed || getStyles( elem ); + + // Support: IE <=9 only + // getPropertyValue is only needed for .css('filter') (#12537) + if ( computed ) { + ret = computed.getPropertyValue( name ) || computed[ name ]; + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Android Browser returns percentage for some values, + // but width seems to be reliably pixels. + // This is against the CSSOM draft spec: + // https://drafts.csswg.org/cssom/#resolved-values + if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret !== undefined ? + + // Support: IE <=9 - 11 only + // IE returns zIndex value as an integer. + ret + "" : + ret; +} + + +function addGetHookIf( conditionFn, hookFn ) { + + // Define the hook, we'll check on the first run if it's really needed. + return { + get: function() { + if ( conditionFn() ) { + + // Hook not needed (or it's not possible to use it due + // to missing dependency), remove it. + delete this.get; + return; + } + + // Hook needed; redefine it so that the support test is not executed again. + return ( this.get = hookFn ).apply( this, arguments ); + } + }; +} + + +var + + // Swappable if display is none or starts with table + // except "table", "table-cell", or "table-caption" + // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: "0", + fontWeight: "400" + }, + + cssPrefixes = [ "Webkit", "Moz", "ms" ], + emptyStyle = document.createElement( "div" ).style; + +// Return a css property mapped to a potentially vendor prefixed property +function vendorPropName( name ) { + + // Shortcut for names that are not vendor prefixed + if ( name in emptyStyle ) { + return name; + } + + // Check for vendor prefixed names + var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in emptyStyle ) { + return name; + } + } +} + +function setPositiveNumber( elem, value, subtract ) { + + // Any relative (+/-) values have already been + // normalized at this point + var matches = rcssNum.exec( value ); + return matches ? + + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + + // If we already have the right measurement, avoid augmentation + 4 : + + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + + // Both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + } + + if ( isBorderBox ) { + + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // At this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + + // At this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // At this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property, which is equivalent to the border-box value + var val, + valueIsBorderBox = true, + styles = getStyles( elem ), + isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // Support: IE <=11 only + // Running getBoundingClientRect on a disconnected node + // in IE throws an error. + if ( elem.getClientRects().length ) { + val = elem.getBoundingClientRect()[ name ]; + } + + // Some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name, styles ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test( val ) ) { + return val; + } + + // Check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && + ( support.boxSizingReliable() || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // Use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +jQuery.extend( { + + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Don't automatically add "px" to these possibly-unitless properties + cssNumber: { + "animationIterationCount": true, + "columnCount": true, + "fillOpacity": true, + "flexGrow": true, + "flexShrink": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "order": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + "float": "cssFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; + + name = jQuery.cssProps[ origName ] || + ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); + + // Gets hook for the prefixed version, then unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // Convert "+=" or "-=" to relative numbers (#7345) + if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { + value = adjustCSS( elem, name, ret ); + + // Fixes bug #9237 + type = "number"; + } + + // Make sure that null and NaN values aren't set (#7116) + if ( value == null || value !== value ) { + return; + } + + // If a number was passed in, add the unit (except for certain CSS properties) + if ( type === "number" ) { + value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); + } + + // background-* props affect original clone's values + if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !( "set" in hooks ) || + ( value = hooks.set( elem, value, extra ) ) !== undefined ) { + + style[ name ] = value; + } + + } else { + + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && + ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { + + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var val, num, hooks, + origName = jQuery.camelCase( name ); + + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || + ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); + + // Try prefixed name followed by the unprefixed name + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + // Convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Make numeric if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || isFinite( num ) ? num || 0 : val; + } + return val; + } +} ); + +jQuery.each( [ "height", "width" ], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + + // Certain elements can have dimension info if we invisibly show them + // but it must have a current display style that would benefit + return rdisplayswap.test( jQuery.css( elem, "display" ) ) && + + // Support: Safari 8+ + // Table columns in Safari have non-zero offsetWidth & zero + // getBoundingClientRect().width unless display is changed. + // Support: IE <=11 only + // Running getBoundingClientRect on a disconnected node + // in IE throws an error. + ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? + swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + } ) : + getWidthOrHeight( elem, name, extra ); + } + }, + + set: function( elem, value, extra ) { + var matches, + styles = extra && getStyles( elem ), + subtract = extra && augmentWidthOrHeight( + elem, + name, + extra, + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + styles + ); + + // Convert to pixels if value adjustment is needed + if ( subtract && ( matches = rcssNum.exec( value ) ) && + ( matches[ 3 ] || "px" ) !== "px" ) { + + elem.style[ name ] = value; + value = jQuery.css( elem, name ); + } + + return setPositiveNumber( elem, value, subtract ); + } + }; +} ); + +jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, + function( elem, computed ) { + if ( computed ) { + return ( parseFloat( curCSS( elem, "marginLeft" ) ) || + elem.getBoundingClientRect().left - + swap( elem, { marginLeft: 0 }, function() { + return elem.getBoundingClientRect().left; + } ) + ) + "px"; + } + } +); + +// These hooks are used by animate to expand properties +jQuery.each( { + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i = 0, + expanded = {}, + + // Assumes a single number if not a string + parts = typeof value === "string" ? value.split( " " ) : [ value ]; + + for ( ; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( !rmargin.test( prefix ) ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +} ); + +jQuery.fn.extend( { + css: function( name, value ) { + return access( this, function( elem, name, value ) { + var styles, len, + map = {}, + i = 0; + + if ( jQuery.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + } +} ); + + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || jQuery.easing._default; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + // Use a property on the element directly when it is not a DOM element, + // or when there is no matching style property that exists. + if ( tween.elem.nodeType !== 1 || + tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { + return tween.elem[ tween.prop ]; + } + + // Passing an empty string as a 3rd parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails. + // Simple values such as "10px" are parsed to Float; + // complex values such as "rotate(1rad)" are returned as-is. + result = jQuery.css( tween.elem, tween.prop, "" ); + + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + + // Use step hook for back compat. + // Use cssHook if its there. + // Use .style if available and use plain properties where available. + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.nodeType === 1 && + ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || + jQuery.cssHooks[ tween.prop ] ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Support: IE <=9 only +// Panic based approach to setting things on disconnected nodes +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p * Math.PI ) / 2; + }, + _default: "swing" +}; + +jQuery.fx = Tween.prototype.init; + +// Back compat <1.8 extension point +jQuery.fx.step = {}; + + + + +var + fxNow, timerId, + rfxtypes = /^(?:toggle|show|hide)$/, + rrun = /queueHooks$/; + +function raf() { + if ( timerId ) { + window.requestAnimationFrame( raf ); + jQuery.fx.tick(); + } +} + +// Animations created synchronously will run synchronously +function createFxNow() { + window.setTimeout( function() { + fxNow = undefined; + } ); + return ( fxNow = jQuery.now() ); +} + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + i = 0, + attrs = { height: type }; + + // If we include width, step value is 1 to do all cssExpand values, + // otherwise step value is 2 to skip over Left and Right + includeWidth = includeWidth ? 1 : 0; + for ( ; i < 4; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +function createTween( value, prop, animation ) { + var tween, + collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { + + // We're done with this property + return tween; + } + } +} + +function defaultPrefilter( elem, props, opts ) { + var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, + isBox = "width" in props || "height" in props, + anim = this, + orig = {}, + style = elem.style, + hidden = elem.nodeType && isHiddenWithinTree( elem ), + dataShow = dataPriv.get( elem, "fxshow" ); + + // Queue-skipping animations hijack the fx hooks + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always( function() { + + // Ensure the complete handler is called before this completes + anim.always( function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + } ); + } ); + } + + // Detect show/hide animations + for ( prop in props ) { + value = props[ prop ]; + if ( rfxtypes.test( value ) ) { + delete props[ prop ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + + // Pretend to be hidden if this is a "show" and + // there is still data from a stopped show/hide + if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { + hidden = true; + + // Ignore all other no-op show/hide data + } else { + continue; + } + } + orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); + } + } + + // Bail out if this is a no-op like .hide().hide() + propTween = !jQuery.isEmptyObject( props ); + if ( !propTween && jQuery.isEmptyObject( orig ) ) { + return; + } + + // Restrict "overflow" and "display" styles during box animations + if ( isBox && elem.nodeType === 1 ) { + + // Support: IE <=9 - 11, Edge 12 - 13 + // Record all 3 overflow attributes because IE does not infer the shorthand + // from identically-valued overflowX and overflowY + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Identify a display type, preferring old show/hide data over the CSS cascade + restoreDisplay = dataShow && dataShow.display; + if ( restoreDisplay == null ) { + restoreDisplay = dataPriv.get( elem, "display" ); + } + display = jQuery.css( elem, "display" ); + if ( display === "none" ) { + if ( restoreDisplay ) { + display = restoreDisplay; + } else { + + // Get nonempty value(s) by temporarily forcing visibility + showHide( [ elem ], true ); + restoreDisplay = elem.style.display || restoreDisplay; + display = jQuery.css( elem, "display" ); + showHide( [ elem ] ); + } + } + + // Animate inline elements as inline-block + if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { + if ( jQuery.css( elem, "float" ) === "none" ) { + + // Restore the original display value at the end of pure show/hide animations + if ( !propTween ) { + anim.done( function() { + style.display = restoreDisplay; + } ); + if ( restoreDisplay == null ) { + display = style.display; + restoreDisplay = display === "none" ? "" : display; + } + } + style.display = "inline-block"; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + anim.always( function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + } ); + } + + // Implement show/hide animations + propTween = false; + for ( prop in orig ) { + + // General show/hide setup for this element animation + if ( !propTween ) { + if ( dataShow ) { + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + } else { + dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); + } + + // Store hidden/visible for toggle so `.stop().toggle()` "reverses" + if ( toggle ) { + dataShow.hidden = !hidden; + } + + // Show elements before animating them + if ( hidden ) { + showHide( [ elem ], true ); + } + + /* eslint-disable no-loop-func */ + + anim.done( function() { + + /* eslint-enable no-loop-func */ + + // The final step of a "hide" animation is actually hiding the element + if ( !hidden ) { + showHide( [ elem ] ); + } + dataPriv.remove( elem, "fxshow" ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + } ); + } + + // Per-property setup + propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = propTween.start; + if ( hidden ) { + propTween.end = propTween.start; + propTween.start = 0; + } + } + } +} + +function propFilter( props, specialEasing ) { + var index, name, easing, value, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = jQuery.camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( jQuery.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // Not quite $.extend, this won't overwrite existing keys. + // Reusing 'index' because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +function Animation( elem, properties, options ) { + var result, + stopped, + index = 0, + length = Animation.prefilters.length, + deferred = jQuery.Deferred().always( function() { + + // Don't match elem in the :animated selector + delete tick.elem; + } ), + tick = function() { + if ( stopped ) { + return false; + } + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + + // Support: Android 2.3 only + // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ] ); + + if ( percent < 1 && length ) { + return remaining; + } else { + deferred.resolveWith( elem, [ animation ] ); + return false; + } + }, + animation = deferred.promise( { + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { + specialEasing: {}, + easing: jQuery.easing._default + }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + + // If we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + if ( stopped ) { + return this; + } + stopped = true; + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // Resolve when we played the last frame; otherwise, reject + if ( gotoEnd ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + } ), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length; index++ ) { + result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + if ( jQuery.isFunction( result.stop ) ) { + jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = + jQuery.proxy( result.stop, result ); + } + return result; + } + } + + jQuery.map( props, createTween, animation ); + + if ( jQuery.isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + jQuery.fx.timer( + jQuery.extend( tick, { + elem: elem, + anim: animation, + queue: animation.opts.queue + } ) + ); + + // attach callbacks from options + return animation.progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweeners: { + "*": [ function( prop, value ) { + var tween = this.createTween( prop, value ); + adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); + return tween; + } ] + }, + + tweener: function( props, callback ) { + if ( jQuery.isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.match( rnotwhite ); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length; index++ ) { + prop = props[ index ]; + Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; + Animation.tweeners[ prop ].unshift( callback ); + } + }, + + prefilters: [ defaultPrefilter ], + + prefilter: function( callback, prepend ) { + if ( prepend ) { + Animation.prefilters.unshift( callback ); + } else { + Animation.prefilters.push( callback ); + } + } +} ); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; + + // Go to the end state if fx are off or if document is hidden + if ( jQuery.fx.off || document.hidden ) { + opt.duration = 0; + + } else { + opt.duration = typeof opt.duration === "number" ? + opt.duration : opt.duration in jQuery.fx.speeds ? + jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; + } + + // Normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.fn.extend( { + fadeTo: function( speed, to, easing, callback ) { + + // Show any hidden elements after setting opacity to 0 + return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() + + // Animate to the value specified + .end().animate( { opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + + // Empty animations, or finishing resolves immediately + if ( empty || dataPriv.get( this, "finish" ) ) { + anim.stop( true ); + } + }; + doAnimation.finish = doAnimation; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } + + return this.each( function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = dataPriv.get( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && + ( type == null || timers[ index ].queue === type ) ) { + + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // Start the next in the queue if the last step wasn't forced. + // Timers currently will call their complete callbacks, which + // will dequeue but only if they were gotoEnd. + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + } ); + }, + finish: function( type ) { + if ( type !== false ) { + type = type || "fx"; + } + return this.each( function() { + var index, + data = dataPriv.get( this ), + queue = data[ type + "queue" ], + hooks = data[ type + "queueHooks" ], + timers = jQuery.timers, + length = queue ? queue.length : 0; + + // Enable finishing flag on private data + data.finish = true; + + // Empty the queue first + jQuery.queue( this, type, [] ); + + if ( hooks && hooks.stop ) { + hooks.stop.call( this, true ); + } + + // Look for any active animations, and finish them + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && timers[ index ].queue === type ) { + timers[ index ].anim.stop( true ); + timers.splice( index, 1 ); + } + } + + // Look for any animations in the old queue and finish them + for ( index = 0; index < length; index++ ) { + if ( queue[ index ] && queue[ index ].finish ) { + queue[ index ].finish.call( this ); + } + } + + // Turn off finishing flag + delete data.finish; + } ); + } +} ); + +jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +} ); + +// Generate shortcuts for custom animations +jQuery.each( { + slideDown: genFx( "show" ), + slideUp: genFx( "hide" ), + slideToggle: genFx( "toggle" ), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +} ); + +jQuery.timers = []; +jQuery.fx.tick = function() { + var timer, + i = 0, + timers = jQuery.timers; + + fxNow = jQuery.now(); + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + + // Checks the timer has not already been removed + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; + +jQuery.fx.timer = function( timer ) { + jQuery.timers.push( timer ); + if ( timer() ) { + jQuery.fx.start(); + } else { + jQuery.timers.pop(); + } +}; + +jQuery.fx.interval = 13; +jQuery.fx.start = function() { + if ( !timerId ) { + timerId = window.requestAnimationFrame ? + window.requestAnimationFrame( raf ) : + window.setInterval( jQuery.fx.tick, jQuery.fx.interval ); + } +}; + +jQuery.fx.stop = function() { + if ( window.cancelAnimationFrame ) { + window.cancelAnimationFrame( timerId ); + } else { + window.clearInterval( timerId ); + } + + timerId = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + + // Default speed + _default: 400 +}; + + +// Based off of the plugin by Clint Helfers, with permission. +// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ +jQuery.fn.delay = function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = window.setTimeout( next, time ); + hooks.stop = function() { + window.clearTimeout( timeout ); + }; + } ); +}; + + +( function() { + var input = document.createElement( "input" ), + select = document.createElement( "select" ), + opt = select.appendChild( document.createElement( "option" ) ); + + input.type = "checkbox"; + + // Support: Android <=4.3 only + // Default value for a checkbox should be "on" + support.checkOn = input.value !== ""; + + // Support: IE <=11 only + // Must access selectedIndex to make default options select + support.optSelected = opt.selected; + + // Support: IE <=11 only + // An input loses its value after becoming a radio + input = document.createElement( "input" ); + input.value = "t"; + input.type = "radio"; + support.radioValue = input.value === "t"; +} )(); + + +var boolHook, + attrHandle = jQuery.expr.attrHandle; + +jQuery.fn.extend( { + attr: function( name, value ) { + return access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each( function() { + jQuery.removeAttr( this, name ); + } ); + } +} ); + +jQuery.extend( { + attr: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set attributes on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + // Attribute hooks are determined by the lowercase version + // Grab necessary hook if one is defined + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + hooks = jQuery.attrHooks[ name.toLowerCase() ] || + ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); + } + + if ( value !== undefined ) { + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + } + + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + elem.setAttribute( name, value + "" ); + return value; + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + ret = jQuery.find.attr( elem, name ); + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? undefined : ret; + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !support.radioValue && value === "radio" && + jQuery.nodeName( elem, "input" ) ) { + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + removeAttr: function( elem, value ) { + var name, + i = 0, + attrNames = value && value.match( rnotwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( ( name = attrNames[ i++ ] ) ) { + elem.removeAttribute( name ); + } + } + } +} ); + +// Hooks for boolean attributes +boolHook = { + set: function( elem, value, name ) { + if ( value === false ) { + + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + elem.setAttribute( name, name ); + } + return name; + } +}; + +jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { + var getter = attrHandle[ name ] || jQuery.find.attr; + + attrHandle[ name ] = function( elem, name, isXML ) { + var ret, handle, + lowercaseName = name.toLowerCase(); + + if ( !isXML ) { + + // Avoid an infinite loop by temporarily removing this function from the getter + handle = attrHandle[ lowercaseName ]; + attrHandle[ lowercaseName ] = ret; + ret = getter( elem, name, isXML ) != null ? + lowercaseName : + null; + attrHandle[ lowercaseName ] = handle; + } + return ret; + }; +} ); + + + + +var rfocusable = /^(?:input|select|textarea|button)$/i, + rclickable = /^(?:a|area)$/i; + +jQuery.fn.extend( { + prop: function( name, value ) { + return access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + return this.each( function() { + delete this[ jQuery.propFix[ name ] || name ]; + } ); + } +} ); + +jQuery.extend( { + prop: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set properties on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + return ( elem[ name ] = value ); + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + return elem[ name ]; + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + + // Support: IE <=9 - 11 only + // elem.tabIndex doesn't always return the + // correct value when it hasn't been explicitly set + // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + // Use proper attribute retrieval(#12072) + var tabindex = jQuery.find.attr( elem, "tabindex" ); + + return tabindex ? + parseInt( tabindex, 10 ) : + rfocusable.test( elem.nodeName ) || + rclickable.test( elem.nodeName ) && elem.href ? + 0 : + -1; + } + } + }, + + propFix: { + "for": "htmlFor", + "class": "className" + } +} ); + +// Support: IE <=11 only +// Accessing the selectedIndex property +// forces the browser to respect setting selected +// on the option +// The getter ensures a default option is selected +// when in an optgroup +if ( !support.optSelected ) { + jQuery.propHooks.selected = { + get: function( elem ) { + var parent = elem.parentNode; + if ( parent && parent.parentNode ) { + parent.parentNode.selectedIndex; + } + return null; + }, + set: function( elem ) { + var parent = elem.parentNode; + if ( parent ) { + parent.selectedIndex; + + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + } + }; +} + +jQuery.each( [ + "tabIndex", + "readOnly", + "maxLength", + "cellSpacing", + "cellPadding", + "rowSpan", + "colSpan", + "useMap", + "frameBorder", + "contentEditable" +], function() { + jQuery.propFix[ this.toLowerCase() ] = this; +} ); + + + + +var rclass = /[\t\r\n\f]/g; + +function getClass( elem ) { + return elem.getAttribute && elem.getAttribute( "class" ) || ""; +} + +jQuery.fn.extend( { + addClass: function( value ) { + var classes, elem, cur, curValue, clazz, j, finalValue, + i = 0; + + if ( jQuery.isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( typeof value === "string" && value ) { + classes = value.match( rnotwhite ) || []; + + while ( ( elem = this[ i++ ] ) ) { + curValue = getClass( elem ); + cur = elem.nodeType === 1 && + ( " " + curValue + " " ).replace( rclass, " " ); + + if ( cur ) { + j = 0; + while ( ( clazz = classes[ j++ ] ) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = jQuery.trim( cur ); + if ( curValue !== finalValue ) { + elem.setAttribute( "class", finalValue ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, curValue, clazz, j, finalValue, + i = 0; + + if ( jQuery.isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( !arguments.length ) { + return this.attr( "class", "" ); + } + + if ( typeof value === "string" && value ) { + classes = value.match( rnotwhite ) || []; + + while ( ( elem = this[ i++ ] ) ) { + curValue = getClass( elem ); + + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && + ( " " + curValue + " " ).replace( rclass, " " ); + + if ( cur ) { + j = 0; + while ( ( clazz = classes[ j++ ] ) ) { + + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) > -1 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = jQuery.trim( cur ); + if ( curValue !== finalValue ) { + elem.setAttribute( "class", finalValue ); + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value; + + if ( typeof stateVal === "boolean" && type === "string" ) { + return stateVal ? this.addClass( value ) : this.removeClass( value ); + } + + if ( jQuery.isFunction( value ) ) { + return this.each( function( i ) { + jQuery( this ).toggleClass( + value.call( this, i, getClass( this ), stateVal ), + stateVal + ); + } ); + } + + return this.each( function() { + var className, i, self, classNames; + + if ( type === "string" ) { + + // Toggle individual class names + i = 0; + self = jQuery( this ); + classNames = value.match( rnotwhite ) || []; + + while ( ( className = classNames[ i++ ] ) ) { + + // Check each className given, space separated list + if ( self.hasClass( className ) ) { + self.removeClass( className ); + } else { + self.addClass( className ); + } + } + + // Toggle whole class name + } else if ( value === undefined || type === "boolean" ) { + className = getClass( this ); + if ( className ) { + + // Store className if set + dataPriv.set( this, "__className__", className ); + } + + // If the element has a class name or if we're passed `false`, + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + if ( this.setAttribute ) { + this.setAttribute( "class", + className || value === false ? + "" : + dataPriv.get( this, "__className__" ) || "" + ); + } + } + } ); + }, + + hasClass: function( selector ) { + var className, elem, + i = 0; + + className = " " + selector + " "; + while ( ( elem = this[ i++ ] ) ) { + if ( elem.nodeType === 1 && + ( " " + getClass( elem ) + " " ).replace( rclass, " " ) + .indexOf( className ) > -1 + ) { + return true; + } + } + + return false; + } +} ); + + + + +var rreturn = /\r/g, + rspaces = /[\x20\t\r\n\f]+/g; + +jQuery.fn.extend( { + val: function( value ) { + var hooks, ret, isFunction, + elem = this[ 0 ]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || + jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && + "get" in hooks && + ( ret = hooks.get( elem, "value" ) ) !== undefined + ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + + // Handle most common string cases + ret.replace( rreturn, "" ) : + + // Handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each( function( i ) { + var val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, jQuery( this ).val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + + } else if ( typeof val === "number" ) { + val += ""; + + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map( val, function( value ) { + return value == null ? "" : value + ""; + } ); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + } ); + } +} ); + +jQuery.extend( { + valHooks: { + option: { + get: function( elem ) { + + var val = jQuery.find.attr( elem, "value" ); + return val != null ? + val : + + // Support: IE <=10 - 11 only + // option.text throws exceptions (#14686, #14858) + // Strip and collapse whitespace + // https://html.spec.whatwg.org/#strip-and-collapse-whitespace + jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " ); + } + }, + select: { + get: function( elem ) { + var value, option, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one", + values = one ? null : [], + max = one ? index + 1 : options.length, + i = index < 0 ? + max : + one ? index : 0; + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Support: IE <=9 only + // IE8-9 doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + + // Don't return options that are disabled or in a disabled optgroup + !option.disabled && + ( !option.parentNode.disabled || + !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var optionSet, option, + options = elem.options, + values = jQuery.makeArray( value ), + i = options.length; + + while ( i-- ) { + option = options[ i ]; + + /* eslint-disable no-cond-assign */ + + if ( option.selected = + jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 + ) { + optionSet = true; + } + + /* eslint-enable no-cond-assign */ + } + + // Force browsers to behave consistently when non-matching value is set + if ( !optionSet ) { + elem.selectedIndex = -1; + } + return values; + } + } + } +} ); + +// Radios and checkboxes getter/setter +jQuery.each( [ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); + } + } + }; + if ( !support.checkOn ) { + jQuery.valHooks[ this ].get = function( elem ) { + return elem.getAttribute( "value" ) === null ? "on" : elem.value; + }; + } +} ); + + + + +// Return jQuery for attributes-only inclusion + + +var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; + +jQuery.extend( jQuery.event, { + + trigger: function( event, data, elem, onlyHandlers ) { + + var i, cur, tmp, bubbleType, ontype, handle, special, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "." ) > -1 ) { + + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split( "." ); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf( ":" ) < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join( "." ); + event.rnamespace = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === ( elem.ownerDocument || document ) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && + dataPriv.get( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( ( !special._default || + special._default.apply( eventPath.pop(), data ) === false ) && + acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name as the event. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + // Piggyback on a donor event to simulate a different one + // Used only for `focus(in | out)` events + simulate: function( type, elem, event ) { + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true + } + ); + + jQuery.event.trigger( e, null, elem ); + } + +} ); + +jQuery.fn.extend( { + + trigger: function( type, data ) { + return this.each( function() { + jQuery.event.trigger( type, data, this ); + } ); + }, + triggerHandler: function( type, data ) { + var elem = this[ 0 ]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +} ); + + +jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup contextmenu" ).split( " " ), + function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; +} ); + +jQuery.fn.extend( { + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +} ); + + + + +support.focusin = "onfocusin" in window; + + +// Support: Firefox <=44 +// Firefox doesn't have focus(in | out) events +// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 +// +// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 +// focus(in | out) events fire after focus & blur events, +// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order +// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 +if ( !support.focusin ) { + jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + var doc = this.ownerDocument || this, + attaches = dataPriv.access( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this, + attaches = dataPriv.access( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + dataPriv.remove( doc, fix ); + + } else { + dataPriv.access( doc, fix, attaches ); + } + } + }; + } ); +} +var location = window.location; + +var nonce = jQuery.now(); + +var rquery = ( /\?/ ); + + + +// Cross-browser xml parsing +jQuery.parseXML = function( data ) { + var xml; + if ( !data || typeof data !== "string" ) { + return null; + } + + // Support: IE 9 - 11 only + // IE throws on parseFromString with invalid input. + try { + xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); + } catch ( e ) { + xml = undefined; + } + + if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; +}; + + +var + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, + rsubmittable = /^(?:input|select|textarea|keygen)/i; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( jQuery.isArray( obj ) ) { + + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + + // Item is non-scalar (array or object), encode its numeric index. + buildParams( + prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", + v, + traditional, + add + ); + } + } ); + + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + + // Serialize scalar item. + add( prefix, obj ); + } +} + +// Serialize an array of form elements or a set of +// key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, valueOrFunction ) { + + // If value is a function, invoke it and use its return value + var value = jQuery.isFunction( valueOrFunction ) ? + valueOrFunction() : + valueOrFunction; + + s[ s.length ] = encodeURIComponent( key ) + "=" + + encodeURIComponent( value == null ? "" : value ); + }; + + // If an array was passed in, assume that it is an array of form elements. + if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + } ); + + } else { + + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ); +}; + +jQuery.fn.extend( { + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map( function() { + + // Can add propHook for "elements" to filter or add form elements + var elements = jQuery.prop( this, "elements" ); + return elements ? jQuery.makeArray( elements ) : this; + } ) + .filter( function() { + var type = this.type; + + // Use .is( ":disabled" ) so that fieldset[disabled] works + return this.name && !jQuery( this ).is( ":disabled" ) && + rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && + ( this.checked || !rcheckableType.test( type ) ); + } ) + .map( function( i, elem ) { + var val = jQuery( this ).val(); + + return val == null ? + null : + jQuery.isArray( val ) ? + jQuery.map( val, function( val ) { + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ) : + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ).get(); + } +} ); + + +var + r20 = /%20/g, + rhash = /#.*$/, + rts = /([?&])_=[^&]*/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, + + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = "*/".concat( "*" ), + + // Anchor tag for parsing the document origin + originAnchor = document.createElement( "a" ); + originAnchor.href = location.href; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, + i = 0, + dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; + + if ( jQuery.isFunction( func ) ) { + + // For each dataType in the dataTypeExpression + while ( ( dataType = dataTypes[ i++ ] ) ) { + + // Prepend if requested + if ( dataType[ 0 ] === "+" ) { + dataType = dataType.slice( 1 ) || "*"; + ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); + + // Otherwise append + } else { + ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); + } + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { + + var inspected = {}, + seekingTransport = ( structure === transports ); + + function inspect( dataType ) { + var selected; + inspected[ dataType ] = true; + jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { + var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); + if ( typeof dataTypeOrTransport === "string" && + !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + + options.dataTypes.unshift( dataTypeOrTransport ); + inspect( dataTypeOrTransport ); + return false; + } else if ( seekingTransport ) { + return !( selected = dataTypeOrTransport ); + } + } ); + return selected; + } + + return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } + + return target; +} + +/* Handles responses to an ajax request: + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var ct, type, finalDataType, firstDataType, + contents = s.contents, + dataTypes = s.dataTypes; + + // Remove auto dataType and get content-type in the process + while ( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +/* Chain conversions given the request and the original response + * Also sets the responseXXX fields on the jqXHR instance + */ +function ajaxConvert( s, response, jqXHR, isSuccess ) { + var conv2, current, conv, tmp, prev, + converters = {}, + + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(); + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + current = dataTypes.shift(); + + // Convert to each sequential dataType + while ( current ) { + + if ( s.responseFields[ current ] ) { + jqXHR[ s.responseFields[ current ] ] = response; + } + + // Apply the dataFilter if provided + if ( !prev && isSuccess && s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + prev = current; + current = dataTypes.shift(); + + if ( current ) { + + // There's only work to do if current dataType is non-auto + if ( current === "*" ) { + + current = prev; + + // Convert response if prev dataType is non-auto and differs from current + } else if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split( " " ); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.unshift( tmp[ 1 ] ); + } + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s.throws ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { + state: "parsererror", + error: conv ? e : "No conversion from " + prev + " to " + current + }; + } + } + } + } + } + } + + return { state: "success", data: response }; +} + +jQuery.extend( { + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {}, + + ajaxSettings: { + url: location.href, + type: "GET", + isLocal: rlocalProtocol.test( location.protocol ), + global: true, + processData: true, + async: true, + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + "*": allTypes, + text: "text/plain", + html: "text/html", + xml: "application/xml, text/xml", + json: "application/json, text/javascript" + }, + + contents: { + xml: /\bxml\b/, + html: /\bhtml/, + json: /\bjson\b/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText", + json: "responseJSON" + }, + + // Data converters + // Keys separate source (or catchall "*") and destination types with a single space + converters: { + + // Convert anything to text + "* text": String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": JSON.parse, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + url: true, + context: true + } + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + return settings ? + + // Building a settings object + ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : + + // Extending ajaxSettings + ajaxExtend( jQuery.ajaxSettings, target ); + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var transport, + + // URL without anti-cache param + cacheURL, + + // Response headers + responseHeadersString, + responseHeaders, + + // timeout handle + timeoutTimer, + + // Url cleanup var + urlAnchor, + + // Request state (becomes false upon send and true upon completion) + completed, + + // To know if global events are to be dispatched + fireGlobals, + + // Loop variable + i, + + // uncached part of the url + uncached, + + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + + // Callbacks context + callbackContext = s.context || s, + + // Context for global events is callbackContext if it is a DOM node or jQuery collection + globalEventContext = s.context && + ( callbackContext.nodeType || callbackContext.jquery ) ? + jQuery( callbackContext ) : + jQuery.event, + + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + + // Status-dependent callbacks + statusCode = s.statusCode || {}, + + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + + // Default abort message + strAbort = "canceled", + + // Fake xhr + jqXHR = { + readyState: 0, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( completed ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while ( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match == null ? null : match; + }, + + // Raw string + getAllResponseHeaders: function() { + return completed ? responseHeadersString : null; + }, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( completed == null ) { + name = requestHeadersNames[ name.toLowerCase() ] = + requestHeadersNames[ name.toLowerCase() ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( completed == null ) { + s.mimeType = type; + } + return this; + }, + + // Status-dependent callbacks + statusCode: function( map ) { + var code; + if ( map ) { + if ( completed ) { + + // Execute the appropriate callbacks + jqXHR.always( map[ jqXHR.status ] ); + } else { + + // Lazy-add the new callbacks in a way that preserves old ones + for ( code in map ) { + statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; + } + } + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + var finalText = statusText || strAbort; + if ( transport ) { + transport.abort( finalText ); + } + done( 0, finalText ); + return this; + } + }; + + // Attach deferreds + deferred.promise( jqXHR ); + + // Add protocol if not provided (prefilters might expect it) + // Handle falsy url in the settings object (#10093: consistency with old signature) + // We also use the url parameter if available + s.url = ( ( url || s.url || location.href ) + "" ) + .replace( rprotocol, location.protocol + "//" ); + + // Alias method option to type as per ticket #12004 + s.type = options.method || options.type || s.method || s.type; + + // Extract dataTypes list + s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; + + // A cross-domain request is in order when the origin doesn't match the current origin. + if ( s.crossDomain == null ) { + urlAnchor = document.createElement( "a" ); + + // Support: IE <=8 - 11, Edge 12 - 13 + // IE throws exception on accessing the href property if url is malformed, + // e.g. http://example.com:80x/ + try { + urlAnchor.href = s.url; + + // Support: IE <=8 - 11 only + // Anchor's host property isn't correctly set when s.url is relative + urlAnchor.href = urlAnchor.href; + s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== + urlAnchor.protocol + "//" + urlAnchor.host; + } catch ( e ) { + + // If there is an error parsing the URL, assume it is crossDomain, + // it can be rejected by the transport if it is invalid + s.crossDomain = true; + } + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( completed ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) + fireGlobals = jQuery.event && s.global; + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Save the URL in case we're toying with the If-Modified-Since + // and/or If-None-Match header later on + // Remove hash to simplify url manipulation + cacheURL = s.url.replace( rhash, "" ); + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // Remember the hash so we can put it back + uncached = s.url.slice( cacheURL.length ); + + // If data is available, append data to url + if ( s.data ) { + cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; + + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Add anti-cache in uncached url if needed + if ( s.cache === false ) { + cacheURL = cacheURL.replace( rts, "" ); + uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; + } + + // Put hash and anti-cache on the URL that will be requested (gh-1732) + s.url = cacheURL + uncached; + + // Change '%20' to '+' if this is encoded form body content (gh-2658) + } else if ( s.data && s.processData && + ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { + s.data = s.data.replace( r20, "+" ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + if ( jQuery.lastModified[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); + } + if ( jQuery.etag[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? + s.accepts[ s.dataTypes[ 0 ] ] + + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && + ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { + + // Abort if not done already and return + return jqXHR.abort(); + } + + // Aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + completeDeferred.add( s.complete ); + jqXHR.done( s.success ); + jqXHR.fail( s.error ); + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + + // If request was aborted inside ajaxSend, stop there + if ( completed ) { + return jqXHR; + } + + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = window.setTimeout( function() { + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + completed = false; + transport.send( requestHeaders, done ); + } catch ( e ) { + + // Rethrow post-completion exceptions + if ( completed ) { + throw e; + } + + // Propagate others as results + done( -1, e ); + } + } + + // Callback for when everything is done + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Ignore repeat invocations + if ( completed ) { + return; + } + + completed = true; + + // Clear timeout if it exists + if ( timeoutTimer ) { + window.clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Determine if successful + isSuccess = status >= 200 && status < 300 || status === 304; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // Convert no matter what (that way responseXXX fields are always set) + response = ajaxConvert( s, response, jqXHR, isSuccess ); + + // If successful, handle type chaining + if ( isSuccess ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + modified = jqXHR.getResponseHeader( "Last-Modified" ); + if ( modified ) { + jQuery.lastModified[ cacheURL ] = modified; + } + modified = jqXHR.getResponseHeader( "etag" ); + if ( modified ) { + jQuery.etag[ cacheURL ] = modified; + } + } + + // if no content + if ( status === 204 || s.type === "HEAD" ) { + statusText = "nocontent"; + + // if not modified + } else if ( status === 304 ) { + statusText = "notmodified"; + + // If we have data, let's convert it + } else { + statusText = response.state; + success = response.data; + error = response.error; + isSuccess = !error; + } + } else { + + // Extract error from statusText and normalize for non-aborts + error = statusText; + if ( status || !statusText ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + return jqXHR; + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + } +} ); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + + // Shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + // The url can be an options object (which then must have .url) + return jQuery.ajax( jQuery.extend( { + url: url, + type: method, + dataType: type, + data: data, + success: callback + }, jQuery.isPlainObject( url ) && url ) ); + }; +} ); + + +jQuery._evalUrl = function( url ) { + return jQuery.ajax( { + url: url, + + // Make this explicit, since user can override this through ajaxSetup (#11264) + type: "GET", + dataType: "script", + cache: true, + async: false, + global: false, + "throws": true + } ); +}; + + +jQuery.fn.extend( { + wrapAll: function( html ) { + var wrap; + + if ( this[ 0 ] ) { + if ( jQuery.isFunction( html ) ) { + html = html.call( this[ 0 ] ); + } + + // The elements to wrap the target around + wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); + + if ( this[ 0 ].parentNode ) { + wrap.insertBefore( this[ 0 ] ); + } + + wrap.map( function() { + var elem = this; + + while ( elem.firstElementChild ) { + elem = elem.firstElementChild; + } + + return elem; + } ).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each( function( i ) { + jQuery( this ).wrapInner( html.call( this, i ) ); + } ); + } + + return this.each( function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + } ); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each( function( i ) { + jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); + } ); + }, + + unwrap: function( selector ) { + this.parent( selector ).not( "body" ).each( function() { + jQuery( this ).replaceWith( this.childNodes ); + } ); + return this; + } +} ); + + +jQuery.expr.pseudos.hidden = function( elem ) { + return !jQuery.expr.pseudos.visible( elem ); +}; +jQuery.expr.pseudos.visible = function( elem ) { + return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); +}; + + + + +jQuery.ajaxSettings.xhr = function() { + try { + return new window.XMLHttpRequest(); + } catch ( e ) {} +}; + +var xhrSuccessStatus = { + + // File protocol always yields status code 0, assume 200 + 0: 200, + + // Support: IE <=9 only + // #1450: sometimes IE returns 1223 when it should be 204 + 1223: 204 + }, + xhrSupported = jQuery.ajaxSettings.xhr(); + +support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); +support.ajax = xhrSupported = !!xhrSupported; + +jQuery.ajaxTransport( function( options ) { + var callback, errorCallback; + + // Cross domain only allowed if supported through XMLHttpRequest + if ( support.cors || xhrSupported && !options.crossDomain ) { + return { + send: function( headers, complete ) { + var i, + xhr = options.xhr(); + + xhr.open( + options.type, + options.url, + options.async, + options.username, + options.password + ); + + // Apply custom fields if provided + if ( options.xhrFields ) { + for ( i in options.xhrFields ) { + xhr[ i ] = options.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( options.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( options.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Set headers + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + + // Callback + callback = function( type ) { + return function() { + if ( callback ) { + callback = errorCallback = xhr.onload = + xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; + + if ( type === "abort" ) { + xhr.abort(); + } else if ( type === "error" ) { + + // Support: IE <=9 only + // On a manual native abort, IE9 throws + // errors on any property access that is not readyState + if ( typeof xhr.status !== "number" ) { + complete( 0, "error" ); + } else { + complete( + + // File: protocol always yields status 0; see #8605, #14207 + xhr.status, + xhr.statusText + ); + } + } else { + complete( + xhrSuccessStatus[ xhr.status ] || xhr.status, + xhr.statusText, + + // Support: IE <=9 only + // IE9 has no XHR2 but throws on binary (trac-11426) + // For XHR2 non-text, let the caller handle it (gh-2498) + ( xhr.responseType || "text" ) !== "text" || + typeof xhr.responseText !== "string" ? + { binary: xhr.response } : + { text: xhr.responseText }, + xhr.getAllResponseHeaders() + ); + } + } + }; + }; + + // Listen to events + xhr.onload = callback(); + errorCallback = xhr.onerror = callback( "error" ); + + // Support: IE 9 only + // Use onreadystatechange to replace onabort + // to handle uncaught aborts + if ( xhr.onabort !== undefined ) { + xhr.onabort = errorCallback; + } else { + xhr.onreadystatechange = function() { + + // Check readyState before timeout as it changes + if ( xhr.readyState === 4 ) { + + // Allow onerror to be called first, + // but that will not handle a native abort + // Also, save errorCallback to a variable + // as xhr.onerror cannot be accessed + window.setTimeout( function() { + if ( callback ) { + errorCallback(); + } + } ); + } + }; + } + + // Create the abort callback + callback = callback( "abort" ); + + try { + + // Do send the request (this may raise an exception) + xhr.send( options.hasContent && options.data || null ); + } catch ( e ) { + + // #14683: Only rethrow if this hasn't been notified as an error yet + if ( callback ) { + throw e; + } + } + }, + + abort: function() { + if ( callback ) { + callback(); + } + } + }; + } +} ); + + + + +// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) +jQuery.ajaxPrefilter( function( s ) { + if ( s.crossDomain ) { + s.contents.script = false; + } +} ); + +// Install script dataType +jQuery.ajaxSetup( { + accepts: { + script: "text/javascript, application/javascript, " + + "application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /\b(?:java|ecma)script\b/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +} ); + +// Handle cache's special case and crossDomain +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + } +} ); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function( s ) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + var script, callback; + return { + send: function( _, complete ) { + script = jQuery( " - + + + + + + + + - +
                          -
                          +

                          Index

                          @@ -79,3180 +70,1645 @@

                          A

                          - + +
                          - -
                          accept() (M2Crypto.SSL.Connection.Connection method) -
                          - - -
                          accept_ssl() (M2Crypto.SSL.Connection.Connection method) -
                          - - -
                          add_cert() (M2Crypto.X509.X509_Store method) -
                          - - -
                          add_entry_by_txt() (M2Crypto.X509.X509_Name method) -
                          - - -
                          add_ext() (M2Crypto.X509.X509 method) -
                          - - -
                          add_extensions() (M2Crypto.X509.Request method) -
                          - - -
                          add_session() (M2Crypto.SSL.Context.Context method) -
                          - - -
                          add_signature() (M2Crypto.PGP.PublicKey.PublicKey method) -
                          - - -
                          add_userid() (M2Crypto.PGP.PublicKey.PublicKey method) -
                          - - -
                          add_x509() (M2Crypto.X509.X509_Store method) -
                          +
                          - -
                          (M2Crypto.X509.X509 method) -
                          +

                          B

                          + + + +
                          - -
                          (M2Crypto.X509.X509_Name method) -
                          +

                          C

                          + + - + +
                          - -
                          as_pem() (M2Crypto.EC.EC method) -
                          + +
                        • clear() (M2Crypto.SSL.Connection.Connection method) -
                          - -
                          (M2Crypto.EVP.PKey method) -
                          +
                        • +
                        • clientPostConnectionCheck (M2Crypto.SSL.Connection.Connection attribute) +
                        • +
                        • close() (M2Crypto.BIO.BIO method) - -
                          (M2Crypto.RSA.RSA method) -
                          +
                        • +
                          - -
                          (M2Crypto.X509.X509 method) -
                          +

                          D

                          + + + +
                          -
                          - -
                          (M2Crypto.SSL.Session.Session method) -
                          +

                          E

                          + + + +
                          - -
                          (M2Crypto.X509.CRL method) -
                          +

                          F

                          + + + +
                          -
                          - -
                          ASN1_Integer (class in M2Crypto.ASN1) -
                          +

                          G

                          + + + + +
                        • get_x509_verify_error() (in module M2Crypto.Err) +
                        • +
                        • getpeername() (M2Crypto.SSL.Connection.Connection method) +
                        • +
                        • getsockname() (M2Crypto.SSL.Connection.Connection method) +
                        • +
                        • getsockopt() (M2Crypto.SSL.Connection.Connection method) +
                        • +
                        • getvalue() (M2Crypto.BIO.MemoryBuffer method) +
                        • +
                          -

                          B

                          +

                          H

                          - - + +
                          - -
                          bin_to_hex() (in module M2Crypto.util) -
                          - - -
                          bind() (M2Crypto.SSL.Connection.Connection method) -
                          - - -
                          BIO (class in M2Crypto.BIO) -
                          - -
                          - -
                          bio_ptr() (M2Crypto.BIO.BIO method) -
                          - - -
                          BIOError -
                          +
                          - -
                          build_opener() (in module M2Crypto.m2urllib2) -
                          +

                          I

                          + + + +
                        • IOBuffer (class in M2Crypto.BIO) +
                        • + +
                          -

                          C

                          +

                          K

                          - +
                          - -
                          check_ca() (M2Crypto.X509.X509 method) -
                          +
                          - -
                          check_key() (M2Crypto.DSA.DSA method) -
                          +

                          L

                          + + + +
                          - -
                          (class in M2Crypto.SSL.Cipher) -
                          +

                          M

                          + + + +
                          - -
                          cleanup() (in module M2Crypto.Engine) -
                          +

                          N

                          + + + +
                          -
                          - -
                          clear() (M2Crypto.SSL.Connection.Connection method) -
                          +

                          O

                          + + + +
                          -
                          - -
                          (M2Crypto.SSL.TwistedProtocolWrapper.TLSProtocolWrapper method) -
                          +

                          P

                          + + + +
                          - -
                          (M2Crypto.PGP.packet.PacketStream method) -
                          +

                          Q

                          + + +
                          - -
                          (M2Crypto.SSL.Connection.Connection method) -
                          +

                          R

                          + + + +
                          - -
                          CompressedPacket (class in M2Crypto.PGP.packet) -
                          +

                          S

                          + + - + + +
                        • sign_dsa() (M2Crypto.EC.EC method) +
                        • +
                        • sign_dsa_asn1() (M2Crypto.EC.EC method) +
                        • +
                        • sign_final() (M2Crypto.EVP.PKey method) +
                        • +
                        • sign_init() (M2Crypto.EVP.PKey method) +
                        • +
                        • sign_rsassa_pss() (M2Crypto.RSA.RSA method) +
                        • +
                        • sign_update() (M2Crypto.EVP.PKey method) +
                        • +
                        • size() (M2Crypto.EVP.PKey method) +
                        • +
                        • SMIME (class in M2Crypto.SMIME) +
                        • +
                        • SMIME_Error +
                        • +
                        • smime_load_pkcs7() (in module M2Crypto.SMIME) +
                        • +
                        • smime_load_pkcs7_bio() (in module M2Crypto.SMIME) +
                        • +
                        • ssl_dispatcher (class in M2Crypto.SSL.ssl_dispatcher) +
                        • +
                        • ssl_get_error() (M2Crypto.SSL.Connection.Connection method) +
                        • +
                        • ssl_info_callback() (in module M2Crypto.SSL.cb) +
                        • +
                        • SSL_Transport (class in M2Crypto.m2xmlrpclib) +
                        • +
                        • ssl_verify_callback() (in module M2Crypto.SSL.cb) +
                        • +
                        • ssl_verify_callback_allow_unknown_ca() (in module M2Crypto.SSL.cb) +
                        • +
                        • ssl_verify_callback_stub() (in module M2Crypto.SSL.cb) +
                        • +
                        • SSLBio (class in M2Crypto.BIO) +
                        • +
                        • SSLError, [1] +
                        • +
                        • SSLServer (class in M2Crypto.SSL.SSLServer) +
                        • +
                        • SSLTimeoutError +
                        • +
                        • SSLVerificationError +
                        • +
                        • startTLS() (M2Crypto.SSL.TwistedProtocolWrapper.TLSProtocolWrapper method) +
                        • +
                        • struct_size() (in module M2Crypto.SSL.timeout) +
                        • +
                        • struct_to_timeout() (in module M2Crypto.SSL.timeout) +
                        • +
                          - -
                          compute_key() (M2Crypto.DH.DH method) -
                          + +
                        • save_key_bio() (M2Crypto.DSA.DSA method) - -
                          connect() (M2Crypto.httpslib.HTTPSConnection method) -
                          +
                        • +
                        • save_key_der() (M2Crypto.RSA.RSA method) +
                        • +
                        • save_key_der_bio() (M2Crypto.RSA.RSA method) +
                        • +
                        • save_params() (M2Crypto.DSA.DSA method) +
                        • +
                        • save_params_bio() (M2Crypto.DSA.DSA method) +
                        • +
                        • save_pem() (M2Crypto.RSA.RSA method) -
                          - -
                          (M2Crypto.SSL.Connection.Connection method) -
                          +
                        • +
                        • save_pub_key() (M2Crypto.DSA.DSA method) - -
                          (M2Crypto.SSL.ssl_dispatcher.ssl_dispatcher method) -
                          +
                        • +
                        • save_pub_key_bio() (M2Crypto.DSA.DSA method) - -
                          (M2Crypto.httpslib.ProxyHTTPSConnection method) -
                          +
                        • +
                        • seek() (M2Crypto.BIO.BIO method) +
                        • +
                        • send() (M2Crypto.SSL.Connection.Connection method) -
                        • - -
                          connect_ssl() (M2Crypto.SSL.Connection.Connection method) -
                          + +
                        • sendall() (M2Crypto.SSL.Connection.Connection method) +
                        • +
                        • serverPostConnectionCheck() (M2Crypto.SSL.Connection.Connection method) +
                        • +
                        • Session (class in M2Crypto.SSL.Session) +
                        • +
                        • set_accept_state() (M2Crypto.SSL.Connection.Connection method) +
                        • +
                        • set_allow_unknown_ca() (M2Crypto.SSL.Context.Context method) +
                        • +
                        • set_bio() (M2Crypto.SSL.Connection.Connection method) +
                        • +
                        • set_cipher() (M2Crypto.BIO.CipherStream method) - -
                          Connection (class in M2Crypto.SSL.Connection) -
                          +
                        • +
                        • set_cipher_list() (M2Crypto.SSL.Connection.Connection method) - -
                          connectionLost() (M2Crypto.SSL.TwistedProtocolWrapper.TLSProtocolWrapper method) -
                          +
                        • +
                        • set_client_CA_list_from_context() (M2Crypto.SSL.Connection.Connection method) +
                        • +
                        • set_client_CA_list_from_file() (M2Crypto.SSL.Connection.Connection method) - -
                          connectionMade() (M2Crypto.SSL.TwistedProtocolWrapper.TLSProtocolWrapper method) -
                          +
                        • +
                        • set_connect_state() (M2Crypto.SSL.Connection.Connection method) +
                        • +
                        • set_critical() (M2Crypto.X509.X509_Extension method) +
                        • +
                        • set_data() (M2Crypto.X509.X509_Name_Entry method) +
                        • +
                        • set_datetime() (M2Crypto.ASN1.ASN1_TIME method) +
                        • +
                        • set_default() (M2Crypto.Engine.Engine method) +
                        • +
                        • set_default_verify_paths() (M2Crypto.SSL.Context.Context method) +
                        • +
                        • set_info_callback() (M2Crypto.SSL.Context.Context method) +
                        • +
                        • set_issuer() (M2Crypto.X509.X509 method) +
                        • +
                        • set_issuer_name() (M2Crypto.X509.X509 method) +
                        • +
                        • set_key() (M2Crypto.RC4.RC4 method) +
                        • +
                        • set_not_after() (M2Crypto.X509.X509 method) +
                        • +
                        • set_not_before() (M2Crypto.X509.X509 method) +
                        • +
                        • set_object() (M2Crypto.X509.X509_Name_Entry method) +
                        • +
                        • set_options() (M2Crypto.SSL.Context.Context method) +
                        • +
                        • set_padding() (M2Crypto.EVP.Cipher method) +
                        • +
                        • set_params() (in module M2Crypto.DH) - -
                          connectSSL() (in module M2Crypto.SSL.TwistedProtocolWrapper) -
                          +
                        • +
                        • set_post_connection_check_callback() (M2Crypto.SSL.Connection.Connection method) +
                        • +
                        • set_pubkey() (M2Crypto.X509.Request method) - -
                          connectTCP() (in module M2Crypto.SSL.TwistedProtocolWrapper) -
                          +
                        • +
                        • set_serial_number() (M2Crypto.X509.X509 method) +
                        • +
                        • set_session() (M2Crypto.httpslib.HTTPSConnection method) - -
                          Context (class in M2Crypto.SSL.Context) -
                          +
                        • +
                          -

                          D

                          +

                          T

                          - + +
                          - -
                          data() (M2Crypto.AuthCookie.AuthCookie method) -
                          - - -
                          dataReceived() (M2Crypto.SSL.TwistedProtocolWrapper.TLSProtocolWrapper method) -
                          - - -
                          decrypt() (M2Crypto.PGP.PublicKey.PublicKey method) -
                          - -
                          - -
                          (M2Crypto.SMIME.SMIME method) -
                          +
                          -
                          - -
                          default_port (M2Crypto.httpslib.HTTPSConnection attribute) -
                          +

                          U

                          + + + +
                          - -
                          DHError -
                          +

                          V

                          + + - + +
                          - -
                          digest() (M2Crypto.EVP.HMAC method) -
                          + +
                        • verify_asn1() (M2Crypto.DSA.DSA method) +
                        • +
                          -
                          - -
                          (M2Crypto.EVP.MessageDigest method) -
                          +

                          W

                          + + + +
                          - -
                          DSA_pub (class in M2Crypto.DSA) -
                          +

                          X

                          + + + +
                          - -
                          DSAError -
                          - -
                          dst() (M2Crypto.ASN1.LocalTimezone method) -
                          -
                          + + + + - -
                          -
                          - - - - - -
                          -
                          -
                          - - - + \ No newline at end of file diff --git a/doc/html/howto.ca.html b/doc/html/howto.ca.html index b3625ec..8a30e5a 100644 --- a/doc/html/howto.ca.html +++ b/doc/html/howto.ca.html @@ -1,50 +1,42 @@ - - - - HOWTO: Creating your own CA with OpenSSL — M2Crypto documentation - - + HOWTO: Creating your own CA with OpenSSL — M2Crypto documentation + - - + + + + + + + + - +
                          -
                          +

                          HOWTO: Creating your own CA with OpenSSL

                          @@ -64,30 +56,30 @@ with OpenSSL.

                          I last created a CA about a year ago, when I began work on M2Crypto and needed -certificates for the SSL bits. I accepted the tools’ default +certificates for the SSL bits. I accepted the tools’ default settings then, e.g., certificate validity of 365 days; this meant -that my certificates, including my CA’s certificate, have now +that my certificates, including my CA’s certificate, have now expired.

                          -

                          Since I am using these certificates for M2Crypto’s demonstration -programs (and I have forgotten the passphrase to the CA’s private +

                          Since I am using these certificates for M2Crypto’s demonstration +programs (and I have forgotten the passphrase to the CA’s private key), I decided to discard the old CA and start afresh. I also decided to document the process, hence this HOWTO.

                          The Procedure

                          -

                          I use CA.pl, a Perl program written by Steve Hanson and bundled with +

                          I use CA.pl, a Perl program written by Steve Hanson and bundled with OpenSSL.

                          The following are the steps to create a CA:

                          1. Choose a directory to do your CA work. All commands are executed -within this directory. Let’s call the directory demo.

                            +within this directory. Let’s call the directory demo.

                          2. -
                          3. Copy CA.pl and openssl.cnf into demo.

                            +
                          4. Copy CA.pl and openssl.cnf into demo.

                          5. -
                          6. Apply the following patch to CA.pl, which allows it to generate a +

                          7. Apply the following patch to CA.pl, which allows it to generate a CA certificate with a validity period of 1095 days, i.e., 3 years:

                            -
                            --- CA.pl.org   Sat Mar 31 12:40:13 2001
                            +
                            --- CA.pl.org   Sat Mar 31 12:40:13 2001
                             +++ CA.pl       Sat Mar 31 12:41:15 2001
                             @@ -97,7 +97,7 @@
                                             } else {
                            @@ -97,185 +89,191 @@ CA certificate with a validity period of 1095 days, i.e.,
                             +                       "${CATOP}/private/$CAKEY -out ${CATOP}/$CACERT -days 1095");
                                                 $RET=$?;
                                             }
                            -            }
                            + } +
                        • Create a new CA like this:

                          -
                          ./CA.pl -newca
                          +
                          ./CA.pl -newca
                           
                          -A certificate filename (or enter to create) <enter>
                          +A certificate filename (or enter to create) <enter>
                           
                          -Making CA certificate ...
                          -Using configuration from openssl.cnf
                          -Generating a 1024 bit RSA private key
                          -............++++++
                          -......................++++++
                          -writing new private key to './demoCA/private/cakey.pem'
                          -Enter PEM pass phrase: <secret passphrase here>
                          -Verifying password - Enter PEM pass phrase: <secret passphrase again>
                          ------
                          -You are about to be asked to enter information that will be incorporated
                          -into your certificate request.
                          -What you are about to enter is what is called a Distinguished Name or a DN.
                          -There are quite a few fields but you can leave some blank
                          -For some fields there will be a default value,
                          -If you enter '.', the field will be left blank.
                          ------
                          -Country Name (2 letter code) [AU]:SG
                          -State or Province Name (full name) [Some-State]:.
                          -Locality Name (eg, city) []:..
                          -Organization Name (eg, company) [Internet Widgits Pty Ltd]:DemoCA
                          -Organizational Unit Name (eg, section) []:.
                          -Common Name (eg, YOUR name) []:DemoCA Certificate Master
                          -Email Address []:certmaster@democa.dom
                          +Making CA certificate ... +Using configuration from openssl.cnf +Generating a 1024 bit RSA private key +............++++++ +......................++++++ +writing new private key to './demoCA/private/cakey.pem' +Enter PEM pass phrase: <secret passphrase here> +Verifying password - Enter PEM pass phrase: <secret passphrase again> +----- +You are about to be asked to enter information that will be incorporated +into your certificate request. +What you are about to enter is what is called a Distinguished Name or a DN. +There are quite a few fields but you can leave some blank +For some fields there will be a default value, +If you enter '.', the field will be left blank. +----- +Country Name (2 letter code) [AU]:SG +State or Province Name (full name) [Some-State]:. +Locality Name (eg, city) []:.. +Organization Name (eg, company) [Internet Widgits Pty Ltd]:DemoCA +Organizational Unit Name (eg, section) []:. +Common Name (eg, YOUR name) []:DemoCA Certificate Master +Email Address []:certmaster@democa.dom +
                        • -

                          This creates a new CA in the directory demoCA. The CA’s -self-signed certificate is in demoCA/cacert.pem and its RSA key -pair is in demoCA/private/cakey.pem.

                          -

                          demoCA/private/cakey.pem looks like this:

                          -
                          cat demoCA/private/cakey.pem
                          +

                          This creates a new CA in the directory demoCA. The CA’s +self-signed certificate is in demoCA/cacert.pem and its RSA key +pair is in demoCA/private/cakey.pem.

                          +

                          demoCA/private/cakey.pem looks like this:

                          +
                          cat demoCA/private/cakey.pem
                           
                          ------BEGIN RSA PRIVATE KEY-----
                          -Proc-Type: 4,ENCRYPTED
                          -DEK-Info: DES-EDE3-CBC,19973A9DBBB601BA
                          +-----BEGIN RSA PRIVATE KEY-----
                          +Proc-Type: 4,ENCRYPTED
                          +DEK-Info: DES-EDE3-CBC,19973A9DBBB601BA
                           
                          -eOq9WFScNiI4/UWEUaSnGTKpJv2JYuMD3HwQox2Q3Cd4zGqVjJ6gF3exa5126cKf
                          -X/bMVnwbPpuFZPiAIvaLyCjT6pYeXTBbSzs7/GQnvEOv+nYnDUFWi0Qm92qLk0uy
                          -pFi/M1aWheN3vir2ZlAw+DW0bOOZhj8tC7Co7lMYb0YE271b6/YRPZCwQ3GXAHUJ
                          -+aMYxlUDrK45aCUa/1CZDzTgk7h9cDgx2QJSIvYMYytCfI3zsuZMJS8/4OXLL0bI
                          -lKmAc1dwB3DqGJt5XK4WJesiNfdxeCNEgAcYtEAgYZTPIApU+kTgTCIxJl2nMW7j
                          -ax+Q1z7g+4MpgG20WD633D4z4dTlDdz+dnLi0rvuvxiwt+dUhrqiML1tyi+Z6EBH
                          -jU4/cLBWev3rYfrlp4x8J9mDte0YKOk3t0wQOHqRetTsIfdtjnFp/Hu3qDmTCWjD
                          -z/g7PPoO/bg/B877J9WBPbL/1hXXFYo88M+2aGlPOgDcFdiOqbLb2DCscohMbbVr
                          -A4mgiy2kwWfIE73qiyV7yyG8FlRvr1iib+jbT3LTGf743utYAAs7HNGuOUObhoyt
                          -jYvBD7ACn35P5YX7KTqvqErwdijxYCaNBCnvmRtmYSaNw9Kv1UJTxc5Vx7YLwIPk
                          -E9KyBgKI7vPOjWBZ27+zOvNycmv1ciNtpALAw4bWtXnhCDVTHaVDy34OkheMzNCg
                          -2cjcBFzOkMIjcI03KbTQXOFIQGlsTWXGzkNf/zBQ+KksT1MCj+zBXSCvlDASMckg
                          -kef21pGgUqPF14gKGfWX3sV4bjc1vbrRwq6zlG3nMuYqR5MtJJY9eQ==
                          ------END RSA PRIVATE KEY-----
                          +eOq9WFScNiI4/UWEUaSnGTKpJv2JYuMD3HwQox2Q3Cd4zGqVjJ6gF3exa5126cKf +X/bMVnwbPpuFZPiAIvaLyCjT6pYeXTBbSzs7/GQnvEOv+nYnDUFWi0Qm92qLk0uy +pFi/M1aWheN3vir2ZlAw+DW0bOOZhj8tC7Co7lMYb0YE271b6/YRPZCwQ3GXAHUJ ++aMYxlUDrK45aCUa/1CZDzTgk7h9cDgx2QJSIvYMYytCfI3zsuZMJS8/4OXLL0bI +lKmAc1dwB3DqGJt5XK4WJesiNfdxeCNEgAcYtEAgYZTPIApU+kTgTCIxJl2nMW7j +ax+Q1z7g+4MpgG20WD633D4z4dTlDdz+dnLi0rvuvxiwt+dUhrqiML1tyi+Z6EBH +jU4/cLBWev3rYfrlp4x8J9mDte0YKOk3t0wQOHqRetTsIfdtjnFp/Hu3qDmTCWjD +z/g7PPoO/bg/B877J9WBPbL/1hXXFYo88M+2aGlPOgDcFdiOqbLb2DCscohMbbVr +A4mgiy2kwWfIE73qiyV7yyG8FlRvr1iib+jbT3LTGf743utYAAs7HNGuOUObhoyt +jYvBD7ACn35P5YX7KTqvqErwdijxYCaNBCnvmRtmYSaNw9Kv1UJTxc5Vx7YLwIPk +E9KyBgKI7vPOjWBZ27+zOvNycmv1ciNtpALAw4bWtXnhCDVTHaVDy34OkheMzNCg +2cjcBFzOkMIjcI03KbTQXOFIQGlsTWXGzkNf/zBQ+KksT1MCj+zBXSCvlDASMckg +kef21pGgUqPF14gKGfWX3sV4bjc1vbrRwq6zlG3nMuYqR5MtJJY9eQ== +-----END RSA PRIVATE KEY----- +
                        • Next, generate a certificate request:

                          -
                          ./CA.pl -newreq
                          +
                          ./CA.pl -newreq
                           
                          -Using configuration from openssl.cnf
                          -Generating a 1024 bit RSA private key
                          -..........++++++
                          -..............++++++
                          -writing new private key to 'newreq.pem'
                          -Enter PEM pass phrase: <another secret passphrase here>
                          -Verifying password - Enter PEM pass phrase: <another secret passphrase again>
                          ------
                          -You are about to be asked to enter information that will be incorporated
                          -into your certificate request.
                          -What you are about to enter is what is called a Distinguished Name or a DN.
                          -There are quite a few fields but you can leave some blank
                          -For some fields there will be a default value,
                          -If you enter '.', the field will be left blank.
                          ------
                          -Country Name (2 letter code) [AU]:SG
                          -State or Province Name (full name) [Some-State]:..
                          -Locality Name (eg, city) []:.
                          -Organization Name (eg, company) [Internet Widgits Pty Ltd]:M2Crypto
                          -Organizational Unit Name (eg, section) []:.
                          -Common Name (eg, YOUR name) []:localhost
                          -Email Address []:admin@server.example.dom
                          +Using configuration from openssl.cnf
                          +Generating a 1024 bit RSA private key
                          +..........++++++
                          +..............++++++
                          +writing new private key to 'newreq.pem'
                          +Enter PEM pass phrase: <another secret passphrase here>
                          +Verifying password - Enter PEM pass phrase: <another secret passphrase again>
                          +-----
                          +You are about to be asked to enter information that will be incorporated
                          +into your certificate request.
                          +What you are about to enter is what is called a Distinguished Name or a DN.
                          +There are quite a few fields but you can leave some blank
                          +For some fields there will be a default value,
                          +If you enter '.', the field will be left blank.
                          +-----
                          +Country Name (2 letter code) [AU]:SG
                          +State or Province Name (full name) [Some-State]:..
                          +Locality Name (eg, city) []:.
                          +Organization Name (eg, company) [Internet Widgits Pty Ltd]:M2Crypto
                          +Organizational Unit Name (eg, section) []:.
                          +Common Name (eg, YOUR name) []:localhost
                          +Email Address []:admin@server.example.dom
                           
                          -Please enter the following 'extra' attributes
                          -to be sent with your certificate request
                          -A challenge password []:<enter>
                          -An optional company name []:<enter>
                          -Request (and private key) is in newreq.pem
                          +Please enter the following 'extra' attributes +to be sent with your certificate request +A challenge password []:<enter> +An optional company name []:<enter> +Request (and private key) is in newreq.pem +
                        • -

                          The certificate request and private key in newreq.pem looks like +

                          The certificate request and private key in newreq.pem looks like this:

                          -
                          cat newreq.pem
                          +
                          cat newreq.pem
                           
                          ------BEGIN RSA PRIVATE KEY-----
                          -Proc-Type: 4,ENCRYPTED
                          -DEK-Info: DES-EDE3-CBC,41B2874DF3D02DD4
                          +-----BEGIN RSA PRIVATE KEY-----
                          +Proc-Type: 4,ENCRYPTED
                          +DEK-Info: DES-EDE3-CBC,41B2874DF3D02DD4
                           
                          -mg611EoVkLEooSTv+qTM0Ddmm/M1jE/Jy5RD/sc3LSMhuGu9xc26OgsTJmkQuIAh
                          -J/B4lAw8G59VTG6DykeEtrG0rUBx4bggc7PKbFuiN423YjJODWcHvVgnPOzXMQt+
                          -lY4tPl5+217MRHyx2NsWGrpkQNdu3GeSPOVMl3jeQiaXupONbwQ7rj42+X/VtAJP
                          -W4D1NNwu8aGCPyShsEXHc/fI1WDpphYWke97pOjIZVQESFZOPty5HjIYZux4U+td
                          -W81xODtq2ecJXc8fn2Wpa9y5VD1LT7oJksOuL1+Z04OVaeUe4x0swM17HlBm2kVt
                          -fe/C/L6kN27MwZhE331VjtTjSGl4/gknqQDbLOtqT06f3OISsDJETm2itllyhgzv
                          -C6Fi3N03rGFmKectijC+tws5k+P+HRG6sai33usk8xPokJqA+HYSWPz1XVlpRmv4
                          -kdjQOdST7ovU62mOTgf3ARcduPPwuzTfxOlYONe5NioO1APVHBrInQwcpLkpOTQR
                          -vI4roIN+b75/nihUWGUJn/nbbBa2Yl0N5Gs1Tyiy9Z+CcRT2TfWKBBFlEUIFl7Mb
                          -J9fTV3DI+k+akbR4il1NkQ8EcSmCr3WpA0I9n0EHI7ZVpVaHxc0sqaPFl8YGdFHq
                          -1Qk53C/w6+qPpDzT3yKFmG2LZytAAM1czvb6RbNRJJP2ZrpBwn/h99sUTo/yPfxY
                          -nueYmFJDm0uVNtG0icXGNUfSfnjKNTtHPAgyKGetRIC3kgJz/bo2w7EI6iEjBAzK
                          -l5TRm4x6ZJxwuXXMiJCehMMd8TC8ybwWO4AO19B3ebFFeTVsUgxSGA==
                          ------END RSA PRIVATE KEY-----
                          ------BEGIN CERTIFICATE REQUEST-----
                          -MIIBnTCCAQYCAQAwXTELMAkGA1UEBhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRvMRIw
                          -EAYDVQQDEwlsb2NhbGhvc3QxJzAlBgkqhkiG9w0BCQEWGGFkbWluQHNlcnZlci5l
                          -eGFtcGxlLmRvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAr1nYY1Qrll1r
                          -uB/FqlCRrr5nvupdIN+3wF7q915tvEQoc74bnu6b8IbbGRMhzdzmvQ4SzFfVEAuM
                          -MuTHeybPq5th7YDrTNizKKxOBnqE2KYuX9X22A1Kh49soJJFg6kPb9MUgiZBiMlv
                          -tb7K3CHfgw5WagWnLl8Lb+ccvKZZl+8CAwEAAaAAMA0GCSqGSIb3DQEBBAUAA4GB
                          -AHpoRp5YS55CZpy+wdigQEwjL/wSluvo+WjtpvP0YoBMJu4VMKeZi405R7o8oEwi
                          -PdlrrliKNknFmHKIaCKTLRcU59ScA6ADEIWUzqmUzP5Cs6jrSRo3NKfg1bd09D1K
                          -9rsQkRc9Urv9mRBIsredGnYECNeRaK5R1yzpOowninXC
                          ------END CERTIFICATE REQUEST-----
                          +mg611EoVkLEooSTv+qTM0Ddmm/M1jE/Jy5RD/sc3LSMhuGu9xc26OgsTJmkQuIAh +J/B4lAw8G59VTG6DykeEtrG0rUBx4bggc7PKbFuiN423YjJODWcHvVgnPOzXMQt+ +lY4tPl5+217MRHyx2NsWGrpkQNdu3GeSPOVMl3jeQiaXupONbwQ7rj42+X/VtAJP +W4D1NNwu8aGCPyShsEXHc/fI1WDpphYWke97pOjIZVQESFZOPty5HjIYZux4U+td +W81xODtq2ecJXc8fn2Wpa9y5VD1LT7oJksOuL1+Z04OVaeUe4x0swM17HlBm2kVt +fe/C/L6kN27MwZhE331VjtTjSGl4/gknqQDbLOtqT06f3OISsDJETm2itllyhgzv +C6Fi3N03rGFmKectijC+tws5k+P+HRG6sai33usk8xPokJqA+HYSWPz1XVlpRmv4 +kdjQOdST7ovU62mOTgf3ARcduPPwuzTfxOlYONe5NioO1APVHBrInQwcpLkpOTQR +vI4roIN+b75/nihUWGUJn/nbbBa2Yl0N5Gs1Tyiy9Z+CcRT2TfWKBBFlEUIFl7Mb +J9fTV3DI+k+akbR4il1NkQ8EcSmCr3WpA0I9n0EHI7ZVpVaHxc0sqaPFl8YGdFHq +1Qk53C/w6+qPpDzT3yKFmG2LZytAAM1czvb6RbNRJJP2ZrpBwn/h99sUTo/yPfxY +nueYmFJDm0uVNtG0icXGNUfSfnjKNTtHPAgyKGetRIC3kgJz/bo2w7EI6iEjBAzK +l5TRm4x6ZJxwuXXMiJCehMMd8TC8ybwWO4AO19B3ebFFeTVsUgxSGA== +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE REQUEST----- +MIIBnTCCAQYCAQAwXTELMAkGA1UEBhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRvMRIw +EAYDVQQDEwlsb2NhbGhvc3QxJzAlBgkqhkiG9w0BCQEWGGFkbWluQHNlcnZlci5l +eGFtcGxlLmRvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAr1nYY1Qrll1r +uB/FqlCRrr5nvupdIN+3wF7q915tvEQoc74bnu6b8IbbGRMhzdzmvQ4SzFfVEAuM +MuTHeybPq5th7YDrTNizKKxOBnqE2KYuX9X22A1Kh49soJJFg6kPb9MUgiZBiMlv +tb7K3CHfgw5WagWnLl8Lb+ccvKZZl+8CAwEAAaAAMA0GCSqGSIb3DQEBBAUAA4GB +AHpoRp5YS55CZpy+wdigQEwjL/wSluvo+WjtpvP0YoBMJu4VMKeZi405R7o8oEwi +PdlrrliKNknFmHKIaCKTLRcU59ScA6ADEIWUzqmUzP5Cs6jrSRo3NKfg1bd09D1K +9rsQkRc9Urv9mRBIsredGnYECNeRaK5R1yzpOowninXC +-----END CERTIFICATE REQUEST----- +

                          Decoding the certificate request gives the following:

                          -
                          openssl req -text -noout < newreq.pem
                          +
                          openssl req -text -noout < newreq.pem
                           
                          -Using configuration from /usr/local/pkg/openssl/openssl.cnf
                          -Certificate Request:
                          -   Data:
                          -       Version: 0 (0x0)
                          -       Subject: C=SG, O=M2Crypto, CN=localhost/Email=admin@server.example.dom
                          -       Subject Public Key Info:
                          -           Public Key Algorithm: rsaEncryption
                          -           RSA Public Key: (1024 bit)
                          -               Modulus (1024 bit):
                          -                   00:af:59:d8:63:54:2b:96:5d:6b:b8:1f:c5:aa:50:
                          -                   91:ae:be:67:be:ea:5d:20:df:b7:c0:5e:ea:f7:5e:
                          -                   6d:bc:44:28:73:be:1b:9e:ee:9b:f0:86:db:19:13:
                          -                   21:cd:dc:e6:bd:0e:12:cc:57:d5:10:0b:8c:32:e4:
                          -                   c7:7b:26:cf:ab:9b:61:ed:80:eb:4c:d8:b3:28:ac:
                          -                   4e:06:7a:84:d8:a6:2e:5f:d5:f6:d8:0d:4a:87:8f:
                          -                   6c:a0:92:45:83:a9:0f:6f:d3:14:82:26:41:88:c9:
                          -                   6f:b5:be:ca:dc:21:df:83:0e:56:6a:05:a7:2e:5f:
                          -                   0b:6f:e7:1c:bc:a6:59:97:ef
                          -               Exponent: 65537 (0x10001)
                          -       Attributes:
                          -           a0:00
                          -   Signature Algorithm: md5WithRSAEncryption
                          -       7a:68:46:9e:58:4b:9e:42:66:9c:be:c1:d8:a0:40:4c:23:2f:
                          -       fc:12:96:eb:e8:f9:68:ed:a6:f3:f4:62:80:4c:26:ee:15:30:
                          -       a7:99:8b:8d:39:47:ba:3c:a0:4c:22:3d:d9:6b:ae:58:8a:36:
                          -       49:c5:98:72:88:68:22:93:2d:17:14:e7:d4:9c:03:a0:03:10:
                          -       85:94:ce:a9:94:cc:fe:42:b3:a8:eb:49:1a:37:34:a7:e0:d5:
                          -       b7:74:f4:3d:4a:f6:bb:10:91:17:3d:52:bb:fd:99:10:48:b2:
                          -       b7:9d:1a:76:04:08:d7:91:68:ae:51:d7:2c:e9:3a:8c:27:8a:
                          -       75:c2
                          +Using configuration from /usr/local/pkg/openssl/openssl.cnf +Certificate Request: + Data: + Version: 0 (0x0) + Subject: C=SG, O=M2Crypto, CN=localhost/Email=admin@server.example.dom + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:af:59:d8:63:54:2b:96:5d:6b:b8:1f:c5:aa:50: + 91:ae:be:67:be:ea:5d:20:df:b7:c0:5e:ea:f7:5e: + 6d:bc:44:28:73:be:1b:9e:ee:9b:f0:86:db:19:13: + 21:cd:dc:e6:bd:0e:12:cc:57:d5:10:0b:8c:32:e4: + c7:7b:26:cf:ab:9b:61:ed:80:eb:4c:d8:b3:28:ac: + 4e:06:7a:84:d8:a6:2e:5f:d5:f6:d8:0d:4a:87:8f: + 6c:a0:92:45:83:a9:0f:6f:d3:14:82:26:41:88:c9: + 6f:b5:be:ca:dc:21:df:83:0e:56:6a:05:a7:2e:5f: + 0b:6f:e7:1c:bc:a6:59:97:ef + Exponent: 65537 (0x10001) + Attributes: + a0:00 + Signature Algorithm: md5WithRSAEncryption + 7a:68:46:9e:58:4b:9e:42:66:9c:be:c1:d8:a0:40:4c:23:2f: + fc:12:96:eb:e8:f9:68:ed:a6:f3:f4:62:80:4c:26:ee:15:30: + a7:99:8b:8d:39:47:ba:3c:a0:4c:22:3d:d9:6b:ae:58:8a:36: + 49:c5:98:72:88:68:22:93:2d:17:14:e7:d4:9c:03:a0:03:10: + 85:94:ce:a9:94:cc:fe:42:b3:a8:eb:49:1a:37:34:a7:e0:d5: + b7:74:f4:3d:4a:f6:bb:10:91:17:3d:52:bb:fd:99:10:48:b2: + b7:9d:1a:76:04:08:d7:91:68:ae:51:d7:2c:e9:3a:8c:27:8a: + 75:c2 +
                          1. Now, sign the certificate request:

                            -
                            ./CA.pl -sign
                            +
                            ./CA.pl -sign
                             
                             Using configuration from openssl.cnf
                            -Enter PEM pass phrase: <CA's passphrase>
                            +Enter PEM pass phrase: <CA's passphrase>
                             Check that the request matches the signature
                             Signature ok
                             The Subjects Distinguished Name is as follows
                            -countryName           :PRINTABLE:'SG'
                            -organizationName      :PRINTABLE:'M2Crypto'
                            -commonName            :PRINTABLE:'localhost'
                            -emailAddress          :IA5STRING:'admin@server.example.dom'
                            +countryName           :PRINTABLE:'SG'
                            +organizationName      :PRINTABLE:'M2Crypto'
                            +commonName            :PRINTABLE:'localhost'
                            +emailAddress          :IA5STRING:'admin@server.example.dom'
                             Certificate is to be certified until Mar 31 02:57:30 2002 GMT (365 days)
                             Sign the certificate? [y/n]:y
                             
                            @@ -283,123 +281,127 @@ Sign the certificate? [y/n]:y
                             1 out of 1 certificate requests certified, commit?  [y/n]y
                             Write out database with 1 new entries
                             Data Base Updated
                            -Signed certificate is in newcert.pem
                            +Signed certificate is in newcert.pem +

                          -

                          newcert.pem looks like this:

                          -
                          cat newcert.pem
                          +

                          newcert.pem looks like this:

                          +
                          cat newcert.pem
                           
                          -Certificate:
                          -Data:
                          -   Version: 3 (0x2)
                          -   Serial Number: 1 (0x1)
                          -   Signature Algorithm: md5WithRSAEncryption
                          -   Issuer: C=SG, O=DemoCA, CN=DemoCA Certificate Master/Email=certmaster@democa.dom
                          -   Validity
                          -       Not Before: Mar 31 02:57:30 2001 GMT
                          -       Not After : Mar 31 02:57:30 2002 GMT
                          -   Subject: C=SG, O=M2Crypto, CN=localhost/Email=admin@server.example.dom
                          -   Subject Public Key Info:
                          -       Public Key Algorithm: rsaEncryption
                          -       RSA Public Key: (1024 bit)
                          -           Modulus (1024 bit):
                          -               00:af:59:d8:63:54:2b:96:5d:6b:b8:1f:c5:aa:50:
                          -               91:ae:be:67:be:ea:5d:20:df:b7:c0:5e:ea:f7:5e:
                          -               6d:bc:44:28:73:be:1b:9e:ee:9b:f0:86:db:19:13:
                          -               21:cd:dc:e6:bd:0e:12:cc:57:d5:10:0b:8c:32:e4:
                          -               c7:7b:26:cf:ab:9b:61:ed:80:eb:4c:d8:b3:28:ac:
                          -               4e:06:7a:84:d8:a6:2e:5f:d5:f6:d8:0d:4a:87:8f:
                          -               6c:a0:92:45:83:a9:0f:6f:d3:14:82:26:41:88:c9:
                          -               6f:b5:be:ca:dc:21:df:83:0e:56:6a:05:a7:2e:5f:
                          -               0b:6f:e7:1c:bc:a6:59:97:ef
                          -           Exponent: 65537 (0x10001)
                          -   X509v3 extensions:
                          -       X509v3 Basic Constraints:
                          -Certificate:
                          -Data:
                          -   Version: 3 (0x2)
                          -   Serial Number: 1 (0x1)
                          -   Signature Algorithm: md5WithRSAEncryption
                          -   Issuer: C=SG, O=DemoCA, CN=DemoCA Certificate Master/Email=certmaster@democa.dom
                          -   Validity
                          -       Not Before: Mar 31 02:57:30 2001 GMT
                          -       Not After : Mar 31 02:57:30 2002 GMT
                          -   Subject: C=SG, O=M2Crypto, CN=localhost/Email=admin@server.example.dom
                          -   Subject Public Key Info:
                          -       Public Key Algorithm: rsaEncryption
                          -       RSA Public Key: (1024 bit)
                          -           Modulus (1024 bit):
                          -               00:af:59:d8:63:54:2b:96:5d:6b:b8:1f:c5:aa:50:
                          -               91:ae:be:67:be:ea:5d:20:df:b7:c0:5e:ea:f7:5e:
                          -               6d:bc:44:28:73:be:1b:9e:ee:9b:f0:86:db:19:13:
                          -               21:cd:dc:e6:bd:0e:12:cc:57:d5:10:0b:8c:32:e4:
                          -               c7:7b:26:cf:ab:9b:61:ed:80:eb:4c:d8:b3:28:ac:
                          -               4e:06:7a:84:d8:a6:2e:5f:d5:f6:d8:0d:4a:87:8f:
                          -               6c:a0:92:45:83:a9:0f:6f:d3:14:82:26:41:88:c9:
                          -               6f:b5:be:ca:dc:21:df:83:0e:56:6a:05:a7:2e:5f:
                          -               0b:6f:e7:1c:bc:a6:59:97:ef
                          -           Exponent: 65537 (0x10001)
                          -   X509v3 extensions:
                          -       X509v3 Basic Constraints:
                          -           CA:FALSE
                          -       Netscape Comment:
                          -           OpenSSL Generated Certificate
                          -       X509v3 Subject Key Identifier:
                          -           B3:D6:89:88:2F:B1:15:40:EC:0A:C0:30:35:3A:B7:DA:72:73:1B:4D
                          -       X509v3 Authority Key Identifier:
                          -           keyid:F9:6A:A6:34:97:6B:BC:BB:5A:17:0D:19:FC:62:21:0B:00:B5:0E:29
                          -           DirName:/C=SG/O=DemoCA/CN=DemoCA Certificate Master/Email=certmaster@democa.dom
                          -           serial:00
                          +Certificate:
                          +Data:
                          +   Version: 3 (0x2)
                          +   Serial Number: 1 (0x1)
                          +   Signature Algorithm: md5WithRSAEncryption
                          +   Issuer: C=SG, O=DemoCA, CN=DemoCA Certificate Master/Email=certmaster@democa.dom
                          +   Validity
                          +       Not Before: Mar 31 02:57:30 2001 GMT
                          +       Not After : Mar 31 02:57:30 2002 GMT
                          +   Subject: C=SG, O=M2Crypto, CN=localhost/Email=admin@server.example.dom
                          +   Subject Public Key Info:
                          +       Public Key Algorithm: rsaEncryption
                          +       RSA Public Key: (1024 bit)
                          +           Modulus (1024 bit):
                          +               00:af:59:d8:63:54:2b:96:5d:6b:b8:1f:c5:aa:50:
                          +               91:ae:be:67:be:ea:5d:20:df:b7:c0:5e:ea:f7:5e:
                          +               6d:bc:44:28:73:be:1b:9e:ee:9b:f0:86:db:19:13:
                          +               21:cd:dc:e6:bd:0e:12:cc:57:d5:10:0b:8c:32:e4:
                          +               c7:7b:26:cf:ab:9b:61:ed:80:eb:4c:d8:b3:28:ac:
                          +               4e:06:7a:84:d8:a6:2e:5f:d5:f6:d8:0d:4a:87:8f:
                          +               6c:a0:92:45:83:a9:0f:6f:d3:14:82:26:41:88:c9:
                          +               6f:b5:be:ca:dc:21:df:83:0e:56:6a:05:a7:2e:5f:
                          +               0b:6f:e7:1c:bc:a6:59:97:ef
                          +           Exponent: 65537 (0x10001)
                          +   X509v3 extensions:
                          +       X509v3 Basic Constraints:
                          +Certificate:
                          +Data:
                          +   Version: 3 (0x2)
                          +   Serial Number: 1 (0x1)
                          +   Signature Algorithm: md5WithRSAEncryption
                          +   Issuer: C=SG, O=DemoCA, CN=DemoCA Certificate Master/Email=certmaster@democa.dom
                          +   Validity
                          +       Not Before: Mar 31 02:57:30 2001 GMT
                          +       Not After : Mar 31 02:57:30 2002 GMT
                          +   Subject: C=SG, O=M2Crypto, CN=localhost/Email=admin@server.example.dom
                          +   Subject Public Key Info:
                          +       Public Key Algorithm: rsaEncryption
                          +       RSA Public Key: (1024 bit)
                          +           Modulus (1024 bit):
                          +               00:af:59:d8:63:54:2b:96:5d:6b:b8:1f:c5:aa:50:
                          +               91:ae:be:67:be:ea:5d:20:df:b7:c0:5e:ea:f7:5e:
                          +               6d:bc:44:28:73:be:1b:9e:ee:9b:f0:86:db:19:13:
                          +               21:cd:dc:e6:bd:0e:12:cc:57:d5:10:0b:8c:32:e4:
                          +               c7:7b:26:cf:ab:9b:61:ed:80:eb:4c:d8:b3:28:ac:
                          +               4e:06:7a:84:d8:a6:2e:5f:d5:f6:d8:0d:4a:87:8f:
                          +               6c:a0:92:45:83:a9:0f:6f:d3:14:82:26:41:88:c9:
                          +               6f:b5:be:ca:dc:21:df:83:0e:56:6a:05:a7:2e:5f:
                          +               0b:6f:e7:1c:bc:a6:59:97:ef
                          +           Exponent: 65537 (0x10001)
                          +   X509v3 extensions:
                          +       X509v3 Basic Constraints:
                          +           CA:FALSE
                          +       Netscape Comment:
                          +           OpenSSL Generated Certificate
                          +       X509v3 Subject Key Identifier:
                          +           B3:D6:89:88:2F:B1:15:40:EC:0A:C0:30:35:3A:B7:DA:72:73:1B:4D
                          +       X509v3 Authority Key Identifier:
                          +           keyid:F9:6A:A6:34:97:6B:BC:BB:5A:17:0D:19:FC:62:21:0B:00:B5:0E:29
                          +           DirName:/C=SG/O=DemoCA/CN=DemoCA Certificate Master/Email=certmaster@democa.dom
                          +           serial:00
                           
                          -Signature Algorithm: md5WithRSAEncryption
                          +Signature Algorithm: md5WithRSAEncryption +
                          1. In certain situations, e.g., where your certificate and private key are to be used in an unattended SSL server, you may wish to not encrypt the private key, i.e., leave the key in the clear. This -decision should be governed by your site’s security policy and threat +decision should be governed by your site’s security policy and threat model, of course:

                            -
                            openssl rsa < newkey.pem > newkey2.pem
                            +
                            openssl rsa < newkey.pem > newkey2.pem
                             
                            -read RSA key
                            -Enter PEM pass phrase:<secret passphrase here>
                            -writing RSA key
                            +read RSA key +Enter PEM pass phrase:<secret passphrase here> +writing RSA key +
                            -

                            newkey2.pem looks like this:

                            -
                            cat newkey2.pem
                            +

                            newkey2.pem looks like this:

                            +
                            cat newkey2.pem
                             
                            ------BEGIN RSA PRIVATE KEY-----
                            -MIICXgIBAAKBgQCvWdhjVCuWXWu4H8WqUJGuvme+6l0g37fAXur3Xm28RChzvhue
                            -7pvwhtsZEyHN3Oa9DhLMV9UQC4wy5Md7Js+rm2HtgOtM2LMorE4GeoTYpi5f1fbY
                            -DUqHj2ygkkWDqQ9v0xSCJkGIyW+1vsrcId+DDlZqBacuXwtv5xy8plmX7wIDAQAB
                            -AoGAbAkU8w3W1Qu15Hle1bJSL7GMReoreqeblOBmMAZz4by0l6sXZXJpjWXo86f/
                            -+dASMYTMPC4ZTYtv06N07AFbjL+kDfqDMTfzQkYMHp1LAq1Ihbq1rHWSBH5n3ekq
                            -KiY8JKpv8DR5Po1iKaXJFuDByGDENJwYbSRSpSK3P+vkWWECQQDkEUE/ZPqqqZkQ
                            -2iWRPAsCbEID8SAraQl3DdCLYs/GgARfmmj4yUHEwkys9Jo1H8k4BdxugmaUwNi5
                            -YQ/CVzrXAkEAxNO80ArbGxPUmr11GHG/bGBYj1DUBkHZSc7dgxZdtUCLGNxQnNsg
                            -Iwq3n6j1sUzS3UW6abQ8bivYNOUcMKJAqQJBANQxFaLU4b/NQaODQ3aoBZpAfP9L
                            -5eFdvbet+7zjt2r5CpikgkwOfAmDuXEltx/8LevY0CllW+nErx9zJgVrwUsCQQCu
                            -76H5JiznPBDSF2FjgHWqVVdgyW4owY3mU739LHvNBLicN/RN9VPy0Suy8/CqzKT9
                            -lWPBXzf2k3FuUdNkRlFBAkEAmpXoybuiFR2S5Bma/ax96lVs0/VihhfC1zZP/X/F
                            -Br77+h9dIul+2DnyOl50zu0Sdzst1/7ay4JSDHyiBCMGSQ==
                            ------END RSA PRIVATE KEY-----
                            +-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQCvWdhjVCuWXWu4H8WqUJGuvme+6l0g37fAXur3Xm28RChzvhue +7pvwhtsZEyHN3Oa9DhLMV9UQC4wy5Md7Js+rm2HtgOtM2LMorE4GeoTYpi5f1fbY +DUqHj2ygkkWDqQ9v0xSCJkGIyW+1vsrcId+DDlZqBacuXwtv5xy8plmX7wIDAQAB +AoGAbAkU8w3W1Qu15Hle1bJSL7GMReoreqeblOBmMAZz4by0l6sXZXJpjWXo86f/ ++dASMYTMPC4ZTYtv06N07AFbjL+kDfqDMTfzQkYMHp1LAq1Ihbq1rHWSBH5n3ekq +KiY8JKpv8DR5Po1iKaXJFuDByGDENJwYbSRSpSK3P+vkWWECQQDkEUE/ZPqqqZkQ +2iWRPAsCbEID8SAraQl3DdCLYs/GgARfmmj4yUHEwkys9Jo1H8k4BdxugmaUwNi5 +YQ/CVzrXAkEAxNO80ArbGxPUmr11GHG/bGBYj1DUBkHZSc7dgxZdtUCLGNxQnNsg +Iwq3n6j1sUzS3UW6abQ8bivYNOUcMKJAqQJBANQxFaLU4b/NQaODQ3aoBZpAfP9L +5eFdvbet+7zjt2r5CpikgkwOfAmDuXEltx/8LevY0CllW+nErx9zJgVrwUsCQQCu +76H5JiznPBDSF2FjgHWqVVdgyW4owY3mU739LHvNBLicN/RN9VPy0Suy8/CqzKT9 +lWPBXzf2k3FuUdNkRlFBAkEAmpXoybuiFR2S5Bma/ax96lVs0/VihhfC1zZP/X/F +Br77+h9dIul+2DnyOl50zu0Sdzst1/7ay4JSDHyiBCMGSQ== +-----END RSA PRIVATE KEY----- +
                          -

                          That’s it! The certificate, newcert.pem, and the private key - -newkey.pem (encrypted) or newkey2.pem (unencrypted) - are now +

                          That’s it! The certificate, newcert.pem, and the private key - +newkey.pem (encrypted) or newkey2.pem (unencrypted) - are now ready to be used. You may wish to rename the files to more intuitive names.

                          -

                          You should also keep the CA’s certificate demo/cacert.pem handy +

                          You should also keep the CA’s certificate demo/cacert.pem handy for use when developing and deploying SSL or S/MIME applications.

                          Conclusion

                          -

                          We’ve walked through the basic steps in the creation of a CA and +

                          We’ve walked through the basic steps in the creation of a CA and certificates using the tools that come with OpenSSL. We did not cover more advanced topics such as constraining a certificate to be SSL-only or S/MIME-only.

                          @@ -415,7 +417,7 @@ developing SSL and S/MIME applications in
                          -
                          + - + + + + \ No newline at end of file diff --git a/doc/html/howto.smime.html b/doc/html/howto.smime.html index d1ae312..75a4ecf 100644 --- a/doc/html/howto.smime.html +++ b/doc/html/howto.smime.html @@ -1,50 +1,42 @@ - - - - HOWTO: Programming S/MIME in Python with M2Crypto — M2Crypto documentation - - + HOWTO: Programming S/MIME in Python with M2Crypto — M2Crypto documentation + - - + + + + + + + + - +
                          -
                          +

                          HOWTO: Programming S/MIME in Python with M2Crypto

                          @@ -86,7 +78,7 @@ said public key.

                          To create an S/MIME-encrypted message, you need an X.509 certificate for each recipient.

                          To create an S/MIME-signed and -encrypted message, first create a -signed message, then encrypt the signed message with the recipients’ +signed message, then encrypt the signed message with the recipients’ certificates.

                          You may generate key pairs and obtain certificates by using a commercial certification authority service.

                          @@ -97,122 +89,127 @@ this approach is cheap and effective.

                          certificates. This assumes you have OpenSSL installed properly on your system.

                          First, we generate an X.509 certificate to be used for signing:

                          -
                          openssl req -newkey rsa:1024 -nodes -x509 -days 365 -out signer.pem
                          -
                          -Using configuration from /usr/local/pkg/openssl/openssl.cnf
                          -Generating a 1024 bit RSA private key
                          -..++++++
                          -....................++++++
                          -writing new private key to 'privkey.pem'
                          ------
                          -You are about to be asked to enter information that will be incorporated
                          -into your certificate request.
                          -What you are about to enter is what is called a Distinguished Name or a DN.
                          -There are quite a few fields but you can leave some blank
                          -For some fields there will be a default value,
                          -If you enter '.', the field will be left blank.
                          ------
                          -Country Name (2 letter code) [AU]:SG
                          -State or Province Name (full name) [Some-State]:.
                          -Locality Name (eg, city) []:.
                          -Organization Name (eg, company) [Internet Widgits Pty Ltd]:M2Crypto
                          -Organizational Unit Name (eg, section) []:.
                          -Common Name (eg, YOUR name) []:S/MIME Sender
                          -Email Address []:sender@example.dom
                          +
                          openssl req -newkey rsa:1024 -nodes -x509 -days 365 -out signer.pem
                          +
                          +Using configuration from /usr/local/pkg/openssl/openssl.cnf
                          +Generating a 1024 bit RSA private key
                          +..++++++
                          +....................++++++
                          +writing new private key to 'privkey.pem'
                          +-----
                          +You are about to be asked to enter information that will be incorporated
                          +into your certificate request.
                          +What you are about to enter is what is called a Distinguished Name or a DN.
                          +There are quite a few fields but you can leave some blank
                          +For some fields there will be a default value,
                          +If you enter '.', the field will be left blank.
                          +-----
                          +Country Name (2 letter code) [AU]:SG
                          +State or Province Name (full name) [Some-State]:.
                          +Locality Name (eg, city) []:.
                          +Organization Name (eg, company) [Internet Widgits Pty Ltd]:M2Crypto
                          +Organizational Unit Name (eg, section) []:.
                          +Common Name (eg, YOUR name) []:S/MIME Sender
                          +Email Address []:sender@example.dom
                          +

                          This generates a 1024-bit RSA key pair, unencrypted, into -privkey.pem; it also generates a self-signed X.509 certificate for -the public key into signer.pem. The certificate is valid for 365 +privkey.pem; it also generates a self-signed X.509 certificate for +the public key into signer.pem. The certificate is valid for 365 days, i.e., a year.

                          -

                          Let’s rename privkey.pem so that we know it is a companion of -signer.pem‘s:

                          -
                          mv privkey.pem signer_key.pem
                          -
                          -

                          To verify the content of signer.pem, execute the following:

                          -
                          openssl x509 -noout -text -in signer.pem
                          -
                          -Certificate:
                          -    Data:
                          -        Version: 3 (0x2)
                          -        Serial Number: 0 (0x0)
                          -        Signature Algorithm: md5WithRSAEncryption
                          -        Issuer: C=SG, O=M2Crypto, CN=S/MIME Sender/Email=sender@example.dom
                          -        Validity
                          -            Not Before: Mar 24 12:56:16 2001 GMT
                          -            Not After : Mar 24 12:56:16 2002 GMT
                          -        Subject: C=SG, O=M2Crypto, CN=S/MIME Sender/Email=sender@example.dom
                          -        Subject Public Key Info:
                          -            Public Key Algorithm: rsaEncryption
                          -            RSA Public Key: (1024 bit)
                          -                Modulus (1024 bit):
                          -                    00:a9:d6:e2:b5:11:3b:ae:3c:e2:17:31:70:e1:6e:
                          -                    01:f4:19:6d:bd:2a:42:36:2b:37:34:e2:83:1d:0d:
                          -                    11:2e:b4:99:44:db:10:67:be:97:5f:5b:1a:26:33:
                          -                    46:23:2f:95:04:7a:35:da:9d:f9:26:88:39:9e:17:
                          -                    cd:3e:eb:a8:19:8d:a8:2a:f1:43:da:55:a9:2e:2c:
                          -                    65:ed:04:71:42:ce:73:53:b8:ea:7e:c7:f0:23:c6:
                          -                    63:c5:5e:68:96:64:a7:b4:2a:94:26:76:eb:79:ea:
                          -                    e3:4e:aa:82:09:4f:44:87:4a:12:62:b5:d7:1f:ca:
                          -                    f2:ce:d5:ba:7e:1f:48:fd:b9
                          -                Exponent: 65537 (0x10001)
                          -        X509v3 extensions:
                          -            X509v3 Subject Key Identifier:
                          -                29:FB:38:B6:BF:E2:40:BB:FF:D5:71:D7:D5:C4:F0:83:1A:2B:C7:99
                          -            X509v3 Authority Key Identifier:
                          -                keyid:29:FB:38:B6:BF:E2:40:BB:FF:D5:71:D7:D5:C4:F0:83:1A:2B:C7:99
                          -                DirName:/C=SG/O=M2Crypto/CN=S/MIME Sender/Email=sender@example.dom
                          -                serial:00
                          -
                          -            X509v3 Basic Constraints:
                          -                CA:TRUE
                          -    Signature Algorithm: md5WithRSAEncryption
                          -        68:c8:6b:1b:fa:7c:9a:39:35:76:18:15:c9:fd:89:97:62:db:
                          -        7a:b0:2d:13:dd:97:e8:1b:7a:9f:22:27:83:24:9d:2e:56:ec:
                          -        97:89:3c:ef:16:55:80:5a:18:7c:22:d0:f6:bb:e3:a4:e8:59:
                          -        30:ff:99:5a:93:3e:ea:bc:ee:7f:8d:d6:7d:37:8c:ac:3d:74:
                          -        80:ce:7a:99:ba:27:b9:2a:a3:71:fa:a5:25:ba:47:17:df:07:
                          -        56:96:36:fd:60:b9:6c:96:06:e8:e3:7b:9f:4b:6a:95:71:a8:
                          -        34:fc:fc:b5:88:8b:c4:3f:1e:24:f6:52:47:b2:7d:44:67:d9:
                          -        83:e8
                          +

                          Let’s rename privkey.pem so that we know it is a companion of +signer.pem’s:

                          +
                          mv privkey.pem signer_key.pem
                          +
                          +
                          +

                          To verify the content of signer.pem, execute the following:

                          +
                          openssl x509 -noout -text -in signer.pem
                          +
                          +Certificate:
                          +    Data:
                          +        Version: 3 (0x2)
                          +        Serial Number: 0 (0x0)
                          +        Signature Algorithm: md5WithRSAEncryption
                          +        Issuer: C=SG, O=M2Crypto, CN=S/MIME Sender/Email=sender@example.dom
                          +        Validity
                          +            Not Before: Mar 24 12:56:16 2001 GMT
                          +            Not After : Mar 24 12:56:16 2002 GMT
                          +        Subject: C=SG, O=M2Crypto, CN=S/MIME Sender/Email=sender@example.dom
                          +        Subject Public Key Info:
                          +            Public Key Algorithm: rsaEncryption
                          +            RSA Public Key: (1024 bit)
                          +                Modulus (1024 bit):
                          +                    00:a9:d6:e2:b5:11:3b:ae:3c:e2:17:31:70:e1:6e:
                          +                    01:f4:19:6d:bd:2a:42:36:2b:37:34:e2:83:1d:0d:
                          +                    11:2e:b4:99:44:db:10:67:be:97:5f:5b:1a:26:33:
                          +                    46:23:2f:95:04:7a:35:da:9d:f9:26:88:39:9e:17:
                          +                    cd:3e:eb:a8:19:8d:a8:2a:f1:43:da:55:a9:2e:2c:
                          +                    65:ed:04:71:42:ce:73:53:b8:ea:7e:c7:f0:23:c6:
                          +                    63:c5:5e:68:96:64:a7:b4:2a:94:26:76:eb:79:ea:
                          +                    e3:4e:aa:82:09:4f:44:87:4a:12:62:b5:d7:1f:ca:
                          +                    f2:ce:d5:ba:7e:1f:48:fd:b9
                          +                Exponent: 65537 (0x10001)
                          +        X509v3 extensions:
                          +            X509v3 Subject Key Identifier:
                          +                29:FB:38:B6:BF:E2:40:BB:FF:D5:71:D7:D5:C4:F0:83:1A:2B:C7:99
                          +            X509v3 Authority Key Identifier:
                          +                keyid:29:FB:38:B6:BF:E2:40:BB:FF:D5:71:D7:D5:C4:F0:83:1A:2B:C7:99
                          +                DirName:/C=SG/O=M2Crypto/CN=S/MIME Sender/Email=sender@example.dom
                          +                serial:00
                          +
                          +            X509v3 Basic Constraints:
                          +                CA:TRUE
                          +    Signature Algorithm: md5WithRSAEncryption
                          +        68:c8:6b:1b:fa:7c:9a:39:35:76:18:15:c9:fd:89:97:62:db:
                          +        7a:b0:2d:13:dd:97:e8:1b:7a:9f:22:27:83:24:9d:2e:56:ec:
                          +        97:89:3c:ef:16:55:80:5a:18:7c:22:d0:f6:bb:e3:a4:e8:59:
                          +        30:ff:99:5a:93:3e:ea:bc:ee:7f:8d:d6:7d:37:8c:ac:3d:74:
                          +        80:ce:7a:99:ba:27:b9:2a:a3:71:fa:a5:25:ba:47:17:df:07:
                          +        56:96:36:fd:60:b9:6c:96:06:e8:e3:7b:9f:4b:6a:95:71:a8:
                          +        34:fc:fc:b5:88:8b:c4:3f:1e:24:f6:52:47:b2:7d:44:67:d9:
                          +        83:e8
                          +

                          Next, we generate a self-signed X.509 certificate for the recipient. -Note that privkey.pem will be recreated:

                          -
                          openssl req -newkey rsa:1024 -nodes -x509 -days 365 -out recipient.pem
                          -
                          -Using configuration from /usr/local/pkg/openssl/openssl.cnf
                          -Generating a 1024 bit RSA private key
                          -.....................................++++++
                          -.................++++++
                          -writing new private key to 'privkey.pem'
                          ------
                          -You are about to be asked to enter information that will be incorporated
                          -into your certificate request.
                          -What you are about to enter is what is called a Distinguished Name or a DN.
                          -There are quite a few fields but you can leave some blank
                          -For some fields there will be a default value,
                          -If you enter '.', the field will be left blank.
                          ------
                          -Country Name (2 letter code) [AU]:SG
                          -State or Province Name (full name) [Some-State]:.
                          -Locality Name (eg, city) []:.
                          -Organization Name (eg, company) [Internet Widgits Pty Ltd]:M2Crypto
                          -Organizational Unit Name (eg, section) []:.
                          -Common Name (eg, YOUR name) []:S/MIME Recipient
                          -Email Address []:recipient@example.dom
                          -
                          -

                          Again, rename privkey.pem:

                          -
                          mv privkey.pem recipient_key.pem
                          -
                          -

                          In the examples to follow, S/MIME Sender, <sender@example.dom>, +Note that privkey.pem will be recreated:

                          +
                          openssl req -newkey rsa:1024 -nodes -x509 -days 365 -out recipient.pem
                          +
                          +Using configuration from /usr/local/pkg/openssl/openssl.cnf
                          +Generating a 1024 bit RSA private key
                          +.....................................++++++
                          +.................++++++
                          +writing new private key to 'privkey.pem'
                          +-----
                          +You are about to be asked to enter information that will be incorporated
                          +into your certificate request.
                          +What you are about to enter is what is called a Distinguished Name or a DN.
                          +There are quite a few fields but you can leave some blank
                          +For some fields there will be a default value,
                          +If you enter '.', the field will be left blank.
                          +-----
                          +Country Name (2 letter code) [AU]:SG
                          +State or Province Name (full name) [Some-State]:.
                          +Locality Name (eg, city) []:.
                          +Organization Name (eg, company) [Internet Widgits Pty Ltd]:M2Crypto
                          +Organizational Unit Name (eg, section) []:.
                          +Common Name (eg, YOUR name) []:S/MIME Recipient
                          +Email Address []:recipient@example.dom
                          +
                          +
                          +

                          Again, rename privkey.pem:

                          +
                          mv privkey.pem recipient_key.pem
                          +
                          +
                          +

                          In the examples to follow, S/MIME Sender, <sender@example.dom>, shall be the sender of S/MIME messages, while S/MIME Recipient, -<recipient@example.dom>, shall be the recipient of S/MIME messages.

                          +<recipient@example.dom>, shall be the recipient of S/MIME messages.

                          Armed with the key pairs and certificates, we are now ready to begin programming S/MIME in Python.

                          Note: The private keys generated above are not passphrase-protected, i.e., they are in the clear. Anyone who has access to such a key can generate S/MIME-signed messages with it, -and decrypt S/MIME messages encrypted to it’s corresponding public +and decrypt S/MIME messages encrypted to it’s corresponding public key.

                          We may passphrase-protect the keys, if we so choose. M2Crypto will prompt the user for the passphrase when such a key is being loaded.

                          @@ -220,23 +217,23 @@ prompt the user for the passphrase when such a key is being loaded.

                          M2Crypto.SMIME

                          -

                          The Python programmer accesses M2Crypto’s S/MIME functionality through -class SMIME in the module M2Crypto.SMIME. Typically, an -SMIME object is instantiated; the object is then set up for the +

                          The Python programmer accesses M2Crypto’s S/MIME functionality through +class SMIME in the module M2Crypto.SMIME. Typically, an +SMIME object is instantiated; the object is then set up for the intended operation: sign, encrypt, decrypt or verify; finally, the operation is invoked on the object.

                          -

                          M2Crypto.SMIME makes extensive use of M2Crypto.BIO: -M2Crypto.BIO is a Python abstraction of the BIO abstraction in -OpenSSL. A commonly used BIO abstraction in M2Crypto is -M2Crypto.BIO.MemoryBuffer, which implements a memory-based file-like -object, similar to Python’s own StringIO.

                          +

                          M2Crypto.SMIME makes extensive use of M2Crypto.BIO: +M2Crypto.BIO is a Python abstraction of the BIO abstraction in +OpenSSL. A commonly used BIO abstraction in M2Crypto is +M2Crypto.BIO.MemoryBuffer, which implements a memory-based file-like +object, similar to Python’s own StringIO.

                          Sign

                          The following code demonstrates how to generate an S/MIME-signed -message. randpool.dat contains random data which is used to seed -OpenSSL’s pseudo-random number generator via M2Crypto:

                          -
                          from M2Crypto import BIO, Rand, SMIME
                          +message. randpool.dat contains random data which is used to seed
                          +OpenSSL’s pseudo-random number generator via M2Crypto:

                          +
                          from M2Crypto import BIO, Rand, SMIME
                           
                           def makebuf(text):
                               return BIO.MemoryBuffer(text)
                          @@ -253,14 +250,14 @@ OpenSSL’s pseudo-random number generator via M2Crypto:

                          p7 = s.sign(buf, SMIME.PKCS7_DETACHED)
                          -

                          p7 now contains a PKCS #7 signature blob wrapped in an -M2Crypto.SMIME.PKCS7 object. Note that buf has been consumed by -sign() and has to be recreated if it is to be used again.

                          +

                          p7 now contains a PKCS #7 signature blob wrapped in an +M2Crypto.SMIME.PKCS7 object. Note that buf has been consumed by +sign() and has to be recreated if it is to be used again.

                          We may now send the signed message via SMTP. In these examples, we shall -not do so; instead, we’ll render the S/MIME output in mail-friendly +not do so; instead, we’ll render the S/MIME output in mail-friendly format, and pretend that our messages are sent and received correctly:

                          -
                          # Recreate buf.
                          +
                          # Recreate buf.
                           buf = makebuf('a sign of our times')
                           
                           # Output p7 in mail-friendly format.
                          @@ -270,64 +267,65 @@ correctly:

                          out.write('Subject: M2Crypto S/MIME testing\n') s.write(out, p7, buf) -print(out.read()) +print(out.read()) # Save the PRNG's state. Rand.save_file('randpool.dat')
                          -

                          Here’s the output:

                          -
                          From: sender@example.dom
                          -To: recipient@example.dom
                          -Subject: M2Crypto S/MIME testing
                          -MIME-Version: 1.0
                          -Content-Type: multipart/signed ; protocol="application/x-pkcs7-signature" ; micalg=sha1 ; boundary="----3C93156FC7B4EBF49FE9C7DB7F503087"
                          -
                          -This is an S/MIME signed message
                          -
                          -------3C93156FC7B4EBF49FE9C7DB7F503087
                          -a sign of our times
                          -------3C93156FC7B4EBF49FE9C7DB7F503087
                          -Content-Type: application/x-pkcs7-signature; name="smime.p7s"
                          -Content-Transfer-Encoding: base64
                          -Content-Disposition: attachment; filename="smime.p7s"
                          -
                          -MIIE8AYJKoZIhvcNAQcCoIIE4TCCBN0CAQExCzAJBgUrDgMCGgUAMCIGCSqGSIb3
                          -DQEHAaAVBBNhIHNpZ24gb2Ygb3VyIHRpbWVzoIIC5zCCAuMwggJMoAMCAQICAQAw
                          -DQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRv
                          -MRYwFAYDVQQDEw1TL01JTUUgU2VuZGVyMSEwHwYJKoZIhvcNAQkBFhJzZW5kZXJA
                          -ZXhhbXBsZS5kb20wHhcNMDEwMzMxMTE0MDMzWhcNMDIwMzMxMTE0MDMzWjBbMQsw
                          -CQYDVQQGEwJTRzERMA8GA1UEChMITTJDcnlwdG8xFjAUBgNVBAMTDVMvTUlNRSBT
                          -ZW5kZXIxITAfBgkqhkiG9w0BCQEWEnNlbmRlckBleGFtcGxlLmRvbTCBnzANBgkq
                          -hkiG9w0BAQEFAAOBjQAwgYkCgYEA5c5Tj1CHTSOxa1q2q0FYiwMWYHptJpJcvtZm
                          -UwrgU5sHrA8OnCM0cDXEj0KPf3cfNjHffB8HWMzI4UEgNmFXQNsxoGZ+iqwxLlNj
                          -y9Mh7eFW/Bjq5hNXbouSlQ0rWBRkoxV64y+t6lQehb32WfYXQbKFxFJSXzSxOx3R
                          -8YhSPd0CAwEAAaOBtjCBszAdBgNVHQ4EFgQUXOyolL1t4jaBwZFRM7MS8nBLzUow
                          -gYMGA1UdIwR8MHqAFFzsqJS9beI2gcGRUTOzEvJwS81KoV+kXTBbMQswCQYDVQQG
                          -EwJTRzERMA8GA1UEChMITTJDcnlwdG8xFjAUBgNVBAMTDVMvTUlNRSBTZW5kZXIx
                          -ITAfBgkqhkiG9w0BCQEWEnNlbmRlckBleGFtcGxlLmRvbYIBADAMBgNVHRMEBTAD
                          -AQH/MA0GCSqGSIb3DQEBBAUAA4GBAHo3DrCHR86fSTVAvfiXdSswWqKtCEhUHRdC
                          -TLFGl4hDk2GyZxaFuqZwiURz/H7nMicymI2wkz8H/wyHFg8G3BIehURpj2v/ZWXY
                          -eovbgS7EZALVVkDj4hNl/IIHWd6Gtv1UODf7URbxtl3hQ9/eTWITrefT1heuPnar
                          -8czydsOLMYIBujCCAbYCAQEwYDBbMQswCQYDVQQGEwJTRzERMA8GA1UEChMITTJD
                          -cnlwdG8xFjAUBgNVBAMTDVMvTUlNRSBTZW5kZXIxITAfBgkqhkiG9w0BCQEWEnNl
                          -bmRlckBleGFtcGxlLmRvbQIBADAJBgUrDgMCGgUAoIGxMBgGCSqGSIb3DQEJAzEL
                          -BgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTAxMDMzMTExNDUwMlowIwYJKoZI
                          -hvcNAQkEMRYEFOoeRUd8ExIYXfQq8BTFuKWrSP3iMFIGCSqGSIb3DQEJDzFFMEMw
                          -CgYIKoZIhvcNAwcwDgYIKoZIhvcNAwICAgCAMA0GCCqGSIb3DQMCAgFAMAcGBSsO
                          -AwIHMA0GCCqGSIb3DQMCAgEoMA0GCSqGSIb3DQEBAQUABIGAQpU8hFUtLCF6hO2t
                          -ec9EYJ/Imqqiiw+BxWxkUUVT81Vbjwdn9JST6+sztM5JRP2ZW+b4txEjZriYC8f3
                          -kv95YMTGbIsuWkJ93GrbvqoJ/CxO23r9WWRnZEm/1EZN9ZmlrYqzBTxnNRmP3Dhj
                          -cW8kzZwH+2/2zz2G7x1HxRWH95A=
                          -
                          -------3C93156FC7B4EBF49FE9C7DB7F503087--
                          +

                          Here’s the output:

                          +
                          From: sender@example.dom
                          +To: recipient@example.dom
                          +Subject: M2Crypto S/MIME testing
                          +MIME-Version: 1.0
                          +Content-Type: multipart/signed ; protocol="application/x-pkcs7-signature" ; micalg=sha1 ; boundary="----3C93156FC7B4EBF49FE9C7DB7F503087"
                          +
                          +This is an S/MIME signed message
                          +
                          +------3C93156FC7B4EBF49FE9C7DB7F503087
                          +a sign of our times
                          +------3C93156FC7B4EBF49FE9C7DB7F503087
                          +Content-Type: application/x-pkcs7-signature; name="smime.p7s"
                          +Content-Transfer-Encoding: base64
                          +Content-Disposition: attachment; filename="smime.p7s"
                          +
                          +MIIE8AYJKoZIhvcNAQcCoIIE4TCCBN0CAQExCzAJBgUrDgMCGgUAMCIGCSqGSIb3
                          +DQEHAaAVBBNhIHNpZ24gb2Ygb3VyIHRpbWVzoIIC5zCCAuMwggJMoAMCAQICAQAw
                          +DQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRv
                          +MRYwFAYDVQQDEw1TL01JTUUgU2VuZGVyMSEwHwYJKoZIhvcNAQkBFhJzZW5kZXJA
                          +ZXhhbXBsZS5kb20wHhcNMDEwMzMxMTE0MDMzWhcNMDIwMzMxMTE0MDMzWjBbMQsw
                          +CQYDVQQGEwJTRzERMA8GA1UEChMITTJDcnlwdG8xFjAUBgNVBAMTDVMvTUlNRSBT
                          +ZW5kZXIxITAfBgkqhkiG9w0BCQEWEnNlbmRlckBleGFtcGxlLmRvbTCBnzANBgkq
                          +hkiG9w0BAQEFAAOBjQAwgYkCgYEA5c5Tj1CHTSOxa1q2q0FYiwMWYHptJpJcvtZm
                          +UwrgU5sHrA8OnCM0cDXEj0KPf3cfNjHffB8HWMzI4UEgNmFXQNsxoGZ+iqwxLlNj
                          +y9Mh7eFW/Bjq5hNXbouSlQ0rWBRkoxV64y+t6lQehb32WfYXQbKFxFJSXzSxOx3R
                          +8YhSPd0CAwEAAaOBtjCBszAdBgNVHQ4EFgQUXOyolL1t4jaBwZFRM7MS8nBLzUow
                          +gYMGA1UdIwR8MHqAFFzsqJS9beI2gcGRUTOzEvJwS81KoV+kXTBbMQswCQYDVQQG
                          +EwJTRzERMA8GA1UEChMITTJDcnlwdG8xFjAUBgNVBAMTDVMvTUlNRSBTZW5kZXIx
                          +ITAfBgkqhkiG9w0BCQEWEnNlbmRlckBleGFtcGxlLmRvbYIBADAMBgNVHRMEBTAD
                          +AQH/MA0GCSqGSIb3DQEBBAUAA4GBAHo3DrCHR86fSTVAvfiXdSswWqKtCEhUHRdC
                          +TLFGl4hDk2GyZxaFuqZwiURz/H7nMicymI2wkz8H/wyHFg8G3BIehURpj2v/ZWXY
                          +eovbgS7EZALVVkDj4hNl/IIHWd6Gtv1UODf7URbxtl3hQ9/eTWITrefT1heuPnar
                          +8czydsOLMYIBujCCAbYCAQEwYDBbMQswCQYDVQQGEwJTRzERMA8GA1UEChMITTJD
                          +cnlwdG8xFjAUBgNVBAMTDVMvTUlNRSBTZW5kZXIxITAfBgkqhkiG9w0BCQEWEnNl
                          +bmRlckBleGFtcGxlLmRvbQIBADAJBgUrDgMCGgUAoIGxMBgGCSqGSIb3DQEJAzEL
                          +BgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTAxMDMzMTExNDUwMlowIwYJKoZI
                          +hvcNAQkEMRYEFOoeRUd8ExIYXfQq8BTFuKWrSP3iMFIGCSqGSIb3DQEJDzFFMEMw
                          +CgYIKoZIhvcNAwcwDgYIKoZIhvcNAwICAgCAMA0GCCqGSIb3DQMCAgFAMAcGBSsO
                          +AwIHMA0GCCqGSIb3DQMCAgEoMA0GCSqGSIb3DQEBAQUABIGAQpU8hFUtLCF6hO2t
                          +ec9EYJ/Imqqiiw+BxWxkUUVT81Vbjwdn9JST6+sztM5JRP2ZW+b4txEjZriYC8f3
                          +kv95YMTGbIsuWkJ93GrbvqoJ/CxO23r9WWRnZEm/1EZN9ZmlrYqzBTxnNRmP3Dhj
                          +cW8kzZwH+2/2zz2G7x1HxRWH95A=
                          +
                          +------3C93156FC7B4EBF49FE9C7DB7F503087--
                          +

                          Verify

                          -

                          Assume the above output has been saved into sign.p7. Let’s now +

                          Assume the above output has been saved into sign.p7. Let’s now verify the signature:

                          -
                          from M2Crypto import SMIME, X509
                          +
                          from M2Crypto import SMIME, X509
                           
                           # Instantiate an SMIME object.
                           s = SMIME.SMIME()
                          @@ -347,36 +345,38 @@ verify the signature:

                          # Load the data, verify it. p7, data = SMIME.smime_load_pkcs7('sign.p7') v = s.verify(p7, data) -print(v) -print(data) -print(data.read()) +print(v) +print(data) +print(data.read())
                          -

                          Here’s the output of the above program:

                          -
                          a sign of our times
                          -<M2Crypto.BIO.BIO instance at 0x822012c>
                          -a sign of our times
                          +

                          Here’s the output of the above program:

                          +
                          a sign of our times
                          +<M2Crypto.BIO.BIO instance at 0x822012c>
                          +a sign of our times
                          +
                          -

                          Suppose, instead of loading signer.pem above, we load -recipient.pem. That is, we do a global substitution of -recipient.pem for signer.pem in the above program. Here’s the -modified program’s output:

                          -
                          Traceback (most recent call last):
                          +

                          Suppose, instead of loading signer.pem above, we load +recipient.pem. That is, we do a global substitution of +recipient.pem for signer.pem in the above program. Here’s the +modified program’s output:

                          +
                          Traceback (most recent call last):
                             File "./verify.py", line 22, in ?
                               v = s.verify(p7)
                             File "/usr/local/home/ngps/prog/m2/M2Crypto/SMIME.py", line 205, in verify
                               raise SMIME_Error, Err.get_error()
                          -M2Crypto.SMIME.SMIME_Error: 312:error:21075075:PKCS7 routines:PKCS7_verify:certificate verify error:pk7_smime.c:213:Verify error:self signed certificate
                          +M2Crypto.SMIME.SMIME_Error: 312:error:21075075:PKCS7 routines:PKCS7_verify:certificate verify error:pk7_smime.c:213:Verify error:self signed certificate +
                          -

                          As displayed, the error is generated by line 213 of OpenSSL’s -pk7_smime.c (as of OpenSSL 0.9.6); if you are a C programmer, you -may wish to look up the C source to explore OpenSSL’s S/MIME +

                          As displayed, the error is generated by line 213 of OpenSSL’s +pk7_smime.c (as of OpenSSL 0.9.6); if you are a C programmer, you +may wish to look up the C source to explore OpenSSL’s S/MIME implementation and understand why the error message is worded thus.

                          Encrypt

                          We now demonstrate how to generate an S/MIME-encrypted message:

                          -
                          from M2Crypto import BIO, Rand, SMIME, X509
                          +
                          from M2Crypto import BIO, Rand, SMIME, X509
                           
                           def makebuf(text):
                               return BIO.MemoryBuffer(text)
                          @@ -409,36 +409,37 @@ implementation and understand why the error message is worded thus.

                          out.write('Subject: M2Crypto S/MIME testing\n') s.write(out, p7) -print(out.read()) +print(out.read()) # Save the PRNG's state. Rand.save_file('randpool.dat')
                          -

                          Here’s the output of the above program:

                          -
                          From: sender@example.dom
                          -To: recipient@example.dom
                          -Subject: M2Crypto S/MIME testing
                          -MIME-Version: 1.0
                          -Content-Disposition: attachment; filename="smime.p7m"
                          -Content-Type: application/x-pkcs7-mime; name="smime.p7m"
                          -Content-Transfer-Encoding: base64
                          -
                          -MIIBVwYJKoZIhvcNAQcDoIIBSDCCAUQCAQAxggEAMIH9AgEAMGYwYTELMAkGA1UE
                          -BhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRvMRkwFwYDVQQDExBTL01JTUUgUmVjaXBp
                          -ZW50MSQwIgYJKoZIhvcNAQkBFhVyZWNpcGllbnRAZXhhbXBsZS5kb20CAQAwDQYJ
                          -KoZIhvcNAQEBBQAEgYCBaXZ+qjpBEZwdP7gjfzfAtQitESyMwo3i+LBOw6sSDir6
                          -FlNDPCnkrTvqDX3Rt6X6vBtTCYOm+qiN7ujPkOU61cN7h8dvHR8YW9+0IPY80/W0
                          -lZ/HihSRgwTNd7LnxUUcPx8YV1id0dlmP0Hz+Lg+mHf6rqaR//JcYhX9vW4XvjA7
                          -BgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECMN+qya6ADywgBgHr9Jkhwn5Gsdu7BwX
                          -nIQfYTYcdL9I5Sk=
                          +

                          Here’s the output of the above program:

                          +
                          From: sender@example.dom
                          +To: recipient@example.dom
                          +Subject: M2Crypto S/MIME testing
                          +MIME-Version: 1.0
                          +Content-Disposition: attachment; filename="smime.p7m"
                          +Content-Type: application/x-pkcs7-mime; name="smime.p7m"
                          +Content-Transfer-Encoding: base64
                          +
                          +MIIBVwYJKoZIhvcNAQcDoIIBSDCCAUQCAQAxggEAMIH9AgEAMGYwYTELMAkGA1UE
                          +BhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRvMRkwFwYDVQQDExBTL01JTUUgUmVjaXBp
                          +ZW50MSQwIgYJKoZIhvcNAQkBFhVyZWNpcGllbnRAZXhhbXBsZS5kb20CAQAwDQYJ
                          +KoZIhvcNAQEBBQAEgYCBaXZ+qjpBEZwdP7gjfzfAtQitESyMwo3i+LBOw6sSDir6
                          +FlNDPCnkrTvqDX3Rt6X6vBtTCYOm+qiN7ujPkOU61cN7h8dvHR8YW9+0IPY80/W0
                          +lZ/HihSRgwTNd7LnxUUcPx8YV1id0dlmP0Hz+Lg+mHf6rqaR//JcYhX9vW4XvjA7
                          +BgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECMN+qya6ADywgBgHr9Jkhwn5Gsdu7BwX
                          +nIQfYTYcdL9I5Sk=
                          +

                          Decrypt

                          -

                          Assume the above output has been saved into encrypt.p7. Decrypt the +

                          Assume the above output has been saved into encrypt.p7. Decrypt the message thusly:

                          -
                          from M2Crypto import BIO, SMIME, X509
                          +
                          from M2Crypto import BIO, SMIME, X509
                           
                           # Instantiate an SMIME object.
                           s = SMIME.SMIME()
                          @@ -452,17 +453,18 @@ message thusly:

                          # Decrypt p7. out = s.decrypt(p7) -print(out) +print(out)
                          -

                          Here’s the output:

                          -
                          a sign of our times
                          +

                          Here’s the output:

                          +
                          a sign of our times
                          +

                          Sign and Encrypt

                          -

                          Here’s how to generate an S/MIME-signed/encrypted message:

                          -
                          from M2Crypto import BIO, Rand, SMIME, X509
                          +

                          Here’s how to generate an S/MIME-signed/encrypted message:

                          +
                          from M2Crypto import BIO, Rand, SMIME, X509
                           
                           def makebuf(text):
                               return BIO.MemoryBuffer(text)
                          @@ -505,75 +507,76 @@ message thusly:

                          out.write('Subject: M2Crypto S/MIME testing\n') s.write(out, p7) -print(out.read()) +print(out.read()) # Save the PRNG's state. Rand.save_file('randpool.dat')
                          -

                          Here’s the output of the above program:

                          -
                          From: sender@example.dom
                          -To: recipient@example.dom
                          -Subject: M2Crypto S/MIME testing
                          -MIME-Version: 1.0
                          -Content-Disposition: attachment; filename="smime.p7m"
                          -Content-Type: application/x-pkcs7-mime; name="smime.p7m"
                          -Content-Transfer-Encoding: base64
                          -
                          -MIIIwwYJKoZIhvcNAQcDoIIItDCCCLACAQAxggEAMIH9AgEAMGYwYTELMAkGA1UE
                          -BhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRvMRkwFwYDVQQDExBTL01JTUUgUmVjaXBp
                          -ZW50MSQwIgYJKoZIhvcNAQkBFhVyZWNpcGllbnRAZXhhbXBsZS5kb20CAQAwDQYJ
                          -KoZIhvcNAQEBBQAEgYBlZlGupFphwhsGtIAPvDExN61qisz3oem88xoXkUW0SzoR
                          -B9zJFFAuQTWzdNJgrKKYikhWjDojaAc/PFl1K5dYxRgtZLB36ULJD/v/yWmxnjz8
                          -TvtK+Wbal2P/MH2pZ4LVERXa/snTElhCawUlwtiFz/JvY5CiF/dcwd+AwFQq4jCC
                          -B6UGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIRF525UfwszaAggeA85RmX6AXQMxb
                          -eBDz/LJeCgc3RqU1UwIsbKMquIs1S46Ebbm5nP75izPnujOkJ2hv+LNzqOWADmOl
                          -+CnGEq1qxTyduIgUDA2nBgCL/gVyVy+/XC9dtImUUTxtxLgYtB0ujkBNsOaENOlM
                          -fv4SGM3jkR+K/xlYG6HHzZGbfYyNGj2Y7yMZ1rL1m8SnRNmkCysKGTrudeNf6wT9
                          -J6wO9DzLTioz3ZnVr3LjsSKIb4tIp4ugqNJaLuW7m3FtZ3MAgxN68hBbJs8TZ8tL
                          -V/0jwUqS+grcgZEb9ymfcedxahtDUfHjRkpDpsxZzVVGkSBNcbQu92oByQVnRQ8m
                          -wrYLp3/eawM5AvuV7HNpTT5ZR+1t8luishHN9899IMP2Vyg0Ub67FqFypYmM2cm2
                          -sjAI4KpfvT00XFNvgLuYwYEKs9syGTO7hiHNQKcF44F5LYv6nTFwmFQB11dAtY9V
                          -ull4D2CLDx9OvyNyKwdEZB5dyV0r/uKIdkhST60V2Q9KegpzgFpoZtSKM/HPYSVH
                          -1Bc9f3Q/GqZCvNZZCMx8UvRjQR8dRWDSmPJ0VXG1+wJ+fCmSPP3AuQ1/VsgPRqx2
                          -56VrpGPpGut40hV8xQFbWIZ2whwWLKPFAHj8B79ZtFUzUrU6Z2rNpvv8inHc/+S/
                          -b6GR5s8/gucRblvd7n3OFNX5UJmPmcw9zWbu/1Dr9DY8l0nAQh21y5FGSS8B1wdE
                          -oD2M3Lp7JbwjQbRtnDhImqul2S4yu+m+wDD1aR2K4k3GAI7KKgOBWT0+BDClcn8A
                          -4Ju6/YUbj33YlMPJgnGijLnolFy0hNW7TmWqR+8tSI3wO5eNKg4qwBnarqc3vgCV
                          -quVxINAXyGQCO9lzdw6hudk8/+BlweGdqhONaIWbK5z1L/SfQo6LC9MTsj7FJydq
                          -bc+kEbfZS8aSq7uc9axW6Ti0eAPJ8EVHtwhSBgZQRweKFBXs6HbbhMIdc4N0M7Oq
                          -UiFXaF6s4n2uihVP6TqXtHEjTpZoC7pC+HCYiuKXUJtaqtXBOh+y3KLvHk09YL6D
                          -XmTDg+UTiFsh4jKKm/BhdelbR5JbpJcj5AId76Mfr8+F/1g9ePOvsWHpQr/oIQTo
                          -xEkaxCmzEgP0b6caMWfMUQrbVGxBBNcqKc/ir9fGGOPHATzzq/xLcQYvK1tZhd/D
                          -ah/gpMPndsyvVCEuFPluWyDiM0VkwHgC2/3pJIYFHaxK64IutmPsy393rHMEB4kN
                          -AHau6kWK+yL9qEVH1pP2zvswQ12P7gjt3T/G3bGsmvlXkEfztfjkXo6XnjcBNf5y
                          -G+974AKLcjnk1gzIgarz+lAMY57Gkw4oNDMrTqVQ2OJQlvOSbllPXzH+aAiavB8W
                          -ZPECLLwHxD4B1AuaiAArgKl935u/TOB+yQOR8JgGsUzROyJqHJ/SC51HkebgCkL1
                          -aggtjgPlIBEXLZAlhpWLZ9lAQyrQpvCVJYwaOvfMmvRav4NAFNoZ2/Q7S4Tn1z+U
                          -XX+f+GD58P4MPMhU5IKnz4yH4nlHnAiTEvcs85TZUAXze9g/uBOwZITeGtyLi52S
                          -aETIr4v7SgXMepX7ThQ1Pv/jddsK/u4j2F34u0XktwCP+UrbfkE2mocdXvdzxbmd
                          -tZSznK2qwgVSsPOs9MhUaepbnjmNBFFBrULhrUtSglM/VX/rWNiyh0aw4XYyHhIt
                          -9ZNlfEjKjJ67VEMBxBJ/ieUCouRGCxPYD1j65VT7oB3ZiyPu2F2nlUIcYNqPg1Sd
                          -QBCrdaOXdJ0uLwyTAUeVE+wMbgscLvWsfZcCCJHAvw9NHFMUcnrdWxAYMVETNUOn
                          -uryVAK7VfOldaz6z3NOSOi6nonNeHpR/sipBa4ik5xCRLT9e0S2QJgRvO9GyfAqz
                          -3DIzHtxIGePFzTiUYUTxS3i2gnMX2PEe3ChTLlYWD3jNeAKz0iOzpDphIF2xHLLQ
                          -1tCAqBmq/vUzALyDFFdFuTIqQZys4z/u4Dmyq9uXs421eN3v2hkVHvDy8uT2Ot29
                          -lg4Q5YezR1EjaW//9guL1BXbcKrTEdtxeNqtem7SpZOMTSwD2lhB8z65GrX90Cyt
                          -EMmaRSGYEdf5h1afL1SmKOMskbqxe1D2jG/vsXC7XX7xO/ioy0BdiJcYN1JiMOHJ
                          -EOzFol5I20YkiV6j+cenfQFwc/NkaSxEkR8AUHJSbvUmRQRl6r0nnsFpZdR1w7pv
                          -wkaT+eOpZynO4mY/ZtF6MpXJsixi6L4ZYXEbS6yHf+XGFfB0okILylmwv2bf6+Mq
                          -nqXlmGj3Jwq7X9/+2BDqvfpFFX5lSmItKZAobLdssjFR6roJxOqRsGia2aZ+0+U5
                          -VhgdITtnElgtHBaeZU5rHDswgdeLVBP+rGWnKxpJ+pLtNNi25sPYRcWFL6Erd25u
                          -eXiY8GEIr+u7rqBWpc9HR34sAPRs3ubbCUleT748keCbx247ImBtiDctZxcc1O86
                          -+0QjHP6HUT7FSo/FmT7a120S3Gd2jixGh06l/9ij5Z6mJa7Rm7TTbSjup/XISnOT
                          -MKWcbI1nfVOhCv3xDq2eLae+s0oVoc041ceRazqFM2TL/Z6UXRME
                          +

                          Here’s the output of the above program:

                          +
                          From: sender@example.dom
                          +To: recipient@example.dom
                          +Subject: M2Crypto S/MIME testing
                          +MIME-Version: 1.0
                          +Content-Disposition: attachment; filename="smime.p7m"
                          +Content-Type: application/x-pkcs7-mime; name="smime.p7m"
                          +Content-Transfer-Encoding: base64
                          +
                          +MIIIwwYJKoZIhvcNAQcDoIIItDCCCLACAQAxggEAMIH9AgEAMGYwYTELMAkGA1UE
                          +BhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRvMRkwFwYDVQQDExBTL01JTUUgUmVjaXBp
                          +ZW50MSQwIgYJKoZIhvcNAQkBFhVyZWNpcGllbnRAZXhhbXBsZS5kb20CAQAwDQYJ
                          +KoZIhvcNAQEBBQAEgYBlZlGupFphwhsGtIAPvDExN61qisz3oem88xoXkUW0SzoR
                          +B9zJFFAuQTWzdNJgrKKYikhWjDojaAc/PFl1K5dYxRgtZLB36ULJD/v/yWmxnjz8
                          +TvtK+Wbal2P/MH2pZ4LVERXa/snTElhCawUlwtiFz/JvY5CiF/dcwd+AwFQq4jCC
                          +B6UGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIRF525UfwszaAggeA85RmX6AXQMxb
                          +eBDz/LJeCgc3RqU1UwIsbKMquIs1S46Ebbm5nP75izPnujOkJ2hv+LNzqOWADmOl
                          ++CnGEq1qxTyduIgUDA2nBgCL/gVyVy+/XC9dtImUUTxtxLgYtB0ujkBNsOaENOlM
                          +fv4SGM3jkR+K/xlYG6HHzZGbfYyNGj2Y7yMZ1rL1m8SnRNmkCysKGTrudeNf6wT9
                          +J6wO9DzLTioz3ZnVr3LjsSKIb4tIp4ugqNJaLuW7m3FtZ3MAgxN68hBbJs8TZ8tL
                          +V/0jwUqS+grcgZEb9ymfcedxahtDUfHjRkpDpsxZzVVGkSBNcbQu92oByQVnRQ8m
                          +wrYLp3/eawM5AvuV7HNpTT5ZR+1t8luishHN9899IMP2Vyg0Ub67FqFypYmM2cm2
                          +sjAI4KpfvT00XFNvgLuYwYEKs9syGTO7hiHNQKcF44F5LYv6nTFwmFQB11dAtY9V
                          +ull4D2CLDx9OvyNyKwdEZB5dyV0r/uKIdkhST60V2Q9KegpzgFpoZtSKM/HPYSVH
                          +1Bc9f3Q/GqZCvNZZCMx8UvRjQR8dRWDSmPJ0VXG1+wJ+fCmSPP3AuQ1/VsgPRqx2
                          +56VrpGPpGut40hV8xQFbWIZ2whwWLKPFAHj8B79ZtFUzUrU6Z2rNpvv8inHc/+S/
                          +b6GR5s8/gucRblvd7n3OFNX5UJmPmcw9zWbu/1Dr9DY8l0nAQh21y5FGSS8B1wdE
                          +oD2M3Lp7JbwjQbRtnDhImqul2S4yu+m+wDD1aR2K4k3GAI7KKgOBWT0+BDClcn8A
                          +4Ju6/YUbj33YlMPJgnGijLnolFy0hNW7TmWqR+8tSI3wO5eNKg4qwBnarqc3vgCV
                          +quVxINAXyGQCO9lzdw6hudk8/+BlweGdqhONaIWbK5z1L/SfQo6LC9MTsj7FJydq
                          +bc+kEbfZS8aSq7uc9axW6Ti0eAPJ8EVHtwhSBgZQRweKFBXs6HbbhMIdc4N0M7Oq
                          +UiFXaF6s4n2uihVP6TqXtHEjTpZoC7pC+HCYiuKXUJtaqtXBOh+y3KLvHk09YL6D
                          +XmTDg+UTiFsh4jKKm/BhdelbR5JbpJcj5AId76Mfr8+F/1g9ePOvsWHpQr/oIQTo
                          +xEkaxCmzEgP0b6caMWfMUQrbVGxBBNcqKc/ir9fGGOPHATzzq/xLcQYvK1tZhd/D
                          +ah/gpMPndsyvVCEuFPluWyDiM0VkwHgC2/3pJIYFHaxK64IutmPsy393rHMEB4kN
                          +AHau6kWK+yL9qEVH1pP2zvswQ12P7gjt3T/G3bGsmvlXkEfztfjkXo6XnjcBNf5y
                          +G+974AKLcjnk1gzIgarz+lAMY57Gkw4oNDMrTqVQ2OJQlvOSbllPXzH+aAiavB8W
                          +ZPECLLwHxD4B1AuaiAArgKl935u/TOB+yQOR8JgGsUzROyJqHJ/SC51HkebgCkL1
                          +aggtjgPlIBEXLZAlhpWLZ9lAQyrQpvCVJYwaOvfMmvRav4NAFNoZ2/Q7S4Tn1z+U
                          +XX+f+GD58P4MPMhU5IKnz4yH4nlHnAiTEvcs85TZUAXze9g/uBOwZITeGtyLi52S
                          +aETIr4v7SgXMepX7ThQ1Pv/jddsK/u4j2F34u0XktwCP+UrbfkE2mocdXvdzxbmd
                          +tZSznK2qwgVSsPOs9MhUaepbnjmNBFFBrULhrUtSglM/VX/rWNiyh0aw4XYyHhIt
                          +9ZNlfEjKjJ67VEMBxBJ/ieUCouRGCxPYD1j65VT7oB3ZiyPu2F2nlUIcYNqPg1Sd
                          +QBCrdaOXdJ0uLwyTAUeVE+wMbgscLvWsfZcCCJHAvw9NHFMUcnrdWxAYMVETNUOn
                          +uryVAK7VfOldaz6z3NOSOi6nonNeHpR/sipBa4ik5xCRLT9e0S2QJgRvO9GyfAqz
                          +3DIzHtxIGePFzTiUYUTxS3i2gnMX2PEe3ChTLlYWD3jNeAKz0iOzpDphIF2xHLLQ
                          +1tCAqBmq/vUzALyDFFdFuTIqQZys4z/u4Dmyq9uXs421eN3v2hkVHvDy8uT2Ot29
                          +lg4Q5YezR1EjaW//9guL1BXbcKrTEdtxeNqtem7SpZOMTSwD2lhB8z65GrX90Cyt
                          +EMmaRSGYEdf5h1afL1SmKOMskbqxe1D2jG/vsXC7XX7xO/ioy0BdiJcYN1JiMOHJ
                          +EOzFol5I20YkiV6j+cenfQFwc/NkaSxEkR8AUHJSbvUmRQRl6r0nnsFpZdR1w7pv
                          +wkaT+eOpZynO4mY/ZtF6MpXJsixi6L4ZYXEbS6yHf+XGFfB0okILylmwv2bf6+Mq
                          +nqXlmGj3Jwq7X9/+2BDqvfpFFX5lSmItKZAobLdssjFR6roJxOqRsGia2aZ+0+U5
                          +VhgdITtnElgtHBaeZU5rHDswgdeLVBP+rGWnKxpJ+pLtNNi25sPYRcWFL6Erd25u
                          +eXiY8GEIr+u7rqBWpc9HR34sAPRs3ubbCUleT748keCbx247ImBtiDctZxcc1O86
                          ++0QjHP6HUT7FSo/FmT7a120S3Gd2jixGh06l/9ij5Z6mJa7Rm7TTbSjup/XISnOT
                          +MKWcbI1nfVOhCv3xDq2eLae+s0oVoc041ceRazqFM2TL/Z6UXRME
                          +

                          Decrypt and Verify

                          -

                          Suppose the above output has been saved into se.p7. The following +

                          Suppose the above output has been saved into se.p7. The following demonstrates how to decrypt and verify it:

                          -
                          from M2Crypto import BIO, SMIME, X509
                          +
                          from M2Crypto import BIO, SMIME, X509
                           
                           # Instantiate an SMIME object.
                           s = SMIME.SMIME()
                          @@ -606,23 +609,24 @@ demonstrates how to decrypt and verify it:

                          p7, data = SMIME.smime_load_pkcs7_bio(p7_bio) v = s.verify(p7) -print(v) +print(v)

                          The output is as follows:

                          -
                          a sign of our times
                          +
                          a sign of our times
                          +

                          Sending S/MIME messages via SMTP

                          -

                          In the above examples, we’ve assumed that our S/MIME messages are sent +

                          In the above examples, we’ve assumed that our S/MIME messages are sent and received automagically. The following is a Python function that generates S/MIME-signed/encrypted messages and sends them via SMTP:

                          -
                          from M2Crypto import BIO, SMIME, X509
                          +
                          from M2Crypto import BIO, SMIME, X509
                           import smtplib, string, sys
                           
                          -def sendsmime(from_addr, to_addrs, subject, msg, from_key, from_cert=None, to_certs=None, smtpd='localhost'):
                          +def sendsmime(from_addr, to_addrs, subject, msg, from_key, from_cert=None, to_certs=None, smtpd='localhost'):
                           
                               msg_bio = BIO.MemoryBuffer(msg)
                               sign = from_key
                          @@ -672,81 +676,83 @@ SMTP:

                          This function sends plain, S/MIME-signed, S/MIME-encrypted, and S/MIME-signed/encrypted messages, depending on the parameters -from_key and to_certs. The function’s output interoperates with +from_key and to_certs. The function’s output interoperates with Netscape Messenger.

                          Verifying origin of S/MIME messages

                          In our examples above that decrypt or verify messages, we skipped a -step: verifying that the from address of the message matches the -email address attribute in the sender’s certificate.

                          +step: verifying that the from address of the message matches the +email address attribute in the sender’s certificate.

                          The premise of current X.509 certification practice is that the CA is supposed to verify your identity, and to issue a certificate with -email address that matches your actual mail address. (Verisign’s +email address that matches your actual mail address. (Verisign’s March 2001 failure in identity verification resulting in Microsoft certificates being issued to spoofers notwithstanding.)

                          If you run your own CA, your certification practice is up to you, of course, and it would probably be part of your security policy.

                          -

                          Whether your S/MIME messaging application needs to verify the from +

                          Whether your S/MIME messaging application needs to verify the from addresses of S/MIME messages depends on your security policy and your -system’s threat model, as always.

                          +system’s threat model, as always.

                          Interoperating with Netscape Messenger

                          Suppose S/MIME Recipient uses Netscape Messenger. To enable Messenger to handle S/MIME messages from S/MIME Sender, S/MIME Recipient needs to configure Messenger with his private key and certificate, as well as -S/MIME Sender’s certificate.

                          +S/MIME Sender’s certificate.

                          -
                          Note: Configuring Messenger’s POP or IMAP settings so that it +
                          Note: Configuring Messenger’s POP or IMAP settings so that it retrieves mail correctly is beyond the scope of this HOWTO.
                          -

                          The following steps demonstrate how to import S/MIME Recipient’s private +

                          The following steps demonstrate how to import S/MIME Recipient’s private key and certificate for Messenger:

                            -
                          1. Transform S/MIME Recipient’s private key and certificate into PKCS +

                          2. Transform S/MIME Recipient’s private key and certificate into PKCS #12 format:

                            -
                            openssl pkcs12 -export -in recipient.pem -inkey recipient_key.pem \
                            -    -name "S/MIME Recipient" -out recipient.p12
                            +
                            openssl pkcs12 -export -in recipient.pem -inkey recipient_key.pem \
                            +    -name "S/MIME Recipient" -out recipient.p12
                             
                            -Enter Export Password:<enter>
                            -Verifying password - Enter Export Password:<enter>
                            +Enter Export Password:<enter> +Verifying password - Enter Export Password:<enter> +
                        • Start Messenger.

                        • -
                        • Click on the (open) “lock” icon at the bottom left corner of -Messenger’s window. This brings up the “Security Info” dialog box.

                          +
                        • Click on the (open) “lock” icon at the bottom left corner of +Messenger’s window. This brings up the “Security Info” dialog box.

                        • -
                        • Click on “Yours” under “Certificates”.

                          +
                        • Click on “Yours” under “Certificates”.

                        • -
                        • Select “Import a certificate”, then pick recipient.p12 from the +

                        • Select “Import a certificate”, then pick recipient.p12 from the ensuing file selection dialog box.

                        • -

                          Next, you need to import signer.pem as a CA certificate, so that -Messenger will mark messages signed by S/MIME Sender as “trusted”:

                          +

                          Next, you need to import signer.pem as a CA certificate, so that +Messenger will mark messages signed by S/MIME Sender as “trusted”:

                            -
                          1. Create a DER encoding of signer.pem:

                            -
                            openssl x509 -inform pem -outform der -in signer.pem -out signer.der
                            +
                          2. Create a DER encoding of signer.pem:

                            +
                            openssl x509 -inform pem -outform der -in signer.pem -out signer.der
                            +
                          3. -
                          4. Install signer.der into Messenger as MIME type -application/x-x509-ca-cert. You do this by downloading -signer.der via Navigator from a HTTP or HTTPS server, with the -correct MIME type mapping. (You may use demo/ssl/https_srv.py, +

                          5. Install signer.der into Messenger as MIME type +application/x-x509-ca-cert. You do this by downloading +signer.der via Navigator from a HTTP or HTTPS server, with the +correct MIME type mapping. (You may use demo/ssl/https_srv.py, bundled with M2Crypto, for this purpose.) Follow the series of dialog -boxes to accept signer.der as a CA for certifying email users.

                            +boxes to accept signer.der as a CA for certifying email users.

                          -

                          S/MIME Recipient is now able to decrypt and read S/MIME Sender’s -messages with Messenger. Messenger will indicate that S/MIME Sender’s +

                          S/MIME Recipient is now able to decrypt and read S/MIME Sender’s +messages with Messenger. Messenger will indicate that S/MIME Sender’s messages are signed, encrypted, or encrypted and signed, as the case -may be, via the “stamp” icon on the message window’s top right corner.

                          -

                          Clicking on the “stamp” icon brings you to the Security Info dialog box. +may be, via the “stamp” icon on the message window’s top right corner.

                          +

                          Clicking on the “stamp” icon brings you to the Security Info dialog box. Messenger informs you that the message is, say, encrypted with 168-bit DES-EDE3-CBC and that it is digitally signed by the private key corresponding to the public key contained in the certificate -signer.pem.

                          +signer.pem.

                          Interoperating with Microsoft Outlook

                          @@ -782,7 +788,7 @@ document.)

                          -
                          + - + + + + \ No newline at end of file diff --git a/doc/html/howto.ssl.html b/doc/html/howto.ssl.html index e880fe8..f31f9db 100644 --- a/doc/html/howto.ssl.html +++ b/doc/html/howto.ssl.html @@ -1,50 +1,42 @@ - - - - HOWTO: Programming SSL in Python with M2Crypto — M2Crypto documentation - - + HOWTO: Programming SSL in Python with M2Crypto — M2Crypto documentation + - - + + + + + + + + - +
                          -
                          +

                          HOWTO: Programming SSL in Python with M2Crypto

                          @@ -74,21 +66,21 @@ v2, RSA, DSA, DH, symmetric ciphers, message digests and HMACs.

                          M2Crypto was created during the time of Python 1.5, which features a module httplib providing client-side HTTP functionality. M2Crypto sports a httpslib based on httplib.

                          -

                          Beginning with version 2.0, Python’s socket module provided +

                          Beginning with version 2.0, Python’s socket module provided (rudimentary) SSL support. Also in the same version, httplib was enhanced with class HTTPConnection, which is more sophisticated than the old class HTTP, and HTTPSConnection, which does HTTPS.

                          Subsequently, M2Crypto.httpslib grew a compatible (but not identical) class HTTPSConnection.

                          The primary interface difference between the two HTTPSConnection classes -is that M2Crypto’s version accepts an M2Crypto.SSL.Context instance as a -parameter, whereas Python 2.x’s SSL support does not permit Pythonic +is that M2Crypto’s version accepts an M2Crypto.SSL.Context instance as a +parameter, whereas Python 2.x’s SSL support does not permit Pythonic control of the SSL context.

                          -

                          Within the implementations, Python’s HTTPSConnection employs a -FakeSocket object, which collects all input from the SSL connection -before returning it to the application as a StringIO buffer, whereas -M2Crypto’s HTTPSConnection uses a buffering -M2Crypto.BIO.IOBuffer object that works over the underlying +

                          Within the implementations, Python’s HTTPSConnection employs a +FakeSocket object, which collects all input from the SSL connection +before returning it to the application as a StringIO buffer, whereas +M2Crypto’s HTTPSConnection uses a buffering +M2Crypto.BIO.IOBuffer object that works over the underlying M2Crypto.SSL.Connection directly.

                          Since then M2Crypto has gained a Twisted wrapper that allows securing Twisted SSL connections with M2Crypto.

                          @@ -99,9 +91,9 @@ Twisted SSL connections with M2Crypto.

                          by John Viega, Matt Messier and Pravir Chandra, ISBN 059600270X.

                          Using M2Crypto does not automatically make an SSL connection secure. There are various steps that need to be made before we can make that -claim. Let’s see how a simple client can establish a secure +claim. Let’s see how a simple client can establish a secure connection:

                          -
                          ctx = SSL.Context()
                          +
                          ctx = SSL.Context()
                           ctx.set_verify(SSL.verify_peer | SSL.verify_fail_if_no_peer_cert, depth=9)
                           if ctx.load_verify_locations('ca.pem') != 1: raise Exception('No CA certs')
                           s = SSL.Connection(ctx)
                          @@ -150,7 +142,7 @@ above on how to make them secure.

                          ssldump

                          -

                          ssldump “is an SSLv3/TLS network protocol analyser. It identifies TCP +

                          ssldump “is an SSLv3/TLS network protocol analyser. It identifies TCP connections on the chosen network interface and attempts to interpret them as SSLv3/TLS traffic. When it identifies SSLv3/TLS traffic, it decodes the records and displays them in a textual form to stdout. If @@ -158,7 +150,7 @@ provided with the appropriate keying material, it will also decrypt the connections and display the application data traffic.

                          If linked with OpenSSL, ssldump can display certificates in decoded form and decrypt traffic (provided that it has the appropriate keying -material).”

                          +material).”

                          ssldump is written by Eric Rescorla.

                          @@ -166,7 +158,7 @@ material).”

                          -
                          + - + + + + \ No newline at end of file diff --git a/doc/html/index.html b/doc/html/index.html index ac8e968..cabf99c 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -1,109 +1,89 @@ - - - - Welcome to M2Crypto’s documentation! — M2Crypto documentation - - + Welcome to M2Crypto’s documentation! — M2Crypto documentation + - - - + + + + + + + + + - +
                          -
                          +
                          -

                          Welcome to M2Crypto’s documentation!

                          +

                          Welcome to M2Crypto’s documentation!

                          Contents:

                          -
                          + - + + + + \ No newline at end of file diff --git a/doc/html/objects.inv b/doc/html/objects.inv index 9d7632e..82b7dd9 100644 Binary files a/doc/html/objects.inv and b/doc/html/objects.inv differ diff --git a/doc/html/py-modindex.html b/doc/html/py-modindex.html index 100b720..85d8c98 100644 --- a/doc/html/py-modindex.html +++ b/doc/html/py-modindex.html @@ -1,53 +1,45 @@ - - - - Python Module Index — M2Crypto documentation - - + Python Module Index — M2Crypto documentation + - - - + + + + + + + + + - +
                          -
                          +

                          Python Module Index

                          @@ -56,230 +48,200 @@ m
                          - - +
                           
                          + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                           
                          m
                          - M2Crypto -
                              - M2Crypto.__init__ -
                              - M2Crypto.ASN1 -
                              - M2Crypto.AuthCookie + M2Crypto
                              - M2Crypto.BIO +     + M2Crypto.__init__
                              - M2Crypto.BN +     + M2Crypto.ASN1
                              - M2Crypto.callback +     + M2Crypto.AuthCookie
                              - M2Crypto.DH +     + M2Crypto.BIO
                              - M2Crypto.DSA +     + M2Crypto.BN
                              - M2Crypto.EC +     + M2Crypto.callback
                              - M2Crypto.Engine +     + M2Crypto.DH
                              - M2Crypto.Err +     + M2Crypto.DSA
                              - M2Crypto.EVP +     + M2Crypto.EC
                              - M2Crypto.ftpslib +     + M2Crypto.Engine
                              - M2Crypto.httpslib +     + M2Crypto.Err
                              - M2Crypto.m2 +     + M2Crypto.EVP
                              - M2Crypto.m2crypto +     + M2Crypto.ftpslib
                              - M2Crypto.m2urllib +     + M2Crypto.httpslib
                              - M2Crypto.m2urllib2 +     + M2Crypto.m2
                              - M2Crypto.m2xmlrpclib +     + M2Crypto.m2crypto
                              - M2Crypto.PGP +     + M2Crypto.m2urllib
                              - M2Crypto.PGP.constants +     + M2Crypto.m2urllib2
                              - M2Crypto.PGP.packet +     + M2Crypto.m2xmlrpclib
                              - M2Crypto.PGP.PublicKey +     + M2Crypto.Rand
                              - M2Crypto.PGP.PublicKeyRing +     + M2Crypto.RC4
                              - M2Crypto.PGP.RSA +     + M2Crypto.RSA
                              - M2Crypto.Rand +     + M2Crypto.SMIME
                              - M2Crypto.RC4 +     + M2Crypto.SSL
                              - M2Crypto.RSA +     + M2Crypto.SSL.cb
                              - M2Crypto.SMIME +     + M2Crypto.SSL.Checker
                              - M2Crypto.SSL +     + M2Crypto.SSL.Cipher
                              - M2Crypto.SSL.cb +     + M2Crypto.SSL.Connection
                              - M2Crypto.SSL.Checker +     + M2Crypto.SSL.Context
                              - M2Crypto.SSL.Cipher +     + M2Crypto.SSL.Session
                              - M2Crypto.SSL.Connection +     + M2Crypto.SSL.ssl_dispatcher
                              - M2Crypto.SSL.Context +     + M2Crypto.SSL.SSLServer
                              - M2Crypto.SSL.Session +     + M2Crypto.SSL.timeout
                              - M2Crypto.SSL.ssl_dispatcher +     + M2Crypto.SSL.TwistedProtocolWrapper
                              - M2Crypto.SSL.SSLServer +     + M2Crypto.threading
                              - M2Crypto.SSL.timeout +     + M2Crypto.util
                              - M2Crypto.SSL.TwistedProtocolWrapper -
                              - M2Crypto.threading -
                              - M2Crypto.util -
                              - M2Crypto.X509 +     + M2Crypto.X509
                          @@ -287,40 +249,39 @@
                          -
                          -
                          - - + + + + \ No newline at end of file diff --git a/doc/html/search.html b/doc/html/search.html index d5386cc..ac23baf 100644 --- a/doc/html/search.html +++ b/doc/html/search.html @@ -1,56 +1,50 @@ - - - - Search — M2Crypto documentation - - + Search — M2Crypto documentation + - - + + + + + + + + + + - +
                          -
                          +

                          Search

                          @@ -79,27 +73,29 @@
                          -
                          -
                          +
                          - + + + + \ No newline at end of file diff --git a/doc/html/searchindex.js b/doc/html/searchindex.js index 4ca9b1b..b55849b 100644 --- a/doc/html/searchindex.js +++ b/doc/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{"M2Crypto.SSL.TwistedProtocolWrapper.TLSProtocolWrapper":{connectionMade:[6,1,1,""],startTLS:[6,1,1,""],clear:[6,1,1,""],write:[6,1,1,""],connectionLost:[6,1,1,""],loseConnection:[6,1,1,""],dataReceived:[6,1,1,""],writeSequence:[6,1,1,""]},"M2Crypto.threading":{init:[3,2,1,""],cleanup:[3,2,1,""]},"M2Crypto.AuthCookie":{mix:[3,2,1,""],unmix:[3,2,1,""],unmix3:[3,2,1,""],AuthCookie:[3,3,1,""],AuthCookieJar:[3,3,1,""]},"M2Crypto.PGP":{PublicKey:[4,0,1,""],PublicKeyRing:[4,0,1,""],packet:[4,0,1,""],constants:[4,0,1,""],RSA:[4,0,1,""]},"M2Crypto.PGP.packet.Packet":{timestamp:[4,1,1,""],validity:[4,1,1,""],pkc:[4,1,1,""],version:[4,1,1,""],validate:[4,1,1,""],pack:[4,1,1,""]},"M2Crypto.X509.X509_Name":{add_entry_by_txt:[3,1,1,""],as_hash:[3,1,1,""],as_text:[3,1,1,""],nid:[3,4,1,""],entry_count:[3,1,1,""],as_der:[3,1,1,""],m2_x509_name_free:[3,1,1,""],get_entries_by_nid:[3,1,1,""]},"M2Crypto.PGP.packet.UserIDPacket":{userid:[4,1,1,""],pack:[4,1,1,""]},"M2Crypto.EVP.Cipher":{set_padding:[3,1,1,""],"final":[3,1,1,""],m2_cipher_ctx_free:[3,1,1,""],update:[3,1,1,""]},"M2Crypto.SSL.Session":{Session:[6,3,1,""],load_session:[6,2,1,""]},"M2Crypto.BIO.MemoryBuffer":{read_all:[3,1,1,""],close:[3,1,1,""],write_close:[3,1,1,""],read:[3,1,1,""],getvalue:[3,1,1,""]},"M2Crypto.m2urllib":{open_https:[3,2,1,""]},"M2Crypto.SSL.timeout.timeout":{pack:[6,1,1,""]},"M2Crypto.SMIME.SMIME":{unset_key:[3,1,1,""],encrypt:[3,1,1,""],set_x509_store:[3,1,1,""],load_key:[3,1,1,""],unset_x509_store:[3,1,1,""],decrypt:[3,1,1,""],sign:[3,1,1,""],write:[3,1,1,""],set_cipher:[3,1,1,""],verify:[3,1,1,""],set_x509_stack:[3,1,1,""],load_key_bio:[3,1,1,""],unset_cipher:[3,1,1,""],unset_x509_stack:[3,1,1,""]},"M2Crypto.m2xmlrpclib":{SSL_Transport:[3,3,1,""]},"M2Crypto.SSL.Checker":{WrongCertificate:[6,5,1,""],Checker:[6,3,1,""],SSLVerificationError:[6,5,1,""],WrongHost:[6,5,1,""],NoCertificate:[6,5,1,""]},"M2Crypto.EC.EC_pub":{get_der:[3,1,1,""],save_key:[3,1,1,""],save_key_bio:[3,1,1,""],get_key:[3,1,1,""]},"M2Crypto.SSL.ssl_dispatcher":{ssl_dispatcher:[6,3,1,""]},"M2Crypto.EVP":{MessageDigest:[3,3,1,""],PKey:[3,3,1,""],load_key_string:[3,2,1,""],load_key:[3,2,1,""],pbkdf2:[3,2,1,""],load_key_bio_pubkey:[3,2,1,""],HMAC:[3,3,1,""],Cipher:[3,3,1,""],EVPError:[3,5,1,""],load_key_string_pubkey:[3,2,1,""],hmac:[3,2,1,""],load_key_bio:[3,2,1,""]},"M2Crypto.SSL.ssl_dispatcher.ssl_dispatcher":{recv:[6,1,1,""],connect:[6,1,1,""],send:[6,1,1,""],create_socket:[6,1,1,""]},"M2Crypto.BIO.SSLBio":{set_ssl:[3,1,1,""],do_handshake:[3,1,1,""]},"M2Crypto.SSL.Checker.Checker":{numericIpMatch:[6,4,1,""]},"M2Crypto.PGP.packet.CompressedPacket":{validate:[4,1,1,""],uncompress:[4,1,1,""]},"M2Crypto.BIO.IOBuffer":{m2_bio_pop:[3,1,1,""],close:[3,1,1,""],m2_bio_free:[3,1,1,""]},"M2Crypto.PGP.packet.SignaturePacket":{validate:[4,1,1,""],pack:[4,1,1,""]},"M2Crypto.BN":{randfname:[3,2,1,""],rand_range:[3,2,1,""],rand:[3,2,1,""]},"M2Crypto.X509.X509_Name_Entry":{get_object:[3,1,1,""],get_data:[3,1,1,""],create_by_txt:[3,1,1,""],set_data:[3,1,1,""],set_object:[3,1,1,""],m2_x509_name_entry_free:[3,1,1,""]},"M2Crypto.Err":{get_error_reason:[3,2,1,""],get_error_code:[3,2,1,""],peek_error_code:[3,2,1,""],get_error_lib:[3,2,1,""],M2CryptoError:[3,5,1,""],get_error:[3,2,1,""],SSLError:[3,5,1,""],get_error_func:[3,2,1,""],get_x509_verify_error:[3,2,1,""]},"M2Crypto.SSL.Session.Session":{write_bio:[6,1,1,""],as_text:[6,1,1,""],m2_ssl_session_free:[6,1,1,""],get_timeout:[6,1,1,""],as_der:[6,1,1,""],get_time:[6,1,1,""],set_timeout:[6,1,1,""],set_time:[6,1,1,""]},"M2Crypto.m2urllib2":{HTTPSHandler:[3,3,1,""],build_opener:[3,2,1,""]},"M2Crypto.m2crypto.stack_st_OPENSSL_BLOCK":{"this":[3,4,1,""],thisown:[3,4,1,""],stack:[3,4,1,""]},"M2Crypto.SMIME":{text_crlf:[3,2,1,""],load_pkcs7:[3,2,1,""],load_pkcs7_bio_der:[3,2,1,""],SMIME_Error:[3,5,1,""],load_pkcs7_bio:[3,2,1,""],load_pkcs7_der:[3,2,1,""],smime_load_pkcs7_bio:[3,2,1,""],PKCS7_Error:[3,5,1,""],Cipher:[3,3,1,""],SMIME:[3,3,1,""],smime_load_pkcs7:[3,2,1,""],text_crlf_bio:[3,2,1,""],PKCS7:[3,3,1,""]},"M2Crypto.PGP.packet":{CompressedPacket:[4,3,1,""],LiteralPacket:[4,3,1,""],PKEPacket:[4,3,1,""],CommentPacket:[4,3,1,""],make_ctb:[4,2,1,""],is_ctb:[4,2,1,""],CKEPacket:[4,3,1,""],Packet:[4,3,1,""],XXXError:[4,5,1,""],PacketStream:[4,3,1,""],UserIDPacket:[4,3,1,""],SignaturePacket:[4,3,1,""],TrustPacket:[4,3,1,""],PrivateKeyPacket:[4,3,1,""],PublicKeyPacket:[4,3,1,""]},"M2Crypto.EVP.PKey":{as_pem:[3,1,1,""],"final":[3,1,1,""],save_key_bio:[3,1,1,""],verify_final:[3,1,1,""],sign_init:[3,1,1,""],reset_context:[3,1,1,""],update:[3,1,1,""],as_der:[3,1,1,""],verify_init:[3,1,1,""],get_rsa:[3,1,1,""],verify_update:[3,1,1,""],m2_pkey_free:[3,1,1,""],save_key:[3,1,1,""],sign_final:[3,1,1,""],get_modulus:[3,1,1,""],assign_rsa:[3,1,1,""],m2_md_ctx_free:[3,1,1,""],sign_update:[3,1,1,""],size:[3,1,1,""]},"M2Crypto.httpslib.HTTPSConnection":{close:[3,1,1,""],get_session:[3,1,1,""],connect:[3,1,1,""],set_session:[3,1,1,""],default_port:[3,4,1,""]},"M2Crypto.SSL.Connection.Connection":{m2_bio_free:[6,1,1,""],set_connect_state:[6,1,1,""],set_accept_state:[6,1,1,""],set_session_id_ctx:[6,1,1,""],get_peer_cert:[6,1,1,""],accept:[6,1,1,""],set_tlsext_host_name:[6,1,1,""],connect:[6,1,1,""],shutdown:[6,1,1,""],serverPostConnectionCheck:[6,1,1,""],close:[6,1,1,""],ssl_get_error:[6,1,1,""],write:[6,1,1,""],get_socket_read_timeout:[6,1,1,""],getsockopt:[6,1,1,""],get_verify_depth:[6,1,1,""],verify_ok:[6,1,1,""],get_version:[6,1,1,""],makefile:[6,1,1,""],setup_addr:[6,1,1,""],send:[6,1,1,""],m2_ssl_free:[6,1,1,""],get_verify_mode:[6,1,1,""],get_peer_cert_chain:[6,1,1,""],set_cipher_list:[6,1,1,""],get_context:[6,1,1,""],get_ciphers:[6,1,1,""],listen:[6,1,1,""],set_socket_write_timeout:[6,1,1,""],set_client_CA_list_from_context:[6,1,1,""],get_session:[6,1,1,""],set_post_connection_check_callback:[6,1,1,""],get_verify_result:[6,1,1,""],fileno:[6,1,1,""],getsockname:[6,1,1,""],get_cipher:[6,1,1,""],set_session:[6,1,1,""],setup_ssl:[6,1,1,""],set_bio:[6,1,1,""],get_cipher_list:[6,1,1,""],get_state:[6,1,1,""],get_shutdown:[6,1,1,""],getpeername:[6,1,1,""],recv:[6,1,1,""],setblocking:[6,1,1,""],set_client_CA_list_from_file:[6,1,1,""],setsockopt:[6,1,1,""],get_default_session_timeout:[6,1,1,""],accept_ssl:[6,1,1,""],connect_ssl:[6,1,1,""],read:[6,1,1,""],bind:[6,1,1,""],clear:[6,1,1,""],clientPostConnectionCheck:[6,4,1,""],set_shutdown:[6,1,1,""],renegotiate:[6,1,1,""],get_socket_write_timeout:[6,1,1,""],pending:[6,1,1,""],sendall:[6,1,1,""],set_ssl_close_flag:[6,1,1,""],settimeout:[6,1,1,""],set_socket_read_timeout:[6,1,1,""]},"M2Crypto.ASN1.ASN1_Integer":{m2_asn1_integer_free:[3,1,1,""]},"M2Crypto.EVP.HMAC":{m2_hmac_ctx_free:[3,1,1,""],reset:[3,1,1,""],"final":[3,1,1,""],digest:[3,1,1,""],update:[3,1,1,""]},"M2Crypto.X509.X509":{get_serial_number:[3,1,1,""],get_subject:[3,1,1,""],add_ext:[3,1,1,""],sign:[3,1,1,""],get_not_after:[3,1,1,""],set_version:[3,1,1,""],set_subject:[3,1,1,""],set_serial_number:[3,1,1,""],as_pem:[3,1,1,""],get_issuer:[3,1,1,""],m2_x509_free:[3,1,1,""],get_version:[3,1,1,""],as_der:[3,1,1,""],check_purpose:[3,1,1,""],save:[3,1,1,""],get_fingerprint:[3,1,1,""],as_text:[3,1,1,""],save_pem:[3,1,1,""],set_issuer_name:[3,1,1,""],set_not_after:[3,1,1,""],set_subject_name:[3,1,1,""],get_ext_at:[3,1,1,""],check_ca:[3,1,1,""],set_issuer:[3,1,1,""],verify:[3,1,1,""],get_pubkey:[3,1,1,""],get_not_before:[3,1,1,""],set_not_before:[3,1,1,""],set_pubkey:[3,1,1,""],get_ext:[3,1,1,""],get_ext_count:[3,1,1,""]},"M2Crypto.RC4.RC4":{rc4_free:[3,1,1,""],set_key:[3,1,1,""],update:[3,1,1,""],"final":[3,1,1,""]},"M2Crypto.SSL.cb":{ssl_verify_callback_allow_unknown_ca:[6,2,1,""],ssl_info_callback:[6,2,1,""],ssl_verify_callback_stub:[6,2,1,""],ssl_verify_callback:[6,2,1,""]},"M2Crypto.httpslib.ProxyHTTPSConnection":{putrequest:[3,1,1,""],endheaders:[3,1,1,""],connect:[3,1,1,""],putheader:[3,1,1,""]},"M2Crypto.SSL.SSLServer":{ThreadingSSLServer:[6,3,1,""],SSLServer:[6,3,1,""],ForkingSSLServer:[6,3,1,""]},"M2Crypto.PGP.PublicKey.PublicKey":{keyid:[4,1,1,""],encrypt:[4,1,1,""],decrypt:[4,1,1,""],write:[4,1,1,""],add_userid:[4,1,1,""],add_signature:[4,1,1,""],remove_userid:[4,1,1,""]},"M2Crypto.X509.X509_Store_Context":{get1_chain:[3,1,1,""],get_error_depth:[3,1,1,""],get_current_cert:[3,1,1,""],get_error:[3,1,1,""],m2_x509_store_ctx_free:[3,1,1,""]},"M2Crypto.X509":{load_request_string:[3,2,1,""],x509_store_default_cb:[3,2,1,""],new_extension:[3,2,1,""],new_stack_from_der:[3,2,1,""],load_crl:[3,2,1,""],load_request_bio:[3,2,1,""],X509_Extension_Stack:[3,3,1,""],CRL:[3,3,1,""],X509_Store_Context:[3,3,1,""],load_cert_bio:[3,2,1,""],X509:[3,3,1,""],load_cert_string:[3,2,1,""],load_request:[3,2,1,""],X509_Name_Entry:[3,3,1,""],load_request_der_string:[3,2,1,""],load_cert_der_string:[3,2,1,""],Request:[3,3,1,""],X509_Store:[3,3,1,""],X509Error:[3,5,1,""],load_cert:[3,2,1,""],X509_Name:[3,3,1,""],X509_Stack:[3,3,1,""],X509_Extension:[3,3,1,""]},"M2Crypto.PGP.PublicKeyRing":{load_pubring:[4,2,1,""],PublicKeyRing:[4,3,1,""]},"M2Crypto.DSA.DSA_pub":{sign_asn1:[3,1,1,""],save_key:[3,1,1,""],save_key_bio:[3,1,1,""],check_key:[3,1,1,""],sign:[3,1,1,""]},"M2Crypto.RC4":{RC4:[3,3,1,""]},"M2Crypto.RSA.RSA":{private_decrypt:[3,1,1,""],sign_rsassa_pss:[3,1,1,""],m2_rsa_free:[3,1,1,""],save_key_der_bio:[3,1,1,""],private_encrypt:[3,1,1,""],verify:[3,1,1,""],verify_rsassa_pss:[3,1,1,""],save_key:[3,1,1,""],save_key_bio:[3,1,1,""],pub:[3,1,1,""],check_key:[3,1,1,""],save_pem:[3,1,1,""],save_pub_key:[3,1,1,""],public_decrypt:[3,1,1,""],save_key_der:[3,1,1,""],save_pub_key_bio:[3,1,1,""],public_encrypt:[3,1,1,""],as_pem:[3,1,1,""],sign:[3,1,1,""]},"M2Crypto.m2urllib2.HTTPSHandler":{https_request:[3,1,1,""],https_open:[3,1,1,""]},"M2Crypto.X509.X509_Extension":{get_critical:[3,1,1,""],get_value:[3,1,1,""],set_critical:[3,1,1,""],m2_x509_extension_free:[3,1,1,""],get_name:[3,1,1,""]},"M2Crypto.BIO.CipherStream":{m2_bio_free:[3,1,1,""],m2_bio_pop:[3,1,1,""],set_cipher:[3,1,1,""],write_close:[3,1,1,""],close:[3,1,1,""],SALT_LEN:[3,4,1,""]},"M2Crypto.ASN1.ASN1_String":{m2_asn1_string_free:[3,1,1,""],as_text:[3,1,1,""]},"M2Crypto.ASN1.LocalTimezone":{utcoffset:[3,1,1,""],tzname:[3,1,1,""],dst:[3,1,1,""]},"M2Crypto.X509.Request":{as_text:[3,1,1,""],get_pubkey:[3,1,1,""],get_version:[3,1,1,""],get_subject:[3,1,1,""],as_der:[3,1,1,""],sign:[3,1,1,""],save_pem:[3,1,1,""],set_pubkey:[3,1,1,""],add_extensions:[3,1,1,""],set_version:[3,1,1,""],set_subject:[3,1,1,""],verify:[3,1,1,""],set_subject_name:[3,1,1,""],m2_x509_req_free:[3,1,1,""],save:[3,1,1,""],as_pem:[3,1,1,""]},"M2Crypto.m2xmlrpclib.SSL_Transport":{request:[3,1,1,""],user_agent:[3,4,1,""]},"M2Crypto.DH":{gen_params:[3,2,1,""],DH:[3,3,1,""],DHError:[3,5,1,""],load_params:[3,2,1,""],set_params:[3,2,1,""],load_params_bio:[3,2,1,""]},"M2Crypto.DSA":{pub_key_from_params:[3,2,1,""],gen_params:[3,2,1,""],load_pub_key:[3,2,1,""],DSA_pub:[3,3,1,""],load_params:[3,2,1,""],load_key:[3,2,1,""],set_params:[3,2,1,""],DSAError:[3,5,1,""],load_pub_key_bio:[3,2,1,""],DSA:[3,3,1,""],load_params_bio:[3,2,1,""],load_key_bio:[3,2,1,""]},"M2Crypto.m2crypto.stack_st_OPENSSL_STRING":{"this":[3,4,1,""],thisown:[3,4,1,""],stack:[3,4,1,""]},"M2Crypto.SSL.Cipher":{Cipher:[6,3,1,""],Cipher_Stack:[6,3,1,""]},"M2Crypto.AuthCookie.AuthCookie":{headerValue:[3,1,1,""],value:[3,1,1,""],expiry:[3,1,1,""],mac:[3,1,1,""],output:[3,1,1,""],isExpired:[3,1,1,""],data:[3,1,1,""],name:[3,1,1,""]},"M2Crypto.SSL.timeout":{struct_to_timeout:[6,2,1,""],struct_size:[6,2,1,""],timeout:[6,3,1,""]},"M2Crypto.PGP.PublicKey":{PublicKey:[4,3,1,""]},"M2Crypto.RSA":{new_pub_key:[3,2,1,""],gen_key:[3,2,1,""],load_key:[3,2,1,""],rsa_error:[3,2,1,""],RSA:[3,3,1,""],RSA_pub:[3,3,1,""],load_pub_key:[3,2,1,""],keygen_callback:[3,2,1,""],load_pub_key_bio:[3,2,1,""],load_key_bio:[3,2,1,""],RSAError:[3,5,1,""],load_key_string:[3,2,1,""]},"M2Crypto.PGP.packet.CommentPacket":{pack:[4,1,1,""]},"M2Crypto.AuthCookie.AuthCookieJar":{isGoodCookie:[3,1,1,""],makeCookie:[3,1,1,""],isGoodCookieString:[3,1,1,""]},"M2Crypto.ftpslib.FTP_TLS":{prot_p:[3,1,1,""],ntransfercmd:[3,1,1,""],prot_c:[3,1,1,""],auth_ssl:[3,1,1,""],auth_tls:[3,1,1,""]},"M2Crypto.ASN1.ASN1_TIME":{get_datetime:[3,1,1,""],set_time:[3,1,1,""],set_string:[3,1,1,""],set_datetime:[3,1,1,""],m2_asn1_time_free:[3,1,1,""]},"M2Crypto.ASN1.ASN1_Object":{m2_asn1_object_free:[3,1,1,""]},"M2Crypto.ftpslib":{FTP_TLS:[3,3,1,""]},"M2Crypto.ASN1":{ASN1_Object:[3,3,1,""],ASN1_Integer:[3,3,1,""],ASN1_TIME:[3,3,1,""],ASN1_UTCTIME:[3,4,1,""],LocalTimezone:[3,3,1,""],ASN1_String:[3,3,1,""]},"M2Crypto.SSL.Connection":{Connection:[6,3,1,""]},"M2Crypto.SSL.Cipher.Cipher":{version:[6,1,1,""],name:[6,1,1,""]},"M2Crypto.SSL.Context.Context":{set_tmp_dh_callback:[6,1,1,""],set_session_id_ctx:[6,1,1,""],set_verify:[6,1,1,""],set_session_timeout:[6,1,1,""],close:[6,1,1,""],set_tmp_rsa_callback:[6,1,1,""],get_session_timeout:[6,1,1,""],set_tmp_dh:[6,1,1,""],load_cert:[6,1,1,""],remove_session:[6,1,1,""],get_verify_depth:[6,1,1,""],get_verify_mode:[6,1,1,""],set_tmp_rsa:[6,1,1,""],load_client_CA:[6,1,1,""],set_cipher_list:[6,1,1,""],add_session:[6,1,1,""],set_default_verify_paths:[6,1,1,""],set_client_CA_list_from_file:[6,1,1,""],load_verify_locations:[6,1,1,""],set_session_cache_mode:[6,1,1,""],load_cert_chain:[6,1,1,""],set_options:[6,1,1,""],get_cert_store:[6,1,1,""],get_allow_unknown_ca:[6,1,1,""],set_allow_unknown_ca:[6,1,1,""],m2_ssl_ctx_free:[6,1,1,""],set_info_callback:[6,1,1,""],load_client_ca:[6,1,1,""],load_verify_info:[6,1,1,""],get_session_cache_mode:[6,1,1,""]},"M2Crypto.SSL.TwistedProtocolWrapper":{connectSSL:[6,2,1,""],TLSProtocolWrapper:[6,3,1,""],listenTCP:[6,2,1,""],listenSSL:[6,2,1,""],connectTCP:[6,2,1,""]},"M2Crypto.EC.EC":{verify_dsa_asn1:[3,1,1,""],verify_dsa:[3,1,1,""],gen_key:[3,1,1,""],save_key:[3,1,1,""],save_key_bio:[3,1,1,""],pub:[3,1,1,""],as_pem:[3,1,1,""],compute_dh_key:[3,1,1,""],sign_dsa:[3,1,1,""],m2_ec_key_free:[3,1,1,""],save_pub_key_bio:[3,1,1,""],save_pub_key:[3,1,1,""],check_key:[3,1,1,""],sign_dsa_asn1:[3,1,1,""]},"M2Crypto.SSL.Context":{map:[6,2,1,""],ctxmap:[6,2,1,""],Context:[6,3,1,""]},"M2Crypto.Engine":{Engine:[3,3,1,""],load_dynamic_engine:[3,2,1,""],load_openssl:[3,2,1,""],EngineError:[3,5,1,""],load_dynamic:[3,2,1,""],cleanup:[3,2,1,""]},"M2Crypto.BIO":{BIO:[3,3,1,""],openfile:[3,2,1,""],SSLBio:[3,3,1,""],BIOError:[3,5,1,""],IOBuffer:[3,3,1,""],File:[3,3,1,""],CipherStream:[3,3,1,""],MemoryBuffer:[3,3,1,""]},"M2Crypto.X509.CRL":{m2_x509_crl_free:[3,1,1,""],as_text:[3,1,1,""]},"M2Crypto.Engine.Engine":{ctrl_cmd_string:[3,1,1,""],finish:[3,1,1,""],load_public_key:[3,1,1,""],m2_engine_free:[3,1,1,""],load_certificate:[3,1,1,""],init:[3,1,1,""],get_name:[3,1,1,""],get_id:[3,1,1,""],set_default:[3,1,1,""],load_private_key:[3,1,1,""]},"M2Crypto.X509.X509_Store":{set_verify_cb:[3,1,1,""],add_x509:[3,1,1,""],load_locations:[3,1,1,""],load_info:[3,1,1,""],add_cert:[3,1,1,""],m2_x509_store_free:[3,1,1,""]},"M2Crypto.SMIME.PKCS7":{get0_signers:[3,1,1,""],type:[3,1,1,""],write:[3,1,1,""],m2_pkcs7_free:[3,1,1,""],write_der:[3,1,1,""]},"M2Crypto.X509.X509_Extension_Stack":{push:[3,1,1,""],m2_sk_x509_extension_free:[3,1,1,""],pop:[3,1,1,""]},"M2Crypto.X509.X509_Stack":{push:[3,1,1,""],pop:[3,1,1,""],m2_sk_x509_free:[3,1,1,""],as_der:[3,1,1,""]},"M2Crypto.PGP.PublicKeyRing.PublicKeyRing":{spurious:[4,1,1,""],load:[4,1,1,""],save:[4,1,1,""]},"M2Crypto.DH.DH":{compute_key:[3,1,1,""],print_params:[3,1,1,""],gen_key:[3,1,1,""],check_params:[3,1,1,""],m2_dh_free:[3,1,1,""]},"M2Crypto.PGP.RSA":{new_pub_key:[4,2,1,""]},"M2Crypto.RSA.RSA_pub":{private_encrypt:[3,1,1,""],private_decrypt:[3,1,1,""],save_key_bio:[3,1,1,""],check_key:[3,1,1,""],save_key:[3,1,1,""]},"M2Crypto.Rand":{rand_pseudo_bytes:[3,2,1,""],save_file:[3,2,1,""],rand_seed:[3,2,1,""],rand_bytes:[3,2,1,""],rand_add:[3,2,1,""],load_file:[3,2,1,""],rand_status:[3,2,1,""],rand_file_name:[3,2,1,""]},"M2Crypto.BIO.File":{reset:[3,1,1,""],close:[3,1,1,""]},M2Crypto:{DH:[3,0,1,""],BN:[3,0,1,""],m2urllib2:[3,0,1,""],ASN1:[3,0,1,""],EVP:[3,0,1,""],"__init__":[3,0,1,""],Engine:[3,0,1,""],BIO:[3,0,1,""],callback:[3,0,1,""],X509:[3,0,1,""],PGP:[4,0,1,""],m2:[3,0,1,""],Err:[3,0,1,""],m2xmlrpclib:[3,0,1,""],httpslib:[3,0,1,""],EC:[3,0,1,""],util:[3,0,1,""],m2crypto:[3,0,1,""],ftpslib:[3,0,1,""],SMIME:[3,0,1,""],SSL:[6,0,1,""],DSA:[3,0,1,""],Rand:[3,0,1,""],RC4:[3,0,1,""],RSA:[3,0,1,""],threading:[3,0,1,""],m2urllib:[3,0,1,""],AuthCookie:[3,0,1,""]},"M2Crypto.PGP.packet.PacketStream":{read:[4,1,1,""],close:[4,1,1,""],count:[4,1,1,""]},"M2Crypto.util":{no_passphrase_callback:[3,2,1,""],py3str:[3,2,1,""],quiet_genparam_callback:[3,2,1,""],pkcs7_pad:[3,2,1,""],genparam_callback:[3,2,1,""],passphrase_callback:[3,2,1,""],UtilError:[3,5,1,""],octx_to_num:[3,2,1,""],py3bytes:[3,2,1,""],bin_to_hex:[3,2,1,""],pkcs5_pad:[3,2,1,""]},"M2Crypto.SSL":{SSLServer:[6,0,1,""],Context:[6,0,1,""],Session:[6,0,1,""],cb:[6,0,1,""],Checker:[6,0,1,""],ssl_dispatcher:[6,0,1,""],SSLTimeoutError:[6,5,1,""],Connection:[6,0,1,""],Cipher:[6,0,1,""],timeout:[6,0,1,""],SSLError:[6,5,1,""],TwistedProtocolWrapper:[6,0,1,""]},"M2Crypto.EVP.MessageDigest":{m2_md_ctx_free:[3,1,1,""],update:[3,1,1,""],digest:[3,1,1,""],"final":[3,1,1,""]},"M2Crypto.EC":{pub_key_from_der:[3,2,1,""],pub_key_from_params:[3,2,1,""],gen_params:[3,2,1,""],EC_pub:[3,3,1,""],load_pub_key:[3,2,1,""],EC:[3,3,1,""],ec_error:[3,2,1,""],ECError:[3,5,1,""],load_key_bio:[3,2,1,""],load_pub_key_bio:[3,2,1,""],get_builtin_curves:[3,2,1,""],load_key_string:[3,2,1,""],load_key:[3,2,1,""],load_key_string_pubkey:[3,2,1,""]},"M2Crypto.m2crypto":{stack_st_OPENSSL_STRING:[3,3,1,""],stack_st_OPENSSL_BLOCK:[3,3,1,""]},"M2Crypto.SSL.SSLServer.SSLServer":{handle_request:[6,1,1,""],handle_error:[6,1,1,""]},"M2Crypto.httpslib":{HTTPSConnection:[3,3,1,""],ProxyHTTPSConnection:[3,3,1,""]},"M2Crypto.DSA.DSA":{sign_asn1:[3,1,1,""],gen_key:[3,1,1,""],save_params_bio:[3,1,1,""],verify:[3,1,1,""],save_key_bio:[3,1,1,""],sign:[3,1,1,""],set_params:[3,1,1,""],m2_dsa_free:[3,1,1,""],save_params:[3,1,1,""],save_key:[3,1,1,""],save_pub_key_bio:[3,1,1,""],save_pub_key:[3,1,1,""],check_key:[3,1,1,""],verify_asn1:[3,1,1,""]},"M2Crypto.PGP.packet.PublicKeyPacket":{pubkey:[4,1,1,""],pack:[4,1,1,""]},"M2Crypto.BIO.BIO":{m2_bio_free:[3,1,1,""],writeable:[3,1,1,""],fileno:[3,1,1,""],read:[3,1,1,""],readable:[3,1,1,""],flush:[3,1,1,""],readlines:[3,1,1,""],should_retry:[3,1,1,""],reset:[3,1,1,""],readline:[3,1,1,""],write:[3,1,1,""],should_write:[3,1,1,""],write_close:[3,1,1,""],close:[3,1,1,""],bio_ptr:[3,1,1,""],should_read:[3,1,1,""],seek:[3,1,1,""],tell:[3,1,1,""]},"M2Crypto.PGP.packet.PrivateKeyPacket":{is_encrypted:[4,1,1,""]}},terms:{represent:3,get_object:3,saver:7,"1g9epovswhpqr":7,load_cert_der_str:3,prefix:3,dirnam:[5,7],makecooki:3,"8tsi3wo5enkg4qwbnarqc3vgcv":7,whose:3,ssl_dispatch:[1,3,6],set_param:3,ecdh:3,wdigqewjl:5,v_asn1_ia5str:3,under:7,save_pub_key_bio:3,sha256:3,untrust:2,bgkqhkig9w0bbwewfayikozihvcnawcecmn:7,digit:7,dherror:3,toivonen:[0,6],govern:5,readbio:6,msg_bio:7,i2d_ssl_sess:6,four:6,qlen:6,cmd:3,zsyncer:2,correct:[6,7],multipurpos:7,verif:[3,6,7],initialis:[3,6],set_accept_st:6,sizehint:3,second:[0,3,6],follow:[0,3,7,5,2],wmbgsclvwsfzcccjhavw9nhfmucnrdwxaymvetnuon:7,xgffb0okilylmwv2bf6:7,even:3,get_stat:6,bioerror:3,neg:3,m2_asn1_time_fre:3,load_openssl:3,ssl_transport:[3,2],"new":[3,7,5,6,2],symmetr:[0,3,7],set_opt:6,eoq9wfscnii4:5,here:[3,5,7],text_crlf:3,lamy57gkw4ondmrtqvq2ojqlvosbllpxzh:7,path:3,peercertdigest:6,m2_x509_name_fre:3,set_session_cache_mod:6,fcgiserv:2,datetim:3,bitmask:6,"9rsqkrc9urv9mrbisredgnyecnerak5r1yzpoowninxc":5,aka:3,set_connect_st:6,q1z7g:5,readlin:3,unix:6,certbio:3,org:[0,7,5,2],cqydvqqgewjtrzerma8ga1uechmittjdcnlwdg8xfjaubgnvbamtdvmvtulnrsbt:7,txt:0,abstracthttphandl:3,subjectaltnam:[0,3],get_der:3,describ:[3,6],would:[3,6,7],emailaddress:[3,5],getpeernam:6,recommend:[0,3],type:[3,7,5,6,2],until:[5,6],skip_accept_encod:3,set_default_verify_path:6,warn:[3,2,6],hold:3,unpack:2,must:[0,3,6],join:7,err:[1,3,7],work:[0,2,3,5,6,7],"2bconvert":6,standard_error_messag:2,rn9vpy0suy8:5,root:0,could:[0,3,6],overrid:6,give:5,smtp:7,indic:[1,6,7],rsassa:3,under_bio:3,end:[3,5,6],load_cert_bio:3,duqhj2ygkkwdqq9v0xscjkgiyw:5,how:[0,3,6,7],hot:7,conn:3,pgp2:4,verifi:[3,7,5,6,2],bio_f_ciph:3,updat:[3,5],x509:[0,1,3,5,7],after:[0,3,5,6,7],dw0boozhj8tc7co7lmyb0ye271b6:5,befor:[0,3,5,6,7],httpconnect:[0,3],serialnumb:3,gen_param:3,demonstr:[0,5,7],xlyg6hhzzgbfyyngj2y7ymz1rl1m8snrnmkcyskgtrudenf6wt9:7,set_verify_cb:3,attempt:[0,3],third:0,ntransfercmd:3,perform:[0,3],maintain:6,environ:6,incorpor:[5,7],enter:[3,7,5,2],struct_to_timeout:6,asn1obj:3,oper:[3,2,6,7],sslserver:[1,3,6],composit:[4,3],feedback:3,private_encrypt:3,b9zjffauqtwzdnjgrkkyikhwjdojaac:7,over:[0,3,2,6],failur:[3,6,7],becaus:[3,6,7],wbal2p:7,affect:6,medusa:2,digest:[0,3,7],standard_html_head:2,cngeq1qxtyduiguda2nbgcl:7,imc:7,img:2,better:3,set_socket_write_timeout:6,them:[0,7],thei:[0,3,6,7],proce:6,safe:3,"break":2,pkcs7_error:3,getvalu:3,timeout:[1,3,6],each:[3,6,7],complet:[3,6],side:[0,3,6],mean:3,zw5kzxixitafbgkqhkig9w0bcqewennlbmrlckblegftcgxllmrvbtcbnzanbgkq:7,zserverssl:[1,2],bio_clos:6,kozihvcnaqebbqaegycbaxz:7,pgp:[1,3,4],save_params_bio:3,extract:6,proxyhttpsconnect:3,qtm0ddmm:5,network:[0,7],goe:[3,6],open:[0,3,2,6,7],dst:3,content:[1,3,2,6,7],public_decrypt:3,keyr:4,size:[3,6],dsa:[0,1,3,7],multilin:3,navig:7,wherea:[0,3],situat:5,renegoti:6,ireactortcp:6,fixm:6,md5:3,pubr:4,instal:[2,7],traceback:7,openssl:[0,1,2,3,4,5,6,7],unknown:[3,6],onto:3,niqfytycdl9i5sk:7,wjtpvp0yobmju4vmkezi405r7o8oewi:5,rand:[1,3,2,7],rang:3,render:7,load_pkcs7_bio:3,hook:6,instruct:2,alreadi:6,wrapper:[0,3,6],primari:0,set_client_ca_list_from_context:6,top:[3,2,7],noout:[5,7],master:5,too:0,"4mpgg20wd633d4z4dtlddz":5,john:0,listen:6,zssl:2,pkepacket:4,tool:5,privaci:7,get_cipher_list:6,sync:3,get_datetim:3,b4law8g59vtg6dykeetrg0rubx4bggc7pkbfuin423yjjodwchvvgnpozxmqt:5,md5withrsaencrypt:[5,7],keyid:[4,5,7],target:[3,2,7],provid:[0,3,2,6,7],project:[0,7],tzname:3,get_not_aft:3,fashion:2,seed:[2,7],lg4q5yezr1ejaw:7,seek:3,minu:3,p7_bio:[3,7],getsocknam:6,recreat:7,latter:6,nerx9zjgvrwuscqqcu:5,genparam_callback:3,set_tmp_rsa:6,set_datetim:3,unset_x509_stack:3,"0x2057cf8":6,unknow:3,shall:[2,7],add_x509:3,object:[0,4,3,6,7],regular:3,verify_fail_if_no_peer_cert:[0,6],letter:[5,6,7],geturl:3,x509_extension_stack:3,don:3,dom:[5,7],dog:7,doe:[0,3,6],commonnam:[0,3,5,6],freewar:7,"1tcaqbmq":7,jcyhx9vw4xvja7:7,listentcp:6,x509_store_default_cb:3,set_issu:3,random:[3,7],privkei:7,pkcs7_text:7,pkc:[4,7],set_info_callback:6,pkg:[5,7],protocol:[0,3,2,6,7],load_loc:3,bmrlckblegftcgxllmrvbqibadajbgurdgmcgguaoigxmbggcsqgsib3dqejazel:7,absolut:3,acquir:3,"059600270x":0,m2_ssl_session_fre:6,explain:7,configur:[5,7],apach:2,gymga1udiwr8mhqaffzsqjs9bei2gcgrutozevjws81kov:7,tzinfo:3,peek_error_cod:3,get_vers:[3,6],xekaxcmzegp0b6camwfmuqrbvgxbbncqkc:7,test_ssl:0,stop:2,ssldump:0,net:5,bat:2,ietf:7,stack_st_openssl_str:3,"public":[4,3,5,7],twice:6,bad:6,u4j2f34u0xktwcp:7,keylen:3,fieldnam:6,format_format_d:3,yqor8jggsuzroyjqhj:7,result:[3,6,7],utilerror:3,fail:[3,6],best:0,subject:[3,5,7],newkey2:5,said:[3,7],databas:5,z04ovaeue4x0swm17hlbm2kvt:5,urllib:2,ssl_verify_callback:6,mua:7,awai:[3,6],approach:7,attribut:[3,5,7],accord:[3,6],manpag:[3,6],ssl_cert_fil:6,weak:0,extens:[3,5,6,7],ywmxnjz8:7,zbq:5,memorybuff:[3,7],protect:[3,6,7],howev:6,coz:7,against:3,logic:6,bio_f_buff:3,browser:2,sre_pattern:[3,6],ctxt:4,"509v3":2,height:2,"19973a9dbbb601ba":5,load_kei:[3,7],trust:7,assum:[2,6,7],strong:3,awihma0gccqgsib3dqmcageoma0gcsqgsib3dqebaquabigaqpu8hfutlcf6ho2t:7,recipient_kei:7,verify_ok:6,been:[3,6,7],skip_host:3,interpret:[0,3,6],interest:6,basic:[5,7],ext_stack:3,sendsmim:7,get_verify_result:6,argument:3,load_cert_chain:6,j6wo9dzltioz3znvr3ljsskib4tip4ugqnjaluw7m3ftz3magxn68hbbjs8tz8tl:7,rand_pseudo_byt:3,emploi:0,ident:[0,2,6,7],servic:[6,7],commerci:7,calcul:3,p7file:3,kef21pgguqpf14gkgfwx3sv4bjc1vbrrwq6zlg3nmuyqr5mtjjy9eq:5,printabl:5,get_verify_mod:6,zopebutton:2,need:[0,3,5,6,7],kwarg:3,sever:[3,5,6],credit:2,receiv:[6,7],suggest:3,make:[0,3,5,6,7],thusli:[2,7],cipher_stack:6,sopath:3,should_writ:3,get1_chain:3,key_as_byt:3,zsmime:7,nid:3,"1t8luishhn9899imp2vyg0ub67fqfypymm2cm2":7,rais:[0,3,6,7],portal:2,errdepth:6,get_verify_depth:6,thu:[3,7],inherit:[3,6],client:[0,3,6,7],thi:[0,2,3,5,6,7],pubkey_pkt:4,programm:[0,7],settimeout:6,left:[5,7],countrynam:5,identifi:[0,3,5,7],just:[0,6],salt_length:3,xisnot:7,kkst1mcj:5,yet:6,previous:6,wrappedprotocol:6,els:[3,5,6,7],ffffff:2,save:[4,3,7],applic:[0,3,5,6,7],blwegdqhonaiwbk5z1l:7,disposit:7,verify_dsa_asn1:3,"_close_cb":3,"0x4996190":6,hihsrgwtnd7lnxuucpx8yv1id0dlmp0hz:7,get_allow_unknown_ca:6,x509_store:[3,7],viega:0,specif:[0,5,6],filenam:[4,3,5,6,7],client_addr:3,manual:[0,3],modulu:[3,5,7],miiiwwyjkozihvcnaqcdoiiitdccclacaqaxggeamih9ageamgywytelmakga1u:7,underli:[0,3,6],openfil:3,right:[4,6,7],old:[0,5],famili:6,propertymap:2,intern:[3,6],"1hxxfyo88m":5,load_pub_key_bio:3,successfulli:6,startpassthrough:6,requesthandlerclass:6,trace:3,temp_fold:2,subclass:3,cnf:[5,7],unit:[5,7],condit:3,localhost:[7,5,2],plu:6,uncompress:4,save_key_d:3,pkcs7_detach:7,kxtbbmqswcqydvqqg:7,"2aglpogdcfdioqblb2dcscohmbbvr":5,post:3,rwniyh0aw4xyyhhit:7,unsaf:3,ireactorssl:6,m2_asn1_integer_fre:3,ctxmap:6,from_kei:7,produc:3,"float":3,encod:[3,2,6,7],www:[3,2,7],ditto:3,"9ij5z6mja7rm7ttbsjup":7,pair:[3,7,5,6,2],tmp_bio:7,getproto:6,netscap:[5,7],wrap:7,od2m3lp7jbwjqbrtndhimqul2s4yu:7,sign_asn1:3,wai:[6,7],sfl_home:7,support:[0,3,6],frill:3,transform:7,load_key_string_pubkei:3,avail:[0,2,6,7],width:2,reli:[3,6],set_not_aft:3,call:[0,3,5,6,7],x509_ext_ptr:3,"0x1faa758":3,so_:6,gqnveov:5,head:2,form:[0,3,6],micalg:7,write_bio:6,refcount:[3,6],"0x1ec24a0":3,"4oxll0bi":5,"true":[3,6,7],pub_key_from_d:3,reset:3,absent:6,duhrqiml1tyi:5,py3str:3,maximum:6,dcwd:7,tell:[0,3],featur:0,fv4sgm3jkr:7,"abstract":[3,7],decrypt:[0,4,3,7],exist:[5,2],x509_store_ctx:3,localtimezon:3,p7m:7,check:[0,3,5,6,2],ec9eyj:7,encrypt:[4,3,5,6,7],kdjqodst7ovu62motgf3arcduppwuztfxolyone5nioo1apvhbrinqwcplkpotqr:5,when:[0,3,5,6,7],https_open:3,test:[0,3,2,7],jvy5cif:7,node:7,add_ext:3,intend:7,determin:3,stringio:[0,7],notwithstand:7,consid:6,useridpacket:4,longer:3,"1dr9dy8l0naqh21y5fgss8b1wd":7,pbkdf2:3,bottom:[3,7],pseudo:7,pathnam:2,time:[0,3,2,6,7],push:[3,7],bio_ptr:3,chain:[0,3,6],u7rqbwpc9hr34saprs3ubbculet748kecbx247imbtidctzxcc1o86:7,"41b2874df3d02dd4":5,consum:7,cadav:2,from_cert:7,cacert:[5,6],signific:[3,6],emmarsgyedf5h1afl1smkomskbqxe1d2jg:7,ztf6mpxjsixi6l4zyxebs6yhf:7,vsgprqx2:7,llf:4,should_retri:3,decid:[5,6],depend:[3,2,6,7],"5efdvbet":5,get_crit:3,readabl:3,post1:[7,5,2],decis:5,multivalu:3,sourc:[0,3,4,2,6,7],string:[4,3,2,6,7],load_param:3,ftpserver:2,word:7,brows:2,m2_x509_store_fre:3,pub_key_from_param:3,administr:7,level:[2,6],did:[5,6],iter:3,item:3,cooki:3,authcooki:[1,3],upper:3,ssl_verify_callback_stub:6,unmix:3,set_client_ca_list_from_fil:6,htm:7,sign:[3,5,7],port:[3,2,6],load_key_bio_pubkei:3,addr:6,repli:2,current:[3,6,7],eovbgs7ezalvvkdj4hnl:7,m2_engine_fre:3,deriv:3,gener:[3,5,6,7],swigpyobject:3,ckepacket:4,nconnect:2,get_serial_numb:3,m2_dh_free:3,along:3,kdfqdmtfzqkymhp1laq1ihbq1rhwsbh5n3ekq:5,wait:6,m2_bio_pop:3,m2_sk_x509_free:3,load_sess:6,behav:6,http_class:3,load_fil:[3,7],commonli:7,dqehaaavbbnhihnpz24gb2ygb3vyihrpbwvzoiic5zccaumwggjmoamcaqicaqaw:7,extra:5,modul:[0,1,3,4,6,7],keyfil:[3,6],peer:6,bio_noclos:6,asn1:[1,3],regex:3,memori:[3,7],msu:3,rsa_error:3,perl:5,rc4:[1,3],bio_s_pyfd:3,handler:[3,6],msg:7,scope:7,msb:3,cipher_list:6,tb7k3chfgw5wagwnll8lb:5,keep_tri:4,enhanc:0,visual:3,ioy0bdijcyn1jimohj:7,nueymfjdm0uvntg0icxgnufsfnjkntthpagykgetric3kgjz:5,signer_kei:7,commentpacket:4,prepar:2,pretend:7,mpint:3,bxwxkuuvt81vbjwdn9jst6:7,setblock:6,can:[0,2,3,5,6,7],save_param:3,purpos:[3,7],cookie_str:3,m2_pkey_fre:3,claim:0,stream:[4,3],add_extens:3,agent:2,topic:5,critic:3,kv95ymtgbisuwkj93grbvqoj:7,occur:[3,6],alwai:[3,7],close_pyfil:3,qppdzt3ykfmg2lzytaam1czvb6rbnrjjp2zrpbwn:5,rand_add:3,write:[4,3,5,6,7],anyon:7,fourth:0,m2urllib:[1,3,2],map:[6,7],product:7,mar:[5,7],as_text:[3,6],sni:6,sol_tcp:6,mac:3,commit:5,mai:[0,3,7,5,2],data:[0,2,3,5,6,7],aes_128_cbc:3,practic:[0,3,7],newkei:[5,7],democa:5,"7pvwhtszeyhn3oa9dhlmv9uqc4wy5md7j":5,inform:[0,7,5,6,2],combin:6,callabl:[3,6],zhttps_server:2,optnam:6,eawm5avuv7hnptt5zr:7,load_crl:3,coll:2,nbsp:2,print_param:3,get_error_depth:3,still:6,pointer:3,xmtdg:7,dynam:3,verify_dsa:3,polici:[5,6,7],is_encrypt:4,ma0gcsqgsib3dqebbauaa4gbaho3drchr86fstvavfixdsswwqktcehuhrdc:7,window:[2,7],mail:7,keyout:5,non:[3,6,7],within:[0,5,6],recal:7,ssl_verify_callback_allow_unknown_ca:6,reject:6,initi:[3,6],bound:6,pavel:3,aggtjgplibexlzalhpwlz9laqyrqpvcvjywaovfmmvrav4nafnoz2:7,now:[5,7],negoti:6,nor:[6,7],introduct:[0,7,5,2],pfl1k5dyxrgtzlb36uljd:7,down:6,zwxy:7,name:[0,3,5,6,7],verify_fin:3,h7nmicymi2wkz8h:7,ssl_connect:6,bufsiz:6,compil:3,set_sess:[3,6],https_srv:7,continu:6,egftcgxllmrvbtcbnzanbgkqhkig9w0baqefaaobjqawgykcgyear1nyy1qrll1r:5,lkmac1dwb3dqgjt5xk4wjesinfdxecnegacyteagyztpiapu:5,fi1wdpphywke97pojizvqesfzopty5hjiyzux4u:5,keypair:3,year:[5,7],happen:0,newcert:5,dispos:6,subjectnam:3,asn1_utctim:3,shown:[0,2],space:3,ahporp5ys55czpi:5,"_pyfree_x509":3,load_verify_loc:[0,6],internet:[5,6,7],text_nam:3,factori:[4,3,6],get_error_func:3,sc51hkebgckl1:7,fakesocket:0,state:[3,5,6,7],argv:3,mime:[0,1,5,7],plen:3,"byte":[4,3,6],tzsznk2qwgvsspos9mhuaepbnjmnbffbrulhrutsglm:7,ax96lvs0:5,get_pubkei:3,first:[0,3,7],origin:[3,7],directli:[0,6],onc:[3,6],save_pub_kei:3,amyxludrk45acua:5,"long":[0,6],sztm5jrp2zw:7,wronghost:6,zhttps_handler:2,publickeypacket:4,given:[3,6],bio_f_ssl:3,engineerror:3,"8levy0cllw":5,cgyikozihvcnawcwdgyikozihvcnawicagcama0gccqgsib3dqmcagfamacgbsso:7,citi:[5,7],checker:[0,1,3,6],ssl_:6,conveni:6,zovnycmv1cintpalaw4bwtxnhcdvthavdy34okhemzncg:5,provinc:[5,7],copi:[5,6,2],rsa_pub:[4,3],specifi:[3,6],ecerror:3,get_ext_at:3,than:[0,3,6],serv:2,ddlzqbacuxwtv5xy8plmx7widaqab:5,sha224:3,zw50msqwigyjkozihvcnaqkbfhvyzwnpcgllbnrazxhhbxbszs5kb20caqawdqyj:7,dyman:3,were:6,seri:7,sai:7,smime_load_pkcs7_bio:[3,7],ani:[0,3,6],ly4tpl5:5,load_params_bio:3,sat:[5,2],add_entry_by_txt:3,bitwis:3,engin:[1,3,6],inkei:7,note:[0,3,6,7],addhead:2,take:6,bgbyj1dubkhzsc7dgxzdtuclgnxqnnsg:5,cipherstream:3,"0x3f0bc68":6,noth:3,channel:[2,6],begin:[0,5,7],sure:3,makebuf:7,normal:[0,6],buffer:[0,3,6,7],add_userid:4,"0qjhp6hut7fso":7,set_mod:6,icon:7,renam:[5,7],contextfactori:6,messier:0,ftp_tl:3,link:[0,2],salt:3,hmac:[0,3,7],recipi:7,cheap:7,connectssl:6,hack:2,corner:7,m2_sk_x509_extension_fre:3,gqzcvnzzcmx8uvrjqr8drwdsmpj0vxg1:7,fifth:0,onli:[3,5,6],explicitli:6,get_error_reason:3,load_certif:3,lwpbxzf2k3fuudnkrlfbakeampxoybuifr2s5bma:5,engine_method_:3,set_x509_stor:[3,7],algorigthm:3,shramov:3,analys:0,get_fingerprint:3,verify_upd:3,variou:[0,6],get:[3,2,6],ssl_ptr:6,ssl:[0,1,2,3,5,6,7],sslbio:3,requir:[0,3,6],prime:[4,3],fileno:[3,6],save_kei:3,l6kn27mwzhe331vjttjsgl4:5,seldom:3,verify_init:3,error_log:2,through:[3,5,6,7],where:[3,5,6],e_n:[4,3],pkcs7_verifi:7,rand_byt:3,br77:5,set_tmp_rsa_callback:6,sport:0,m2_x509_req_fre:3,load_request_str:3,asn1int:3,between:0,"import":[3,2,6,7],create_socket:6,gratefulli:7,screen:[2,7],rsaencrypt:[5,7],set_data:3,sslverificationerror:6,come:[0,5],tue:2,"76h5jiznpbdsf2fjghwqvvdgyw4owy3mu739lhvnblicn":5,load_cert_str:3,evp_ciph:3,set_socket_read_timeout:6,mani:[3,2,7],ewjtrzerma8ga1uechmittjdcnlwdg8xfjaubgnvbamtdvmvtulnrsbtzw5kzxix:7,period:5,pop:[3,7],set_pad:3,b6ugcsqgsib3dqehataubggqhkig9w0dbwqirf525ufwszaaggea85rmx6axqmxb:7,bo2w7ei6iejbazk:5,mark:[3,7],zserver:2,certifi:[5,7],valueerror:3,get_rsa:3,get_id:3,standard:[3,7],"case":[0,6,7],interoper:7,heikki:[0,6],eaydvqqdewlsb2nhbghvc3qxjzalbgkqhkig9w0bcqewggfkbwluqhnlcnzlci5l:5,invok:[3,2,6,7],sol_socket:6,stdout:[0,3],set_session_id_ctx:6,henc:5,dsaerror:3,clutter:2,get_session_timeout:6,m2xmlrpclib:[1,3,2],httpserver:2,develop:5,author:[0,3,7,5,2],j9ftv3di:5,same:[0,3,6],binari:[4,3,6],epoch:3,html:[2,7],pad:3,document:[0,1,2,5,6,7],load_dynam:3,finish:[3,6],companion:7,"_mode_":6,extern:6,wrylp3:7,sign_dsa_asn1:3,appropri:[0,3,6],x509_name:[3,6],set_subject_nam:3,s0ovoc041cerazqfm2tl:7,"0x822012c":7,sfqo6lc9mtsj7fjydq:7,x509_stack:[3,7],model:[5,7],execut:[5,7],t6lqehb32wfyxqbkfxfjsxzsxox3r:7,m2urllib2:[1,3],auth_ssl:3,rest:3,addinfourl:3,q7s4tn1z:7,get_cert_stor:6,struct:6,m2_x509_free:3,except:[0,4,3,6],param:3,desktop:2,catop:5,blob:[3,7],struct_siz:6,real:3,stack_st_openssl_block:3,"2bdqvfpffx5lsmitkzaobldssjfr6rojxoqrsgia2az":7,read:[0,2,3,4,5,6,7],hkig9w0baqefaaobjqawgykcgyea5c5tj1chtsoxa1q2q0fyiwmwyhptjpjcvtzm:7,httplib:[0,3],traffic:0,dispatch:6,world:6,integ:6,server:[0,7,5,6,2],either:[3,6],smime:[1,3,7],output:[3,7],manag:2,set_tmp_dh:6,handshak:[3,6],pythonwar:3,nonzero:3,mbstring_asc:3,tvtk:7,freebsd:2,save_key_der_bio:3,legal:3,exit:3,"9znlfejkjj67vembxbj":7,freed:6,power:2,to_addr:7,urllib2:3,set_ciph:[3,7],passphrase_callback:[3,6],asn1_str:3,gvyvi:7,src:2,mg611eovkleoostv:5,eozfol5i20ykiv6j:7,pkcs5_pad:3,ssl_info_callback:6,other:[0,3,5,6],routin:[6,7],outlook:7,wsluvo:5,"0jwuq":7,awfqq4jcc:7,build_open:3,get_issu:3,ju4:5,your:[1,3,7,5,2],loc:3,buffer_s:6,hex:3,overwrit:2,start:[7,5,6,2],interfac:[0,3,6,7],ipv4:6,ipv6:6,premis:7,handle_request:6,load_pkcs7:3,tupl:[4,3,6],bundl:[7,5,2],dqyjkozihvcnaqeebqawwzelmakga1uebhmcu0cxetapbgnvbaotce0yq3j5chrv:7,jun:2,add_signatur:4,cryptograph:[3,7],miicxgibaakbgqcvwdhjvcuwxwu4h8wqujguvm:5,conclus:[5,2],tripl:7,immedi:6,get_not_befor:3,possibl:[3,6],"default":[0,2,3,5,6,7],mbstring_utf8:3,format_d:3,set_timeout:6,expect:3,cbc:[5,7],hellman:[3,2],creat:[0,1,2,3,5,6,7],certain:[5,6],w81xodtq2ecjxc8fn2wpa9y5vd1lt7ojksoul1:5,mhf6rqar:7,stack_of:6,file:[0,2,3,5,6,7],again:[3,5,7],fqlcrrr5nvupdin:5,get_data:3,tcpserver:6,field:[0,3,5,7],cleanup:3,ignor:3,you:[0,2,3,5,6,7],private_decrypt:3,ssl_sess_cache_:6,yubj33ylmpjgngijlnolfy0hnw7tmwqr:7,symbol:6,publickeyr:[1,3,4],blklen:3,set_pubkei:3,nyndufwi0qm92qlk0ui:5,directori:[0,5,6,2],bindaddress:6,newli:3,ngp:[0,7,5,2],pemfil:6,all:[0,4,3,5,6],ssl_cert_dir:6,alg:3,pty:[5,7],iqwxllnj:7,m2_x509_name_entry_fre:3,alt:2,"7zjt2r5cpikgkwofamduxeltx":5,osafound:0,init:3,program:[0,1,5,7],those:0,h9diul:5,octx_to_num:3,get_peer_cert_chain:6,global:7,fals:[3,5,6],mpi:3,util:[0,1,3],zpecllwhxd4b1auaiaargkl935u:7,get_kei:3,veri:[3,6],gucrblvd7n3ofnx5ujmpmcw9zwbu:7,load_cert:[3,6,7],list:[3,2,6],stderr:6,default_port:3,open_http:3,webdav:2,get_peer_cert:6,zero:3,pass:[3,5,6],further:6,b4txejzriyc8f3:7,"6l0g37faxur3xm28rchzvhu":5,what:[3,5,7],sun:2,section:[5,7],abl:7,overload:6,delet:3,version:[0,3,4,5,6,7],method:[3,6],"9gul1bxbckrtedtxenqtem7spzomtswd2lhb8z65grx90cyt":7,expon:[4,3,5,7],set_ssl:3,full:[5,7],hash:3,sophist:0,"3dizhtxigepfztiuyutxs3i2gnmx2pee3chtllywd3jneakz0iozpdphif2xhllq":7,behaviour:6,get_entries_by_nid:3,rudimentari:0,modifi:[3,2,7],valu:[4,3,5,6,7],search:1,sender:7,reason:[3,6],ccvkzzl:5,starttl:6,pick:7,action:6,diffi:[3,2],via:[3,6,7],literalpacket:4,nhost:2,cafil:6,wkat:7,href:2,s_pkt:4,signaturepacket:4,establish:[0,3,6],handle_error:6,select:[2,6,7],fcmspp3auq1:7,recv:6,two:[0,3,6],as_der:[3,6],organizationnam:[3,5],tlsprotocolwrapp:6,ede3:[5,7],more:[0,3,5,6],prot_p:3,epollreactor:6,mozilla:[2,7],flag:[0,3,6,7],prot_c:3,"1czdztgk7h9cdgx2qjsivymyytcfi3zsuzmjs8":5,known:0,compani:[5,7],cach:6,ensu:7,none:[4,3,6,7],"56vrpgppgut40hv8xqfbwiz2whwwlkpfahj8b79ztfuzuru6z2rnpvv8inhc":7,der:[3,7],m2_asn1_string_fre:3,dev:2,histori:0,dek:5,dec:2,def:7,randfnam:3,prompt:7,m2crypto_xmlrpc:3,expectedhost:6,share:3,accept:[0,7,5,6,2],explor:7,phrase:5,add_cert:3,cours:[5,7],get_socket_read_timeout:6,secur:[0,3,5,6,7],rather:6,anoth:[5,6],kiy8jkpv8dr5po1ikaxjfudbygdenjwybsrspsk3p:5,lnzqowadmol:7,"__init__":2,m2_x509_extension_fre:3,simpl:[0,3,6],css:2,get_tim:6,resourc:7,check_purpos:3,catalog:2,load_pkcs7_bio_d:3,"1bc9f3q":7,associ:6,set_serial_numb:3,cenfqfwc:7,caus:3,callback:[1,3,6],ssl_ctx_flush_sess:6,"8yhspd0caweaaaobtjcbszadbgnvhq4efgquxoyoll1t4jabwzfrm7ms8nblzuow":7,"0x3f0b3f8":6,u4dmyq9uxs421en3v2hkvhvdy8ut2ot29:7,dough:3,untouch:6,paramet:[0,3,2,6,7],getronicsgov:7,style:6,get_valu:3,sc3lsmhugu9xc26ogstjmkquiah:5,pend:6,set_x509_stack:[3,7],bjq5hnxbouslq0rwbrkoxv64i:7,assign_rsa:3,might:6,rwb:3,good:3,"return":[0,3,6,7],rgwnkxpj:7,timestamp:4,x509_purpose_:3,entry_count:3,qbcrdaoxdj0ulwytauev:7,vihhfc1zzp:5,mkwcbi1nfvohcv3xdq2ela:7,userid:4,authent:7,mysteri:3,chandra:0,man:6,found:6,nocertif:6,text_crlf_bio:3,format_pem:3,hard:3,hrg6sai33usk8xpokjqa:5,procedur:5,connect:[0,1,3,2,6,7],y3klvhk09yl6d:7,beyond:7,hostnam:6,ftp:[3,2],grcgzeb9ymfcedxahtdufhjrkpdpsxzzvvgksbncbqu92obyqvnrq8m:7,zbxscvldasmckg:5,etag:2,print:[3,7,5,6,2],"3wf7q915tveqoc74bnu6b8ibbgrmhzdzmvq4szffveaum":5,get_sess:[3,6],rand_rang:3,proxi:3,advanc:5,rm2htgotm2lmore4geotypi5f1fbi:5,pub:3,m2_cipher_ctx_fre:3,base:[0,2,3,4,5,6,7],connecttcp:6,eopzyno4mi:7,ask:[3,5,7],get_default_session_timeout:6,refer:[3,2],basi:6,messagedigest:3,thread:[1,3],pub_kei:3,threat:[5,7],pkcs7_pad:3,lifetim:6,python3:6,assign:[3,6],feed:3,certfil:[3,6],notifi:6,exchang:[0,3],set_tmp_dh_callback:6,number:[4,3,5,6,7],ec_error:3,urbfke2mocdxvdzxbmd:7,done:[2,6],blank:[5,7],miss:6,differ:[0,6],script:0,uweuasngtkpjv2jyumd3hwqox2q3cd4zgqvjj6gf3exa5126ckf:5,least:6,m2_ssl_free:6,bdclcn8a:7,buf_len:3,"0x1fe7dd0":6,store:[3,6],option:[3,5,6],create_by_txt:3,tob:7,part:7,check_ca:3,kind:6,grew:0,asyncor:[2,6],whenev:6,remot:6,remov:6,ecdsa:3,reus:6,str:6,comput:3,fmt7a120s3gd2jixgh06l:7,evperror:3,packag:[1,3,6,4],m2_pkcs7_free:3,expir:[3,5,6],"null":[3,6],x509error:3,vsxc7xx7xo:7,built:6,equival:6,self:[3,5,6,7],also:[0,2,3,5,6,7],unset_kei:3,load_client_ca:6,useless:0,puthead:3,distribut:[0,2],previou:3,most:[0,3,6,7],user_ag:3,dai:[5,7],appear:2,m2_x509_store_ctx_fre:3,clear:[3,5,6,7],cover:5,ext:3,exp:3,microsoft:7,des_ede3_cbc:7,load_key_str:3,remove_userid:4,microsec:6,find:6,access:[2,7],"0x1faa848":[3,6],post_connection_check:6,copyright:[0,2,4,5,6,7],unattend:5,putrequest:3,smtplib:7,writebio:6,localitynam:3,get_current_cert:3,thisown:3,verify_p:[0,6],m2_x509_crl_free:3,utcoffset:3,rfc:[3,7],no_passphrase_callback:3,common:[0,5,7],should_read:3,crl:3,certif:[0,2,3,5,6,7],add_sess:6,set:[0,3,5,6,7],netmemet:0,see:[0,3,2,6],sec:6,arg:[3,6],reserv:[4,6],set_not_befor:3,passphras:[3,5,6,7],set_vers:3,altern:[2,6],signatur:[3,5,7],web:[2,7],numer:2,ssl_sent_shutdown:6,numericipmatch:6,peercerthash:6,succeed:[3,2,6],"0x49948c0":6,distinguish:[5,6,7],acl_us:2,read_al:3,both:[3,2,6],last:[0,5,6,7],bhmcu0cxetapbgnvbaotce0yq3j5chrvmrkwfwydvqqdexbtl01jtuugumvjaxbp:7,kozihvcnaqebbqaegyblzlgupfphwhsgtiapvdexn61qisz3oem88xoxkuw0szor:7,get_error:[3,6,7],forgotten:5,prng:[2,7],load:[0,3,4,2,6,7],simpli:3,ec_pub:3,point:3,instanti:[4,3,7],address:[0,5,6,7],header:[3,2],littl:[0,2],shutdown:6,suppli:[3,6],cakei:5,surnam:3,stamp:7,due:6,bgcolor:2,secret:5,vi4roin:5,box:[2,7],buflen:6,append:3,understand:7,"2zz2g7x1hxrwh95a":7,imap:7,look:[5,7],get0_sign:3,ypfxy:5,index_html:2,"while":[3,2,6,7],abov:[0,2,6,7],error:[3,6,7],asn1_string_print_ex:3,pack:[4,6],propag:3,readi:[5,6,7],itself:[3,7],uwrgu5shra8oncm0cdxej0kpf3cfnjhffb8hwmzi4uegnmfxqnsxogz:7,set_tim:[3,6],around:2,setup_addr:6,"_ptr":3,close_flag:3,decod:[0,5,6],zope:[2,7],qya6adywgbghr9jkhwn5gsdu7bwx:7,obio:3,jddsk:7,uifxaf6s4n2uihvp6tqxthejtpzoc7pc:7,alert:6,temporari:[6,7],user:7,stack:[3,6],recent:7,subpackag:[1,3],sha1:[3,6,7],set_allow_unknown_ca:6,entri:[3,5],without:3,"0x7fc7ebc63150":3,set_kei:3,bio_fre:6,explan:6,predetermin:3,utifsh4jkkm:7,load_request_bio:3,pss:3,set_object:3,m2_asn1_object_fre:3,pubkei:[4,3],fancyurlopen:2,browser_id_manag:2,"_sre":[3,6],sslerror:[3,6],input:[0,4,6],subsequ:0,certdata2pem:0,bio:[0,1,3,6,7],march:7,format:[0,4,3,6,7],rc4_free:3,big:[4,3],wdd1ar2k4k3gai7kkgobwt0:7,intuit:5,bio_in:3,etwitreft1heupnar:7,gd58p4mpmhu5iknz4yh4nlhnaitevcs85tzuaxze9g:7,bit:[0,3,5,6,7],bin_to_hex:3,pdlrrliknknfmhkiacktlrcu59sca6adeiwuzqmuzp5cs6jrsro3nkfg1bd09d1k:5,signal:3,resolv:2,cw8kzzwh:7,collect:[0,2],princip:3,get_socket_write_timeout:6,givennam:3,popular:7,ssl_ctx_set_timeout:6,creation:[5,6],some:[5,6,7],sampl:0,control_panel:2,m2_bio_fre:[3,6],nqxlmgj3jwq7x9:7,endhead:3,pltnni25spyrcwfl6erd25u:7,per:[3,2,6],pem:[0,2,3,5,6,7],substitut:7,prog:7,stateorprovincenam:3,proc:5,privatekeypacket:4,asn1_object:3,run:[3,2,7],do_handshak:3,clientpostconnectioncheck:6,jyvbd7acn35p5yx7ktqvqerwdijxycanbcnvmrtmysanw9kv1ujtxc5vx7ylwipk:5,step:[0,5,7],loseconnect:6,ftpslib:[1,3],jy5rd:5,load_key_bio:3,"3pjiyfhaxk64iutmpsy393rhmeb4kn":7,is_ctb:4,idx:6,constraint:[5,7],materi:[0,2],new_pub_kei:[4,3],keybio:3,dialog:[2,7],smtpd:7,block:6,https_server:2,compute_kei:3,chang:[3,6],nss:[0,7],enabl:[6,7],sock:6,textual:0,custom:6,includ:[3,5],sslv3:[0,6],suit:6,set_cipher_list:6,yl9qevh1pp2zvswq12p7gjt3t:7,properli:7,bio_s_mem:3,skip:7,newer:3,line:[0,3,7],aqh:7,info:[3,5,7],concaten:6,consist:[3,7],caller:6,protocolwrapp:6,sign_rsassa_pss:3,unlock:3,py3byt:3,akbr4il1nkq8ecsmcr3wpa0i9n0ehi7zvpvahxc0sqapfl8ygdfhq:5,similar:[7,5,6,2],curv:3,constant:[1,3,6,4],retriev:[3,7],doesn:6,repres:[3,6],m2_ec_key_fre:3,get_ciph:6,compressedpacket:4,yrpzcwq3gxahuj:5,titl:2,invalid:3,public_encrypt:3,librari:[6,7],clean:[3,6],hanson:5,m2_md_ctx_free:3,ago:5,ccrt2tfwkbbfleuifl7mb:5,twistedprotocolwrapp:[1,3,6],algorithm:[3,5,7],pkei:3,ubowzitegtyli52:7,rand_se:3,"1vsrcid":5,depth:[0,3,6],algo:3,get_subject:3,lbow6ssdir6:7,asyncio:6,load_request_der_str:3,code:[0,3,5,6,7],queri:6,der_str:3,steve:5,urandom:2,ssltimeouterror:6,issuer:[3,5,7],privat:[3,5,6,7],"_debug":3,base64:7,reset_context:3,friendli:7,send:[0,2,6,7],flowinfo:6,ahau6kwk:7,sens:6,fatal:6,ripemd160:3,sent:[3,5,6,7],get_error_cod:3,mutheybpq5th7ydrtnizkkxobnqe2kyux9x22a1kh49sojjfg6kpb9mugizbimlv:5,electron:7,b877j9wbpbl:5,get_shutdown:6,tri:[0,6],iobuff:[0,3],newreq:5,get_timeout:6,m2_ssl_ctx_free:6,certdata:0,session:[1,3,6],evp:[1,3],uryvak7vfoldaz6z3nosoi6nonnehpr:7,pleas:5,x509v3:[5,7],dasmytmpc4ztytv06n07afbjl:5,"0x2":[5,7],"0x1":5,"0x0":[5,7],pkcs12:7,oiqto:7,download:[0,2,7],write_clos:3,cat:5,odd:3,click:[2,7],client_address:6,compat:0,index:[1,3],"974aklcjnk1gzigarz":7,compar:0,henceforth:2,weak_crypto:6,make_ctb:4,ssl_ctx_set_opt:6,mimetool:3,pep484:6,len:3,vkwwecqqdkeu:5,ssl_received_shutdown:6,kebfzs8asq7uc9axw6ti0eapj8evhtwhsbgzqrwekfbxs6hbbhmidc4n0m7oq:7,let:[0,5,7],threadingsslserv:6,relativedistinguishednam:3,sinc:[0,3,5],kilroi:3,convert:[0,3],iihwd6gtv1uodf7urbxtl3hq9:7,pretti:0,"1qk53c":5,ctx:[0,3,6],later:6,cert:[0,3,6,7],ctb:4,pheng:[0,2,4,5,6,7],typic:[0,6,7],rdn:3,revoc:3,ggarfmmj4yuhewkys9jo1h8k4bdxugmauwni5:5,appli:[3,5,2],foundat:[0,6],api:[3,6],set_subject:3,clbwev3ryfrlp4x8j9mdte0ykok3t0wqohqrettsifdtjnfp:5,from:[0,2,3,4,5,6,7],getsockopt:6,zip:2,commun:[3,6],check_kei:3,next:[3,5,7],prompt1:3,few:[5,7],prompt2:3,usr:[5,7],get_nam:3,pfi:5,socketserv:6,about:[5,6,7],forkingsslserv:6,load_info:[3,7],ctrl_cmd_string:3,m2_rsa_fre:3,tunnel:3,alia:3,bmvnwbppufzpiaivalycjt6pyextbbszs7:5,set_tlsext_host_nam:6,b6gr5s8:7,endian:[4,3],serverpostconnectioncheck:6,get_ext_count:3,aliv:6,control:[0,3,6],process:[5,6,7],lock:7,rescorla:0,m2_hmac_ctx_fre:3,httpsconnect:[0,3],serial:[3,5,7],hvcnaqkemryefooerud8exiyxfqq8btfukwrsp3imfigcsqgsib3dqejdzffmemw:7,gknqqdblotqt06f3oissdjetm2itllyhgzv:5,load_verify_info:6,ssl_get_default_timeout:6,bgkqhkig9w0bbwewhayjkozihvcnaqkfmq8xdtaxmdmzmtexnduwmlowiwyjkozi:7,rand_file_nam:3,scopeid:6,hcyiukxujtaqtxboh:7,m1je:5,pkcs7:[3,7],imqqiiw:7,m1awhen3vir2zlaw:5,qjpbezwdp7gjfzfatqitesymwo3i:7,farm:2,zxhhbxbszs5kb20whhcnmdewmzmxmte0mdmzwhcnmdiwmzmxmte0mdmzwjbbmqsw:7,pyfil:3,sign_init:3,load_pub_kei:3,nuser:2,connectionmad:6,"3c93156fc7b4ebf49fe9c7db7f503087":7,bind:6,correspond:7,issu:[2,6,7],l5trm4x6zjxwuxxmijcehmmd8tc8ybwwo4ao19b3ebffetvsugxsga:5,packetstream:4,allow:[0,3,5,6],sendal:6,https_request:3,ir9fggophatzzq:7,get_builtin_curv:3,dnli0rvuvxiwt:5,load_pubr:4,mutt:7,siong:[0,2,4,5,6,7],chosen:0,request_bodi:3,therefor:6,"217mrhyx2nswgrpkqndu3gespovml3jeqiaxuponbwq7rj42":5,crash:3,ktgtcixjl2nmw7j:5,dh1024:2,python:[0,1,2,3,5,6,7],handi:5,auth:3,dat:[2,7],"8czydsolmyibujccabycaqewydbbmqswcqydvqqgewjtrzerma8ga1uechmittjd":7,dav:2,facilit:5,instead:[2,7],"0x1ffa410":3,spoofer:7,miie8ayjkozihvcnaqccoiie4tccbn0caqexczajbgurdgmcgguamcigcsqgsib3:7,wrongcertif:6,anyth:0,capath:6,mode:[3,2,6,7],organizationunitnam:3,postconnectioncheck:6,get_x509_verify_error:3,x509_store_context:3,vhgdittnelgthbaezu5rhdswgdelvbp:7,portal0:2,"7ay4jsdhyibcmgsq":5,jbt3ltgf743utyaas7hnguouobhoyt:5,usernam:3,our:7,patch:[5,2],b75:5,variabl:6,matt:0,req:[3,5,7],xc9dtimuutxtxlgytb0ujkbnsoaenolm:7,ret:[5,6],as_pem:3,suitabl:0,binstr:6,get_context:6,"2dnyol50zu0sdzst1":5,shut:6,sendmail:7,manipul:[3,6],save_key_bio:3,releas:3,as_hash:3,get_modulu:3,indent:3,accept_ssl:6,c6fi3n03rgfmkectijc:5,keep:5,dhpfile:6,length:[3,2,6],timeo:6,ltd:[5,7],datareceiv:6,organiz:[5,7],softwar:7,isbn:0,pk7_smime:7,"_timeout_":6,smartcard:3,date:[0,3,2],"1ezn9zmlryqzbtxnnrmp3dhj":7,rand_statu:3,utc:3,publickei:[1,3,4],strict:3,ssl_ctx_ptr:6,system:[7,5,6,2],messag:[0,3,7],asn1_integ:3,attach:7,ssl_ctx_set_session_cache_mod:6,termin:6,"0x10001":[5,7],"final":[3,7],xlcqyvk1tzhd:7,tws5k:5,"__del__":6,"4ju6":7,rsa:[0,1,2,3,4,5,6,7],load_pkcs7_der:3,nqaodq3aobzpafp9l:5,structur:[3,6],charact:3,unset_ciph:3,headervalu:3,unencrypt:[5,7],iwq3n6j1suzs3uw6abq8bivynoucmkjaqqjbanqxfalu4b:5,httpshandler:3,quarante:0,authcookiejar:3,set_str:3,have:[5,6,7],tabl:1,close:[4,3,2,6,7],border:2,automat:[0,6],widgit:[5,7],messeng:7,arm:7,mix:3,builtin:3,connectionlost:6,which:[0,3,5,6,7],sign_upd:3,singl:3,newca:5,repudi:7,actualhost:6,who:7,flndpcnkrtvqdx3rt6x6vbttcyom:7,aogabaku8w3w1qu15hle1bjsl7gmreoreqeblobmmazz4by0l6sxzxjpjwxo86f:5,ljecgc3rqu1uwisbkmquis1s46ebbm5np75izpnujokj2hv:7,cipher:[0,1,3,6,7],deploi:5,aetir4v7sgxmepx7thq1pv:7,why:7,afresh:5,url:[3,2],request:[3,5,6,7],quvxinaxygqco9lzdw6hudk8:7,unmix3:3,get_ext:3,constrain:5,skunk:2,itafbgkqhkig9w0bcqewennlbmrlckblegftcgxllmrvbyibadambgnvhrmebtad:7,z6ebh:5,text:[3,7,5,2],get_error_lib:3,verbos:3,bring:7,empir:3,zpqqqzkq:5,miibvwyjkozihvcnaqcdoiibsdccauqcaqaxggeamih9ageamgywytelmakga1u:7,sjai4kpfvt00xfnvgluywyeks9sygto7hihnqkcf44f5lyv6ntfwmfqb11daty9v:7,setup_ssl:6,locat:[2,6],set_issuer_nam:3,should:[3,5,6],jan:2,suppos:7,ebdz:7,"2iwrpascbeid8saraql3ddcli":5,local:[7,5,2],trustpacket:4,meant:5,load_private_kei:3,autom:7,g3bgsmvlxkefztfjkxo6xnjcbnf5i:7,dsa_pub:3,cstringio:3,write_d:3,ukidkhst60v2q9kegpzgfpoztskm:7,organ:[5,7],sha:3,integr:7,contain:[3,2,6,7],challeng:5,hpysvh:7,ftplib:3,ssl_ctx:3,x509_name_entri:3,packet:[1,3,4],malfunct:6,sign_dsa:3,x509_store_set_verify_cb:3,listenssl:6,multipart:7,h99suto:5,mrywfaydvqqdew1tl01jtuugu2vuzgvymsewhwyjkozihvcnaqkbfhjzzw5kzxja:7,statu:[3,6],isgoodcooki:3,correctli:7,boundari:7,below:2,randpool:[2,7],written:[0,3,5],exiy8geir:7,m2cryptoerror:3,limit:3,neither:6,reactor:6,email:[3,5,7],verisign:7,kei:[0,2,3,5,6,7],sign_fin:3,get_session_cache_mod:6,group:7,cvzrxakeaxno80arbgxpumr11ghg:5,salt_len:3,problem:3,addit:[0,3,6],d2i_ssl_sess:6,g7ppoo:5,admin:5,sipba4ik5xcrlt9e0s2qjgrvo9gyfaqz:7,standard_templ:2,etc:6,pgpmime:7,instanc:[0,3,6,7],gen_kei:3,freeli:7,mh2pz4lverxa:7,nbbba2yl0n5gs1tyiy9z:5,comment:5,ssl_get_error:6,"8caweaaaaama0gcsqgsib3dqebbauaa4gb":5,walk:5,respect:[3,6],bio_push:3,quit:[7,5,2],compos:2,out_bio:3,treat:6,pcgiserv:2,"2cjcbfzokmijci03kbtqxofiqglstwxgzknf":5,u_pkt:4,set_post_connection_check_callback:6,z6uxrm:7,setsockopt:6,ptxt:4,save_pem:3,hyswpz1xvlprmv4:5,aaiavb8w:7,togeth:6,openpgp:7,present:[2,6],connect_ssl:6,plain:7,permit:0,noncrit:3,defin:6,isgoodcookiestr:3,"0ipy80":7,smime_load_pkcs7:[3,7],session_data_manag:2,set_ssl_close_flag:6,bind_and_activ:6,almost:3,demo:[0,7,5,2],site:5,set_session_timeout:6,forkingmixin:6,load_public_kei:3,"_alwayssucceedspostconnectioncheck":6,save_fil:[3,7],welcom:1,began:5,x509_ext:3,handl:7,keygen_callback:3,set_verifi:[0,6],m2_dsa_fre:3,http:[0,3,2,7],context:[0,1,3,6],pystack:3,effect:7,ssl_context:[3,6],tlfgl4hdk2gyzxafuqzwiurz:7,miibntccaqycaqawxtelmakga1uebhmcu0cxetapbgnvbaotce0yq3j5chrvmriw:5,m2crypto:[0,1,2,3,4,5,6,7],asn1str:3,countri:[5,7],y9mh7efw:7,off:3,com:[0,3,7,5,2],well:[3,2,6,7],p12:7,exampl:[0,2,3,5,6,7],command:[0,5],choos:[5,7],usual:[0,3],less:3,bhdelbr5jbpjcj5aid76mfr8:7,fingerprint:3,asn1_tim:3,obtain:[3,7],tcp:[0,6],a4mgiy2kwwfie73qiyv7yyg8flrvr1iib:5,load_dynamic_engin:3,outform:7,smime_error:[3,7],makefil:[3,6],discuss:5,"_top":2,add:[3,2,6],valid:[0,3,4,5,6,7],crack:7,bool:6,logger:2,match:[3,5,7],gmt:[7,5,2],threadingmixin:6,xmlrpc:2,wyhfg8g3biehurpj2v:7,howto:[0,1,7,5,2],imec:3,realiz:6,set_bio:6,know:7,password:[3,5,7],rsaerror:3,verify_asn1:3,insert:3,x509_extens:3,resid:6,like:[3,5,7],success:[3,6],set_shutdown:6,nihuwgujn:5,ieucourgcxpyd1j65vt7ob3ziypu2f2nluicynqpg1sd:7,necessari:3,vuzalydffdfutiqqzys4z:7,page:[1,2,6],backlog:6,zhttp_handler:2,captur:3,linux:0,"export":[6,7],flush:3,proper:6,home:[2,7],transport:3,tmp:7,lead:[3,6],quiet_genparam_callback:3,leak:3,avoid:2,octet:[3,6],overlap:7,leav:[5,7],new_stack_from_d:3,nkasxekr8auhjsbvumrqrl6r0nnsfpzdr1w7pv:7,to_cert:7,httpslib:[0,1,3],standard_html_foot:2,usag:7,isexpir:3,host:[0,3,6],although:0,offset:3,"0x202cf50":6,expiri:3,err_get_error:3,actual:[0,3,6,7],socket:[0,3,6],certchainfil:6,discard:5,vtajp:5,disabl:6,w4d1nnwu8agcpyshsexhc:5,own:[1,2,3,5,6,7],auth_tl:3,ull4d2cldx9ovynykwdezb5dyv0r:7,cnlwdg8xfjaubgnvbamtdvmvtulnrsbtzw5kzxixitafbgkqhkig9w0bcqewennl:7,automag:[3,7],x509_ptr:6,sid_ctx:6,qin7ujpkou61cn7h8dvhr8yw9:7,transfer:[3,7],cqzkt9:5,certmast:5,"function":[0,3,4,2,6,7],set_crit:3,errnum:6,check_param:3,"_pyfre":[3,6],bodi:[4,2],new_extens:3,gain:0,spuriou:4,naccept:2,buf:7,compute_dh_kei:3,count:[4,3,2],ia5str:5,made:0,whether:[3,7],wish:[7,5,2],writeabl:3,displai:[0,7],record:0,gpmpndsyvvceufpluwydim0vkwhgc2:7,data_bio:3,ensur:6,signer:7,otherwis:3,server_address:[0,6],engine_ctrl_cmd_str:3,pin:3,"int":[3,6],dure:[0,3,6],twist:[0,6],ephemer:6,implement:[0,3,7],unset_x509_stor:3,eric:0,cxo23r9wwrnzem:7,probabl:[0,7],e9kybgki7vpojwbz27:5,from_addr:7,xxxerror:4,book:0,pravir:0,load_request:3,set_default:3,out:[3,7,5,6,2],writesequ:6,hu3qdmtcwjd:5,"class":[0,4,3,6,7],counterpan:7,verify_rsassa_pss:3,zhttp_server:2,xmlrpclib:3,indirectli:3,portion:[0,3],sntelhcawulwtifz:7,remove_sess:6},objtypes:{"0":"py:module","1":"py:method","2":"py:function","3":"py:class","4":"py:attribute","5":"py:exception"},titles:["HOWTO: Programming SSL in Python with M2Crypto","Welcome to M2Crypto’s documentation!","1.   ZServerSSL-HOWTO","M2Crypto Package","PGP Package","HOWTO: Creating your own CA with OpenSSL","SSL Package","HOWTO: Programming S/MIME in Python with M2Crypto"],objnames:{"0":["py","module","Python module"],"1":["py","method","Python method"],"2":["py","function","Python function"],"3":["py","class","Python class"],"4":["py","attribute","Python attribute"],"5":["py","exception","Python exception"]},filenames:["howto.ssl","index","ZServerSSL-HOWTO","M2Crypto","M2Crypto.PGP","howto.ca","M2Crypto.SSL","howto.smime"]}) \ No newline at end of file +Search.setIndex({docnames:["M2Crypto","M2Crypto.SSL","ZServerSSL-HOWTO","howto.ca","howto.smime","howto.ssl","index"],envversion:52,filenames:["M2Crypto.rst","M2Crypto.SSL.rst","ZServerSSL-HOWTO.rst","howto.ca.rst","howto.smime.rst","howto.ssl.rst","index.rst"],objects:{"M2Crypto.ASN1":{ASN1_Integer:[0,1,1,""],ASN1_Object:[0,1,1,""],ASN1_String:[0,1,1,""],ASN1_TIME:[0,1,1,""],ASN1_UTCTIME:[0,3,1,""],LocalTimezone:[0,1,1,""]},"M2Crypto.ASN1.ASN1_Integer":{m2_asn1_integer_free:[0,2,1,""]},"M2Crypto.ASN1.ASN1_Object":{m2_asn1_object_free:[0,2,1,""]},"M2Crypto.ASN1.ASN1_String":{as_text:[0,2,1,""],m2_asn1_string_free:[0,2,1,""]},"M2Crypto.ASN1.ASN1_TIME":{get_datetime:[0,2,1,""],m2_asn1_time_free:[0,2,1,""],set_datetime:[0,2,1,""],set_string:[0,2,1,""],set_time:[0,2,1,""]},"M2Crypto.ASN1.LocalTimezone":{dst:[0,2,1,""],tzname:[0,2,1,""],utcoffset:[0,2,1,""]},"M2Crypto.AuthCookie":{AuthCookie:[0,1,1,""],AuthCookieJar:[0,1,1,""],mix:[0,4,1,""],unmix3:[0,4,1,""],unmix:[0,4,1,""]},"M2Crypto.AuthCookie.AuthCookie":{data:[0,2,1,""],expiry:[0,2,1,""],headerValue:[0,2,1,""],isExpired:[0,2,1,""],mac:[0,2,1,""],name:[0,2,1,""],output:[0,2,1,""],value:[0,2,1,""]},"M2Crypto.AuthCookie.AuthCookieJar":{isGoodCookie:[0,2,1,""],isGoodCookieString:[0,2,1,""],makeCookie:[0,2,1,""]},"M2Crypto.BIO":{BIO:[0,1,1,""],BIOError:[0,5,1,""],CipherStream:[0,1,1,""],File:[0,1,1,""],IOBuffer:[0,1,1,""],MemoryBuffer:[0,1,1,""],SSLBio:[0,1,1,""],openfile:[0,4,1,""]},"M2Crypto.BIO.BIO":{bio_ptr:[0,2,1,""],close:[0,2,1,""],fileno:[0,2,1,""],flush:[0,2,1,""],m2_bio_free:[0,2,1,""],read:[0,2,1,""],readable:[0,2,1,""],readline:[0,2,1,""],readlines:[0,2,1,""],reset:[0,2,1,""],seek:[0,2,1,""],should_read:[0,2,1,""],should_retry:[0,2,1,""],should_write:[0,2,1,""],tell:[0,2,1,""],write:[0,2,1,""],write_close:[0,2,1,""],writeable:[0,2,1,""]},"M2Crypto.BIO.CipherStream":{SALT_LEN:[0,3,1,""],close:[0,2,1,""],m2_bio_free:[0,2,1,""],m2_bio_pop:[0,2,1,""],set_cipher:[0,2,1,""],write_close:[0,2,1,""]},"M2Crypto.BIO.File":{close:[0,2,1,""],flush:[0,2,1,""],reset:[0,2,1,""]},"M2Crypto.BIO.IOBuffer":{close:[0,2,1,""],m2_bio_free:[0,2,1,""],m2_bio_pop:[0,2,1,""]},"M2Crypto.BIO.MemoryBuffer":{close:[0,2,1,""],getvalue:[0,2,1,""],read:[0,2,1,""],read_all:[0,2,1,""],write_close:[0,2,1,""]},"M2Crypto.BIO.SSLBio":{do_handshake:[0,2,1,""],set_ssl:[0,2,1,""]},"M2Crypto.BN":{rand:[0,4,1,""],rand_range:[0,4,1,""],randfname:[0,4,1,""]},"M2Crypto.DH":{DH:[0,1,1,""],DHError:[0,5,1,""],gen_params:[0,4,1,""],load_params:[0,4,1,""],load_params_bio:[0,4,1,""],set_params:[0,4,1,""]},"M2Crypto.DH.DH":{check_params:[0,2,1,""],compute_key:[0,2,1,""],gen_key:[0,2,1,""],m2_dh_free:[0,2,1,""],print_params:[0,2,1,""]},"M2Crypto.DSA":{DSA:[0,1,1,""],DSAError:[0,5,1,""],DSA_pub:[0,1,1,""],gen_params:[0,4,1,""],load_key:[0,4,1,""],load_key_bio:[0,4,1,""],load_params:[0,4,1,""],load_params_bio:[0,4,1,""],load_pub_key:[0,4,1,""],load_pub_key_bio:[0,4,1,""],pub_key_from_params:[0,4,1,""],set_params:[0,4,1,""]},"M2Crypto.DSA.DSA":{check_key:[0,2,1,""],gen_key:[0,2,1,""],m2_dsa_free:[0,2,1,""],save_key:[0,2,1,""],save_key_bio:[0,2,1,""],save_params:[0,2,1,""],save_params_bio:[0,2,1,""],save_pub_key:[0,2,1,""],save_pub_key_bio:[0,2,1,""],set_params:[0,2,1,""],sign:[0,2,1,""],sign_asn1:[0,2,1,""],verify:[0,2,1,""],verify_asn1:[0,2,1,""]},"M2Crypto.DSA.DSA_pub":{check_key:[0,2,1,""],save_key:[0,2,1,""],save_key_bio:[0,2,1,""],sign:[0,2,1,""],sign_asn1:[0,2,1,""]},"M2Crypto.EC":{EC:[0,1,1,""],ECError:[0,5,1,""],EC_pub:[0,1,1,""],ec_error:[0,4,1,""],gen_params:[0,4,1,""],get_builtin_curves:[0,4,1,""],load_key:[0,4,1,""],load_key_bio:[0,4,1,""],load_key_string:[0,4,1,""],load_key_string_pubkey:[0,4,1,""],load_pub_key:[0,4,1,""],load_pub_key_bio:[0,4,1,""],pub_key_from_der:[0,4,1,""],pub_key_from_params:[0,4,1,""]},"M2Crypto.EC.EC":{as_pem:[0,2,1,""],check_key:[0,2,1,""],compute_dh_key:[0,2,1,""],gen_key:[0,2,1,""],m2_ec_key_free:[0,2,1,""],pub:[0,2,1,""],save_key:[0,2,1,""],save_key_bio:[0,2,1,""],save_pub_key:[0,2,1,""],save_pub_key_bio:[0,2,1,""],sign_dsa:[0,2,1,""],sign_dsa_asn1:[0,2,1,""],verify_dsa:[0,2,1,""],verify_dsa_asn1:[0,2,1,""]},"M2Crypto.EC.EC_pub":{get_der:[0,2,1,""],get_key:[0,2,1,""],save_key:[0,2,1,""],save_key_bio:[0,2,1,""]},"M2Crypto.EVP":{Cipher:[0,1,1,""],EVPError:[0,5,1,""],HMAC:[0,1,1,""],MessageDigest:[0,1,1,""],PKey:[0,1,1,""],hmac:[0,4,1,""],load_key:[0,4,1,""],load_key_bio:[0,4,1,""],load_key_bio_pubkey:[0,4,1,""],load_key_string:[0,4,1,""],load_key_string_pubkey:[0,4,1,""],pbkdf2:[0,4,1,""]},"M2Crypto.EVP.Cipher":{"final":[0,2,1,""],m2_cipher_ctx_free:[0,2,1,""],set_padding:[0,2,1,""],update:[0,2,1,""]},"M2Crypto.EVP.HMAC":{"final":[0,2,1,""],digest:[0,2,1,""],m2_hmac_ctx_free:[0,2,1,""],reset:[0,2,1,""],update:[0,2,1,""]},"M2Crypto.EVP.MessageDigest":{"final":[0,2,1,""],digest:[0,2,1,""],m2_md_ctx_free:[0,2,1,""],update:[0,2,1,""]},"M2Crypto.EVP.PKey":{"final":[0,2,1,""],as_der:[0,2,1,""],as_pem:[0,2,1,""],assign_rsa:[0,2,1,""],get_modulus:[0,2,1,""],get_rsa:[0,2,1,""],m2_md_ctx_free:[0,2,1,""],m2_pkey_free:[0,2,1,""],reset_context:[0,2,1,""],save_key:[0,2,1,""],save_key_bio:[0,2,1,""],sign_final:[0,2,1,""],sign_init:[0,2,1,""],sign_update:[0,2,1,""],size:[0,2,1,""],update:[0,2,1,""],verify_final:[0,2,1,""],verify_init:[0,2,1,""],verify_update:[0,2,1,""]},"M2Crypto.Engine":{Engine:[0,1,1,""],EngineError:[0,5,1,""],cleanup:[0,4,1,""],load_dynamic:[0,4,1,""],load_dynamic_engine:[0,4,1,""],load_openssl:[0,4,1,""]},"M2Crypto.Engine.Engine":{ctrl_cmd_string:[0,2,1,""],finish:[0,2,1,""],get_id:[0,2,1,""],get_name:[0,2,1,""],init:[0,2,1,""],load_certificate:[0,2,1,""],load_private_key:[0,2,1,""],load_public_key:[0,2,1,""],m2_engine_free:[0,2,1,""],set_default:[0,2,1,""]},"M2Crypto.Err":{M2CryptoError:[0,5,1,""],SSLError:[0,5,1,""],get_error:[0,4,1,""],get_error_code:[0,4,1,""],get_error_func:[0,4,1,""],get_error_lib:[0,4,1,""],get_error_message:[0,4,1,""],get_error_reason:[0,4,1,""],get_x509_verify_error:[0,4,1,""],peek_error_code:[0,4,1,""]},"M2Crypto.RC4":{RC4:[0,1,1,""]},"M2Crypto.RC4.RC4":{"final":[0,2,1,""],rc4_free:[0,2,1,""],set_key:[0,2,1,""],update:[0,2,1,""]},"M2Crypto.RSA":{RSA:[0,1,1,""],RSAError:[0,5,1,""],RSA_pub:[0,1,1,""],gen_key:[0,4,1,""],keygen_callback:[0,4,1,""],load_key:[0,4,1,""],load_key_bio:[0,4,1,""],load_key_string:[0,4,1,""],load_pub_key:[0,4,1,""],load_pub_key_bio:[0,4,1,""],new_pub_key:[0,4,1,""],rsa_error:[0,4,1,""]},"M2Crypto.RSA.RSA":{as_pem:[0,2,1,""],check_key:[0,2,1,""],m2_rsa_free:[0,2,1,""],private_decrypt:[0,2,1,""],private_encrypt:[0,2,1,""],pub:[0,2,1,""],public_decrypt:[0,2,1,""],public_encrypt:[0,2,1,""],save_key:[0,2,1,""],save_key_bio:[0,2,1,""],save_key_der:[0,2,1,""],save_key_der_bio:[0,2,1,""],save_pem:[0,2,1,""],save_pub_key:[0,2,1,""],save_pub_key_bio:[0,2,1,""],sign:[0,2,1,""],sign_rsassa_pss:[0,2,1,""],verify:[0,2,1,""],verify_rsassa_pss:[0,2,1,""]},"M2Crypto.RSA.RSA_pub":{check_key:[0,2,1,""],private_decrypt:[0,2,1,""],private_encrypt:[0,2,1,""],save_key:[0,2,1,""],save_key_bio:[0,2,1,""]},"M2Crypto.Rand":{load_file:[0,4,1,""],rand_add:[0,4,1,""],rand_bytes:[0,4,1,""],rand_file_name:[0,4,1,""],rand_pseudo_bytes:[0,4,1,""],rand_seed:[0,4,1,""],rand_status:[0,4,1,""],save_file:[0,4,1,""]},"M2Crypto.SMIME":{Cipher:[0,1,1,""],PKCS7:[0,1,1,""],PKCS7_Error:[0,5,1,""],SMIME:[0,1,1,""],SMIME_Error:[0,5,1,""],load_pkcs7:[0,4,1,""],load_pkcs7_bio:[0,4,1,""],load_pkcs7_bio_der:[0,4,1,""],load_pkcs7_der:[0,4,1,""],smime_load_pkcs7:[0,4,1,""],smime_load_pkcs7_bio:[0,4,1,""],text_crlf:[0,4,1,""],text_crlf_bio:[0,4,1,""]},"M2Crypto.SMIME.PKCS7":{get0_signers:[0,2,1,""],m2_pkcs7_free:[0,2,1,""],type:[0,2,1,""],write:[0,2,1,""],write_der:[0,2,1,""]},"M2Crypto.SMIME.SMIME":{decrypt:[0,2,1,""],encrypt:[0,2,1,""],load_key:[0,2,1,""],load_key_bio:[0,2,1,""],set_cipher:[0,2,1,""],set_x509_stack:[0,2,1,""],set_x509_store:[0,2,1,""],sign:[0,2,1,""],unset_cipher:[0,2,1,""],unset_key:[0,2,1,""],unset_x509_stack:[0,2,1,""],unset_x509_store:[0,2,1,""],verify:[0,2,1,""],write:[0,2,1,""]},"M2Crypto.SSL":{Checker:[1,0,0,"-"],Cipher:[1,0,0,"-"],Connection:[1,0,0,"-"],Context:[1,0,0,"-"],SSLError:[1,5,1,""],SSLServer:[1,0,0,"-"],SSLTimeoutError:[1,5,1,""],Session:[1,0,0,"-"],TwistedProtocolWrapper:[1,0,0,"-"],cb:[1,0,0,"-"],ssl_dispatcher:[1,0,0,"-"],timeout:[1,0,0,"-"]},"M2Crypto.SSL.Checker":{Checker:[1,1,1,""],NoCertificate:[1,5,1,""],SSLVerificationError:[1,5,1,""],WrongCertificate:[1,5,1,""],WrongHost:[1,5,1,""]},"M2Crypto.SSL.Checker.Checker":{numericIpMatch:[1,3,1,""]},"M2Crypto.SSL.Cipher":{Cipher:[1,1,1,""],Cipher_Stack:[1,1,1,""]},"M2Crypto.SSL.Cipher.Cipher":{name:[1,2,1,""],version:[1,2,1,""]},"M2Crypto.SSL.Connection":{Connection:[1,1,1,""]},"M2Crypto.SSL.Connection.Connection":{accept:[1,2,1,""],accept_ssl:[1,2,1,""],bind:[1,2,1,""],clear:[1,2,1,""],clientPostConnectionCheck:[1,3,1,""],close:[1,2,1,""],connect:[1,2,1,""],connect_ssl:[1,2,1,""],fileno:[1,2,1,""],get_cipher:[1,2,1,""],get_cipher_list:[1,2,1,""],get_ciphers:[1,2,1,""],get_context:[1,2,1,""],get_default_session_timeout:[1,2,1,""],get_peer_cert:[1,2,1,""],get_peer_cert_chain:[1,2,1,""],get_session:[1,2,1,""],get_shutdown:[1,2,1,""],get_socket_read_timeout:[1,2,1,""],get_socket_write_timeout:[1,2,1,""],get_state:[1,2,1,""],get_verify_depth:[1,2,1,""],get_verify_mode:[1,2,1,""],get_verify_result:[1,2,1,""],get_version:[1,2,1,""],getpeername:[1,2,1,""],getsockname:[1,2,1,""],getsockopt:[1,2,1,""],listen:[1,2,1,""],m2_bio_free:[1,2,1,""],m2_ssl_free:[1,2,1,""],makefile:[1,2,1,""],pending:[1,2,1,""],read:[1,2,1,""],recv:[1,2,1,""],recv_into:[1,2,1,""],renegotiate:[1,2,1,""],send:[1,2,1,""],sendall:[1,2,1,""],serverPostConnectionCheck:[1,2,1,""],set_accept_state:[1,2,1,""],set_bio:[1,2,1,""],set_cipher_list:[1,2,1,""],set_client_CA_list_from_context:[1,2,1,""],set_client_CA_list_from_file:[1,2,1,""],set_connect_state:[1,2,1,""],set_post_connection_check_callback:[1,2,1,""],set_session:[1,2,1,""],set_session_id_ctx:[1,2,1,""],set_shutdown:[1,2,1,""],set_socket_read_timeout:[1,2,1,""],set_socket_write_timeout:[1,2,1,""],set_ssl_close_flag:[1,2,1,""],set_tlsext_host_name:[1,2,1,""],setblocking:[1,2,1,""],setsockopt:[1,2,1,""],settimeout:[1,2,1,""],setup_addr:[1,2,1,""],setup_ssl:[1,2,1,""],shutdown:[1,2,1,""],ssl_get_error:[1,2,1,""],verify_ok:[1,2,1,""],write:[1,2,1,""]},"M2Crypto.SSL.Context":{Context:[1,1,1,""],ctxmap:[1,4,1,""],map:[1,4,1,""]},"M2Crypto.SSL.Context.Context":{add_session:[1,2,1,""],close:[1,2,1,""],get_allow_unknown_ca:[1,2,1,""],get_cert_store:[1,2,1,""],get_session_cache_mode:[1,2,1,""],get_session_timeout:[1,2,1,""],get_verify_depth:[1,2,1,""],get_verify_mode:[1,2,1,""],load_cert:[1,2,1,""],load_cert_chain:[1,2,1,""],load_client_CA:[1,2,1,""],load_client_ca:[1,2,1,""],load_verify_info:[1,2,1,""],load_verify_locations:[1,2,1,""],m2_ssl_ctx_free:[1,2,1,""],remove_session:[1,2,1,""],set_allow_unknown_ca:[1,2,1,""],set_cipher_list:[1,2,1,""],set_client_CA_list_from_file:[1,2,1,""],set_default_verify_paths:[1,2,1,""],set_info_callback:[1,2,1,""],set_options:[1,2,1,""],set_session_cache_mode:[1,2,1,""],set_session_id_ctx:[1,2,1,""],set_session_timeout:[1,2,1,""],set_tmp_dh:[1,2,1,""],set_tmp_dh_callback:[1,2,1,""],set_tmp_rsa:[1,2,1,""],set_tmp_rsa_callback:[1,2,1,""],set_verify:[1,2,1,""]},"M2Crypto.SSL.SSLServer":{ForkingSSLServer:[1,1,1,""],SSLServer:[1,1,1,""],ThreadingSSLServer:[1,1,1,""]},"M2Crypto.SSL.SSLServer.SSLServer":{handle_error:[1,2,1,""],handle_request:[1,2,1,""]},"M2Crypto.SSL.Session":{Session:[1,1,1,""],load_session:[1,4,1,""]},"M2Crypto.SSL.Session.Session":{as_der:[1,2,1,""],as_text:[1,2,1,""],get_time:[1,2,1,""],get_timeout:[1,2,1,""],m2_ssl_session_free:[1,2,1,""],set_time:[1,2,1,""],set_timeout:[1,2,1,""],write_bio:[1,2,1,""]},"M2Crypto.SSL.TwistedProtocolWrapper":{TLSProtocolWrapper:[1,1,1,""],connectSSL:[1,4,1,""],connectTCP:[1,4,1,""],listenSSL:[1,4,1,""],listenTCP:[1,4,1,""]},"M2Crypto.SSL.TwistedProtocolWrapper.TLSProtocolWrapper":{clear:[1,2,1,""],connectionLost:[1,2,1,""],connectionMade:[1,2,1,""],dataReceived:[1,2,1,""],loseConnection:[1,2,1,""],startTLS:[1,2,1,""],write:[1,2,1,""],writeSequence:[1,2,1,""]},"M2Crypto.SSL.cb":{ssl_info_callback:[1,4,1,""],ssl_verify_callback:[1,4,1,""],ssl_verify_callback_allow_unknown_ca:[1,4,1,""],ssl_verify_callback_stub:[1,4,1,""]},"M2Crypto.SSL.ssl_dispatcher":{ssl_dispatcher:[1,1,1,""]},"M2Crypto.SSL.ssl_dispatcher.ssl_dispatcher":{connect:[1,2,1,""],create_socket:[1,2,1,""],recv:[1,2,1,""],send:[1,2,1,""]},"M2Crypto.SSL.timeout":{struct_size:[1,4,1,""],struct_to_timeout:[1,4,1,""],timeout:[1,1,1,""]},"M2Crypto.SSL.timeout.timeout":{pack:[1,2,1,""]},"M2Crypto.X509":{CRL:[0,1,1,""],Request:[0,1,1,""],X509:[0,1,1,""],X509Error:[0,5,1,""],X509_Extension:[0,1,1,""],X509_Extension_Stack:[0,1,1,""],X509_Name:[0,1,1,""],X509_Name_Entry:[0,1,1,""],X509_Stack:[0,1,1,""],X509_Store:[0,1,1,""],X509_Store_Context:[0,1,1,""],load_cert:[0,4,1,""],load_cert_bio:[0,4,1,""],load_cert_der_string:[0,4,1,""],load_cert_string:[0,4,1,""],load_crl:[0,4,1,""],load_request:[0,4,1,""],load_request_bio:[0,4,1,""],load_request_der_string:[0,4,1,""],load_request_string:[0,4,1,""],new_extension:[0,4,1,""],new_stack_from_der:[0,4,1,""],x509_store_default_cb:[0,4,1,""]},"M2Crypto.X509.CRL":{as_text:[0,2,1,""],m2_x509_crl_free:[0,2,1,""]},"M2Crypto.X509.Request":{add_extensions:[0,2,1,""],as_der:[0,2,1,""],as_pem:[0,2,1,""],as_text:[0,2,1,""],get_pubkey:[0,2,1,""],get_subject:[0,2,1,""],get_version:[0,2,1,""],m2_x509_req_free:[0,2,1,""],save:[0,2,1,""],save_pem:[0,2,1,""],set_pubkey:[0,2,1,""],set_subject:[0,2,1,""],set_subject_name:[0,2,1,""],set_version:[0,2,1,""],sign:[0,2,1,""],verify:[0,2,1,""]},"M2Crypto.X509.X509":{add_ext:[0,2,1,""],as_der:[0,2,1,""],as_pem:[0,2,1,""],as_text:[0,2,1,""],check_ca:[0,2,1,""],check_purpose:[0,2,1,""],get_ext:[0,2,1,""],get_ext_at:[0,2,1,""],get_ext_count:[0,2,1,""],get_fingerprint:[0,2,1,""],get_issuer:[0,2,1,""],get_not_after:[0,2,1,""],get_not_before:[0,2,1,""],get_pubkey:[0,2,1,""],get_serial_number:[0,2,1,""],get_subject:[0,2,1,""],get_version:[0,2,1,""],m2_x509_free:[0,2,1,""],save:[0,2,1,""],save_pem:[0,2,1,""],set_issuer:[0,2,1,""],set_issuer_name:[0,2,1,""],set_not_after:[0,2,1,""],set_not_before:[0,2,1,""],set_pubkey:[0,2,1,""],set_serial_number:[0,2,1,""],set_subject:[0,2,1,""],set_subject_name:[0,2,1,""],set_version:[0,2,1,""],sign:[0,2,1,""],verify:[0,2,1,""]},"M2Crypto.X509.X509_Extension":{get_critical:[0,2,1,""],get_name:[0,2,1,""],get_value:[0,2,1,""],m2_x509_extension_free:[0,2,1,""],set_critical:[0,2,1,""]},"M2Crypto.X509.X509_Extension_Stack":{m2_sk_x509_extension_free:[0,2,1,""],pop:[0,2,1,""],push:[0,2,1,""]},"M2Crypto.X509.X509_Name":{add_entry_by_txt:[0,2,1,""],as_der:[0,2,1,""],as_hash:[0,2,1,""],as_text:[0,2,1,""],entry_count:[0,2,1,""],get_entries_by_nid:[0,2,1,""],m2_x509_name_free:[0,2,1,""],nid:[0,3,1,""]},"M2Crypto.X509.X509_Name_Entry":{create_by_txt:[0,2,1,""],get_data:[0,2,1,""],get_object:[0,2,1,""],m2_x509_name_entry_free:[0,2,1,""],set_data:[0,2,1,""],set_object:[0,2,1,""]},"M2Crypto.X509.X509_Stack":{as_der:[0,2,1,""],m2_sk_x509_free:[0,2,1,""],pop:[0,2,1,""],push:[0,2,1,""]},"M2Crypto.X509.X509_Store":{add_cert:[0,2,1,""],add_x509:[0,2,1,""],load_info:[0,2,1,""],load_locations:[0,2,1,""],m2_x509_store_free:[0,2,1,""],set_verify_cb:[0,2,1,""]},"M2Crypto.X509.X509_Store_Context":{get1_chain:[0,2,1,""],get_current_cert:[0,2,1,""],get_error:[0,2,1,""],get_error_depth:[0,2,1,""],m2_x509_store_ctx_free:[0,2,1,""]},"M2Crypto.ftpslib":{FTP_TLS:[0,1,1,""]},"M2Crypto.ftpslib.FTP_TLS":{auth_ssl:[0,2,1,""],auth_tls:[0,2,1,""],ntransfercmd:[0,2,1,""],prot_c:[0,2,1,""],prot_p:[0,2,1,""]},"M2Crypto.httpslib":{HTTPSConnection:[0,1,1,""],ProxyHTTPSConnection:[0,1,1,""]},"M2Crypto.httpslib.HTTPSConnection":{close:[0,2,1,""],connect:[0,2,1,""],default_port:[0,3,1,""],get_session:[0,2,1,""],set_session:[0,2,1,""]},"M2Crypto.httpslib.ProxyHTTPSConnection":{connect:[0,2,1,""],endheaders:[0,2,1,""],putheader:[0,2,1,""],putrequest:[0,2,1,""]},"M2Crypto.m2urllib":{open_https:[0,4,1,""]},"M2Crypto.m2urllib2":{HTTPSHandler:[0,1,1,""],build_opener:[0,4,1,""]},"M2Crypto.m2urllib2.HTTPSHandler":{https_open:[0,2,1,""],https_request:[0,2,1,""]},"M2Crypto.m2xmlrpclib":{SSL_Transport:[0,1,1,""]},"M2Crypto.m2xmlrpclib.SSL_Transport":{request:[0,2,1,""],user_agent:[0,3,1,""]},"M2Crypto.threading":{cleanup:[0,4,1,""],init:[0,4,1,""]},"M2Crypto.util":{UtilError:[0,5,1,""],bin_to_hex:[0,4,1,""],genparam_callback:[0,4,1,""],no_passphrase_callback:[0,4,1,""],octx_to_num:[0,4,1,""],passphrase_callback:[0,4,1,""],pkcs5_pad:[0,4,1,""],pkcs7_pad:[0,4,1,""],py3bytes:[0,4,1,""],py3str:[0,4,1,""],quiet_genparam_callback:[0,4,1,""]},M2Crypto:{ASN1:[0,0,0,"-"],AuthCookie:[0,0,0,"-"],BIO:[0,0,0,"-"],BN:[0,0,0,"-"],DH:[0,0,0,"-"],DSA:[0,0,0,"-"],EC:[0,0,0,"-"],EVP:[0,0,0,"-"],Engine:[0,0,0,"-"],Err:[0,0,0,"-"],RC4:[0,0,0,"-"],RSA:[0,0,0,"-"],Rand:[0,0,0,"-"],SMIME:[0,0,0,"-"],SSL:[1,0,0,"-"],X509:[0,0,0,"-"],__init__:[0,0,0,"-"],callback:[0,0,0,"-"],ftpslib:[0,0,0,"-"],httpslib:[0,0,0,"-"],m2:[0,0,0,"-"],m2crypto:[0,0,0,"-"],m2urllib2:[0,0,0,"-"],m2urllib:[0,0,0,"-"],m2xmlrpclib:[0,0,0,"-"],threading:[0,0,0,"-"],util:[0,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","attribute","Python attribute"],"4":["py","function","Python function"],"5":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:attribute","4":"py:function","5":"py:exception"},terms:{"059600270x":5,"0ipy80":4,"0jwuq":4,"0qjhp6hut7fso":4,"0x0":[3,4],"0x1":3,"0x10001":[3,4],"0x2":[3,4],"0x822012c":4,"19973a9dbbb601ba":3,"1bc9f3q":4,"1czdztgk7h9cdgx2qjsivymyytcfi3zsuzmjs8":3,"1dr9dy8l0naqh21y5fgss8b1wd":4,"1ezn9zmlryqzbtxnnrmp3dhj":4,"1g9epovswhpqr":4,"1hxxfyo88m":3,"1qk53c":3,"1t8luishhn9899imp2vyg0ub67fqfypymm2cm2":4,"1tcaqbmq":4,"1vsrcid":3,"217mrhyx2nswgrpkqndu3gespovml3jeqiaxuponbwq7rj42":3,"2aglpogdcfdioqblb2dcscohmbbvr":3,"2bconvert":1,"2bdqvfpffx5lsmitkzaobldssjfr6rojxoqrsgia2az":4,"2cjcbfzokmijci03kbtqxofiqglstwxgzknf":3,"2dnyol50zu0sdzst1":3,"2iwrpascbeid8saraql3ddcli":3,"2zz2g7x1hxrwh95a":4,"3c93156fc7b4ebf49fe9c7db7f503087":4,"3dizhtxigepfztiuyutxs3i2gnmx2pee3chtllywd3jneakz0iozpdphif2xhllq":4,"3pjiyfhaxk64iutmpsy393rhmeb4kn":4,"3wf7q915tveqoc74bnu6b8ibbgrmhzdzmvq4szffveaum":3,"41b2874df3d02dd4":3,"4ju6":4,"4mpgg20wd633d4z4dtlddz":3,"4oxll0bi":3,"509v3":2,"56vrpgppgut40hv8xqfbwiz2whwwlkpfahj8b79ztfuzuru6z2rnpvv8inhc":4,"5efdvbet":3,"6l0g37faxur3xm28rchzvhu":3,"76h5jiznpbdsf2fjghwqvvdgyw4owy3mu739lhvnblicn":3,"7ay4jsdhyibcmgsq":3,"7pvwhtszeyhn3oa9dhlmv9uqc4wy5md7j":3,"7zjt2r5cpikgkwofamduxeltx":3,"8caweaaaaama0gcsqgsib3dqebbauaa4gb":3,"8czydsolmyibujccabycaqewydbbmqswcqydvqqgewjtrzerma8ga1uechmittjd":4,"8levy0cllw":3,"8tsi3wo5enkg4qwbnarqc3vgcv":4,"8yhspd0caweaaaobtjcbszadbgnvhq4efgquxoyoll1t4jabwzfrm7ms8nblzuow":4,"974aklcjnk1gzigarz":4,"9gul1bxbckrtedtxenqtem7spzomtswd2lhb8z65grx90cyt":4,"9ij5z6mja7rm7ttbsjup":4,"9rsqkrc9urv9mrbisredgnyecnerak5r1yzpoowninxc":3,"9znlfejkjj67vembxbj":4,"abstract":[0,4],"break":2,"byte":[0,1],"case":[1,4,5],"class":[0,1,4,5],"default":[0,1,2,3,4,5],"export":[1,4],"final":[0,4],"float":0,"function":[0,1,2,4,5],"import":[0,1,2,4],"int":[0,1],"long":[1,5],"new":[0,1,2,3,4],"null":[0,1],"public":[0,3,4],"return":[0,1,4,5],"true":[0,1,4],"while":[0,1,2,4],AND:1,CAs:1,DES:[3,4],DNS:[0,5],Doing:0,For:[0,1,2,3,4],HAS:1,Its:0,NOT:[0,1],Not:[3,4],THE:1,TLS:[0,1,5],That:[3,4],The:[0,1,2,4,5],There:[1,3,4,5],These:[1,2],Use:[0,1,5],Using:[3,4,5],WILL:1,With:2,__del__:1,__init__:2,_alwayssucceedspostconnectioncheck:1,_close_cb:0,_debug:0,_mode_:1,_ptr:0,_pyfre:[0,1],_pyfree_x509:0,_sre:[0,1],_timeout_:1,_top:2,a4mgiy2kwwfie73qiyv7yyg8flrvr1iib:3,aaiavb8w:4,abl:4,about:[0,1,3,4],abov:[0,1,2,4,5],absent:1,absolut:0,abstracthttphandl:0,accept:[1,2,3,4,5],accept_ssl:1,access:[2,4],accord:[0,1],acl_us:2,acquir:0,action:1,actual:[0,1,4,5],actualhost:1,add:[0,1,2],add_cert:0,add_entry_by_txt:0,add_ext:0,add_extens:0,add_sess:1,add_x509:0,added:[0,1],addhead:2,addinfourl:0,adding:1,addit:[0,1,5],addr:1,address:[1,3,4,5],admin:3,administr:4,advanc:3,adversari:0,aes_128_cbc:0,aetir4v7sgxmepx7thq1pv:4,affect:1,afresh:3,after:[0,1,3,4,5],again:[0,3,4],against:0,agent:2,aggtjgplibexlzalhpwlz9laqyrqpvcvjywaovfmmvrav4nafnoz2:4,ago:3,ahau6kwk:4,ahporp5ys55czpi:3,aka:0,akbr4il1nkq8ecsmcr3wpa0i9n0ehi7zvpvahxc0sqapfl8ygdfhq:3,alert:1,alg:0,algo:0,algorigthm:0,algorithm:[0,3,4],alia:0,aliv:1,all:[0,1,3,5],allow:[0,1,3,5],almost:0,along:0,alreadi:1,also:[0,1,2,3,4,5],alt:2,altern:[1,2],although:5,alwai:[0,4],amyxludrk45acua:3,analys:5,ani:[0,1,5],anoth:[1,3],anyon:4,anyth:5,aogabaku8w3w1qu15hle1bjsl7gmreoreqeblobmmazz4by0l6sxzxjpjwxo86f:3,apach:2,api:[0,1],appear:2,append:0,appli:[0,2,3],applic:[0,1,3,4,5],approach:4,appropri:[0,1,5],aqh:4,arg:[0,1],argument:0,argv:0,arm:4,around:2,as_der:[0,1],as_hash:0,as_pem:0,as_text:[0,1],ask:[0,3,4],asn1:6,asn1_integ:0,asn1_object:0,asn1_str:0,asn1_string_print_ex:0,asn1_tim:0,asn1_utctim:0,asn1int:0,asn1obj:0,asn1str:0,assign:[0,1],assign_rsa:0,associ:1,assum:[1,2,4],asyncio:1,asyncor:[1,2],attach:4,attempt:[0,5],attribut:[0,3,4],auth:0,auth_ssl:0,auth_tl:0,authcooki:6,authcookiejar:0,authent:4,author:[0,2,3,4,5],autom:4,automag:[0,4],automat:[1,5],avail:[1,2,4,5],avoid:2,awai:[0,1],awfqq4jcc:4,awihma0gccqgsib3dqmcageoma0gcsqgsib3dqebaquabigaqpu8hfutlcf6ho2t:4,ax96lvs0:3,b4law8g59vtg6dykeetrg0rubx4bggc7pkbfuin423yjjodwchvvgnpozxmqt:3,b4txejzriyc8f3:4,b6gr5s8:4,b6ugcsqgsib3dqehataubggqhkig9w0dbwqirf525ufwszaaggea85rmx6axqmxb:4,b75:3,b877j9wbpbl:3,b9zjffauqtwzdnjgrkkyikhwjdojaac:4,backlog:1,bad:1,base64:4,base:[0,1,2,3,4,5],basi:1,basic:[3,4],bat:2,bdclcn8a:4,becaus:[0,1,4],been:[0,1,4],befor:[0,1,3,4,5],began:3,begin:[3,4,5],behav:1,behaviour:1,being:[0,1,4],below:2,best:5,better:0,between:5,beyond:4,bgbyj1dubkhzsc7dgxzdtuclgnxqnnsg:3,bgcolor:2,bgkqhkig9w0bbwewfayikozihvcnawcecmn:4,bgkqhkig9w0bbwewhayjkozihvcnaqkfmq8xdtaxmdmzmtexnduwmlowiwyjkozi:4,bhdelbr5jbpjcj5aid76mfr8:4,bhmcu0cxetapbgnvbaotce0yq3j5chrvmrkwfwydvqqdexbtl01jtuugumvjaxbp:4,big:0,bin_to_hex:0,binari:[0,1],bind:1,bind_and_activ:1,bindaddress:1,binstr:1,bio:[1,4,5,6],bio_clos:1,bio_f_buff:0,bio_f_ciph:0,bio_f_ssl:0,bio_fre:1,bio_in:0,bio_noclos:1,bio_ptr:0,bio_push:0,bio_s_mem:0,bio_s_pyfd:0,bioerror:0,bit:[0,1,3,4],bitmask:1,bitwis:0,bjq5hnxbouslq0rwbrkoxv64i:4,blank:[3,4],blklen:0,blob:[0,4],block:1,blwegdqhonaiwbk5z1l:4,bmrlckblegftcgxllmrvbqibadajbgurdgmcgguaoigxmbggcsqgsib3dqejazel:4,bmvnwbppufzpiaivalycjt6pyextbbszs7:3,bo2w7ei6iejbazk:3,bodi:2,book:5,bool:1,border:2,both:[0,1,2],bottom:[0,4],bound:[0,1],boundari:4,box:[2,4],br77:3,bring:4,brows:2,browser:2,browser_id_manag:2,buf:[0,4],buf_len:0,buff:1,buffer:[0,1,4,5],buffer_s:1,buffers:1,buflen:1,bufsiz:1,build_open:0,built:1,builtin:0,bundl:[2,3,4],bxwxkuuvt81vbjwdn9jst6:4,c6fi3n03rgfmkectijc:3,cacert:[1,3],cach:1,cadav:2,cafil:1,cakei:3,calcul:0,call:[0,1,3,4,5],callabl:[0,1],callback:[1,6],caller:1,can:[0,1,2,3,4,5],capath:1,captur:0,cat:3,catalog:2,catop:3,cbc:[3,4],ccrt2tfwkbbfleuifl7mb:3,ccvkzzl:3,cenfqfwc:4,cepl:0,cert:[0,1,4,5],certain:[0,1,3],certbio:0,certchainfil:1,certdata2pem:5,certdata:5,certfil:[0,1],certif:[0,1,2,3,5],certifi:[3,4],certmast:3,cgyikozihvcnawcwdgyikozihvcnawicagcama0gccqgsib3dqmcagfamacgbsso:4,chain:[0,1,5],challeng:3,chandra:5,chang:[0,1],channel:[1,2],charact:0,cheap:4,check:[0,1,2,3,5],check_ca:0,check_kei:0,check_param:0,check_purpos:0,checker:[0,5,6],choos:[3,4],chosen:5,cipher:[0,4,5,6],cipher_list:1,cipher_stack:1,cipherstream:0,citi:[3,4],claim:5,clbwev3ryfrlp4x8j9mdte0ykok3t0wqohqrettsifdtjnfp:3,clean:[0,1],cleanup:0,clear:[0,1,3,4],click:[2,4],client:[0,1,4,5],client_addr:0,client_address:1,clientpostconnectioncheck:1,close:[0,1,2,4],close_flag:0,close_pyfil:0,clutter:2,cmd:0,cnf:[3,4],cngeq1qxtyduiguda2nbgcl:4,cnlwdg8xfjaubgnvbamtdvmvtulnrsbtzw5kzxixitafbgkqhkig9w0bcqewennl:4,code:[0,1,3,4],coll:2,collect:[2,5],com:[0,2,3,4,5],combin:1,come:[0,3,5],command:[3,5],comment:3,commerci:4,commit:3,common:[3,4,5],commonli:4,commonnam:[0,1,3,5],commun:[0,1],compani:[3,4],companion:4,compar:5,compat:5,compil:0,complet:[0,1],compos:2,composit:0,comput:0,compute_dh_kei:0,compute_kei:0,concaten:1,configur:[3,4],conn:0,connect:[0,2,4,5,6],connect_ssl:1,connectionlost:1,connectionmad:1,connectssl:1,connecttcp:1,consid:1,consist:[0,4],constant:[0,1],constrain:3,constraint:[3,4],consum:4,contain:[0,1,2,4],content:[0,1,4,6],context:[0,5,6],contextfactori:1,continu:1,control:[0,1,5],control_panel:2,conveni:1,convert:[0,5],cooki:0,cookie_str:0,copi:[1,2,3],copyright:[0,1,2,3,4,5],corner:4,correct:[1,4],correctli:4,correspond:4,could:[0,1,5],count:[0,2],counterpan:4,countri:[3,4],countrynam:3,cours:[3,4],cover:3,coz:4,cqydvqqgewjtrzerma8ga1uechmittjdcnlwdg8xfjaubgnvbamtdvmvtulnrsbt:4,cqzkt9:3,crack:4,crash:0,creat:[0,1,2,4,5,6],create_by_txt:0,create_socket:1,creation:[1,3],credit:2,critic:0,crl:0,cryptograph:[0,4],css:2,cstringio:0,ctrl_cmd_string:0,ctx:[0,1,5],ctxmap:1,current:[0,1,4],curv:0,custom:1,cvzrxakeaxno80arbgxpumr11ghg:3,cw8kzzwh:4,cxo23r9wwrnzem:4,d2i_ssl_sess:1,dai:[3,4],dasmytmpc4ztytv06n07afbjl:3,dat:[2,4],data:[0,1,2,3,4,5],data_bio:0,databas:3,datareceiv:1,date:[0,2,5],datetim:0,dav:2,dcwd:4,ddlzqbacuxwtv5xy8plmx7widaqab:3,dec:2,decid:[1,3],decis:3,decod:[1,3,5],decrypt:[0,5],def:4,default_port:0,defin:1,dek:3,delet:0,demo:[2,3,4,5],democa:3,demonstr:[3,4,5],depend:[0,1,2,4],deploi:3,depth:[0,1,5],der:[0,4],der_str:0,deriv:0,des_ede3_cbc:4,describ:[0,1],descript:0,desktop:2,detail:0,determin:0,dev:2,develop:3,dh1024:2,dherror:0,dhpfile:1,dialog:[2,4],did:[1,3],differ:[1,5],diffi:[0,2],digest:[0,4,5],digit:4,directli:[1,5],directori:[1,2,3,5],dirnam:[3,4],disabl:[0,1],discard:3,discuss:3,dispatch:1,displai:[4,5],dispos:1,disposit:4,distinguish:[1,3,4],distribut:[2,5],ditto:0,dnli0rvuvxiwt:3,do_handshak:0,document:[1,2,3,4,5],doe:[0,1,5],doesn:1,dog:4,dom:[3,4],don:0,done:[1,2],dough:0,down:1,download:[2,4,5],dqehaaavbbnhihnpz24gb2ygb3vyihrpbwvzoiic5zccaumwggjmoamcaqicaqaw:4,dqyjkozihvcnaqeebqawwzelmakga1uebhmcu0cxetapbgnvbaotce0yq3j5chrv:4,dsa:[4,5,6],dsa_pub:0,dsaerror:0,dst:0,due:1,duhrqiml1tyi:3,duqhj2ygkkwdqq9v0xscjkgiyw:3,dure:[0,1,5],dw0boozhj8tc7co7lmyb0ye271b6:3,dyman:0,dynam:0,e9kybgki7vpojwbz27:3,e_n:0,each:[0,1,4],eawm5avuv7hnptt5zr:4,eaydvqqdewlsb2nhbghvc3qxjzalbgkqhkig9w0bcqewggfkbwluqhnlcnzlci5l:3,ebdz:4,ec9eyj:4,ec_error:0,ec_pub:0,ecdh:0,ecdsa:0,ecerror:0,ede3:[3,4],effect:4,egftcgxllmrvbtcbnzanbgkqhkig9w0baqefaaobjqawgykcgyear1nyy1qrll1r:3,either:[0,1],electron:4,els:[0,1,3,4],email:[0,3,4],emailaddress:[0,3],emmarsgyedf5h1afl1smkomskbqxe1d2jg:4,empir:0,emploi:5,enabl:[1,4],encod:[0,1,2,4],encrypt:[0,1,3],end:[0,1,3],endhead:0,endian:0,engin:[1,6],engine_ctrl_cmd_str:0,engine_method_:0,engineerror:0,enhanc:5,enough:0,ensu:4,ensur:[0,1],enter:[0,2,3,4],entri:[0,3],entropi:0,entry_count:0,environ:[0,1],eopzyno4mi:4,eoq9wfscnii4:3,eovbgs7ezalvvkdj4hnl:4,eozfol5i20ykiv6j:4,ephemer:1,epoch:0,epollreactor:1,equival:[0,1],eric:5,err:[4,6],err_get_error:0,errdepth:1,errnum:1,error:[0,1,4],error_log:2,establish:[0,1,5],estim:0,etag:2,etc:[0,1],etwitreft1heupnar:4,even:0,event:0,evp:6,evp_ciph:0,evperror:0,ewjtrzerma8ga1uechmittjdcnlwdg8xfjaubgnvbamtdvmvtulnrsbtzw5kzxix:4,exampl:[0,1,2,3,4,5],except:[0,1,5],exchang:[0,5],execut:[3,4],exist:[2,3],exit:0,exiy8geir:4,exp:0,expect:0,expectedhost:1,expir:[0,1,3],expiri:0,explain:4,explan:1,explicitli:1,explor:4,expon:[0,3,4],ext:0,ext_stack:0,extens:[0,1,3,4],extern:1,extra:3,extract:1,facilit:3,factori:[0,1],fail:[0,1],failur:[0,1,4],fakesocket:5,fals:[0,1,3],famili:1,fancyurlopen:2,faq:0,farm:2,fashion:2,fatal:1,fcgiserv:2,fcmspp3auq1:4,featur:5,feed:0,feedback:0,few:[3,4],ffffff:2,fi1wdpphywke97pojizvqesfzopty5hjiyzux4u:3,field:[0,3,4,5],fieldnam:1,fifth:5,file:[0,1,2,3,4,5],filenam:[0,1,3,4],fileno:[0,1],find:1,fingerprint:0,finish:[0,1],first:[0,4,5],fixm:1,flag:[0,1,4,5],flndpcnkrtvqdx3rt6x6vbttcyom:4,flowinfo:1,flush:0,fmt7a120s3gd2jixgh06l:4,follow:[0,2,3,4,5],forgotten:3,forkingmixin:1,forkingsslserv:1,form:[0,1,5],format:[0,1,4,5],format_d:0,format_format_d:0,format_pem:0,found:[0,1],foundat:[1,5],four:1,fourth:5,fqlcrrr5nvupdin:3,freebsd:2,freed:1,freeli:4,freewar:4,friendli:4,frill:0,from:[0,1,2,3,4,5],from_addr:4,from_cert:4,from_kei:4,ftp:[0,2],ftp_tl:0,ftplib:0,ftpserver:2,ftpslib:6,full:[3,4],further:1,fv4sgm3jkr:4,g3bgsmvlxkefztfjkxo6xnjcbnf5i:4,g7ppoo:3,gain:5,gd58p4mpmhu5iknz4yh4nlhnaitevcs85tzuaxze9g:4,gen_kei:0,gen_param:0,gener:[0,1,3,4],genparam_callback:0,get0_sign:0,get1_chain:0,get:[0,1,2],get_allow_unknown_ca:1,get_builtin_curv:0,get_cert_stor:1,get_ciph:1,get_cipher_list:1,get_context:1,get_crit:0,get_current_cert:0,get_data:0,get_datetim:0,get_default_session_timeout:1,get_der:0,get_entries_by_nid:0,get_error:[0,1,4],get_error_cod:0,get_error_depth:0,get_error_func:0,get_error_lib:0,get_error_messag:0,get_error_reason:0,get_ext:0,get_ext_at:0,get_ext_count:0,get_fingerprint:0,get_id:0,get_issu:0,get_kei:0,get_modulu:0,get_nam:0,get_not_aft:0,get_not_befor:0,get_object:0,get_peer_cert:1,get_peer_cert_chain:1,get_pubkei:0,get_rsa:0,get_serial_numb:0,get_sess:[0,1],get_session_cache_mod:1,get_session_timeout:1,get_shutdown:1,get_socket_read_timeout:1,get_socket_write_timeout:1,get_stat:1,get_subject:0,get_tim:1,get_timeout:1,get_valu:0,get_verify_depth:1,get_verify_mod:1,get_verify_result:1,get_vers:[0,1],get_x509_verify_error:0,getpeernam:1,getproto:1,getronicsgov:4,getsocknam:1,getsockopt:1,geturl:0,getvalu:0,ggarfmmj4yuhewkys9jo1h8k4bdxugmauwni5:3,give:3,given:[0,1],givennam:0,gknqqdblotqt06f3oissdjetm2itllyhgzv:3,global:4,gmt:[2,3,4],goe:[0,1],good:0,govern:3,gpmpndsyvvceufpluwydim0vkwhgc2:4,gqnveov:3,gqzcvnzzcmx8uvrjqr8drwdsmpj0vxg1:4,gratefulli:4,grcgzeb9ymfcedxahtdufhjrkpdpsxzzvvgksbncbqu92obyqvnrq8m:4,grew:5,group:4,gucrblvd7n3ofnx5ujmpmcw9zwbu:4,gvyvi:4,gymga1udiwr8mhqaffzsqjs9bei2gcgrutozevjws81kov:4,h7nmicymi2wkz8h:4,h99suto:3,h9diul:3,hack:2,handi:3,handl:4,handle_error:1,handle_request:1,handler:[0,1],handshak:[0,1],hanson:3,happen:5,hard:0,hardwar:0,has:[0,1,4,5],hash:0,have:[1,3,4],hcyiukxujtaqtxboh:4,head:2,header:[0,2],headervalu:0,height:2,heikki:[1,5],hellman:[0,2],henc:3,henceforth:2,here:[0,3,4],hex:0,hihsrgwtnd7lnxuucpx8yv1id0dlmp0hz:4,his:4,hkig9w0baqefaaobjqawgykcgyea5c5tj1chtsoxa1q2q0fyiwmwyhptjpjcvtzm:4,hmac:[0,4,5],hold:0,home:[0,2,4],hook:1,host:[0,1,5],hostnam:1,hot:4,how:[0,1,4,5],howev:1,hpysvh:4,href:2,hrg6sai33usk8xpokjqa:3,htm:4,html:[2,4],http:[0,4,5],http_class:0,httpconnect:[0,5],httplib:[0,5],https_open:0,https_request:0,https_server:2,https_srv:4,httpsconnect:[0,5],httpserver:2,httpshandler:0,httpslib:[5,6],hu3qdmtcwjd:3,hvcnaqkemryefooerud8exiyxfqq8btfukwrsp3imfigcsqgsib3dqejdzffmemw:4,hyswpz1xvlprmv4:3,i2d_ssl_sess:1,ia5str:3,icon:4,ident:[1,2,4,5],identifi:[0,3,4,5],idx:1,ietf:4,ieucourgcxpyd1j65vt7ob3ziypu2f2nluicynqpg1sd:4,ignor:0,iihwd6gtv1uodf7urbxtl3hq9:4,imap:4,imc:4,imec:0,img:2,immedi:1,implement:[0,4,5],imqqiiw:4,includ:[0,3],incorpor:[3,4],increas:0,indent:0,index:[0,6],index_html:2,indic:[1,4],indirectli:0,info:[0,3,4],inform:[0,1,2,3,4,5],inherit:[0,1],init:0,initi:[0,1],initialis:[0,1],inkei:4,input:[0,1,5],insert:0,instal:4,instanc:[0,1,4,5],instanti:[0,4],instead:[2,4],instruct:2,integ:1,integr:4,intend:4,interact:0,interest:1,interfac:[0,1,4,5],intern:[0,1],internet:[1,3,4],interpret:[0,1,5],intuit:3,invalid:0,invok:[0,1,2,4],iobuff:[0,5],ioy0bdijcyn1jimohj:4,ipv4:1,ipv6:1,iqwxllnj:4,ir9fggophatzzq:4,ireactorssl:1,ireactortcp:1,isbn:5,isexpir:0,isgoodcooki:0,isgoodcookiestr:0,issu:[1,2,4],issuer:[0,3,4],itafbgkqhkig9w0bcqewennlbmrlckblegftcgxllmrvbyibadambgnvhrmebtad:4,item:0,iter:0,its:[0,1,2,3,4],itself:[0,4],iwq3n6j1suzs3uw6abq8bivynoucmkjaqqjbanqxfalu4b:3,j6wo9dzltioz3znvr3ljsskib4tip4ugqnjaluw7m3ftz3magxn68hbbjs8tz8tl:4,j9ftv3di:3,jan:2,jbt3ltgf743utyaas7hnguouobhoyt:3,jcyhx9vw4xvja7:4,jddsk:4,john:5,join:4,ju4:3,jun:2,just:[1,5],jvy5cif:4,jy5rd:3,jyvbd7acn35p5yx7ktqvqerwdijxycanbcnvmrtmysanw9kv1ujtxc5vx7ylwipk:3,kdfqdmtfzqkymhp1laq1ihbq1rhwsbh5n3ekq:3,kdjqodst7ovu62motgf3arcduppwuztfxolyone5nioo1apvhbrinqwcplkpotqr:3,kebfzs8asq7uc9axw6ti0eapj8evhtwhsbgzqrwekfbxs6hbbhmidc4n0m7oq:4,keep:3,kef21pgguqpf14gkgfwx3sv4bjc1vbrrwq6zlg3nmuyqr5mtjjy9eq:3,kei:[0,1,2,3,5],key_as_byt:0,keybio:0,keyfil:[0,1],keygen_callback:0,keyid:[3,4],keylen:0,keyout:3,keypair:0,kilroi:0,kind:1,kiy8jkpv8dr5po1ikaxjfudbygdenjwybsrspsk3p:3,kkst1mcj:3,know:4,known:5,kozihvcnaqebbqaegyblzlgupfphwhsgtiapvdexn61qisz3oem88xoxkuw0szor:4,kozihvcnaqebbqaegycbaxz:4,ktgtcixjl2nmw7j:3,kv95ymtgbisuwkj93grbvqoj:4,kwarg:0,kxtbbmqswcqydvqqg:4,l5trm4x6zjxwuxxmijcehmmd8tc8ybwwo4ao19b3ebffetvsugxsga:3,l6kn27mwzhe331vjttjsgl4:3,lamy57gkw4ondmrtqvq2ojqlvosbllpxzh:4,last:[1,3,4,5],later:[0,1],latter:1,lbow6ssdir6:4,lead:[0,1],leak:0,least:1,leav:[3,4],left:[3,4],legal:0,len:0,length:[0,1,2],less:0,let:[3,4,5],letter:[1,3,4],level:[1,2],lg4q5yezr1ejaw:4,librari:[1,4],licenc:0,licens:0,lifetim:1,like:[0,3,4],limit:0,line:[0,4,5],link:[2,5],linux:5,list:[0,1,2],listen:1,listenssl:1,listentcp:1,literatur:0,littl:[2,5],ljecgc3rqu1uwisbkmquis1s46ebbm5np75izpnujokj2hv:4,lkmac1dwb3dqgjt5xk4wjesinfdxecnegacyteagyztpiapu:3,lnzqowadmol:4,load:[0,1,2,4,5],load_cert:[0,1,4],load_cert_bio:0,load_cert_chain:1,load_cert_der_str:0,load_cert_str:0,load_certif:0,load_client_ca:1,load_crl:0,load_dynam:0,load_dynamic_engin:0,load_fil:[0,4],load_info:[0,4],load_kei:[0,4],load_key_bio:0,load_key_bio_pubkei:0,load_key_str:0,load_key_string_pubkei:0,load_loc:0,load_openssl:0,load_param:0,load_params_bio:0,load_pkcs7:0,load_pkcs7_bio:0,load_pkcs7_bio_d:0,load_pkcs7_der:0,load_private_kei:0,load_pub_kei:0,load_pub_key_bio:0,load_public_kei:0,load_request:0,load_request_bio:0,load_request_der_str:0,load_request_str:0,load_sess:1,load_verify_info:1,load_verify_loc:[1,5],loc:0,local:[2,3,4],localhost:[2,3,4],localitynam:0,localtimezon:0,locat:[1,2],lock:4,logger:2,logic:1,longer:0,look:[3,4],loseconnect:1,lower:0,ltd:[3,4],lwpbxzf2k3fuudnkrlfbakeampxoybuifr2s5bma:3,ly4tpl5:3,m1awhen3vir2zlaw:3,m1je:3,m2_asn1_integer_fre:0,m2_asn1_object_fre:0,m2_asn1_string_fre:0,m2_asn1_time_fre:0,m2_bio_fre:[0,1],m2_bio_pop:0,m2_cipher_ctx_fre:0,m2_dh_free:0,m2_dsa_fre:0,m2_ec_key_fre:0,m2_engine_fre:0,m2_hmac_ctx_fre:0,m2_md_ctx_free:0,m2_pkcs7_free:0,m2_pkey_fre:0,m2_rsa_fre:0,m2_sk_x509_extension_fre:0,m2_sk_x509_free:0,m2_ssl_ctx_free:1,m2_ssl_free:1,m2_ssl_session_fre:1,m2_x509_crl_free:0,m2_x509_extension_fre:0,m2_x509_free:0,m2_x509_name_entry_fre:0,m2_x509_name_fre:0,m2_x509_req_fre:0,m2_x509_store_ctx_fre:0,m2_x509_store_fre:0,m2crypto:[1,3],m2crypto_xmlrpc:0,m2cryptoerror:0,m2urllib2:6,m2urllib:[2,6],m2xmlrpclib:[2,6],ma0gcsqgsib3dqebbauaa4gbaho3drchr86fstvavfixdsswwqktcehuhrdc:4,mac:0,made:5,mai:[0,2,3,4,5],mail:4,maintain:1,make:[0,1,3,4,5],makebuf:4,makecooki:0,makefil:[0,1],malfunct:1,man:1,manag:2,mani:[0,2,4],manipul:[0,1],manpag:[0,1],manual:[0,5],map:[1,4],mar:[3,4],march:4,mark:[0,4],master:3,match:[0,3,4],matej:0,materi:[2,5],matt:5,max_byt:0,maximum:1,mbstring_asc:0,mbstring_utf8:0,md5:0,md5withrsaencrypt:[3,4],mean:0,meant:3,measur:0,medusa:2,memori:[0,4],memorybuff:[0,4],messag:[0,5],messagedigest:0,messier:5,method:[0,1],mg611eovkleoostv:3,mh2pz4lverxa:4,mhf6rqar:4,micalg:4,microsec:1,might:1,miibntccaqycaqawxtelmakga1uebhmcu0cxetapbgnvbaotce0yq3j5chrvmriw:3,miibvwyjkozihvcnaqcdoiibsdccauqcaqaxggeamih9ageamgywytelmakga1u:4,miicxgibaakbgqcvwdhjvcuwxwu4h8wqujguvm:3,miie8ayjkozihvcnaqccoiie4tccbn0caqexczajbgurdgmcgguamcigcsqgsib3:4,miiiwwyjkozihvcnaqcdoiiitdccclacaqaxggeamih9ageamgywytelmakga1u:4,mime:[3,5,6],mimetool:0,minu:0,miss:1,mix:0,mkwcbi1nfvohcv3xdq2ela:4,mode:[0,1,2,4],model:[3,4],modifi:[0,2,4],modul:[4,5,6],modulu:[0,3,4],more:[0,1,3,5],most:[0,1,4,5],mous:0,movement:0,mozilla:[2,4],mpi:0,mpint:0,mrywfaydvqqdew1tl01jtuugu2vuzgvymsewhwyjkozihvcnaqkbfhjzzw5kzxja:4,msb:0,msg:4,msg_bio:4,msu:0,mua:4,much:0,multilin:0,multipart:4,multipurpos:4,multivalu:0,must:[0,1,5],mutheybpq5th7ydrtnizkkxobnqe2kyux9x22a1kh49sojjfg6kpb9mugizbimlv:3,mutt:4,mysteri:0,naccept:2,name:[0,1,3,4,5],navig:4,nbbba2yl0n5gs1tyiy9z:3,nbsp:2,nbyte:1,nconnect:2,necessari:0,necessarili:0,need:[0,1,3,4,5],neg:0,negoti:1,neither:1,nerx9zjgvrwuscqqcu:3,net:3,netmemet:5,netscap:3,network:[4,5],new_extens:0,new_pub_kei:0,new_stack_from_d:0,newca:3,newcert:3,newer:0,newkei:[3,4],newkey2:3,newli:0,newreq:3,next:[0,3,4],ngp:[2,3,4,5],nhost:2,nid:0,nihuwgujn:3,niqfytycdl9i5sk:4,nkasxekr8auhjsbvumrqrl6r0nnsfpzdr1w7pv:4,no_passphrase_callback:0,nocertif:1,node:4,non:[0,1,4],noncrit:0,none:[0,1,4],nonzero:0,noout:[3,4],nor:[1,4],normal:[1,5],note:[0,1,4,5],noth:0,notifi:1,notwithstand:4,now:[3,4],nqaodq3aobzpafp9l:3,nqxlmgj3jwq7x9:4,nss:[4,5],ntransfercmd:0,nueymfjdm0uvntg0icxgnufsfnjkntthpagykgetric3kgjz:3,num:0,number:[0,1,3,4],numer:2,numericipmatch:1,nuser:2,nyndufwi0qm92qlk0ui:3,obio:0,object:[0,1,4,5],obtain:[0,4],occur:[0,1],octet:[0,1],octx_to_num:0,od2m3lp7jbwjqbrtndhimqul2s4yu:4,odd:0,off:0,offset:0,oiqto:4,old:[3,5],onc:[0,1],one:[1,2,3],ones:5,onli:[0,1,3],onto:0,open:[0,1,2,4,5],open_http:0,openfil:0,openpgp:4,openssl:[0,1,2,4,5,6],oper:[0,1,2,4],option:[0,1,3],optnam:1,org:[2,3,4,5],organ:[3,4],organiz:[3,4],organizationnam:[0,3],organizationunitnam:0,origin:0,osafound:5,other:[0,1,3,5],otherwis:0,our:4,out:[0,1,2,3,4],out_bio:0,outform:4,output:[0,4],over:[0,1,5],overlap:4,overload:1,overrid:1,overwrit:2,own:[0,1,2,4,6],p12:4,p7_bio:[0,4],p7file:0,p7m:4,p7s:4,pack:1,packag:6,pad:0,page:[1,2,6],pair:[0,1,2,3,4],param:[0,1],paramet:[0,1,2,4,5],part:4,pass:[0,1,3],passphras:[0,1,3,4],passphrase_callback:[0,1],password:[0,3,4],patch:[2,3],path:0,pathnam:2,pavel:0,pbkdf2:0,pcgiserv:2,pdlrrliknknfmhkiacktlrcu59sca6adeiwuzqmuzp5cs6jrsro3nkfg1bd09d1k:3,peek_error_cod:0,peer:1,peercertdigest:1,peercerthash:1,pem:[0,1,2,3,4,5],pemfil:1,pend:1,pep484:1,per:[0,1,2],perform:[0,5],period:3,perl:3,permit:5,pfi:3,pfl1k5dyxrgtzlb36uljd:4,pgpmime:4,pheng:[0,1,2,3,4,5],phrase:3,pick:4,pin:0,pk7_smime:4,pkc:4,pkcs12:4,pkcs5_pad:0,pkcs7:[0,4],pkcs7_detach:4,pkcs7_error:0,pkcs7_pad:0,pkcs7_text:4,pkcs7_verifi:4,pkei:0,pkg:[3,4],plain:4,pleas:3,plen:0,pltnni25spyrcwfl6erd25u:4,plu:1,point:0,pointer:0,polici:[1,3,4],pool:0,pop:[0,4],popular:4,port:[0,1,2],portal0:2,portal:2,portion:[0,5],possibl:[0,1],post1:[2,3,4],post:0,post_connection_check:1,postconnectioncheck:1,power:2,practic:[0,4,5],pravir:5,predetermin:0,predict:0,prefix:0,premis:4,present:[1,2],press:0,pretend:4,pretti:5,previou:0,previous:1,primari:5,prime:0,princip:0,print:[0,1,2,3,4],print_param:0,printabl:3,privaci:4,privat:[0,1,3,4],private_decrypt:0,private_encrypt:0,privkei:4,prng:[0,2,4],probabl:[4,5],problem:0,proc:3,proce:1,process:[1,3,4],produc:0,product:4,prog:4,program:[3,6],programm:[4,5],project:[4,5],prompt1:0,prompt2:0,prompt:4,propag:0,proper:1,properli:4,propertymap:2,prot_c:0,prot_p:0,protect:[0,1,4],protocol:[0,1,2,4,5],protocolwrapp:1,provid:[0,1,2,4,5],provinc:[3,4],proxi:0,proxyhttpsconnect:0,pseudo:[0,4],pss:0,pty:[3,4],pub:0,pub_kei:0,pub_key_from_d:0,pub_key_from_param:0,pubkei:0,public_decrypt:0,public_encrypt:0,purpos:[0,4],push:[0,4],puthead:0,putrequest:0,py3byt:0,py3str:0,pyfil:0,pystack:0,python3:1,python:[0,1,3,6],pythonwar:0,q1z7g:3,q7s4tn1z:4,qbcrdaoxdj0ulwytauev:4,qin7ujpkou61cn7h8dvhr8yw9:4,qjpbezwdp7gjfzfatqitesymwo3i:4,qlen:1,qppdzt3ykfmg2lzytaam1czvb6rbnrjjp2zrpbwn:3,qtm0ddmm:3,quarante:5,queri:1,quiet_genparam_callback:0,quit:[2,3,4],quvxinaxygqco9lzdw6hudk8:4,qya6adywgbghr9jkhwn5gsdu7bwx:4,rais:[0,1,4,5],rand:[2,4,6],rand_add:0,rand_byt:0,rand_file_nam:0,rand_pseudo_byt:0,rand_rang:0,rand_se:0,rand_statu:0,randfil:0,randfnam:0,random:[0,4],randpool:[2,4],rang:0,rather:1,rc4:6,rc4_free:0,rdn:0,reactor:1,read:[0,1,2,3,4,5],read_al:0,readabl:0,readbio:1,readi:[1,3,4],readlin:0,real:0,realiz:1,reason:[0,1],recal:4,receiv:[1,4],recent:4,recipi:4,recipient_kei:4,recommend:[0,5],record:5,recreat:4,recv:1,recv_into:1,refcount:[0,1],refer:[0,2],regex:0,regular:0,reject:1,relativedistinguishednam:0,releas:0,reli:[0,1],remot:1,remov:1,remove_sess:1,renam:[3,4],render:4,renegoti:1,repli:2,repres:[0,1],represent:0,repudi:4,req:[0,3,4],request:[0,1,3,4],request_bodi:0,requesthandlerclass:1,requir:[0,1,5],rescorla:5,reserv:[0,1],reset:0,reset_context:0,resid:1,resolv:2,respect:[0,1],rest:0,result:[0,1,4],ret:[1,3],retriev:[0,4],reus:1,revoc:0,rfc:[0,4],rgwnkxpj:4,right:[0,1,4],ripemd160:0,rm2htgotm2lmore4geotypi5f1fbi:3,rn9vpy0suy8:3,rnd:0,root:5,routin:[1,4],rsa:[1,2,3,4,5,6],rsa_error:0,rsa_pub:0,rsaencrypt:[3,4],rsaerror:0,rsassa:0,rudimentari:5,run:[0,2,4],rwb:0,rwniyh0aw4xyyhhit:4,s0ovoc041cerazqfm2tl:4,safe:0,sai:4,said:[0,4],salt:0,salt_len:0,salt_length:0,same:[0,1,5],sat:[2,3],save:[0,4],save_fil:[0,4],save_kei:0,save_key_bio:0,save_key_d:0,save_key_der_bio:0,save_param:0,save_params_bio:0,save_pem:0,save_pub_kei:0,save_pub_key_bio:0,saver:4,sc3lsmhugu9xc26ogstjmkquiah:3,sc51hkebgckl1:4,scope:4,scopeid:1,screen:[2,4],script:5,search:6,sec:1,second:[0,1,5],secret:3,section:[3,4],secur:[0,1,3,4],see:[0,1,2,5],seed:[0,2,4],seek:0,seldom:0,select:[1,2,4],self:[0,1,3,4],send:[1,2,5],sendal:1,sender:4,sendmail:4,sendsmim:4,sens:1,sent:[0,1,3,4],sequenc:0,seri:4,serial:[0,3,4],serialnumb:0,serv:2,server:[1,2,3,4,5],server_address:[1,5],serverpostconnectioncheck:1,servic:[1,4],session:[0,6],session_data_manag:2,set:[0,1,3,4,5],set_accept_st:1,set_allow_unknown_ca:1,set_bio:1,set_ciph:[0,4],set_cipher_list:1,set_client_ca_list_from_context:1,set_client_ca_list_from_fil:1,set_connect_st:1,set_crit:0,set_data:0,set_datetim:0,set_default:0,set_default_verify_path:1,set_info_callback:1,set_issu:0,set_issuer_nam:0,set_kei:0,set_mod:1,set_not_aft:0,set_not_befor:0,set_object:0,set_opt:1,set_pad:0,set_param:0,set_post_connection_check_callback:1,set_pubkei:0,set_serial_numb:0,set_sess:[0,1],set_session_cache_mod:1,set_session_id_ctx:1,set_session_timeout:1,set_shutdown:1,set_socket_read_timeout:1,set_socket_write_timeout:1,set_ssl:0,set_ssl_close_flag:1,set_str:0,set_subject:0,set_subject_nam:0,set_tim:[0,1],set_timeout:1,set_tlsext_host_nam:1,set_tmp_dh:1,set_tmp_dh_callback:1,set_tmp_rsa:1,set_tmp_rsa_callback:1,set_verifi:[1,5],set_verify_cb:0,set_vers:0,set_x509_stack:[0,4],set_x509_stor:[0,4],setblock:1,setsockopt:1,settimeout:1,setup_addr:1,setup_ssl:1,sever:[0,1,3],sfl_home:4,sfqo6lc9mtsj7fjydq:4,sha1:[0,1,4],sha224:0,sha256:0,sha:0,shall:[2,4],share:0,should:[0,1,3],should_read:0,should_retri:0,should_writ:0,shown:[2,5],shramov:0,shut:1,shutdown:1,sid_ctx:1,side:[0,1,5],sign:[0,3],sign_asn1:0,sign_dsa:0,sign_dsa_asn1:0,sign_fin:0,sign_init:0,sign_rsassa_pss:0,sign_upd:0,signal:0,signatur:[0,3,4],signer:4,signer_kei:4,signific:[0,1],similar:[1,2,3,4],simpl:[0,1,5],simpli:0,sinc:[0,3,5],singl:0,siong:[0,1,2,3,4,5],sipba4ik5xcrlt9e0s2qjgrvo9gyfaqz:4,site:3,situat:3,size:[0,1],sizehint:0,sjai4kpfvt00xfnvgluywyeks9sygto7hihnqkcf44f5lyv6ntfwmfqb11daty9v:4,skip:4,skip_accept_encod:0,skip_host:0,skunk:2,smartcard:0,smime:6,smime_error:[0,4],smime_load_pkcs7:[0,4],smime_load_pkcs7_bio:[0,4],smtpd:4,smtplib:4,sni:1,sntelhcawulwtifz:4,so_:1,sock:1,socket:[0,1,5],socketserv:1,softwar:4,sol_socket:1,sol_tcp:1,some:[1,3,4],sopath:0,sophist:5,sourc:[0,1,4,5],space:0,specif:[1,3,5],specifi:[0,1],spoofer:4,sport:5,src:2,sre_pattern:[0,1],ssl:[0,2,3,4,6],ssl_:1,ssl_cert_dir:1,ssl_cert_fil:1,ssl_connect:1,ssl_context:[0,1],ssl_ctx:0,ssl_ctx_flush_sess:1,ssl_ctx_ptr:1,ssl_ctx_set_opt:1,ssl_ctx_set_session_cache_mod:1,ssl_ctx_set_timeout:1,ssl_dispatch:[0,6],ssl_get_default_timeout:1,ssl_get_error:1,ssl_info_callback:1,ssl_ptr:1,ssl_received_shutdown:1,ssl_sent_shutdown:1,ssl_sess_cache_:1,ssl_transport:[0,2],ssl_verify_callback:1,ssl_verify_callback_allow_unknown_ca:1,ssl_verify_callback_stub:1,sslbio:0,sslerror:[0,1],sslserver:[0,6],ssltimeouterror:1,sslv3:[1,5],sslverificationerror:1,stack:[0,1],stack_of:1,stamp:4,standard:[0,4],standard_error_messag:2,standard_html_foot:2,standard_html_head:2,standard_templ:2,start:[0,1,2,3,4],startpassthrough:1,starttl:1,state:[0,1,3,4],stateorprovincenam:0,statu:[0,1],stderr:1,stdout:[0,5],step:[3,4,5],steve:3,still:1,stop:2,store:[0,1],str:1,stream:0,strict:0,string:[0,1,2,4],stringio:[4,5],strong:0,struct:1,struct_siz:1,struct_to_timeout:1,structur:[0,1],style:1,subclass:0,subject:[0,3,4],subjectaltnam:[0,5],subjectnam:0,subpackag:6,subsequ:5,substitut:4,succeed:[0,1,2],success:[0,1],successfulli:1,suffici:0,suggest:0,suit:1,suitabl:[0,5],sun:2,suppli:[0,1],support:[0,1,5],suppos:4,sure:0,surnam:0,symbol:1,symmetr:[0,4,5],sync:0,sys:4,system:[1,2,3,4],sztm5jrp2zw:4,t6lqehb32wfyxqbkfxfjsxzsxox3r:4,take:1,target:[0,2,4],tb7k3chfgw5wagwnll8lb:3,tcp:[1,5],tcpserver:1,tell:[0,5],temp_fold:2,temporari:[1,4],termin:1,test:[0,4,5],test_ssl:5,text:[0,2,3,4],text_crlf:0,text_crlf_bio:0,text_nam:0,textual:5,than:[0,1,5],thei:[0,1,4,5],them:[0,4,5],therefor:1,thi:[0,1,2,3,4,5],third:5,those:5,thread:6,threadingmixin:1,threadingsslserv:1,threat:[3,4],through:[0,1,3,4],thu:[0,4],thusli:[2,4],time:[0,1,2,4,5],timeo:1,timeout:[0,6],titl:2,tlfgl4hdk2gyzxafuqzwiurz:4,tls:1,tlsprotocolwrapp:1,tmp:4,tmp_bio:4,to_addr:4,to_cert:4,tob:4,togeth:1,toivonen:[1,5],too:5,tool:3,top:[0,2,4],topic:3,trace:0,traceback:4,traffic:5,transfer:[0,4],transform:4,transport:0,treat:1,tri:[1,5],tripl:4,trust:4,tue:2,tunnel:0,tupl:[0,1],tvtk:4,twice:1,twist:[1,5],twistedprotocolwrapp:[0,6],two:[0,1,5],tws5k:3,txt:5,type:[0,1,2,3,4],typic:[1,4,5],tzinfo:0,tzname:0,tzsznk2qwgvsspos9mhuaepbnjmnbffbrulhrutsglm:4,u4dmyq9uxs421en3v2hkvhvdy8ut2ot29:4,u4j2f34u0xktwcp:4,u7rqbwpc9hr34saprs3ubbculet748kecbx247imbtidctzxcc1o86:4,ubowzitegtyli52:4,uifxaf6s4n2uihvp6tqxthejtpzoc7pc:4,ukidkhst60v2q9kegpzgfpoztskm:4,ull4d2cldx9ovynykwdezb5dyv0r:4,unattend:3,uncertainti:0,under:4,under_bio:0,underli:[0,1,5],understand:4,unencrypt:[3,4],uniqu:0,unit:[3,4],unix:1,unknow:0,unknown:[0,1],unless:0,unlock:0,unmix3:0,unmix:0,unpack:2,unpredict:0,unsaf:0,unset_ciph:0,unset_kei:0,unset_x509_stack:0,unset_x509_stor:0,until:[1,3],untouch:1,untrust:2,updat:[0,3],upper:0,urandom:2,urbfke2mocdxvdzxbmd:4,url:[0,2],urllib2:0,urllib:2,uryvak7vfoldaz6z3nosoi6nonnehpr:4,usag:4,use:[0,1,2,3,4,5],used:[0,1,3,4],useful:1,useless:5,user:[0,4],user_ag:0,usernam:0,uses:[0,4,5],using:[0,1,3,4],usr:[3,4],usual:[0,5],utc:0,utcoffset:0,utifsh4jkkm:4,util:[5,6],utilerror:0,uweuasngtkpjv2jyumd3hwqox2q3cd4zgqvjj6gf3exa5126ckf:3,uwrgu5shra8oncm0cdxej0kpf3cfnjhffb8hwmzi4uegnmfxqnsxogz:4,v_asn1_ia5str:0,valid:[0,1,3,4,5],valu:[0,1,3,4],valueerror:0,variabl:[0,1],variou:[1,5],verbos:0,veri:[0,1],verif:[0,1,4],verifi:[0,1,2,3],verify_asn1:0,verify_dsa:0,verify_dsa_asn1:0,verify_fail_if_no_peer_cert:[1,5],verify_fin:0,verify_init:0,verify_ok:1,verify_p:[1,5],verify_rsassa_pss:0,verify_upd:0,verisign:4,version:[0,1,3,4,5],vhgdittnelgthbaezu5rhdswgdelvbp:4,vi4roin:3,via:[0,1],viega:5,vihhfc1zzp:3,visual:0,vkwwecqqdkeu:3,vsgprqx2:4,vsxc7xx7xo:4,vtajp:3,vuzalydffdfutiqqzys4z:4,w4d1nnwu8agcpyshsexhc:3,w81xodtq2ecjxc8fn2wpa9y5vd1lt7ojksoul1:3,wai:[1,4],wait:1,walk:3,warn:[0,1,2],wbal2p:4,wdd1ar2k4k3gai7kkgobwt0:4,wdigqewjl:3,weak:5,weak_crypto:1,web:[2,4],well:[0,1,2,4],were:[0,1],what:[0,3,4],when:[0,1,3,4,5],whenev:1,where:[0,1,3],wherea:[0,5],whether:[0,4],which:[0,1,3,4,5],who:4,whose:0,why:4,widgit:[3,4],width:2,window:[2,4],wish:[2,3,4],within:[1,3,5],without:0,wjtpvp0yobmju4vmkezi405r7o8oewi:3,wkat:4,wmbgsclvwsfzcccjhavw9nhfmucnrdwxaymvetnuon:4,word:4,work:[0,1,2,3,4,5],world:1,would:[0,1,4],wrap:4,wrappedprotocol:1,wrapper:[0,1,5],write:[0,1,3,4],write_bio:1,write_clos:0,write_d:0,writeabl:0,writebio:1,writesequ:1,written:[0,3,5],wrongcertif:1,wronghost:1,wrylp3:4,wsluvo:3,www:[0,2,4],wyhfg8g3biehurpj2v:4,x509:[3,4,5,6],x509_ext:0,x509_ext_ptr:0,x509_extens:0,x509_extension_stack:0,x509_name:[0,1],x509_name_entri:0,x509_ptr:1,x509_purpose_:0,x509_stack:[0,4],x509_store:[0,4],x509_store_context:0,x509_store_ctx:0,x509_store_default_cb:0,x509_store_set_verify_cb:0,x509error:0,x509v3:[3,4],xc9dtimuutxtxlgytb0ujkbnsoaenolm:4,xekaxcmzegp0b6camwfmuqrbvgxbbncqkc:4,xgffb0okilylmwv2bf6:4,xisnot:4,xlcqyvk1tzhd:4,xlyg6hhzzgbfyyngj2y7ymz1rl1m8snrnmkcyskgtrudenf6wt9:4,xmlrpclib:0,xmtdg:4,y3klvhk09yl6d:4,y9mh7efw:4,year:[3,4],yet:1,yl9qevh1pp2zvswq12p7gjt3t:4,you:[0,1,2,3,4,5],your:[0,2,4,6],ypfxy:3,yqor8jggsuzroyjqhj:4,yrpzcwq3gxahuj:3,yubj33ylmpjgngijlnolfy0hnw7tmwqr:4,ywmxnjz8:4,z04ovaeue4x0swm17hlbm2kvt:3,z2s:2,z6ebh:3,z6uxrm:4,zbq:3,zbxscvldasmckg:3,zero:0,zhttp_handler:2,zhttp_server:2,zhttps_handler:2,zhttps_server:2,zip:2,zope:[2,4],zopebutton:2,zovnycmv1cintpalaw4bwtxnhcdvthavdy34okhemzncg:3,zpecllwhxd4b1auaiaargkl935u:4,zpqqqzkq:3,zserver:2,zserverssl:6,zssl:2,zsyncer:2,ztf6mpxjsixi6l4zyxebs6yhf:4,zw50msqwigyjkozihvcnaqkbfhvyzwnpcgllbnrazxhhbxbszs5kb20caqawdqyj:4,zw5kzxixitafbgkqhkig9w0bcqewennlbmrlckblegftcgxllmrvbtcbnzanbgkq:4,zwxy:4,zxhhbxbszs5kb20whhcnmdewmzmxmte0mdmzwhcnmdiwmzmxmte0mdmzwjbbmqsw:4},titles:["M2Crypto Package","SSL Package","1.   ZServerSSL-HOWTO","HOWTO: Creating your own CA with OpenSSL","HOWTO: Programming S/MIME in Python with M2Crypto","HOWTO: Programming SSL in Python with M2Crypto","Welcome to M2Crypto\u2019s documentation!"],titleterms:{The:3,asn1:0,authcooki:0,bio:0,bit:5,callback:0,certif:4,checker:1,cipher:1,code:5,conclus:[2,3],connect:1,content:2,context:1,creat:3,decrypt:4,document:6,dsa:0,encrypt:4,engin:0,err:0,evp:0,ftpslib:0,histori:5,howto:[2,3,4,5,6],http:2,httpslib:0,indic:6,instal:2,interoper:4,introduct:[2,3,4,5],kei:4,m2crypto:[0,2,4,5,6],m2urllib2:0,m2urllib:0,m2xmlrpclib:0,messag:4,messeng:4,microsoft:4,mime:4,modul:[0,1],netscap:4,openssl:3,origin:4,outlook:4,over:2,own:3,packag:[0,1],prepar:2,procedur:3,program:[4,5],python:[2,4,5],rand:0,rc4:0,resourc:4,rsa:0,sampl:5,secur:5,send:4,session:1,sign:4,smime:[0,4],smtp:4,sourc:2,ssl:[1,5],ssl_dispatch:1,ssldump:5,sslserver:1,subpackag:0,tabl:6,test:2,thread:0,timeout:1,twistedprotocolwrapp:1,util:0,verifi:4,via:4,webdav:2,welcom:6,x509:0,xmlrpc:2,your:3,zserverssl:2,zsmime:4}}) \ No newline at end of file -- cgit v1.2.1