f9aeed9fdc
- regen plist - fix wantlib
4636 lines
151 KiB
Plaintext
4636 lines
151 KiB
Plaintext
$OpenBSD: patch-POW_c,v 1.6 2011/07/07 17:16:18 jasper Exp $
|
|
--- POW.c.orig Fri Nov 23 02:03:09 2001
|
|
+++ POW.c Sat Oct 9 11:33:22 2010
|
|
@@ -34,7 +34,7 @@
|
|
/* */
|
|
/*****************************************************************************/
|
|
|
|
-#include <python2.1/Python.h>
|
|
+#include <python${MODPY_VERSION}/Python.h>
|
|
|
|
#include <openssl/crypto.h>
|
|
#include <openssl/rand.h>
|
|
@@ -45,7 +45,10 @@
|
|
#include <openssl/evp.h>
|
|
#include <openssl/err.h>
|
|
#include <openssl/md5.h>
|
|
+#ifndef OPENSSL_NO_MD2
|
|
#include <openssl/md2.h>
|
|
+#endif
|
|
+#include <openssl/ripemd.h>
|
|
#include <openssl/sha.h>
|
|
#include <openssl/hmac.h>
|
|
|
|
@@ -145,24 +148,24 @@
|
|
#define X_Digest_Check(op) ((op)->ob_type == &digesttype)
|
|
#define X_Ssl_Check(op) ((op)->ob_type == &ssltype)
|
|
|
|
-static char pow_module__doc__ [] = "
|
|
-<moduleDescription>
|
|
- <header>
|
|
- <name>Python OpenSSL Wrappers v0.6.1</name>
|
|
- <author>Peter Shannon</author>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This is the second release of POW and many of the missing gaps in
|
|
- functionality have been plugged. The <classname>Ssl</classname> class has received
|
|
- several new features relating to security. Other areas have been
|
|
- improved: PRNG support, certificate and CRL signing, certificate chain
|
|
- and client verification. Many bugs have been fixed, and certain
|
|
- parts of code re-written where necessary. I hope you enjoy using POW
|
|
- and please feel free to send me feature requests and bug reports.
|
|
- </para>
|
|
- </body>
|
|
-</moduleDescription>";
|
|
+static char pow_module__doc__ [] = "\n"
|
|
+"<moduleDescription>\n"
|
|
+" <header>\n"
|
|
+" <name>Python OpenSSL Wrappers v0.6.1</name>\n"
|
|
+" <author>Peter Shannon</author>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This is the second release of POW and many of the missing gaps in\n"
|
|
+" functionality have been plugged. The <classname>Ssl</classname> class has received\n"
|
|
+" several new features relating to security. Other areas have been\n"
|
|
+" improved: PRNG support, certificate and CRL signing, certificate chain\n"
|
|
+" and client verification. Many bugs have been fixed, and certain\n"
|
|
+" parts of code re-written where necessary. I hope you enjoy using POW \n"
|
|
+" and please feel free to send me feature requests and bug reports.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</moduleDescription>";
|
|
|
|
/*========== Pre-definitions ==========*/
|
|
static PyObject *SSLErrorObject;
|
|
@@ -464,19 +467,19 @@ error:
|
|
is used as a buffer which the certificate is read into, from this buffer
|
|
it is read into a char[] and returned as a string.
|
|
*/
|
|
-static char X509_object_pem_write__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>pemWrite</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a PEM encoded certificate as a
|
|
- string.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_pem_write__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>pemWrite</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a PEM encoded certificate as a\n"
|
|
+" string.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
X509_object_pem_write(x509_object *self, PyObject *args)
|
|
@@ -525,21 +528,21 @@ error:
|
|
/*
|
|
Currently this function only supports RSA keys.
|
|
*/
|
|
-static char X509_object_set_public_key__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>setPublicKey</name>
|
|
- <parameter>key</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets the public key for this certificate object. The
|
|
- parameter <parameter>key</parameter> should be an instance of
|
|
- <classname>Asymmetric</classname> containing a public key.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_set_public_key__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>setPublicKey</name>\n"
|
|
+" <parameter>key</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets the public key for this certificate object. The\n"
|
|
+" parameter <parameter>key</parameter> should be an instance of\n"
|
|
+" <classname>Asymmetric</classname> containing a public key.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -587,33 +590,33 @@ error:
|
|
|
|
}
|
|
|
|
-static char X509_object_sign__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>sign</name>
|
|
- <parameter>key</parameter>
|
|
- <parameter>digest=MD5_DIGEST</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method signs a certificate with a private key. See the
|
|
- example for the methods which should be invoked before signing a
|
|
- certificate. <parameter>key</parameter> should be an instance of
|
|
- <classname>Asymmetric</classname> containing a private key.
|
|
- The optional parameter <parameter>digest</parameter> indicates
|
|
- which digest function should be used to compute the hash to be
|
|
- signed, it should be one of the following:
|
|
- </para>
|
|
- <simplelist>
|
|
- <member><constant>MD2_DIGEST</constant></member>
|
|
- <member><constant>MD5_DIGEST</constant></member>
|
|
- <member><constant>SHA_DIGEST</constant></member>
|
|
- <member><constant>SHA1_DIGEST</constant></member>
|
|
- <member><constant>RIPEMD160_DIGEST</constant></member>
|
|
- </simplelist>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_sign__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>sign</name>\n"
|
|
+" <parameter>key</parameter>\n"
|
|
+" <parameter>digest=MD5_DIGEST</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method signs a certificate with a private key. See the\n"
|
|
+" example for the methods which should be invoked before signing a\n"
|
|
+" certificate. <parameter>key</parameter> should be an instance of\n"
|
|
+" <classname>Asymmetric</classname> containing a private key.\n"
|
|
+" The optional parameter <parameter>digest</parameter> indicates \n"
|
|
+" which digest function should be used to compute the hash to be \n"
|
|
+" signed, it should be one of the following:\n"
|
|
+" </para>\n"
|
|
+" <simplelist>\n"
|
|
+" <member><constant>MD2_DIGEST</constant></member>\n"
|
|
+" <member><constant>MD5_DIGEST</constant></member>\n"
|
|
+" <member><constant>SHA_DIGEST</constant></member>\n"
|
|
+" <member><constant>SHA1_DIGEST</constant></member>\n"
|
|
+" <member><constant>RIPEMD160_DIGEST</constant></member>\n"
|
|
+" </simplelist>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -783,19 +786,19 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char X509_object_get_version__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>getVersion</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns the version number from the version field of
|
|
- this certificate.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_get_version__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>getVersion</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns the version number from the version field of\n"
|
|
+" this certificate. \n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -816,21 +819,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char X509_object_set_version__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>setVersion</name>
|
|
- <parameter>version</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets the version number in the version field of
|
|
- this certificate. <parameter>version</parameter> should be an
|
|
- integer.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_set_version__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>setVersion</name>\n"
|
|
+" <parameter>version</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets the version number in the version field of\n"
|
|
+" this certificate. <parameter>version</parameter> should be an\n"
|
|
+" integer.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -851,19 +854,19 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char X509_object_get_serial__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>getSerial</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method get the serial number in the serial field of
|
|
- this certificate.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_get_serial__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>getSerial</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method get the serial number in the serial field of\n"
|
|
+" this certificate.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -888,21 +891,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char X509_object_set_serial__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>setSerial</name>
|
|
- <parameter>serial</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets the serial number in the serial field of
|
|
- this certificate. <parameter>serial</parameter> should ba an
|
|
- integer.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_set_serial__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>setSerial</name>\n"
|
|
+" <parameter>serial</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets the serial number in the serial field of\n"
|
|
+" this certificate. <parameter>serial</parameter> should ba an\n"
|
|
+" integer.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -935,37 +938,37 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char X509_object_get_issuer__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>getIssuer</name>
|
|
- <parameter>format=SHORTNAME_FORMAT</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a tuple containing the issuers name. Each
|
|
- element of the tuple is a tuple with 2 elements. The first tuple
|
|
- is an object name and the second is it's value. Both issuer and
|
|
- subject are names distinguished normally composed of a small
|
|
- number of objects:
|
|
- </para>
|
|
- <simplelist>
|
|
- <member><constant>c</constant> or <constant>countryName</constant></member>
|
|
- <member><constant>st</constant> or <constant>stateOrProvinceName</constant></member>
|
|
- <member><constant>o</constant> or <constant>organizationName</constant></member>
|
|
- <member><constant>l</constant> or <constant>localityName</constant></member>
|
|
- <member><constant>ou</constant> or <constant>organizationalUnitName</constant></member>
|
|
- <member><constant>cn</constant> or <constant>commonName</constant></member>
|
|
- </simplelist>
|
|
- <para>
|
|
- The data type varies from one object to another, however, all the
|
|
- common objects are strings. It would be possible to specify any
|
|
- kind of object but that would certainly adversely effect
|
|
- portability and is not recommended.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_get_issuer__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>getIssuer</name>\n"
|
|
+" <parameter>format=SHORTNAME_FORMAT</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a tuple containing the issuers name. Each\n"
|
|
+" element of the tuple is a tuple with 2 elements. The first tuple\n"
|
|
+" is an object name and the second is it's value. Both issuer and\n"
|
|
+" subject are names distinguished normally composed of a small\n"
|
|
+" number of objects:\n"
|
|
+" </para>\n"
|
|
+" <simplelist>\n"
|
|
+" <member><constant>c</constant> or <constant>countryName</constant></member>\n"
|
|
+" <member><constant>st</constant> or <constant>stateOrProvinceName</constant></member>\n"
|
|
+" <member><constant>o</constant> or <constant>organizationName</constant></member>\n"
|
|
+" <member><constant>l</constant> or <constant>localityName</constant></member>\n"
|
|
+" <member><constant>ou</constant> or <constant>organizationalUnitName</constant></member>\n"
|
|
+" <member><constant>cn</constant> or <constant>commonName</constant></member>\n"
|
|
+" </simplelist>\n"
|
|
+" <para>\n"
|
|
+" The data type varies from one object to another, however, all the\n"
|
|
+" common objects are strings. It would be possible to specify any\n"
|
|
+" kind of object but that would certainly adversely effect\n"
|
|
+" portability and is not recommended.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -991,21 +994,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char X509_object_get_subject__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>getSubject</name>
|
|
- <parameter>format=SHORTNAME_FORMAT</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a tuple containg the subjects name. See
|
|
- <function>getIssuer</function> for a description of the returned
|
|
- object's format.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_get_subject__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>getSubject</name>\n"
|
|
+" <parameter>format=SHORTNAME_FORMAT</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a tuple containg the subjects name. See\n"
|
|
+" <function>getIssuer</function> for a description of the returned\n"
|
|
+" object's format.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -1082,21 +1085,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char X509_object_set_subject__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>setSubject</name>
|
|
- <parameter>name</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method is used to set the subjects name.
|
|
- <parameter>name</parameter> can be comprised of lists or tuples in
|
|
- the format described in the <function>getIssuer</function> method.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_set_subject__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>setSubject</name>\n"
|
|
+" <parameter>name</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method is used to set the subjects name.\n"
|
|
+" <parameter>name</parameter> can be comprised of lists or tuples in\n"
|
|
+" the format described in the <function>getIssuer</function> method.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -1129,21 +1132,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char X509_object_set_issuer__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>setIssuer</name>
|
|
- <parameter>name</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method is used to set the issuers name.
|
|
- <parameter>name</parameter> can be comprised of lists or tuples in
|
|
- the format described in the <function>getissuer</function> method.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_set_issuer__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>setIssuer</name>\n"
|
|
+" <parameter>name</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method is used to set the issuers name.\n"
|
|
+" <parameter>name</parameter> can be comprised of lists or tuples in\n"
|
|
+" the format described in the <function>getissuer</function> method.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -1176,21 +1179,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char X509_object_get_not_before__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>getNotBefore</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a tuple containing two integers. The first
|
|
- number represents the time in seconds and is the same as the C
|
|
- <constant>time_t</constant> typedef and the second represents the time zone offset in
|
|
- seconds.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_get_not_before__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>getNotBefore</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a tuple containing two integers. The first\n"
|
|
+" number represents the time in seconds and is the same as the C \n"
|
|
+" <constant>time_t</constant> typedef and the second represents the time zone offset in\n"
|
|
+" seconds.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -1211,21 +1214,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char X509_object_get_not_after__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>getNotAfter</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a tuple containing two integers. The first
|
|
- number represents the time in seconds and is the same as the C
|
|
- <constant>time_t</constant> typedef and the second represents the time zone offset in
|
|
- seconds.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_get_not_after__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>getNotAfter</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a tuple containing two integers. The first\n"
|
|
+" number represents the time in seconds and is the same as the C \n"
|
|
+" <constant>time_t</constant> typedef and the second represents the time zone offset in\n"
|
|
+" seconds.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -1246,23 +1249,23 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char X509_object_set_not_after__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>setNotAfter</name>
|
|
- <parameter>time</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets part of the <constant>Validity</constant>
|
|
- sequence of the certificate, the <constant>notAfter</constant>
|
|
- time. <parameter>time</parameter> should be a time in seconds,
|
|
- as generated by the <function>time</function> function in the Python
|
|
- Standard Library.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_set_not_after__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>setNotAfter</name>\n"
|
|
+" <parameter>time</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets part of the <constant>Validity</constant>\n"
|
|
+" sequence of the certificate, the <constant>notAfter</constant>\n"
|
|
+" time. <parameter>time</parameter> should be a time in seconds,\n"
|
|
+" as generated by the <function>time</function> function in the Python\n"
|
|
+" Standard Library.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -1283,23 +1286,23 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char X509_object_set_not_before__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>setNotBefore</name>
|
|
- <parameter>time</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets part of the <constant>Validity</constant>
|
|
- sequence of the certificate, the <constant>notBefore</constant>
|
|
- time. <parameter>time</parameter> should be a time in seconds,
|
|
- as generated by the <function>time</function> function in the Python
|
|
- Standard Library.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char X509_object_set_not_before__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>setNotBefore</name>\n"
|
|
+" <parameter>time</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets part of the <constant>Validity</constant>\n"
|
|
+" sequence of the certificate, the <constant>notBefore</constant>\n"
|
|
+" time. <parameter>time</parameter> should be a time in seconds,\n"
|
|
+" as generated by the <function>time</function> function in the Python\n"
|
|
+" Standard Library.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -1320,19 +1323,19 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_object_pprint__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- <name>pprint</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a formatted string showing the information
|
|
- held in the certificate.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_object_pprint__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" <name>pprint</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a formatted string showing the information\n"
|
|
+" held in the certificate.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -1428,52 +1431,52 @@ X509_object_dealloc(x509_object *self, char *name)
|
|
PyObject_Del(self);
|
|
}
|
|
|
|
-static char x509type__doc__[] = "
|
|
-<class>
|
|
- <header>
|
|
- <name>X509</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This class provides access to a significant proportion of X509
|
|
- functionality of OpenSSL.
|
|
- </para>
|
|
+static char x509type__doc__[] = "\n"
|
|
+"<class>\n"
|
|
+" <header>\n"
|
|
+" <name>X509</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This class provides access to a significant proportion of X509 \n"
|
|
+" functionality of OpenSSL.\n"
|
|
+" </para>\n"
|
|
+"\n"
|
|
+" <example>\n"
|
|
+" <title><classname>x509</classname> class usage</title>\n"
|
|
+" <programlisting>\n"
|
|
+" privateFile = open('test/private.key', 'r')\n"
|
|
+" publicFile = open('test/public.key', 'r')\n"
|
|
+" certFile = open('test/cacert.pem', 'w')\n"
|
|
+"\n"
|
|
+" publicKey = POW.pemRead(POW.RSA_PUBLIC_KEY, publicFile.read())\n"
|
|
+" privateKey = POW.pemRead(POW.RSA_PRIVATE_KEY, privateFile.read(), 'pass')\n"
|
|
+"\n"
|
|
+" c = POW.X509()\n"
|
|
+"\n"
|
|
+" name = [ ['C', 'GB'], ['ST', 'Hertfordshire'], \n"
|
|
+" ['O','The House'], ['CN', 'Peter Shannon'] ]\n"
|
|
+"\n"
|
|
+" c.setIssuer( name )\n"
|
|
+" c.setSubject( name )\n"
|
|
+" c.setSerial(0)\n"
|
|
+" c.setNotBefore( time.time() )\n"
|
|
+" c.setNotAfter( time.time() + 60*60*24*365)\n"
|
|
+" c.setPublicKey(publicKey)\n"
|
|
+" c.sign(privateKey)\n"
|
|
+"\n"
|
|
+" certFile.write( c.pemWrite() )\n"
|
|
+"\n"
|
|
+" privateFile.close()\n"
|
|
+" publicFile.close()\n"
|
|
+" certFile.close()\n"
|
|
+" </programlisting>\n"
|
|
+" </example>\n"
|
|
+"\n"
|
|
+" </body>\n"
|
|
+"</class>";
|
|
|
|
- <example>
|
|
- <title><classname>x509</classname> class usage</title>
|
|
- <programlisting>
|
|
- privateFile = open('test/private.key', 'r')
|
|
- publicFile = open('test/public.key', 'r')
|
|
- certFile = open('test/cacert.pem', 'w')
|
|
|
|
- publicKey = POW.pemRead(POW.RSA_PUBLIC_KEY, publicFile.read())
|
|
- privateKey = POW.pemRead(POW.RSA_PRIVATE_KEY, privateFile.read(), 'pass')
|
|
-
|
|
- c = POW.X509()
|
|
-
|
|
- name = [ ['C', 'GB'], ['ST', 'Hertfordshire'],
|
|
- ['O','The House'], ['CN', 'Peter Shannon'] ]
|
|
-
|
|
- c.setIssuer( name )
|
|
- c.setSubject( name )
|
|
- c.setSerial(0)
|
|
- c.setNotBefore( time.time() )
|
|
- c.setNotAfter( time.time() + 60*60*24*365)
|
|
- c.setPublicKey(publicKey)
|
|
- c.sign(privateKey)
|
|
-
|
|
- certFile.write( c.pemWrite() )
|
|
-
|
|
- privateFile.close()
|
|
- publicFile.close()
|
|
- certFile.close()
|
|
- </programlisting>
|
|
- </example>
|
|
-
|
|
- </body>
|
|
-</class>";
|
|
-
|
|
-
|
|
static PyTypeObject x509type = {
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
|
0, /*ob_size*/
|
|
@@ -1520,27 +1523,27 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_store_object_verify__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Store</memberof>
|
|
- <name>verify</name>
|
|
- <parameter>certificate</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- The <classname>X509Store</classname> method
|
|
- <function>verify</function> is based on the
|
|
- <function>X509_verify_cert</function>. It handles certain aspects
|
|
- of verification but not others. The certificate will be verified
|
|
- against <constant>notBefore</constant>,
|
|
- <constant>notAfter</constant> and trusted certificates.
|
|
- It crucially will not handle checking the certificate against
|
|
- CRLs. This functionality will probably make it into OpenSSL
|
|
- 0.9.7.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_store_object_verify__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Store</memberof>\n"
|
|
+" <name>verify</name>\n"
|
|
+" <parameter>certificate</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" The <classname>X509Store</classname> method\n"
|
|
+" <function>verify</function> is based on the\n"
|
|
+" <function>X509_verify_cert</function>. It handles certain aspects\n"
|
|
+" of verification but not others. The certificate will be verified\n"
|
|
+" against <constant>notBefore</constant>, \n"
|
|
+" <constant>notAfter</constant> and trusted certificates.\n"
|
|
+" It crucially will not handle checking the certificate against\n"
|
|
+" CRLs. This functionality will probably make it into OpenSSL\n"
|
|
+" 0.9.7.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
x509_store_object_verify(x509_store_object *self, PyObject *args)
|
|
@@ -1564,35 +1567,35 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_store_object_verify_chain__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Store</memberof>
|
|
- <name>verifyChain</name>
|
|
- <parameter>certificate</parameter>
|
|
- <parameter>chain</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- The <classname>X509Store</classname> method <function>verifyChain</function>
|
|
- is based on the <function>X509_verify_cert</function> but is initialised
|
|
- with a <classname>X509</classname> object to verify and list of
|
|
- <classname>X509</classname> objects which form a chain to a trusted
|
|
- certificate. Certain aspects of the verification are handled but not others.
|
|
- The certificates will be verified against <constant>notBefore</constant>,
|
|
- <constant>notAfter</constant> and trusted certificates. It crucially will
|
|
- not handle checking the certificate against CRLs. This functionality will
|
|
- probably make it into OpenSSL 0.9.7.
|
|
- </para>
|
|
- <para>
|
|
- This may all sound quite straight forward but determining the
|
|
- certificate associated with the signature on another certificate
|
|
- can be very time consuming. The management aspects of
|
|
- certificates are addressed by various V3 extensions which are not
|
|
- currently supported.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_store_object_verify_chain__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Store</memberof>\n"
|
|
+" <name>verifyChain</name>\n"
|
|
+" <parameter>certificate</parameter>\n"
|
|
+" <parameter>chain</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" The <classname>X509Store</classname> method <function>verifyChain</function> \n"
|
|
+" is based on the <function>X509_verify_cert</function> but is initialised \n"
|
|
+" with a <classname>X509</classname> object to verify and list of \n"
|
|
+" <classname>X509</classname> objects which form a chain to a trusted \n"
|
|
+" certificate. Certain aspects of the verification are handled but not others. \n"
|
|
+" The certificates will be verified against <constant>notBefore</constant>, \n"
|
|
+" <constant>notAfter</constant> and trusted certificates. It crucially will \n"
|
|
+" not handle checking the certificate against CRLs. This functionality will \n"
|
|
+" probably make it into OpenSSL 0.9.7.\n"
|
|
+" </para>\n"
|
|
+" <para>\n"
|
|
+" This may all sound quite straight forward but determining the \n"
|
|
+" certificate associated with the signature on another certificate\n"
|
|
+" can be very time consuming. The management aspects of\n"
|
|
+" certificates are addressed by various V3 extensions which are not\n"
|
|
+" currently supported.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
x509_store_object_verify_chain(x509_store_object *self, PyObject *args)
|
|
@@ -1641,24 +1644,24 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_store_object_add_trust__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Store</memberof>
|
|
- <name>addTrust</name>
|
|
- <parameter>cert</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method adds a new certificate to the store to be used in the
|
|
- verification process. <parameter>cert</parameter> should be an
|
|
- instance of <classname>X509</classname>. Using trusted certificates to manage
|
|
- verification is relatively primitive, more sophisticated systems
|
|
- can be constructed at an application level by by constructing
|
|
- certifcate chains to verify.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_store_object_add_trust__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Store</memberof>\n"
|
|
+" <name>addTrust</name>\n"
|
|
+" <parameter>cert</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method adds a new certificate to the store to be used in the\n"
|
|
+" verification process. <parameter>cert</parameter> should be an\n"
|
|
+" instance of <classname>X509</classname>. Using trusted certificates to manage\n"
|
|
+" verification is relatively primitive, more sophisticated systems\n"
|
|
+" can be constructed at an application level by by constructing\n"
|
|
+" certifcate chains to verify. \n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
x509_store_object_add_trust(x509_store_object *self, PyObject *args)
|
|
@@ -1677,26 +1680,26 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_store_object_add_crl__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Store</memberof>
|
|
- <name>addCrl</name>
|
|
- <parameter>crl</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method adds a CRL to a store to be used for verification.
|
|
- <parameter>crl</parameter> should be an instance of
|
|
- <classname>X509Crl</classname>.
|
|
- Unfortunately, the current stable release of OpenSSL does not
|
|
- support CRL checking for certificate verification.
|
|
- This functionality will probably make it into OpenSSL 0.9.7, until
|
|
- it does this function is useless and CRL verification must be
|
|
- implemented by the application.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_store_object_add_crl__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Store</memberof>\n"
|
|
+" <name>addCrl</name>\n"
|
|
+" <parameter>crl</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method adds a CRL to a store to be used for verification.\n"
|
|
+" <parameter>crl</parameter> should be an instance of\n"
|
|
+" <classname>X509Crl</classname>.\n"
|
|
+" Unfortunately, the current stable release of OpenSSL does not\n"
|
|
+" support CRL checking for certificate verification.\n"
|
|
+" This functionality will probably make it into OpenSSL 0.9.7, until\n"
|
|
+" it does this function is useless and CRL verification must be\n"
|
|
+" implemented by the application.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
x509_store_object_add_crl(x509_store_object *self, PyObject *args)
|
|
@@ -1741,44 +1744,44 @@ x509_store_object_dealloc(x509_store_object *self, cha
|
|
PyObject_Del(self);
|
|
}
|
|
|
|
-static char x509_storetype__doc__[] = "
|
|
-<class>
|
|
- <header>
|
|
- <name>X509Store</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This class provides preliminary access to OpenSSL X509 verification
|
|
- facilities.
|
|
- </para>
|
|
+static char x509_storetype__doc__[] = "\n"
|
|
+"<class>\n"
|
|
+" <header>\n"
|
|
+" <name>X509Store</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This class provides preliminary access to OpenSSL X509 verification\n"
|
|
+" facilities.\n"
|
|
+" </para>\n"
|
|
+"\n"
|
|
+" <example>\n"
|
|
+" <title><classname>x509_store</classname> class usage</title>\n"
|
|
+" <programlisting>\n"
|
|
+" store = POW.X509Store()\n"
|
|
+"\n"
|
|
+" caFile = open( 'test/cacert.pem', 'r' )\n"
|
|
+" ca = POW.pemRead( POW.X509_CERTIFICATE, caFile.read() )\n"
|
|
+" caFile.close()\n"
|
|
+"\n"
|
|
+" store.addTrust( ca )\n"
|
|
+"\n"
|
|
+" certFile = open( 'test/foocom.cert', 'r' )\n"
|
|
+" x509 = POW.pemRead( POW.X509_CERTIFICATE, certFile.read() )\n"
|
|
+" certFile.close()\n"
|
|
+"\n"
|
|
+" print x509.pprint()\n"
|
|
+" \n"
|
|
+" if store.verify( x509 ):\n"
|
|
+" print 'Verified certificate!.'\n"
|
|
+" else:\n"
|
|
+" print 'Failed to verify certificate!.'\n"
|
|
+" </programlisting>\n"
|
|
+" </example>\n"
|
|
+" </body>\n"
|
|
+"</class>";
|
|
|
|
- <example>
|
|
- <title><classname>x509_store</classname> class usage</title>
|
|
- <programlisting>
|
|
- store = POW.X509Store()
|
|
|
|
- caFile = open( 'test/cacert.pem', 'r' )
|
|
- ca = POW.pemRead( POW.X509_CERTIFICATE, caFile.read() )
|
|
- caFile.close()
|
|
-
|
|
- store.addTrust( ca )
|
|
-
|
|
- certFile = open( 'test/foocom.cert', 'r' )
|
|
- x509 = POW.pemRead( POW.X509_CERTIFICATE, certFile.read() )
|
|
- certFile.close()
|
|
-
|
|
- print x509.pprint()
|
|
-
|
|
- if store.verify( x509 ):
|
|
- print 'Verified certificate!.'
|
|
- else:
|
|
- print 'Failed to verify certificate!.'
|
|
- </programlisting>
|
|
- </example>
|
|
- </body>
|
|
-</class>";
|
|
-
|
|
-
|
|
static PyTypeObject x509_storetype = {
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
|
0, /*ob_size*/
|
|
@@ -1845,19 +1848,19 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_crl_object_get_version__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>getVersion</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns the version number from the version field of
|
|
- this CRL.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_crl_object_get_version__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>getVersion</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns the version number from the version field of\n"
|
|
+" this CRL. \n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -1878,21 +1881,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_crl_object_set_version__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>setVersion</name>
|
|
- <parameter>version</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets the version number in the version field of
|
|
- this CRL. <parameter>version</parameter> should be an
|
|
- integer.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_crl_object_set_version__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>setVersion</name>\n"
|
|
+" <parameter>version</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets the version number in the version field of\n"
|
|
+" this CRL. <parameter>version</parameter> should be an\n"
|
|
+" integer.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -1922,21 +1925,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_crl_object_get_issuer__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>getIssuer</name>
|
|
- <parameter>format=SHORTNAME_FORMAT</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a tuple containg the issuers name. See the
|
|
- <function>getIssuer</function> method of
|
|
- <classname>X509</classname> for more details.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_crl_object_get_issuer__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>getIssuer</name>\n"
|
|
+" <parameter>format=SHORTNAME_FORMAT</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a tuple containg the issuers name. See the\n"
|
|
+" <function>getIssuer</function> method of\n"
|
|
+" <classname>X509</classname> for more details.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -1958,22 +1961,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_crl_object_set_issuer__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>setIssuer</name>
|
|
- <parameter>name</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method is used to set the issuers name.
|
|
- <parameter>name</parameter> can be comprised of lists or tuples in
|
|
- the format described in the <function>getIssuer</function> method
|
|
- of <classname>X509</classname>.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_crl_object_set_issuer__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>setIssuer</name>\n"
|
|
+" <parameter>name</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method is used to set the issuers name.\n"
|
|
+" <parameter>name</parameter> can be comprised of lists or tuples in\n"
|
|
+" the format described in the <function>getIssuer</function> method\n"
|
|
+" of <classname>X509</classname>.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -2009,22 +2012,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_crl_object_set_this_update__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>setThisUpdate</name>
|
|
- <parameter>time</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets the <constant>thisUpdate</constant>
|
|
- field of this CRL. <parameter>time</parameter> should be a time in seconds,
|
|
- as generated by the <function>time</function> function in the Python
|
|
- Standard Library.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_crl_object_set_this_update__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>setThisUpdate</name>\n"
|
|
+" <parameter>time</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets the <constant>thisUpdate</constant>\n"
|
|
+" field of this CRL. <parameter>time</parameter> should be a time in seconds,\n"
|
|
+" as generated by the <function>time</function> function in the Python\n"
|
|
+" Standard Library.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
x509_crl_object_set_this_update (x509_crl_object *self, PyObject *args)
|
|
@@ -2044,21 +2047,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_crl_object_get_this_update__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>getThisUpdate</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a tuple containing two integers. The first
|
|
- number represents the time in seconds and is the same as the C
|
|
- <constant>time_t</constant> typedef and the second represents the time zone offset in
|
|
- seconds.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_crl_object_get_this_update__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>getThisUpdate</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a tuple containing two integers. The first\n"
|
|
+" number represents the time in seconds and is the same as the C \n"
|
|
+" <constant>time_t</constant> typedef and the second represents the time zone offset in\n"
|
|
+" seconds.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
x509_crl_object_get_this_update (x509_crl_object *self, PyObject *args)
|
|
@@ -2073,22 +2076,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_crl_object_set_next_update__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>setNextUpdate</name>
|
|
- <parameter>time</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets the <constant>thisUpdate</constant>
|
|
- field of this CRL. <parameter>time</parameter> should be a time in seconds,
|
|
- as generated by the <function>time</function> function in the Python
|
|
- Standard Library.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_crl_object_set_next_update__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>setNextUpdate</name>\n"
|
|
+" <parameter>time</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets the <constant>thisUpdate</constant>\n"
|
|
+" field of this CRL. <parameter>time</parameter> should be a time in seconds,\n"
|
|
+" as generated by the <function>time</function> function in the Python\n"
|
|
+" Standard Library.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
x509_crl_object_set_next_update (x509_crl_object *self, PyObject *args)
|
|
@@ -2114,21 +2117,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_crl_object_get_next_update__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>getNextUpdate</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a tuple containing two integers. The first
|
|
- number represents the time in seconds and is the same as the C
|
|
- <constant>time_t</constant> typedef and the second represents the time zone offset in
|
|
- seconds.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_crl_object_get_next_update__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>getNextUpdate</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a tuple containing two integers. The first\n"
|
|
+" number represents the time in seconds and is the same as the C \n"
|
|
+" <constant>time_t</constant> typedef and the second represents the time zone offset in\n"
|
|
+" seconds.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
x509_crl_object_get_next_update (x509_crl_object *self, PyObject *args)
|
|
@@ -2143,55 +2146,55 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_crl_object_set_revoked__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>setRevoked</name>
|
|
- <parameter>revoked</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets the sequence of revoked certificates in this CRL.
|
|
- <parameter>revoked</parameter> should be a list or tuple of
|
|
- <classname>X509Revoked</classname>.
|
|
- </para>
|
|
- <example>
|
|
- <title><function>setRevoked</function> function usage</title>
|
|
- <programlisting>
|
|
- privateFile = open('test/private.key', 'r')
|
|
- publicFile = open('test/public.key', 'r')
|
|
- crlFile = open('test/crl.pem', 'w')
|
|
+static char x509_crl_object_set_revoked__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>setRevoked</name>\n"
|
|
+" <parameter>revoked</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets the sequence of revoked certificates in this CRL.\n"
|
|
+" <parameter>revoked</parameter> should be a list or tuple of \n"
|
|
+" <classname>X509Revoked</classname>.\n"
|
|
+" </para>\n"
|
|
+" <example>\n"
|
|
+" <title><function>setRevoked</function> function usage</title>\n"
|
|
+" <programlisting>\n"
|
|
+" privateFile = open('test/private.key', 'r')\n"
|
|
+" publicFile = open('test/public.key', 'r')\n"
|
|
+" crlFile = open('test/crl.pem', 'w')\n"
|
|
+"\n"
|
|
+" publicKey = POW.pemRead(POW.RSA_PUBLIC_KEY, publicFile.read())\n"
|
|
+" privateKey = POW.pemRead(POW.RSA_PRIVATE_KEY, privateFile.read(), 'pass')\n"
|
|
+"\n"
|
|
+" crl = POW.X509Crl()\n"
|
|
+"\n"
|
|
+" name = [ ['C', 'GB'], ['ST', 'Hertfordshire'], \n"
|
|
+" ['O','The House'], ['CN', 'Peter Shannon'] ]\n"
|
|
+"\n"
|
|
+" crl.setIssuer( name )\n"
|
|
+" rev = [ POW.X509Revoked(3, int( time.time() ) - 24*60*60 ),\n"
|
|
+" POW.X509Revoked(4, int( time.time() ) - 24*60*60 ),\n"
|
|
+" POW.X509Revoked(5, int( time.time() ) - 24*60*60 ) ]\n"
|
|
+"\n"
|
|
+" crl.setRevoked( rev )\n"
|
|
+" crl.setThisUpdate( time.time() )\n"
|
|
+" crl.setNextUpdate( time.time() + 2*60*60*24*365)\n"
|
|
+" crl.sign(privateKey)\n"
|
|
+"\n"
|
|
+" crlFile.write( crl.pemWrite() )\n"
|
|
+"\n"
|
|
+" privateFile.close()\n"
|
|
+" publicFile.close()\n"
|
|
+" crlFile.close()\n"
|
|
+" </programlisting>\n"
|
|
+" </example>\n"
|
|
+"\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
- publicKey = POW.pemRead(POW.RSA_PUBLIC_KEY, publicFile.read())
|
|
- privateKey = POW.pemRead(POW.RSA_PRIVATE_KEY, privateFile.read(), 'pass')
|
|
-
|
|
- crl = POW.X509Crl()
|
|
-
|
|
- name = [ ['C', 'GB'], ['ST', 'Hertfordshire'],
|
|
- ['O','The House'], ['CN', 'Peter Shannon'] ]
|
|
-
|
|
- crl.setIssuer( name )
|
|
- rev = [ POW.X509Revoked(3, int( time.time() ) - 24*60*60 ),
|
|
- POW.X509Revoked(4, int( time.time() ) - 24*60*60 ),
|
|
- POW.X509Revoked(5, int( time.time() ) - 24*60*60 ) ]
|
|
-
|
|
- crl.setRevoked( rev )
|
|
- crl.setThisUpdate( time.time() )
|
|
- crl.setNextUpdate( time.time() + 2*60*60*24*365)
|
|
- crl.sign(privateKey)
|
|
-
|
|
- crlFile.write( crl.pemWrite() )
|
|
-
|
|
- privateFile.close()
|
|
- publicFile.close()
|
|
- crlFile.close()
|
|
- </programlisting>
|
|
- </example>
|
|
-
|
|
- </body>
|
|
-</method>";
|
|
-
|
|
static PyObject *
|
|
x509_crl_object_set_revoked(x509_crl_object *self, PyObject *args)
|
|
{
|
|
@@ -2276,46 +2279,46 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_crl_object_get_revoked__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>getRevoked</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a tuple of <classname>X509Revoked</classname>
|
|
- objects described in the CRL.
|
|
- </para>
|
|
- <example>
|
|
- <title><function>getRevoked</function> function usage</title>
|
|
- <programlisting>
|
|
- publicFile = open('test/public.key', 'r')
|
|
- crlFile = open('test/crl.pem', 'r')
|
|
+static char x509_crl_object_get_revoked__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>getRevoked</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a tuple of <classname>X509Revoked</classname>\n"
|
|
+" objects described in the CRL.\n"
|
|
+" </para>\n"
|
|
+" <example>\n"
|
|
+" <title><function>getRevoked</function> function usage</title>\n"
|
|
+" <programlisting>\n"
|
|
+" publicFile = open('test/public.key', 'r')\n"
|
|
+" crlFile = open('test/crl.pem', 'r')\n"
|
|
+"\n"
|
|
+" publicKey = POW.pemRead(POW.RSA_PUBLIC_KEY, publicFile.read())\n"
|
|
+"\n"
|
|
+" crl = POW.pemRead( POW.X509_CRL, crlFile.read() )\n"
|
|
+"\n"
|
|
+" print crl.pprint()\n"
|
|
+" if crl.verify( publicKey ):\n"
|
|
+" print 'signature ok!'\n"
|
|
+" else:\n"
|
|
+" print 'signature not ok!'\n"
|
|
+"\n"
|
|
+" revocations = crl.getRevoked()\n"
|
|
+" for revoked in revocations:\n"
|
|
+" print 'serial number:', revoked.getSerial()\n"
|
|
+" print 'date:', time.ctime( revoked.getDate()[0] )\n"
|
|
+"\n"
|
|
+" publicFile.close()\n"
|
|
+" crlFile.close()\n"
|
|
+" </programlisting>\n"
|
|
+" </example>\n"
|
|
+"\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
- publicKey = POW.pemRead(POW.RSA_PUBLIC_KEY, publicFile.read())
|
|
-
|
|
- crl = POW.pemRead( POW.X509_CRL, crlFile.read() )
|
|
-
|
|
- print crl.pprint()
|
|
- if crl.verify( publicKey ):
|
|
- print 'signature ok!'
|
|
- else:
|
|
- print 'signature not ok!'
|
|
-
|
|
- revocations = crl.getRevoked()
|
|
- for revoked in revocations:
|
|
- print 'serial number:', revoked.getSerial()
|
|
- print 'date:', time.ctime( revoked.getDate()[0] )
|
|
-
|
|
- publicFile.close()
|
|
- crlFile.close()
|
|
- </programlisting>
|
|
- </example>
|
|
-
|
|
- </body>
|
|
-</method>";
|
|
-
|
|
static PyObject *
|
|
x509_crl_object_get_revoked(x509_crl_object *self, PyObject *args)
|
|
{
|
|
@@ -2333,33 +2336,33 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_crl_object_sign__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>sign</name>
|
|
- <parameter>key</parameter>
|
|
- <parameter>digest=MD5_DIGEST</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- <parameter>key</parameter> should be an instance of
|
|
- <classname>Asymmetric</classname> and contain a private key.
|
|
- <parameter>digest</parameter> indicates
|
|
- which digest function should be used to compute the hash to be
|
|
- signed, it should be one of the following:
|
|
- </para>
|
|
- <simplelist>
|
|
- <member><constant>MD2_DIGEST</constant></member>
|
|
- <member><constant>MD5_DIGEST</constant></member>
|
|
- <member><constant>SHA_DIGEST</constant></member>
|
|
- <member><constant>SHA1_DIGEST</constant></member>
|
|
- <member><constant>RIPEMD160_DIGEST</constant></member>
|
|
- </simplelist>
|
|
- </body>
|
|
+static char x509_crl_object_sign__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>sign</name>\n"
|
|
+" <parameter>key</parameter>\n"
|
|
+" <parameter>digest=MD5_DIGEST</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" <parameter>key</parameter> should be an instance of\n"
|
|
+" <classname>Asymmetric</classname> and contain a private key.\n"
|
|
+" <parameter>digest</parameter> indicates \n"
|
|
+" which digest function should be used to compute the hash to be \n"
|
|
+" signed, it should be one of the following:\n"
|
|
+" </para>\n"
|
|
+" <simplelist>\n"
|
|
+" <member><constant>MD2_DIGEST</constant></member>\n"
|
|
+" <member><constant>MD5_DIGEST</constant></member>\n"
|
|
+" <member><constant>SHA_DIGEST</constant></member>\n"
|
|
+" <member><constant>SHA1_DIGEST</constant></member>\n"
|
|
+" <member><constant>RIPEMD160_DIGEST</constant></member>\n"
|
|
+" </simplelist>\n"
|
|
+" </body>\n"
|
|
+"\n"
|
|
+"</method>";
|
|
|
|
-</method>";
|
|
-
|
|
static PyObject *
|
|
x509_crl_object_sign(x509_crl_object *self, PyObject *args)
|
|
{
|
|
@@ -2430,26 +2433,26 @@ error:
|
|
|
|
}
|
|
|
|
-static char x509_crl_object_verify__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>verify</name>
|
|
- <parameter>key</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- The <classname>X509Crl</classname> method
|
|
- <function>verify</function> is based on the
|
|
- <function>X509_CRL_verify</function> function. Unlike the
|
|
- <classname>X509</classname> function of the same name, this
|
|
- function simply checks the CRL was signed with the private key
|
|
- which corresponds the parameter <parameter>key</parameter>.
|
|
- <parameter>key</parameter> should be an instance of
|
|
- <classname>Asymmetric</classname> and contain a public key.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_crl_object_verify__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>verify</name>\n"
|
|
+" <parameter>key</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" The <classname>X509Crl</classname> method\n"
|
|
+" <function>verify</function> is based on the\n"
|
|
+" <function>X509_CRL_verify</function> function. Unlike the\n"
|
|
+" <classname>X509</classname> function of the same name, this\n"
|
|
+" function simply checks the CRL was signed with the private key\n"
|
|
+" which corresponds the parameter <parameter>key</parameter>.\n"
|
|
+" <parameter>key</parameter> should be an instance of\n"
|
|
+" <classname>Asymmetric</classname> and contain a public key.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
x509_crl_object_verify(x509_crl_object *self, PyObject *args)
|
|
@@ -2489,19 +2492,19 @@ error:
|
|
|
|
}
|
|
|
|
-static char x509_crl_object_pem_write__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>pemWrite</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a PEM encoded CRL as a
|
|
- string.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_crl_object_pem_write__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>pemWrite</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a PEM encoded CRL as a\n"
|
|
+" string.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -2546,19 +2549,19 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_crl_object_pprint__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Crl</memberof>
|
|
- <name>pprint</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a formatted string showing the information
|
|
- held in the CRL.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_crl_object_pprint__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Crl</memberof>\n"
|
|
+" <name>pprint</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a formatted string showing the information\n"
|
|
+" held in the CRL.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -2650,18 +2653,18 @@ x509_crl_object_dealloc(x509_crl_object *self, char *n
|
|
PyObject_Del(self);
|
|
}
|
|
|
|
-static char x509_crltype__doc__[] = "
|
|
-<class>
|
|
- <header>
|
|
- <name>X509Crl</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This class provides access to OpenSSL X509 CRL management
|
|
- facilities.
|
|
- </para>
|
|
- </body>
|
|
-</class>";
|
|
+static char x509_crltype__doc__[] = "\n"
|
|
+"<class>\n"
|
|
+" <header>\n"
|
|
+" <name>X509Crl</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This class provides access to OpenSSL X509 CRL management\n"
|
|
+" facilities.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</class>";
|
|
|
|
|
|
static PyTypeObject x509_crltype = {
|
|
@@ -2708,21 +2711,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_revoked_object_set_serial__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Revoked</memberof>
|
|
- <name>setSerial</name>
|
|
- <parameter>serial</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets the serial number in the serial field of
|
|
- this object. <parameter>serial</parameter> should be an
|
|
- integer.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_revoked_object_set_serial__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Revoked</memberof>\n"
|
|
+" <name>setSerial</name>\n"
|
|
+" <parameter>serial</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets the serial number in the serial field of\n"
|
|
+" this object. <parameter>serial</parameter> should be an\n"
|
|
+" integer.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
x509_revoked_object_set_serial(x509_revoked_object *self, PyObject *args)
|
|
@@ -2742,19 +2745,19 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_revoked_object_get_serial__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Revoked</memberof>
|
|
- <name>getSerial</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method gets the serial number in the serial field of
|
|
- this object.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_revoked_object_get_serial__doc__[] = " \n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Revoked</memberof>\n"
|
|
+" <name>getSerial</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method gets the serial number in the serial field of\n"
|
|
+" this object.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
x509_revoked_object_get_serial(x509_revoked_object *self, PyObject *args)
|
|
@@ -2774,22 +2777,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_revoked_object_get_date__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Revoked</memberof>
|
|
- <name>getDate</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a tuple containing two integers representing
|
|
- <constant>revocationDate</constant>. The first
|
|
- number represents the time in seconds and is the same as the C
|
|
- <constant>time_t</constant> typedef and the second represents the time zone offset in
|
|
- seconds.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_revoked_object_get_date__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Revoked</memberof>\n"
|
|
+" <name>getDate</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a tuple containing two integers representing\n"
|
|
+" <constant>revocationDate</constant>. The first\n"
|
|
+" number represents the time in seconds and is the same as the C \n"
|
|
+" <constant>time_t</constant> typedef and the second represents the time zone offset in\n"
|
|
+" seconds.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -2805,22 +2808,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char x509_revoked_object_set_date__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>X509Revoked</memberof>
|
|
- <name>setDate</name>
|
|
- <parameter>time</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets the <constant>revocationDate</constant>
|
|
- field of this object. <parameter>time</parameter> should be a time in seconds,
|
|
- as generated by the <function>time</function> function in the Python
|
|
- Standard Library.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char x509_revoked_object_set_date__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Revoked</memberof>\n"
|
|
+" <name>setDate</name>\n"
|
|
+" <parameter>time</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets the <constant>revocationDate</constant>\n"
|
|
+" field of this object. <parameter>time</parameter> should be a time in seconds,\n"
|
|
+" as generated by the <function>time</function> function in the Python\n"
|
|
+" Standard Library.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -2867,24 +2870,24 @@ x509_revoked_object_dealloc(x509_revoked_object *self,
|
|
PyObject_Del(self);
|
|
}
|
|
|
|
-static char x509_revokedtype__doc__[] = "
|
|
-<class>
|
|
- <header>
|
|
- <name>X509Revoked</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This class provides a container for details of a revoked
|
|
- certificate. It normally would only be used in association with
|
|
- a CRL, its not much use by itself. Indeed the only reason this
|
|
- class exists is because in the future POW is likely to be extended
|
|
- to support extensions for certificates, CRLs and revocations.
|
|
- <classname>X509Revoked</classname> existing as an object in its
|
|
- own right will make adding this support easier, while avoiding
|
|
- backwards compatibility issues.
|
|
- </para>
|
|
- </body>
|
|
-</class>";
|
|
+static char x509_revokedtype__doc__[] = "\n"
|
|
+"<class>\n"
|
|
+" <header>\n"
|
|
+" <name>X509Revoked</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This class provides a container for details of a revoked\n"
|
|
+" certificate. It normally would only be used in association with\n"
|
|
+" a CRL, its not much use by itself. Indeed the only reason this\n"
|
|
+" class exists is because in the future POW is likely to be extended\n"
|
|
+" to support extensions for certificates, CRLs and revocations.\n"
|
|
+" <classname>X509Revoked</classname> existing as an object in its\n"
|
|
+" own right will make adding this support easier, while avoiding\n"
|
|
+" backwards compatibility issues.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</class>";
|
|
|
|
|
|
static PyTypeObject x509_revokedtype = {
|
|
@@ -2914,21 +2917,21 @@ static PyTypeObject x509_revokedtype = {
|
|
/*========== x509 revoked Code ==========*/
|
|
|
|
/*========== ssl Code ==========*/
|
|
-static char ssl_object_use_certificate__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>useCertificate</name>
|
|
- <parameter>cert</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- The parameter <parameter>cert</parameter> must be an
|
|
- instance of the <classname>X590</classname> class and must be
|
|
- called before <function>setFd</function>.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_use_certificate__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>useCertificate</name>\n"
|
|
+" <parameter>cert</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" The parameter <parameter>cert</parameter> must be an\n"
|
|
+" instance of the <classname>X590</classname> class and must be\n"
|
|
+" called before <function>setFd</function>. \n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_use_certificate(ssl_object *self, PyObject *args)
|
|
@@ -2951,22 +2954,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char ssl_object_use_key__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>useKey</name>
|
|
- <parameter>key</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- The parameter <parameter>key</parameter> must be an
|
|
- instance of the <classname>Asymmetric</classname> class and
|
|
- must contain the private key. This function cannot be called
|
|
- after <function>useKey</function>.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_use_key__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>useKey</name>\n"
|
|
+" <parameter>key</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" The parameter <parameter>key</parameter> must be an\n"
|
|
+" instance of the <classname>Asymmetric</classname> class and\n"
|
|
+" must contain the private key. This function cannot be called \n"
|
|
+" after <function>useKey</function>.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_use_key(ssl_object *self, PyObject *args)
|
|
@@ -3015,21 +3018,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char ssl_object_check_key__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>checkKey</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This simple method will return 1 if the public key, contained in
|
|
- the X509 certificate this <classname>Ssl</classname> instance is using,
|
|
- matches the private key this <classname>Ssl</classname> instance is using.
|
|
- Otherwise it will return 0.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_check_key__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>checkKey</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This simple method will return 1 if the public key, contained in\n"
|
|
+" the X509 certificate this <classname>Ssl</classname> instance is using,\n"
|
|
+" matches the private key this <classname>Ssl</classname> instance is using.\n"
|
|
+" Otherwise it will return 0.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_check_key(ssl_object *self, PyObject *args)
|
|
@@ -3040,23 +3043,23 @@ ssl_object_check_key(ssl_object *self, PyObject *args)
|
|
return Py_BuildValue("i", 0);
|
|
}
|
|
|
|
-static char ssl_object_set_fd__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>setFd</name>
|
|
- <parameter>descriptor</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This function is used to associate a file descriptor with a
|
|
- <classname>Ssl</classname> object. The file descriptor should
|
|
- belong to an open TCP connection. Once this function has
|
|
- been called, calling <function>useKey</function> or
|
|
- <function>useCertificate</function> will, fail rasing exceptions.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_set_fd__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>setFd</name>\n"
|
|
+" <parameter>descriptor</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This function is used to associate a file descriptor with a\n"
|
|
+" <classname>Ssl</classname> object. The file descriptor should\n"
|
|
+" belong to an open TCP connection. Once this function has\n"
|
|
+" been called, calling <function>useKey</function> or\n"
|
|
+" <function>useCertificate</function> will, fail rasing exceptions.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_set_fd(ssl_object *self, PyObject *args)
|
|
@@ -3086,57 +3089,57 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char ssl_object_accept__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>accept</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This function will attempt the SSL level accept with a
|
|
- client. The <classname>Ssl</classname> object must have been
|
|
- created using a <constant>XXXXX_SERVER_METHOD</constant> or
|
|
- a <constant>XXXXX_METHOD</constant> and this function should only be
|
|
- called after <function>useKey</function>,
|
|
- <function>useCertificate</function> and
|
|
- <function>setFd</function> functions have been called.
|
|
- </para>
|
|
+static char ssl_object_accept__doc__[] = " \n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>accept</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This function will attempt the SSL level accept with a\n"
|
|
+" client. The <classname>Ssl</classname> object must have been\n"
|
|
+" created using a <constant>XXXXX_SERVER_METHOD</constant> or\n"
|
|
+" a <constant>XXXXX_METHOD</constant> and this function should only be\n"
|
|
+" called after <function>useKey</function>,\n"
|
|
+" <function>useCertificate</function> and\n"
|
|
+" <function>setFd</function> functions have been called.\n"
|
|
+" </para>\n"
|
|
+"\n"
|
|
+" <example>\n"
|
|
+" <title><function>accept</function> function usage</title>\n"
|
|
+" <programlisting>\n"
|
|
+" keyFile = open( 'test/private.key', 'r' )\n"
|
|
+" certFile = open( 'test/cacert.pem', 'r' )\n"
|
|
+"\n"
|
|
+" rsa = POW.pemRead( POW.RSA_PRIVATE_KEY, keyFile.read(), 'pass' )\n"
|
|
+" x509 = POW.pemRead( POW.X509_CERTIFICATE, certFile.read() )\n"
|
|
+"\n"
|
|
+" keyFile.close()\n"
|
|
+" certFile.close()\n"
|
|
+"\n"
|
|
+" sl = POW.Ssl( POW.SSLV23_SERVER_METHOD )\n"
|
|
+" sl.useCertificate( x509 )\n"
|
|
+" sl.useKey( rsa )\n"
|
|
+"\n"
|
|
+" s = socket.socket( socket.AF_INET, socket.SOCK_STREAM )\n"
|
|
+" s.bind( ('localhost', 1111) )\n"
|
|
+" s.listen(5)\n"
|
|
+" s2, addr = s.accept()\n"
|
|
+"\n"
|
|
+" s.close()\n"
|
|
+"\n"
|
|
+" sl.setFd( s2.fileno() )\n"
|
|
+" sl.accept()\n"
|
|
+" print sl.read(1024)\n"
|
|
+" sl.write('Message from server to client...')\n"
|
|
+"\n"
|
|
+" s2.close() \n"
|
|
+" </programlisting>\n"
|
|
+" </example>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
- <example>
|
|
- <title><function>accept</function> function usage</title>
|
|
- <programlisting>
|
|
- keyFile = open( 'test/private.key', 'r' )
|
|
- certFile = open( 'test/cacert.pem', 'r' )
|
|
-
|
|
- rsa = POW.pemRead( POW.RSA_PRIVATE_KEY, keyFile.read(), 'pass' )
|
|
- x509 = POW.pemRead( POW.X509_CERTIFICATE, certFile.read() )
|
|
-
|
|
- keyFile.close()
|
|
- certFile.close()
|
|
-
|
|
- sl = POW.Ssl( POW.SSLV23_SERVER_METHOD )
|
|
- sl.useCertificate( x509 )
|
|
- sl.useKey( rsa )
|
|
-
|
|
- s = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
|
- s.bind( ('localhost', 1111) )
|
|
- s.listen(5)
|
|
- s2, addr = s.accept()
|
|
-
|
|
- s.close()
|
|
-
|
|
- sl.setFd( s2.fileno() )
|
|
- sl.accept()
|
|
- print sl.read(1024)
|
|
- sl.write('Message from server to client...')
|
|
-
|
|
- s2.close()
|
|
- </programlisting>
|
|
- </example>
|
|
- </body>
|
|
-</method>";
|
|
-
|
|
static PyObject *
|
|
ssl_object_accept(ssl_object *self, PyObject *args)
|
|
{
|
|
@@ -3159,38 +3162,38 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char ssl_object_connect__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>connect</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This function will attempt the SSL level connection with a
|
|
- server. The <classname>Ssl</classname> object must have been
|
|
- created using a <constant>XXXXX_CLIENT_METHOD</constant> or
|
|
- a <constant>XXXXX_METHOD</constant> and this function should only be
|
|
- called after <function>setFd</function> has already been
|
|
- called.
|
|
- </para>
|
|
+static char ssl_object_connect__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>connect</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This function will attempt the SSL level connection with a\n"
|
|
+" server. The <classname>Ssl</classname> object must have been\n"
|
|
+" created using a <constant>XXXXX_CLIENT_METHOD</constant> or\n"
|
|
+" a <constant>XXXXX_METHOD</constant> and this function should only be\n"
|
|
+" called after <function>setFd</function> has already been\n"
|
|
+" called.\n"
|
|
+" </para>\n"
|
|
+"\n"
|
|
+" <example>\n"
|
|
+" <title><function>connect</function> function usage</title>\n"
|
|
+" <programlisting>\n"
|
|
+" s = socket.socket( socket.AF_INET, socket.SOCK_STREAM )\n"
|
|
+" s.connect(('localhost', 1111))\n"
|
|
+"\n"
|
|
+" sl = POW.Ssl( POW.SSLV23_CLIENT_METHOD )\n"
|
|
+" sl.setFd( s.fileno() )\n"
|
|
+" sl.connect()\n"
|
|
+" sl.write('Message from client to server...')\n"
|
|
+" print sl.read(1024)\n"
|
|
+" </programlisting>\n"
|
|
+" </example>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
- <example>
|
|
- <title><function>connect</function> function usage</title>
|
|
- <programlisting>
|
|
- s = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
|
- s.connect(('localhost', 1111))
|
|
-
|
|
- sl = POW.Ssl( POW.SSLV23_CLIENT_METHOD )
|
|
- sl.setFd( s.fileno() )
|
|
- sl.connect()
|
|
- sl.write('Message from client to server...')
|
|
- print sl.read(1024)
|
|
- </programlisting>
|
|
- </example>
|
|
- </body>
|
|
-</method>";
|
|
-
|
|
static PyObject *
|
|
ssl_object_connect(ssl_object *self, PyObject *args)
|
|
{
|
|
@@ -3209,22 +3212,22 @@ ssl_object_connect(ssl_object *self, PyObject *args)
|
|
return Py_BuildValue("");
|
|
}
|
|
|
|
-static char ssl_object_write__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>write</name>
|
|
- <parameter>string</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method writes the <parameter>string</parameter> to the
|
|
- <classname>Ssl</classname> object, to be read by it's peer. This
|
|
- function is analogous to the <classname>socket</classname>
|
|
- classes <function>write</function> function.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_write__doc__[] = " \n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>write</name>\n"
|
|
+" <parameter>string</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method writes the <parameter>string</parameter> to the\n"
|
|
+" <classname>Ssl</classname> object, to be read by it's peer. This\n"
|
|
+" function is analogous to the <classname>socket</classname>\n"
|
|
+" classes <function>write</function> function.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_write(ssl_object *self, PyObject *args)
|
|
@@ -3249,22 +3252,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char ssl_object_read__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>read</name>
|
|
- <parameter>amount=1024</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method reads up to <parameter>amount</parameter> characters from the
|
|
- <classname>Ssl</classname> object. This
|
|
- function is analogous to the <classname>socket</classname>
|
|
- classes <function>read</function> function.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_read__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>read</name>\n"
|
|
+" <parameter>amount=1024</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method reads up to <parameter>amount</parameter> characters from the\n"
|
|
+" <classname>Ssl</classname> object. This\n"
|
|
+" function is analogous to the <classname>socket</classname>\n"
|
|
+" classes <function>read</function> function.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_read(ssl_object *self, PyObject *args)
|
|
@@ -3304,20 +3307,20 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char ssl_object_peer_certificate__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>peerCertificate</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns any peer certificate presented in the initial
|
|
- SSL negotiation or <constant>None</constant>. If a certificate is
|
|
- returned, it will be an instance of <classname>X509</classname>.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_peer_certificate__doc__[] = " \n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>peerCertificate</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns any peer certificate presented in the initial\n"
|
|
+" SSL negotiation or <constant>None</constant>. If a certificate is\n"
|
|
+" returned, it will be an instance of <classname>X509</classname>.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -3357,19 +3360,19 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char ssl_object_clear__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>clear</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method will clear the SSL session ready for
|
|
- a new SSL connection. It will not effect the underlying socket.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_clear__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>clear</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method will clear the SSL session ready for\n"
|
|
+" a new SSL connection. It will not effect the underlying socket.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_clear(ssl_object *self, PyObject *args)
|
|
@@ -3387,32 +3390,32 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char ssl_object_shutdown__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>shutdown</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method will issue a <constant>shutdown</constant> signal to it's peer.
|
|
- If this connection's peer has already initiated a shutdown this call
|
|
- will succeed, otherwise it will raise and exception. In order to
|
|
- check the shutdown handshake was successful,
|
|
- <function>shutdown</function> must be called again. If no
|
|
- exception is raised, the handshake is complete.
|
|
- </para>
|
|
- <para>
|
|
- The odd
|
|
- implementation of this function reflects the underlying OpenSSL
|
|
- function, which reflects the SSL protocol. Although rasing an
|
|
- exception is a bit annoying, the alternative, returning true all
|
|
- false will not tell you why the call failed and the exception
|
|
- will, at least that is the theory. Look up the exact meaning
|
|
- of the exceptions in the OpenSSL man page SSL_get_error.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_shutdown__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>shutdown</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method will issue a <constant>shutdown</constant> signal to it's peer. \n"
|
|
+" If this connection's peer has already initiated a shutdown this call\n"
|
|
+" will succeed, otherwise it will raise and exception. In order to\n"
|
|
+" check the shutdown handshake was successful,\n"
|
|
+" <function>shutdown</function> must be called again. If no\n"
|
|
+" exception is raised, the handshake is complete. \n"
|
|
+" </para>\n"
|
|
+" <para>\n"
|
|
+" The odd\n"
|
|
+" implementation of this function reflects the underlying OpenSSL\n"
|
|
+" function, which reflects the SSL protocol. Although rasing an\n"
|
|
+" exception is a bit annoying, the alternative, returning true all\n"
|
|
+" false will not tell you why the call failed and the exception\n"
|
|
+" will, at least that is the theory. Look up the exact meaning\n"
|
|
+" of the exceptions in the OpenSSL man page SSL_get_error.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_shutdown(ssl_object *self, PyObject *args)
|
|
@@ -3438,28 +3441,28 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char ssl_object_get_shutdown__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>getShutdown</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This function returns an integer indicating the state of the
|
|
- SSL connection. <constant>SSL_RECIEVED_SHUTDOWN</constant>
|
|
- will be set the if it's peer sends a <constant>shutdown</constant>
|
|
- signal or the underlying socket
|
|
- receives a close notify . The possible values are:
|
|
- </para>
|
|
- <simplelist>
|
|
- <member><constant>SSL_NO_SHUTDOWN</constant></member>
|
|
- <member><constant>SSL_SENT_SHUTDOWN</constant></member>
|
|
- <member><constant>SSL_RECIEVED_SHUTDOWN</constant></member>
|
|
- <member><constant>SSL_SENT_SHUTDOWN</constant> | <constant>SSL_RECIEVED_SHUTDOWN</constant></member>
|
|
- </simplelist>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_get_shutdown__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>getShutdown</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This function returns an integer indicating the state of the\n"
|
|
+" SSL connection. <constant>SSL_RECIEVED_SHUTDOWN</constant>\n"
|
|
+" will be set the if it's peer sends a <constant>shutdown</constant>\n"
|
|
+" signal or the underlying socket\n"
|
|
+" receives a close notify . The possible values are:\n"
|
|
+" </para>\n"
|
|
+" <simplelist>\n"
|
|
+" <member><constant>SSL_NO_SHUTDOWN</constant></member>\n"
|
|
+" <member><constant>SSL_SENT_SHUTDOWN</constant></member>\n"
|
|
+" <member><constant>SSL_RECIEVED_SHUTDOWN</constant></member>\n"
|
|
+" <member><constant>SSL_SENT_SHUTDOWN</constant> | <constant>SSL_RECIEVED_SHUTDOWN</constant></member>\n"
|
|
+" </simplelist>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_get_shutdown(ssl_object *self, PyObject *args)
|
|
@@ -3478,20 +3481,20 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char ssl_object_get_ciphers__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>getCiphers</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This function returns a list of available ciphers ordered from
|
|
- most favoured to least. This function must be called after
|
|
- <function>setFd</function>.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_get_ciphers__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>getCiphers</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This function returns a list of available ciphers ordered from\n"
|
|
+" most favoured to least. This function must be called after\n"
|
|
+" <function>setFd</function>. \n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_get_ciphers(ssl_object *self, PyObject *args)
|
|
@@ -3535,25 +3538,25 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char ssl_object_set_ciphers__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>setCiphers</name>
|
|
- <parameter>ciphers</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- <function>setCiphers</function>
|
|
- can help protect against certain types of attacks which try to
|
|
- coerce the server, client or both to negotiate a weak cipher.
|
|
- <parameter>ciphers</parameter> should be a list of strings, as
|
|
- produced by <function>getCiphers</function> and described in the
|
|
- OpenSSL man page ciphers. <function>setCiphers</function> should
|
|
- only be called after <function>setFd</function>.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_set_ciphers__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>setCiphers</name>\n"
|
|
+" <parameter>ciphers</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" <function>setCiphers</function>\n"
|
|
+" can help protect against certain types of attacks which try to\n"
|
|
+" coerce the server, client or both to negotiate a weak cipher. \n"
|
|
+" <parameter>ciphers</parameter> should be a list of strings, as\n"
|
|
+" produced by <function>getCiphers</function> and described in the\n"
|
|
+" OpenSSL man page ciphers. <function>setCiphers</function> should\n"
|
|
+" only be called after <function>setFd</function>.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_set_ciphers(ssl_object *self, PyObject *args)
|
|
@@ -3610,18 +3613,18 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char ssl_object_get_cipher__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>getCipher</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This function returns the current cipher in use.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_get_cipher__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>getCipher</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This function returns the current cipher in use.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_get_cipher(ssl_object *self, PyObject *args)
|
|
@@ -3644,30 +3647,30 @@ static int stub_callback(int preverify_ok, X509_STORE_
|
|
return 1;
|
|
}
|
|
|
|
-static char ssl_object_set_verify_mode__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <name>setVerifyMode</name>
|
|
- <parameter>mode</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This function sets the behaviour of the SSL handshake. The
|
|
- parameter <parameter>mode</parameter> should be one of the
|
|
- following:
|
|
- </para>
|
|
- <simplelist>
|
|
- <member><constant>SSL_VERIFY_NONE</constant></member>
|
|
- <member><constant>SSL_VERIFY_PEER</constant></member>
|
|
- </simplelist>
|
|
- <para>
|
|
- See the OpenSSL man page <function>SSL_CTX_set_verify</function>
|
|
- for details. This function must be called after <function>setfd</function>
|
|
- has been called.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char ssl_object_set_verify_mode__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <name>setVerifyMode</name>\n"
|
|
+" <parameter>mode</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This function sets the behaviour of the SSL handshake. The\n"
|
|
+" parameter <parameter>mode</parameter> should be one of the\n"
|
|
+" following:\n"
|
|
+" </para>\n"
|
|
+" <simplelist>\n"
|
|
+" <member><constant>SSL_VERIFY_NONE</constant></member>\n"
|
|
+" <member><constant>SSL_VERIFY_PEER</constant></member>\n"
|
|
+" </simplelist>\n"
|
|
+" <para>\n"
|
|
+" See the OpenSSL man page <function>SSL_CTX_set_verify</function> \n"
|
|
+" for details. This function must be called after <function>setfd</function> \n"
|
|
+" has been called.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
ssl_object_set_verify_mode(ssl_object *self, PyObject *args)
|
|
@@ -3784,24 +3787,24 @@ ssl_object_dealloc(ssl_object *self)
|
|
PyObject_Del(self);
|
|
}
|
|
|
|
-static char ssltype__doc__[] = "
|
|
-<class>
|
|
- <header>
|
|
- <name>Ssl</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This class provides access to the Secure Socket Layer
|
|
- functionality of OpenSSL. It is designed to be a simple as
|
|
- possible to use and is not designed for high performance
|
|
- applications which handle many simultaneous connections. The
|
|
- original motivation for writing this library was to provide a
|
|
- security layer for network agents written in Python, for this
|
|
- application, good performance with multiple concurrent connections
|
|
- is not an issue.
|
|
- </para>
|
|
- </body>
|
|
-</class>";
|
|
+static char ssltype__doc__[] = "\n"
|
|
+"<class>\n"
|
|
+" <header>\n"
|
|
+" <name>Ssl</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This class provides access to the Secure Socket Layer\n"
|
|
+" functionality of OpenSSL. It is designed to be a simple as\n"
|
|
+" possible to use and is not designed for high performance\n"
|
|
+" applications which handle many simultaneous connections. The\n"
|
|
+" original motivation for writing this library was to provide a\n"
|
|
+" security layer for network agents written in Python, for this\n"
|
|
+" application, good performance with multiple concurrent connections\n"
|
|
+" is not an issue. \n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</class>";
|
|
|
|
static PyTypeObject ssltype = {
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
|
@@ -3901,31 +3904,31 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char asymmetric_object_pem_write__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Asymmetric</memberof>
|
|
- <name>pemWrite</name>
|
|
- <parameter>keytype</parameter>
|
|
- <parameter>ciphertype=None</parameter>
|
|
- <parameter>passphrase=None</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method is used to write <classname>Asymmetric</classname>
|
|
- objects out to strings. The first argument should be either
|
|
- <constant>RSA_PUBLIC_KEY</constant> or
|
|
- <constant>RSA_PRIVATE_KEY</constant>. Private keys are often
|
|
- saved in encrypted files to offer extra security above access
|
|
- control mechanisms. If the <parameter>keytype</parameter> is
|
|
- <constant>RSA_PRIVATE_KEY</constant> a
|
|
- <parameter>ciphertype</parameter> and
|
|
- <parameter>passphrase</parameter> can also be specified. The
|
|
- <parameter>ciphertype</parameter> should be one of those listed in
|
|
- the <classname>Symmetric</classname> class section.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char asymmetric_object_pem_write__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Asymmetric</memberof>\n"
|
|
+" <name>pemWrite</name>\n"
|
|
+" <parameter>keytype</parameter>\n"
|
|
+" <parameter>ciphertype=None</parameter>\n"
|
|
+" <parameter>passphrase=None</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method is used to write <classname>Asymmetric</classname>\n"
|
|
+" objects out to strings. The first argument should be either\n"
|
|
+" <constant>RSA_PUBLIC_KEY</constant> or\n"
|
|
+" <constant>RSA_PRIVATE_KEY</constant>. Private keys are often\n"
|
|
+" saved in encrypted files to offer extra security above access\n"
|
|
+" control mechanisms. If the <parameter>keytype</parameter> is\n"
|
|
+" <constant>RSA_PRIVATE_KEY</constant> a\n"
|
|
+" <parameter>ciphertype</parameter> and\n"
|
|
+" <parameter>passphrase</parameter> can also be specified. The\n"
|
|
+" <parameter>ciphertype</parameter> should be one of those listed in\n"
|
|
+" the <classname>Symmetric</classname> class section.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -4012,22 +4015,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char asymmetric_object_public_encrypt__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Asymmetric</memberof>
|
|
- <name>publicEncrypt</name>
|
|
- <parameter>plaintext</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method is used to encrypt the <parameter>plaintext</parameter>
|
|
- using a public key. It should be noted; in practice this
|
|
- function would be used almost exclusively to encrypt symmetric cipher
|
|
- keys and not data since asymmetric cipher operations are very slow.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char asymmetric_object_public_encrypt__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Asymmetric</memberof>\n"
|
|
+" <name>publicEncrypt</name>\n"
|
|
+" <parameter>plaintext</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method is used to encrypt the <parameter>plaintext</parameter>\n"
|
|
+" using a public key. It should be noted; in practice this\n"
|
|
+" function would be used almost exclusively to encrypt symmetric cipher\n"
|
|
+" keys and not data since asymmetric cipher operations are very slow.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
asymmetric_object_public_encrypt(asymmetric_object *self, PyObject *args)
|
|
@@ -4073,22 +4076,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char asymmetric_object_private_encrypt__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Asymmetric</memberof>
|
|
- <name>privateEncrypt</name>
|
|
- <parameter>plaintext</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method is used to encrypt the <parameter>plaintext</parameter>
|
|
- using a private key. It should be noted; in practice this
|
|
- function would be used almost exclusively to encrypt symmetric cipher
|
|
- keys and not data since asymmetric cipher operations are very slow.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char asymmetric_object_private_encrypt__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Asymmetric</memberof>\n"
|
|
+" <name>privateEncrypt</name>\n"
|
|
+" <parameter>plaintext</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method is used to encrypt the <parameter>plaintext</parameter>\n"
|
|
+" using a private key. It should be noted; in practice this\n"
|
|
+" function would be used almost exclusively to encrypt symmetric cipher\n"
|
|
+" keys and not data since asymmetric cipher operations are very slow.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
asymmetric_object_private_encrypt(asymmetric_object *self, PyObject *args)
|
|
@@ -4134,22 +4137,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char asymmetric_object_public_decrypt__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Asymmetric</memberof>
|
|
- <name>publicDecrypt</name>
|
|
- <parameter>ciphertext</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method is used to decrypt the
|
|
- <parameter>ciphertext</parameter> which has been encrypted
|
|
- using the corresponding private key and the
|
|
- <function>privateEncrypt</function> function.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char asymmetric_object_public_decrypt__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Asymmetric</memberof>\n"
|
|
+" <name>publicDecrypt</name>\n"
|
|
+" <parameter>ciphertext</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method is used to decrypt the\n"
|
|
+" <parameter>ciphertext</parameter> which has been encrypted\n"
|
|
+" using the corresponding private key and the\n"
|
|
+" <function>privateEncrypt</function> function. \n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -4196,21 +4199,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char asymmetric_object_private_decrypt__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Asymmetric</memberof>
|
|
- <name>privateDecrypt</name>
|
|
- <parameter>ciphertext</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method is used to decrypt ciphertext which has been encrypted
|
|
- using the corresponding public key and the
|
|
- <function>publicEncrypt</function> function.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char asymmetric_object_private_decrypt__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Asymmetric</memberof>\n"
|
|
+" <name>privateDecrypt</name>\n"
|
|
+" <parameter>ciphertext</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method is used to decrypt ciphertext which has been encrypted\n"
|
|
+" using the corresponding public key and the\n"
|
|
+" <function>publicEncrypt</function> function. \n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
asymmetric_object_private_decrypt(asymmetric_object *self, PyObject *args)
|
|
@@ -4254,38 +4257,38 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char asymmetric_object_sign__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Asymmetric</memberof>
|
|
- <name>sign</name>
|
|
- <parameter>digesttext</parameter>
|
|
- <parameter>digesttype</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method is used to produce a signed digest text.
|
|
- This instance of
|
|
- <classname>Asymmetric</classname> should be a private key used for
|
|
- signing. The parameter
|
|
- <parameter>digesttext</parameter> should be a digest of the
|
|
- data to protect against alteration and
|
|
- finally <parameter>digesttype</parameter> should be one of the
|
|
- following:
|
|
- </para>
|
|
- <simplelist>
|
|
- <member><constant>MD2_DIGEST</constant></member>
|
|
- <member><constant>MD5_DIGEST</constant></member>
|
|
- <member><constant>SHA_DIGEST</constant></member>
|
|
- <member><constant>SHA1_DIGEST</constant></member>
|
|
- <member><constant>RIPEMD160_DIGEST</constant></member>
|
|
- </simplelist>
|
|
- <para>
|
|
- If the procedure was successful, a string containing the signed
|
|
- digest is returned.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char asymmetric_object_sign__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Asymmetric</memberof>\n"
|
|
+" <name>sign</name>\n"
|
|
+" <parameter>digesttext</parameter>\n"
|
|
+" <parameter>digesttype</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method is used to produce a signed digest text. \n"
|
|
+" This instance of\n"
|
|
+" <classname>Asymmetric</classname> should be a private key used for\n"
|
|
+" signing. The parameter\n"
|
|
+" <parameter>digesttext</parameter> should be a digest of the \n"
|
|
+" data to protect against alteration and\n"
|
|
+" finally <parameter>digesttype</parameter> should be one of the\n"
|
|
+" following:\n"
|
|
+" </para>\n"
|
|
+" <simplelist>\n"
|
|
+" <member><constant>MD2_DIGEST</constant></member>\n"
|
|
+" <member><constant>MD5_DIGEST</constant></member>\n"
|
|
+" <member><constant>SHA_DIGEST</constant></member>\n"
|
|
+" <member><constant>SHA1_DIGEST</constant></member>\n"
|
|
+" <member><constant>RIPEMD160_DIGEST</constant></member>\n"
|
|
+" </simplelist>\n"
|
|
+" <para>\n"
|
|
+" If the procedure was successful, a string containing the signed\n"
|
|
+" digest is returned. \n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -4307,8 +4310,10 @@ asymmetric_object_sign(asymmetric_object *self, PyObje
|
|
|
|
switch(digest_type)
|
|
{
|
|
+#ifndef OPENSSL_NO_MD2
|
|
case MD2_DIGEST:
|
|
{ digest_nid = NID_md2; digest_len = MD2_DIGEST_LENGTH; break; }
|
|
+#endif
|
|
case MD5_DIGEST:
|
|
{ digest_nid = NID_md5; digest_len = MD5_DIGEST_LENGTH; break; }
|
|
case SHA_DIGEST:
|
|
@@ -4340,69 +4345,69 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char asymmetric_object_verify__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Asymmetric</memberof>
|
|
- <name>verify</name>
|
|
- <parameter>signedtext</parameter>
|
|
- <parameter>digesttext</parameter>
|
|
- <parameter>digesttype</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method is used to verify a signed digest text.
|
|
- </para>
|
|
- <example>
|
|
- <title><function>verify</function> method usage</title>
|
|
- <programlisting>
|
|
- plain_text = 'Hello World!'
|
|
- print '\tPlain text:', plain_text
|
|
- digest = POW.Digest( POW.RIPEMD160_DIGEST )
|
|
- digest.update( plain_text )
|
|
- print '\tDigest text:', digest.digest()
|
|
+static char asymmetric_object_verify__doc__[] = " \n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Asymmetric</memberof>\n"
|
|
+" <name>verify</name>\n"
|
|
+" <parameter>signedtext</parameter>\n"
|
|
+" <parameter>digesttext</parameter>\n"
|
|
+" <parameter>digesttype</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method is used to verify a signed digest text. \n"
|
|
+" </para>\n"
|
|
+" <example>\n"
|
|
+" <title><function>verify</function> method usage</title>\n"
|
|
+" <programlisting>\n"
|
|
+" plain_text = 'Hello World!'\n"
|
|
+" print '\tPlain text:', plain_text\n"
|
|
+" digest = POW.Digest( POW.RIPEMD160_DIGEST )\n"
|
|
+" digest.update( plain_text )\n"
|
|
+" print '\tDigest text:', digest.digest()\n"
|
|
+"\n"
|
|
+" privateFile = open('test/private.key', 'r')\n"
|
|
+" privateKey = POW.pemRead( POW.RSA_PRIVATE_KEY, privateFile.read(), 'pass' )\n"
|
|
+" privateFile.close()\n"
|
|
+" signed_text = privateKey.sign(digest.digest(), POW.RIPEMD160_DIGEST)\n"
|
|
+" print '\tSigned text:', signed_text\n"
|
|
+"\n"
|
|
+" digest2 = POW.Digest( POW.RIPEMD160_DIGEST )\n"
|
|
+" digest2.update( plain_text )\n"
|
|
+" publicFile = open('test/public.key', 'r')\n"
|
|
+" publicKey = POW.pemRead( POW.RSA_PUBLIC_KEY, publicFile.read() )\n"
|
|
+" publicFile.close()\n"
|
|
+" if publicKey.verify( signed_text, digest2.digest(), POW.RIPEMD160_DIGEST ):\n"
|
|
+" print 'Signing verified!'\n"
|
|
+" else:\n"
|
|
+" print 'Signing gone wrong!'\n"
|
|
+" </programlisting>\n"
|
|
+" </example>\n"
|
|
+" <para>\n"
|
|
+" The parameter <parameter>signedtext</parameter> should be a \n"
|
|
+" signed digest text. This instance of\n"
|
|
+" <classname>Asymmetric</classname> should correspond to the private\n"
|
|
+" key used to sign the digest. The parameter\n"
|
|
+" <parameter>digesttext</parameter> should be a digest of the same\n"
|
|
+" data used to produce the <parameter>signedtext</parameter> and\n"
|
|
+" finally <parameter>digesttype</parameter> should be one of the\n"
|
|
+" following:\n"
|
|
+" </para>\n"
|
|
+" <simplelist>\n"
|
|
+" <member><constant>MD2_DIGEST</constant></member>\n"
|
|
+" <member><constant>MD5_DIGEST</constant></member>\n"
|
|
+" <member><constant>SHA_DIGEST</constant></member>\n"
|
|
+" <member><constant>SHA1_DIGEST</constant></member>\n"
|
|
+" <member><constant>RIPEMD160_DIGEST</constant></member>\n"
|
|
+" </simplelist>\n"
|
|
+" <para>\n"
|
|
+" If the procedure was successful, 1 is returned, otherwise 0 is\n"
|
|
+" returned.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
- privateFile = open('test/private.key', 'r')
|
|
- privateKey = POW.pemRead( POW.RSA_PRIVATE_KEY, privateFile.read(), 'pass' )
|
|
- privateFile.close()
|
|
- signed_text = privateKey.sign(digest.digest(), POW.RIPEMD160_DIGEST)
|
|
- print '\tSigned text:', signed_text
|
|
-
|
|
- digest2 = POW.Digest( POW.RIPEMD160_DIGEST )
|
|
- digest2.update( plain_text )
|
|
- publicFile = open('test/public.key', 'r')
|
|
- publicKey = POW.pemRead( POW.RSA_PUBLIC_KEY, publicFile.read() )
|
|
- publicFile.close()
|
|
- if publicKey.verify( signed_text, digest2.digest(), POW.RIPEMD160_DIGEST ):
|
|
- print 'Signing verified!'
|
|
- else:
|
|
- print 'Signing gone wrong!'
|
|
- </programlisting>
|
|
- </example>
|
|
- <para>
|
|
- The parameter <parameter>signedtext</parameter> should be a
|
|
- signed digest text. This instance of
|
|
- <classname>Asymmetric</classname> should correspond to the private
|
|
- key used to sign the digest. The parameter
|
|
- <parameter>digesttext</parameter> should be a digest of the same
|
|
- data used to produce the <parameter>signedtext</parameter> and
|
|
- finally <parameter>digesttype</parameter> should be one of the
|
|
- following:
|
|
- </para>
|
|
- <simplelist>
|
|
- <member><constant>MD2_DIGEST</constant></member>
|
|
- <member><constant>MD5_DIGEST</constant></member>
|
|
- <member><constant>SHA_DIGEST</constant></member>
|
|
- <member><constant>SHA1_DIGEST</constant></member>
|
|
- <member><constant>RIPEMD160_DIGEST</constant></member>
|
|
- </simplelist>
|
|
- <para>
|
|
- If the procedure was successful, 1 is returned, otherwise 0 is
|
|
- returned.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
-
|
|
static PyObject *
|
|
asymmetric_object_verify(asymmetric_object *self, PyObject *args)
|
|
{
|
|
@@ -4418,8 +4423,10 @@ asymmetric_object_verify(asymmetric_object *self, PyOb
|
|
{
|
|
switch(digest_type)
|
|
{
|
|
+#ifndef OPENSSL_NO_MD2
|
|
case MD2_DIGEST:
|
|
{ digest_len = MD2_DIGEST_LENGTH; digest_nid = NID_md2; break; }
|
|
+#endif
|
|
case MD5_DIGEST:
|
|
{ digest_len = MD5_DIGEST_LENGTH; digest_nid = NID_md5; break; }
|
|
case SHA_DIGEST:
|
|
@@ -4484,19 +4491,19 @@ asymmetric_object_dealloc(asymmetric_object *self, cha
|
|
PyObject_Del(self);
|
|
}
|
|
|
|
-static char asymmetrictype__doc__[] = "
|
|
-<class>
|
|
- <header>
|
|
- <name>Asymmetric</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This class provides access to RSA asymmetric ciphers in OpenSSL.
|
|
- Other ciphers will probably be supported in the future but this is
|
|
- not a priority.
|
|
- </para>
|
|
- </body>
|
|
-</class>";
|
|
+static char asymmetrictype__doc__[] = "\n"
|
|
+"<class>\n"
|
|
+" <header>\n"
|
|
+" <name>Asymmetric</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This class provides access to RSA asymmetric ciphers in OpenSSL.\n"
|
|
+" Other ciphers will probably be supported in the future but this is\n"
|
|
+" not a priority.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</class>";
|
|
|
|
static PyTypeObject asymmetrictype = {
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
|
@@ -4545,27 +4552,27 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char symmetric_object_encrypt_init__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Symmetric</memberof>
|
|
- <name>encryptInit</name>
|
|
- <parameter>key</parameter>
|
|
- <parameter>initialvalue=''</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets up the cipher object to start encrypting a stream
|
|
- of data. The first parameter is the key used to encrypt the
|
|
- data. The second, the <parameter>initialvalue</parameter> serves
|
|
- a similar purpose the the salt supplied to the Unix
|
|
- <function>crypt</function> function.
|
|
- The <parameter>initialvalue</parameter> is normally chosen at random and
|
|
- often transmitted with the encrypted data, its purpose is to prevent
|
|
- two identical plain texts resulting in two identical cipher texts.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char symmetric_object_encrypt_init__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Symmetric</memberof>\n"
|
|
+" <name>encryptInit</name>\n"
|
|
+" <parameter>key</parameter>\n"
|
|
+" <parameter>initialvalue=''</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets up the cipher object to start encrypting a stream\n"
|
|
+" of data. The first parameter is the key used to encrypt the\n"
|
|
+" data. The second, the <parameter>initialvalue</parameter> serves\n"
|
|
+" a similar purpose the the salt supplied to the Unix\n"
|
|
+" <function>crypt</function> function.\n"
|
|
+" The <parameter>initialvalue</parameter> is normally chosen at random and \n"
|
|
+" often transmitted with the encrypted data, its purpose is to prevent \n"
|
|
+" two identical plain texts resulting in two identical cipher texts.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -4593,23 +4600,23 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char symmetric_object_decrypt_init__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Symmetric</memberof>
|
|
- <name>decryptInit</name>
|
|
- <parameter>key</parameter>
|
|
- <parameter>initialvalue=''</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method sets up the cipher object to start decrypting a stream
|
|
- of data. The first value must be the key used to encrypt the
|
|
- data. The second parameter is the <parameter>initialvalue</parameter>
|
|
- used to encrypt the data.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char symmetric_object_decrypt_init__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Symmetric</memberof>\n"
|
|
+" <name>decryptInit</name>\n"
|
|
+" <parameter>key</parameter>\n"
|
|
+" <parameter>initialvalue=''</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method sets up the cipher object to start decrypting a stream\n"
|
|
+" of data. The first value must be the key used to encrypt the\n"
|
|
+" data. The second parameter is the <parameter>initialvalue</parameter> \n"
|
|
+" used to encrypt the data.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
symmetric_object_decrypt_init(symmetric_object *self, PyObject *args)
|
|
@@ -4636,21 +4643,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char symmetric_object_update__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Symmetric</memberof>
|
|
- <name>update</name>
|
|
- <parameter>data</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method is used to process the bulk of data being encrypted
|
|
- or decrypted by the cipher object. <parameter>data</parameter>
|
|
- should be a string.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char symmetric_object_update__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Symmetric</memberof>\n"
|
|
+" <name>update</name>\n"
|
|
+" <parameter>data</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method is used to process the bulk of data being encrypted\n"
|
|
+" or decrypted by the cipher object. <parameter>data</parameter>\n"
|
|
+" should be a string.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
symmetric_object_update(symmetric_object *self, PyObject *args)
|
|
@@ -4682,22 +4689,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char symmetric_object_final__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Symmetric</memberof>
|
|
- <name>final</name>
|
|
- <parameter>size=1024</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- Most ciphers are block ciphers, that is they encrypt or decrypt a block of
|
|
- data at a time. Often the data being processed will not fill an
|
|
- entire block, this method processes these half-empty blocks. A
|
|
- string is returned of a maximum length <parameter>size</parameter>.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char symmetric_object_final__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Symmetric</memberof>\n"
|
|
+" <name>final</name>\n"
|
|
+" <parameter>size=1024</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" Most ciphers are block ciphers, that is they encrypt or decrypt a block of\n"
|
|
+" data at a time. Often the data being processed will not fill an\n"
|
|
+" entire block, this method processes these half-empty blocks. A\n"
|
|
+" string is returned of a maximum length <parameter>size</parameter>. \n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
|
|
static PyObject *
|
|
@@ -4755,45 +4762,45 @@ symmetric_object_dealloc(symmetric_object *self, char
|
|
PyObject_Del(self);
|
|
}
|
|
|
|
-static char symmetrictype__doc__[] = "
|
|
-<class>
|
|
- <header>
|
|
- <name>Symmetric</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This class provides access to all the symmetric ciphers in OpenSSL.
|
|
- Initialisation of the cipher structures is performed late, only
|
|
- when <function>encryptInit</function> or
|
|
- <function>decryptInit</function> is called, the
|
|
- constructor only records the cipher type. It is possible to reuse
|
|
- the <classname>Symmetric</classname> objects by calling
|
|
- <function>encryptInit</function> or <function>decryptInit</function>
|
|
- again.
|
|
- </para>
|
|
- <example>
|
|
- <title><classname>Symmetric</classname> class usage</title>
|
|
- <programlisting>
|
|
- passphrase = 'my silly passphrase'
|
|
- md5 = POW.Digest( POW.MD5_DIGEST )
|
|
- md5.update( passphrase )
|
|
- password = md5.digest()[:8]
|
|
+static char symmetrictype__doc__[] = "\n"
|
|
+"<class>\n"
|
|
+" <header>\n"
|
|
+" <name>Symmetric</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This class provides access to all the symmetric ciphers in OpenSSL.\n"
|
|
+" Initialisation of the cipher structures is performed late, only\n"
|
|
+" when <function>encryptInit</function> or\n"
|
|
+" <function>decryptInit</function> is called, the\n"
|
|
+" constructor only records the cipher type. It is possible to reuse\n"
|
|
+" the <classname>Symmetric</classname> objects by calling\n"
|
|
+" <function>encryptInit</function> or <function>decryptInit</function>\n"
|
|
+" again.\n"
|
|
+" </para>\n"
|
|
+" <example>\n"
|
|
+" <title><classname>Symmetric</classname> class usage</title>\n"
|
|
+" <programlisting>\n"
|
|
+" passphrase = 'my silly passphrase'\n"
|
|
+" md5 = POW.Digest( POW.MD5_DIGEST )\n"
|
|
+" md5.update( passphrase )\n"
|
|
+" password = md5.digest()[:8]\n"
|
|
+"\n"
|
|
+" plaintext = 'cast test message'\n"
|
|
+" cast = POW.Symmetric( POW.CAST5_CFB ) \n"
|
|
+" cast.encryptInit( password )\n"
|
|
+" ciphertext = cast.update(plaintext) + cast.final()\n"
|
|
+" print 'Cipher text:', ciphertext\n"
|
|
+"\n"
|
|
+" cast.decryptInit( password )\n"
|
|
+" out = cast.update( ciphertext ) + cast.final()\n"
|
|
+" print 'Deciphered text:', out\n"
|
|
+" </programlisting>\n"
|
|
+" </example>\n"
|
|
+" </body>\n"
|
|
+"</class>";
|
|
|
|
- plaintext = 'cast test message'
|
|
- cast = POW.Symmetric( POW.CAST5_CFB )
|
|
- cast.encryptInit( password )
|
|
- ciphertext = cast.update(plaintext) + cast.final()
|
|
- print 'Cipher text:', ciphertext
|
|
|
|
- cast.decryptInit( password )
|
|
- out = cast.update( ciphertext ) + cast.final()
|
|
- print 'Deciphered text:', out
|
|
- </programlisting>
|
|
- </example>
|
|
- </body>
|
|
-</class>";
|
|
-
|
|
-
|
|
static PyTypeObject symmetrictype = {
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
|
0, /*ob_size*/
|
|
@@ -4854,21 +4861,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char digest_object_update__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Digest</memberof>
|
|
- <name>update</name>
|
|
- <parameter>data</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method updates the internal structures of the
|
|
- <classname>Digest</classname> object with <parameter>data</parameter>.
|
|
- <parameter>data</parameter> should be a string.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char digest_object_update__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Digest</memberof>\n"
|
|
+" <name>update</name>\n"
|
|
+" <parameter>data</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method updates the internal structures of the \n"
|
|
+" <classname>Digest</classname> object with <parameter>data</parameter>.\n"
|
|
+" <parameter>data</parameter> should be a string.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
digest_object_update(digest_object *self, PyObject *args)
|
|
@@ -4888,19 +4895,19 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char digest_object_copy__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Digest</memberof>
|
|
- <name>copy</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a copy of the <classname>Digest</classname>
|
|
- object.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char digest_object_copy__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Digest</memberof>\n"
|
|
+" <name>copy</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a copy of the <classname>Digest</classname>\n"
|
|
+" object.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
digest_object_copy(digest_object *self, PyObject *args)
|
|
@@ -4921,21 +4928,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char digest_object_digest__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Digest</memberof>
|
|
- <name>digest</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns the digest of all the data which has been
|
|
- processed. This function can be called at any time and will not
|
|
- effect the internal structure of the <classname>digest</classname>
|
|
- object.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char digest_object_digest__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Digest</memberof>\n"
|
|
+" <name>digest</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns the digest of all the data which has been\n"
|
|
+" processed. This function can be called at any time and will not\n"
|
|
+" effect the internal structure of the <classname>digest</classname>\n"
|
|
+" object.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
digest_object_digest(digest_object *self, PyObject *args)
|
|
@@ -4987,29 +4994,29 @@ digest_object_dealloc(digest_object *self, char *name)
|
|
PyObject_Del(self);
|
|
}
|
|
|
|
-static char digesttype__doc__[] = "
|
|
-<class>
|
|
- <header>
|
|
- <name>Digest</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This class provides access to the digest functionality of OpenSSL.
|
|
- It emulates the digest modules in the Python Standard Library but
|
|
- does not currently support the <function>hexdigest</function>
|
|
- function.
|
|
- </para>
|
|
- <example>
|
|
- <title><classname>digest</classname> class usage</title>
|
|
- <programlisting>
|
|
- plain_text = 'Hello World!'
|
|
- sha1 = POW.Digest( POW.SHA1_DIGEST )
|
|
- sha1.update( plain_text )
|
|
- print '\tPlain text: Hello World! =>', sha1.digest()
|
|
- </programlisting>
|
|
- </example>
|
|
- </body>
|
|
-</class>";
|
|
+static char digesttype__doc__[] = "\n"
|
|
+"<class>\n"
|
|
+" <header>\n"
|
|
+" <name>Digest</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This class provides access to the digest functionality of OpenSSL.\n"
|
|
+" It emulates the digest modules in the Python Standard Library but\n"
|
|
+" does not currently support the <function>hexdigest</function>\n"
|
|
+" function.\n"
|
|
+" </para>\n"
|
|
+" <example>\n"
|
|
+" <title><classname>digest</classname> class usage</title>\n"
|
|
+" <programlisting>\n"
|
|
+" plain_text = 'Hello World!'\n"
|
|
+" sha1 = POW.Digest( POW.SHA1_DIGEST )\n"
|
|
+" sha1.update( plain_text )\n"
|
|
+" print '\tPlain text: Hello World! =>', sha1.digest()\n"
|
|
+" </programlisting>\n"
|
|
+" </example>\n"
|
|
+" </body>\n"
|
|
+"</class>";
|
|
|
|
static PyTypeObject digesttype = {
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
|
@@ -5074,21 +5081,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char hmac_object_update__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Hmac</memberof>
|
|
- <name>update</name>
|
|
- <parameter>data</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method updates the internal structures of the
|
|
- <classname>Hmac</classname> object with <parameter>data</parameter>.
|
|
- <parameter>data</parameter> should be a string.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char hmac_object_update__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Hmac</memberof>\n"
|
|
+" <name>update</name>\n"
|
|
+" <parameter>data</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method updates the internal structures of the \n"
|
|
+" <classname>Hmac</classname> object with <parameter>data</parameter>.\n"
|
|
+" <parameter>data</parameter> should be a string.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
hmac_object_update(hmac_object *self, PyObject *args)
|
|
@@ -5108,19 +5115,19 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char hmac_object_copy__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Hmac</memberof>
|
|
- <name>copy</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns a copy of the <classname>Hmac</classname>
|
|
- object.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char hmac_object_copy__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Hmac</memberof>\n"
|
|
+" <name>copy</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns a copy of the <classname>Hmac</classname>\n"
|
|
+" object.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
hmac_object_copy(hmac_object *self, PyObject *args)
|
|
@@ -5140,21 +5147,21 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char hmac_object_mac__doc__[] = "
|
|
-<method>
|
|
- <header>
|
|
- <memberof>Hmac</memberof>
|
|
- <name>mac</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This method returns the MAC of all the data which has been
|
|
- processed. This function can be called at any time and will not
|
|
- effect the internal structure of the <classname>Hmac</classname>
|
|
- object.
|
|
- </para>
|
|
- </body>
|
|
-</method>";
|
|
+static char hmac_object_mac__doc__[] = "\n"
|
|
+"<method>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Hmac</memberof>\n"
|
|
+" <name>mac</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This method returns the MAC of all the data which has been\n"
|
|
+" processed. This function can be called at any time and will not\n"
|
|
+" effect the internal structure of the <classname>Hmac</classname>\n"
|
|
+" object.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</method>";
|
|
|
|
static PyObject *
|
|
hmac_object_mac(hmac_object *self, PyObject *args)
|
|
@@ -5207,20 +5214,20 @@ hmac_object_dealloc(hmac_object *self, char *name)
|
|
PyObject_Del(self);
|
|
}
|
|
|
|
-static char hmactype__doc__[] = "
|
|
-<class>
|
|
- <header>
|
|
- <name>Hmac</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This class provides access to the HMAC functionality of OpenSSL.
|
|
- HMAC's are a varient on digest based MACs, which have the
|
|
- interesting property of a provable level of security. HMAC is
|
|
- discussed further in RFC 2104.
|
|
- </para>
|
|
- </body>
|
|
-</class>";
|
|
+static char hmactype__doc__[] = "\n"
|
|
+"<class>\n"
|
|
+" <header>\n"
|
|
+" <name>Hmac</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This class provides access to the HMAC functionality of OpenSSL. \n"
|
|
+" HMAC's are a varient on digest based MACs, which have the \n"
|
|
+" interesting property of a provable level of security. HMAC is \n"
|
|
+" discussed further in RFC 2104. \n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</class>";
|
|
|
|
static PyTypeObject hmactype = {
|
|
PyObject_HEAD_INIT(&PyType_Type)
|
|
@@ -5249,37 +5256,37 @@ static PyTypeObject hmactype = {
|
|
/*========== hmac Code ==========*/
|
|
|
|
/*========== module functions ==========*/
|
|
-static char pow_module_new_ssl__doc__[] = "
|
|
-<constructor>
|
|
- <header>
|
|
- <memberof>Ssl</memberof>
|
|
- <parameter>protocol=SSLV23METHOD</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This constructor creates a new <classname>Ssl</classname> object which will behave as a client
|
|
- or server, depending on the <parameter>protocol</parameter> value passed. The
|
|
- <parameter>protocol</parameter> also determines the protocol type
|
|
- and version and should be one of the following:
|
|
- </para>
|
|
+static char pow_module_new_ssl__doc__[] = "\n"
|
|
+"<constructor>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Ssl</memberof>\n"
|
|
+" <parameter>protocol=SSLV23METHOD</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This constructor creates a new <classname>Ssl</classname> object which will behave as a client\n"
|
|
+" or server, depending on the <parameter>protocol</parameter> value passed. The\n"
|
|
+" <parameter>protocol</parameter> also determines the protocol type\n"
|
|
+" and version and should be one of the following:\n"
|
|
+" </para>\n"
|
|
+"\n"
|
|
+" <simplelist>\n"
|
|
+" <member><constant>SSLV2_SERVER_METHOD</constant></member>\n"
|
|
+" <member><constant>SSLV2_CLIENT_METHOD</constant></member>\n"
|
|
+" <member><constant>SSLV2_METHOD</constant></member>\n"
|
|
+" <member><constant>SSLV3_SERVER_METHOD</constant></member>\n"
|
|
+" <member><constant>SSLV3_CLIENT_METHOD</constant></member>\n"
|
|
+" <member><constant>SSLV3_METHOD</constant></member>\n"
|
|
+" <member><constant>TLSV1_SERVER_METHOD</constant></member>\n"
|
|
+" <member><constant>TLSV1_CLIENT_METHOD</constant></member>\n"
|
|
+" <member><constant>TLSV1_METHOD</constant></member>\n"
|
|
+" <member><constant>SSLV23_SERVER_METHOD</constant></member>\n"
|
|
+" <member><constant>SSLV23_CLIENT_METHOD</constant></member>\n"
|
|
+" <member><constant>SSLV23_METHOD</constant></member>\n"
|
|
+" </simplelist>\n"
|
|
+" </body>\n"
|
|
+"</constructor>";
|
|
|
|
- <simplelist>
|
|
- <member><constant>SSLV2_SERVER_METHOD</constant></member>
|
|
- <member><constant>SSLV2_CLIENT_METHOD</constant></member>
|
|
- <member><constant>SSLV2_METHOD</constant></member>
|
|
- <member><constant>SSLV3_SERVER_METHOD</constant></member>
|
|
- <member><constant>SSLV3_CLIENT_METHOD</constant></member>
|
|
- <member><constant>SSLV3_METHOD</constant></member>
|
|
- <member><constant>TLSV1_SERVER_METHOD</constant></member>
|
|
- <member><constant>TLSV1_CLIENT_METHOD</constant></member>
|
|
- <member><constant>TLSV1_METHOD</constant></member>
|
|
- <member><constant>SSLV23_SERVER_METHOD</constant></member>
|
|
- <member><constant>SSLV23_CLIENT_METHOD</constant></member>
|
|
- <member><constant>SSLV23_METHOD</constant></member>
|
|
- </simplelist>
|
|
- </body>
|
|
-</constructor>";
|
|
-
|
|
static PyObject *
|
|
pow_module_new_ssl (PyObject *self, PyObject *args)
|
|
{
|
|
@@ -5299,19 +5306,19 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_new_x509__doc__[] = "
|
|
-<constructor>
|
|
- <header>
|
|
- <memberof>X509</memberof>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This constructor creates a skeletal X509 certificate object.
|
|
- It won't be any use at all until several structures
|
|
- have been created using it's member functions.
|
|
- </para>
|
|
- </body>
|
|
-</constructor>";
|
|
+static char pow_module_new_x509__doc__[] = "\n"
|
|
+"<constructor>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509</memberof>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This constructor creates a skeletal X509 certificate object.\n"
|
|
+" It won't be any use at all until several structures \n"
|
|
+" have been created using it's member functions. \n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</constructor>";
|
|
|
|
static PyObject *
|
|
pow_module_new_x509 (PyObject *self, PyObject *args)
|
|
@@ -5331,46 +5338,46 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_new_asymmetric__doc__[] = "
|
|
-<constructor>
|
|
- <header>
|
|
- <memberof>Asymmetric</memberof>
|
|
- <parameter>ciphertype=RSA_CIPHER</parameter>
|
|
- <parameter>keylength=1024</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This constructor builds a new cipher object. Only RSA ciphers
|
|
- are currently support, so the first argument should always be
|
|
- <constant>RSA_CIPHER</constant>. The second argument,
|
|
- <parameter>keylength</parameter>,
|
|
- is normally 512, 768, 1024 or 2048. Key lengths as short as 512
|
|
- bits are generally considered weak, and can be cracked by
|
|
- determined attackers without tremendous expense.
|
|
- </para>
|
|
- <example>
|
|
- <title><classname>asymmetric</classname> class usage</title>
|
|
- <programlisting>
|
|
- privateFile = open('test/private.key', 'w')
|
|
- publicFile = open('test/public.key', 'w')
|
|
+static char pow_module_new_asymmetric__doc__[] = "\n"
|
|
+"<constructor>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Asymmetric</memberof>\n"
|
|
+" <parameter>ciphertype=RSA_CIPHER</parameter>\n"
|
|
+" <parameter>keylength=1024</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This constructor builds a new cipher object. Only RSA ciphers\n"
|
|
+" are currently support, so the first argument should always be\n"
|
|
+" <constant>RSA_CIPHER</constant>. The second argument,\n"
|
|
+" <parameter>keylength</parameter>,\n"
|
|
+" is normally 512, 768, 1024 or 2048. Key lengths as short as 512\n"
|
|
+" bits are generally considered weak, and can be cracked by\n"
|
|
+" determined attackers without tremendous expense.\n"
|
|
+" </para>\n"
|
|
+" <example>\n"
|
|
+" <title><classname>asymmetric</classname> class usage</title>\n"
|
|
+" <programlisting>\n"
|
|
+" privateFile = open('test/private.key', 'w')\n"
|
|
+" publicFile = open('test/public.key', 'w')\n"
|
|
+"\n"
|
|
+" passphrase = 'my silly passphrase'\n"
|
|
+" md5 = POW.Digest( POW.MD5_DIGEST )\n"
|
|
+" md5.update( passphrase )\n"
|
|
+" password = md5.digest()\n"
|
|
+"\n"
|
|
+" rsa = POW.Asymmetric( POW.RSA_CIPHER, 1024 )\n"
|
|
+" privateFile.write( rsa.pemWrite( \n"
|
|
+" POW.RSA_PRIVATE_KEY, POW.DES_EDE3_CFB, password ) )\n"
|
|
+" publicFile.write( rsa.pemWrite( POW.RSA_PUBLIC_KEY ) )\n"
|
|
+"\n"
|
|
+" privateFile.close()\n"
|
|
+" publicFile.close()\n"
|
|
+" </programlisting>\n"
|
|
+" </example>\n"
|
|
+" </body>\n"
|
|
+"</constructor>";
|
|
|
|
- passphrase = 'my silly passphrase'
|
|
- md5 = POW.Digest( POW.MD5_DIGEST )
|
|
- md5.update( passphrase )
|
|
- password = md5.digest()
|
|
-
|
|
- rsa = POW.Asymmetric( POW.RSA_CIPHER, 1024 )
|
|
- privateFile.write( rsa.pemWrite(
|
|
- POW.RSA_PRIVATE_KEY, POW.DES_EDE3_CFB, password ) )
|
|
- publicFile.write( rsa.pemWrite( POW.RSA_PUBLIC_KEY ) )
|
|
-
|
|
- privateFile.close()
|
|
- publicFile.close()
|
|
- </programlisting>
|
|
- </example>
|
|
- </body>
|
|
-</constructor>";
|
|
-
|
|
static PyObject *
|
|
pow_module_new_asymmetric (PyObject *self, PyObject *args)
|
|
{
|
|
@@ -5386,27 +5393,27 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_new_digest__doc__[] = "
|
|
-<constructor>
|
|
- <header>
|
|
- <memberof>Digest</memberof>
|
|
- <parameter>type</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This constructor creates a new <classname>Digest</classname>
|
|
- object. The parameter <parameter>type</parameter> specifies what kind
|
|
- of digest to create and should be one of the following:
|
|
- </para>
|
|
- <simplelist>
|
|
- <member><constant>MD2_DIGEST</constant></member>
|
|
- <member><constant>MD5_DIGEST</constant></member>
|
|
- <member><constant>SHA_DIGEST</constant></member>
|
|
- <member><constant>SHA1_DIGEST</constant></member>
|
|
- <member><constant>RIPEMD160_DIGEST</constant></member>
|
|
- </simplelist>
|
|
- </body>
|
|
-</constructor>";
|
|
+static char pow_module_new_digest__doc__[] = "\n"
|
|
+"<constructor>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Digest</memberof>\n"
|
|
+" <parameter>type</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This constructor creates a new <classname>Digest</classname>\n"
|
|
+" object. The parameter <parameter>type</parameter> specifies what kind\n"
|
|
+" of digest to create and should be one of the following: \n"
|
|
+" </para>\n"
|
|
+" <simplelist>\n"
|
|
+" <member><constant>MD2_DIGEST</constant></member>\n"
|
|
+" <member><constant>MD5_DIGEST</constant></member>\n"
|
|
+" <member><constant>SHA_DIGEST</constant></member>\n"
|
|
+" <member><constant>SHA1_DIGEST</constant></member>\n"
|
|
+" <member><constant>RIPEMD160_DIGEST</constant></member>\n"
|
|
+" </simplelist>\n"
|
|
+" </body>\n"
|
|
+"</constructor>";
|
|
|
|
static PyObject *
|
|
pow_module_new_digest (PyObject *self, PyObject *args)
|
|
@@ -5423,28 +5430,28 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_new_hmac__doc__[] = "
|
|
-<constructor>
|
|
- <header>
|
|
- <memberof>Hmac</memberof>
|
|
- <parameter>type</parameter>
|
|
- <parameter>key</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This constructor creates a new <classname>Hmac</classname>
|
|
- object. The parameter <parameter>key</parameter> should be a
|
|
- string and <parameter>type</parameter> should be one of the following:
|
|
- </para>
|
|
- <simplelist>
|
|
- <member><constant>MD2_DIGEST</constant></member>
|
|
- <member><constant>MD5_DIGEST</constant></member>
|
|
- <member><constant>SHA_DIGEST</constant></member>
|
|
- <member><constant>SHA1_DIGEST</constant></member>
|
|
- <member><constant>RIPEMD160_DIGEST</constant></member>
|
|
- </simplelist>
|
|
- </body>
|
|
-</constructor>";
|
|
+static char pow_module_new_hmac__doc__[] = "\n"
|
|
+"<constructor>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Hmac</memberof>\n"
|
|
+" <parameter>type</parameter>\n"
|
|
+" <parameter>key</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This constructor creates a new <classname>Hmac</classname>\n"
|
|
+" object. The parameter <parameter>key</parameter> should be a\n"
|
|
+" string and <parameter>type</parameter> should be one of the following: \n"
|
|
+" </para>\n"
|
|
+" <simplelist>\n"
|
|
+" <member><constant>MD2_DIGEST</constant></member>\n"
|
|
+" <member><constant>MD5_DIGEST</constant></member>\n"
|
|
+" <member><constant>SHA_DIGEST</constant></member>\n"
|
|
+" <member><constant>SHA1_DIGEST</constant></member>\n"
|
|
+" <member><constant>RIPEMD160_DIGEST</constant></member>\n"
|
|
+" </simplelist>\n"
|
|
+" </body>\n"
|
|
+"</constructor>";
|
|
|
|
static PyObject *
|
|
pow_module_new_hmac (PyObject *self, PyObject *args)
|
|
@@ -5462,37 +5469,37 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_pem_read__doc__[] = "
|
|
-<modulefunction>
|
|
- <header>
|
|
- <name>pemRead</name>
|
|
- <parameter>type</parameter>
|
|
- <parameter>string</parameter>
|
|
- <parameter>pass=None</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This function attempts to parse the <parameter>string</parameter> according to the PEM
|
|
- type passed. <parameter>type</parameter> should be one of the
|
|
- following:
|
|
- </para>
|
|
- <simplelist>
|
|
- <member><constant>RSA_PUBLIC_KEY</constant></member>
|
|
- <member><constant>RSA_PRIVATE_KEY</constant></member>
|
|
- <member><constant>X509_CERTIFICATE</constant></member>
|
|
- <member><constant>X509_CRL</constant></member>
|
|
- </simplelist>
|
|
- <para>
|
|
- <parameter>pass</parameter> should only be provided if an encrypted
|
|
- <classname>Asymmetric</classname> is being loaded. If the password
|
|
- is incorrect an exception will be raised, if no password is provided
|
|
- and the PEM file is encrypted the user will be prompted. If this is
|
|
- not desirable, always supply a password. The object returned will be
|
|
- and instance of <classname>Asymmetric</classname>,
|
|
- <classname>X509</classname> or <classname>X509Crl</classname>.
|
|
- </para>
|
|
- </body>
|
|
-</modulefunction>";
|
|
+static char pow_module_pem_read__doc__[] = "\n"
|
|
+"<modulefunction>\n"
|
|
+" <header>\n"
|
|
+" <name>pemRead</name>\n"
|
|
+" <parameter>type</parameter>\n"
|
|
+" <parameter>string</parameter>\n"
|
|
+" <parameter>pass=None</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This function attempts to parse the <parameter>string</parameter> according to the PEM\n"
|
|
+" type passed. <parameter>type</parameter> should be one of the\n"
|
|
+" following:\n"
|
|
+" </para>\n"
|
|
+" <simplelist>\n"
|
|
+" <member><constant>RSA_PUBLIC_KEY</constant></member>\n"
|
|
+" <member><constant>RSA_PRIVATE_KEY</constant></member>\n"
|
|
+" <member><constant>X509_CERTIFICATE</constant></member>\n"
|
|
+" <member><constant>X509_CRL</constant></member>\n"
|
|
+" </simplelist>\n"
|
|
+" <para>\n"
|
|
+" <parameter>pass</parameter> should only be provided if an encrypted\n"
|
|
+" <classname>Asymmetric</classname> is being loaded. If the password\n"
|
|
+" is incorrect an exception will be raised, if no password is provided\n"
|
|
+" and the PEM file is encrypted the user will be prompted. If this is\n"
|
|
+" not desirable, always supply a password. The object returned will be \n"
|
|
+" and instance of <classname>Asymmetric</classname>, \n"
|
|
+" <classname>X509</classname> or <classname>X509Crl</classname>.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</modulefunction>";
|
|
|
|
static PyObject *
|
|
pow_module_pem_read (PyObject *self, PyObject *args)
|
|
@@ -5536,20 +5543,20 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_new_x509_store__doc__[] = "
|
|
-<constructor>
|
|
- <header>
|
|
- <memberof>X509Store</memberof>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This constructor takes no arguments. The
|
|
- <classname>X509Store</classname> returned cannot be used for
|
|
- verifying certificates until at least one trusted certificate has been
|
|
- added.
|
|
- </para>
|
|
- </body>
|
|
-</constructor>";
|
|
+static char pow_module_new_x509_store__doc__[] = "\n"
|
|
+"<constructor>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Store</memberof>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This constructor takes no arguments. The\n"
|
|
+" <classname>X509Store</classname> returned cannot be used for\n"
|
|
+" verifying certificates until at least one trusted certificate has been\n"
|
|
+" added.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</constructor>";
|
|
|
|
static PyObject *
|
|
pow_module_new_x509_store (PyObject *self, PyObject *args)
|
|
@@ -5564,64 +5571,64 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_new_symmetric__doc__[] = "
|
|
-<constructor>
|
|
- <header>
|
|
- <memberof>Symmetric</memberof>
|
|
- <parameter>type</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This constructor creates a new <classname>Symmetric</classname>
|
|
- object. The parameter <parameter>type</parameter> specifies which kind
|
|
- of cipher to create. <constant>type</constant> should be one of the following:
|
|
- </para>
|
|
- <simplelist columns=\"2\">
|
|
- <member><constant>DES_ECB</constant></member>
|
|
- <member><constant>DES_EDE</constant></member>
|
|
- <member><constant>DES_EDE3</constant></member>
|
|
- <member><constant>DES_CFB</constant></member>
|
|
- <member><constant>DES_EDE_CFB</constant></member>
|
|
- <member><constant>DES_EDE3_CFB</constant></member>
|
|
- <member><constant>DES_OFB</constant></member>
|
|
- <member><constant>DES_EDE_OFB</constant></member>
|
|
- <member><constant>DES_EDE3_OFB</constant></member>
|
|
- <member><constant>DES_CBC</constant></member>
|
|
- <member><constant>DES_EDE_CBC</constant></member>
|
|
- <member><constant>DES_EDE3_CBC</constant></member>
|
|
- <member><constant>DESX_CBC</constant></member>
|
|
- <member><constant>RC4</constant></member>
|
|
- <member><constant>RC4_40</constant></member>
|
|
- <member><constant>IDEA_ECB</constant></member>
|
|
- <member><constant>IDEA_CFB</constant></member>
|
|
- <member><constant>IDEA_OFB</constant></member>
|
|
- <member><constant>IDEA_CBC</constant></member>
|
|
- <member><constant>RC2_ECB</constant></member>
|
|
- <member><constant>RC2_CBC</constant></member>
|
|
- <member><constant>RC2_40_CBC</constant></member>
|
|
- <member><constant>RC2_CFB</constant></member>
|
|
- <member><constant>RC2_OFB</constant></member>
|
|
- <member><constant>BF_ECB</constant></member>
|
|
- <member><constant>BF_CBC</constant></member>
|
|
- <member><constant>BF_CFB</constant></member>
|
|
- <member><constant>BF_OFB</constant></member>
|
|
- <member><constant>CAST5_ECB</constant></member>
|
|
- <member><constant>CAST5_CBC</constant></member>
|
|
- <member><constant>CAST5_CFB</constant></member>
|
|
- <member><constant>CAST5_OFB</constant></member>
|
|
- <member><constant>RC5_32_12_16_CBC</constant></member>
|
|
- <member><constant>RC5_32_12_16_CFB</constant></member>
|
|
- <member><constant>RC5_32_12_16_ECB</constant></member>
|
|
- <member><constant>RC5_32_12_16_OFB</constant></member>
|
|
- </simplelist>
|
|
- <para>
|
|
- Please note your version of OpenSSL might not have been compiled with
|
|
- all the ciphers listed above. If that is the case, which is very
|
|
- likely if you are using a stock binary, the unsuported ciphers will not even
|
|
- be in the module namespace.
|
|
- </para>
|
|
- </body>
|
|
-</constructor>";
|
|
+static char pow_module_new_symmetric__doc__[] = "\n"
|
|
+"<constructor>\n"
|
|
+" <header>\n"
|
|
+" <memberof>Symmetric</memberof>\n"
|
|
+" <parameter>type</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This constructor creates a new <classname>Symmetric</classname>\n"
|
|
+" object. The parameter <parameter>type</parameter> specifies which kind\n"
|
|
+" of cipher to create. <constant>type</constant> should be one of the following: \n"
|
|
+" </para>\n"
|
|
+" <simplelist columns=\"2\">\n"
|
|
+" <member><constant>DES_ECB</constant></member> \n"
|
|
+" <member><constant>DES_EDE</constant></member>\n"
|
|
+" <member><constant>DES_EDE3</constant></member> \n"
|
|
+" <member><constant>DES_CFB</constant></member> \n"
|
|
+" <member><constant>DES_EDE_CFB</constant></member> \n"
|
|
+" <member><constant>DES_EDE3_CFB</constant></member>\n"
|
|
+" <member><constant>DES_OFB</constant></member>\n"
|
|
+" <member><constant>DES_EDE_OFB</constant></member>\n"
|
|
+" <member><constant>DES_EDE3_OFB</constant></member>\n"
|
|
+" <member><constant>DES_CBC</constant></member>\n"
|
|
+" <member><constant>DES_EDE_CBC</constant></member>\n"
|
|
+" <member><constant>DES_EDE3_CBC</constant></member>\n"
|
|
+" <member><constant>DESX_CBC</constant></member>\n"
|
|
+" <member><constant>RC4</constant></member>\n"
|
|
+" <member><constant>RC4_40</constant></member>\n"
|
|
+" <member><constant>IDEA_ECB</constant></member>\n"
|
|
+" <member><constant>IDEA_CFB</constant></member>\n"
|
|
+" <member><constant>IDEA_OFB</constant></member>\n"
|
|
+" <member><constant>IDEA_CBC</constant></member>\n"
|
|
+" <member><constant>RC2_ECB</constant></member>\n"
|
|
+" <member><constant>RC2_CBC</constant></member>\n"
|
|
+" <member><constant>RC2_40_CBC</constant></member>\n"
|
|
+" <member><constant>RC2_CFB</constant></member>\n"
|
|
+" <member><constant>RC2_OFB</constant></member>\n"
|
|
+" <member><constant>BF_ECB</constant></member>\n"
|
|
+" <member><constant>BF_CBC</constant></member>\n"
|
|
+" <member><constant>BF_CFB</constant></member>\n"
|
|
+" <member><constant>BF_OFB</constant></member>\n"
|
|
+" <member><constant>CAST5_ECB</constant></member>\n"
|
|
+" <member><constant>CAST5_CBC</constant></member>\n"
|
|
+" <member><constant>CAST5_CFB</constant></member>\n"
|
|
+" <member><constant>CAST5_OFB</constant></member>\n"
|
|
+" <member><constant>RC5_32_12_16_CBC</constant></member>\n"
|
|
+" <member><constant>RC5_32_12_16_CFB</constant></member>\n"
|
|
+" <member><constant>RC5_32_12_16_ECB</constant></member>\n"
|
|
+" <member><constant>RC5_32_12_16_OFB</constant></member>\n"
|
|
+" </simplelist>\n"
|
|
+" <para>\n"
|
|
+" Please note your version of OpenSSL might not have been compiled with\n"
|
|
+" all the ciphers listed above. If that is the case, which is very\n"
|
|
+" likely if you are using a stock binary, the unsuported ciphers will not even\n"
|
|
+" be in the module namespace.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</constructor>";
|
|
|
|
static PyObject *
|
|
pow_module_new_symmetric (PyObject *self, PyObject *args)
|
|
@@ -5638,17 +5645,17 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_new_x509_crl__doc__[] = " ;
|
|
-<constructor>
|
|
- <header>
|
|
- <memberof>x509_crl</memberof>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This constructor builds an empty CRL.
|
|
- </para>
|
|
- </body>
|
|
-</constructor>";
|
|
+static char pow_module_new_x509_crl__doc__[] = " ;\n"
|
|
+"<constructor>\n"
|
|
+" <header>\n"
|
|
+" <memberof>x509_crl</memberof>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This constructor builds an empty CRL.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</constructor>";
|
|
|
|
static PyObject *
|
|
pow_module_new_x509_crl (PyObject *self, PyObject *args)
|
|
@@ -5663,23 +5670,23 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_new_x509_revoked__doc__[] = "
|
|
-<constructor>
|
|
- <header>
|
|
- <memberof>X509Revoked</memberof>
|
|
- <parameter>serial</parameter>
|
|
- <parameter>date</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This constructor builds a X509 Revoked structure. Both arguments
|
|
- are integers, <parameter>date</parameter> is the same as the C
|
|
- <constant>time_t</constant> typedef and can be
|
|
- generated with the Python Standard Library function
|
|
- <function>time</function>.
|
|
- </para>
|
|
- </body>
|
|
-</constructor>";
|
|
+static char pow_module_new_x509_revoked__doc__[] = "\n"
|
|
+"<constructor>\n"
|
|
+" <header>\n"
|
|
+" <memberof>X509Revoked</memberof>\n"
|
|
+" <parameter>serial</parameter>\n"
|
|
+" <parameter>date</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This constructor builds a X509 Revoked structure. Both arguments\n"
|
|
+" are integers, <parameter>date</parameter> is the same as the C\n"
|
|
+" <constant>time_t</constant> typedef and can be\n"
|
|
+" generated with the Python Standard Library function\n"
|
|
+" <function>time</function>.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</constructor>";
|
|
|
|
static PyObject *
|
|
pow_module_new_x509_revoked (PyObject *self, PyObject *args)
|
|
@@ -5707,17 +5714,17 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_get_error__doc__[] = " ;
|
|
-<modulefunction>
|
|
- <header>
|
|
- <name>getError</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- Pops an error off the global error stack and returns it as a string.
|
|
- </para>
|
|
- </body>
|
|
-</modulefunction>";
|
|
+static char pow_module_get_error__doc__[] = " ;\n"
|
|
+"<modulefunction>\n"
|
|
+" <header>\n"
|
|
+" <name>getError</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" Pops an error off the global error stack and returns it as a string.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</modulefunction>";
|
|
|
|
static PyObject *
|
|
pow_module_get_error(PyObject *self, PyObject *args)
|
|
@@ -5742,17 +5749,17 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_clear_error__doc__[] = "
|
|
-<modulefunction>
|
|
- <header>
|
|
- <name>clearError</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- Removes all errors from the global error stack.
|
|
- </para>
|
|
- </body>
|
|
-</modulefunction>";
|
|
+static char pow_module_clear_error__doc__[] = "\n"
|
|
+"<modulefunction>\n"
|
|
+" <header>\n"
|
|
+" <name>clearError</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" Removes all errors from the global error stack.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</modulefunction>";
|
|
|
|
static PyObject *
|
|
pow_module_clear_error(PyObject *self, PyObject *args)
|
|
@@ -5769,28 +5776,28 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_seed__doc__[] = "
|
|
-<modulefunction>
|
|
- <header>
|
|
- <name>seed</name>
|
|
- <parameter>data</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- The <function>seed</function> function adds data to OpenSSLs PRNG
|
|
- state. It is often said the hardest part of cryptography is
|
|
- getting good random data, after all if you don't have good random
|
|
- data, a 1024 bit key is no better than a 512 bit key and neither
|
|
- would provide protection from a targeted brute force attack.
|
|
- The <function>seed</function> and <function>add</function> are very
|
|
- similar, except the entropy of the data is assumed to be equal to
|
|
- the length for <function>seed</function>. I final point to be aware
|
|
- of, only systems which support /dev/urandom are automatically seeded.
|
|
- If your system does not support /dev/urandom it is your responsibility
|
|
- to seed OpenSSL's PRNG.
|
|
- </para>
|
|
- </body>
|
|
-</modulefunction>";
|
|
+static char pow_module_seed__doc__[] = "\n"
|
|
+"<modulefunction>\n"
|
|
+" <header>\n"
|
|
+" <name>seed</name>\n"
|
|
+" <parameter>data</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" The <function>seed</function> function adds data to OpenSSLs PRNG\n"
|
|
+" state. It is often said the hardest part of cryptography is\n"
|
|
+" getting good random data, after all if you don't have good random\n"
|
|
+" data, a 1024 bit key is no better than a 512 bit key and neither\n"
|
|
+" would provide protection from a targeted brute force attack.\n"
|
|
+" The <function>seed</function> and <function>add</function> are very\n"
|
|
+" similar, except the entropy of the data is assumed to be equal to\n"
|
|
+" the length for <function>seed</function>. I final point to be aware \n"
|
|
+" of, only systems which support /dev/urandom are automatically seeded. \n"
|
|
+" If your system does not support /dev/urandom it is your responsibility \n"
|
|
+" to seed OpenSSL's PRNG.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</modulefunction>";
|
|
|
|
static PyObject *
|
|
pow_module_seed(PyObject *self, PyObject *args)
|
|
@@ -5810,22 +5817,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_add__doc__[] = "
|
|
-<modulefunction>
|
|
- <header>
|
|
- <name>add</name>
|
|
- <parameter>data</parameter>
|
|
- <parameter>entropy</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- The <function>add</function> function adds data to OpenSSLs PRNG
|
|
- state. <parameter>data</parameter> should be data obtained from a
|
|
- random source and <parameter>entropy</parameter> is an estimation of the number of random
|
|
- bytes in <parameter>data</parameter>.
|
|
- </para>
|
|
- </body>
|
|
-</modulefunction>";
|
|
+static char pow_module_add__doc__[] = "\n"
|
|
+"<modulefunction>\n"
|
|
+" <header>\n"
|
|
+" <name>add</name>\n"
|
|
+" <parameter>data</parameter>\n"
|
|
+" <parameter>entropy</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" The <function>add</function> function adds data to OpenSSLs PRNG\n"
|
|
+" state. <parameter>data</parameter> should be data obtained from a\n"
|
|
+" random source and <parameter>entropy</parameter> is an estimation of the number of random\n"
|
|
+" bytes in <parameter>data</parameter>.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</modulefunction>";
|
|
|
|
static PyObject *
|
|
pow_module_add(PyObject *self, PyObject *args)
|
|
@@ -5846,20 +5853,20 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_write_random_file__doc__[] = "
|
|
-<modulefunction>
|
|
- <header>
|
|
- <name>writeRandomFile</name>
|
|
- <parameter>filename</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This function writes the current random state to a file. Clearly
|
|
- this function should be used in conjunction with
|
|
- <function>readRandomFile</function>.
|
|
- </para>
|
|
- </body>
|
|
-</modulefunction>";
|
|
+static char pow_module_write_random_file__doc__[] = "\n"
|
|
+"<modulefunction>\n"
|
|
+" <header>\n"
|
|
+" <name>writeRandomFile</name>\n"
|
|
+" <parameter>filename</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This function writes the current random state to a file. Clearly\n"
|
|
+" this function should be used in conjunction with\n"
|
|
+" <function>readRandomFile</function>.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</modulefunction>";
|
|
|
|
static PyObject *
|
|
pow_module_write_random_file(PyObject *self, PyObject *args)
|
|
@@ -5879,22 +5886,22 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module_read_random_file__doc__[] = "
|
|
-<modulefunction>
|
|
- <header>
|
|
- <name>readRandomFile</name>
|
|
- <parameter>filename</parameter>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This function reads a previously saved random state. It can be very
|
|
- useful to improve the quality of random data used by an application.
|
|
- The random data should be added to, using the
|
|
- <function>add</function> function, with data from other
|
|
- suitable random sources.
|
|
- </para>
|
|
- </body>
|
|
-</modulefunction>";
|
|
+static char pow_module_read_random_file__doc__[] = "\n"
|
|
+"<modulefunction>\n"
|
|
+" <header>\n"
|
|
+" <name>readRandomFile</name>\n"
|
|
+" <parameter>filename</parameter>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This function reads a previously saved random state. It can be very\n"
|
|
+" useful to improve the quality of random data used by an application.\n"
|
|
+" The random data should be added to, using the\n"
|
|
+" <function>add</function> function, with data from other\n"
|
|
+" suitable random sources.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</modulefunction>";
|
|
|
|
static PyObject *
|
|
pow_module_read_random_file(PyObject *self, PyObject *args)
|
|
@@ -5915,23 +5922,23 @@ error:
|
|
return NULL;
|
|
}
|
|
|
|
-static char pow_module___doclist____doc__[] = "
|
|
-<modulefunction>
|
|
- <header>
|
|
- <name>__doclist__</name>
|
|
- </header>
|
|
- <body>
|
|
- <para>
|
|
- This function returns a list of all the doc strings in this
|
|
- module. The doc strings contain a mixture of DocBook markup and
|
|
- custom tags which semi-formally describe the class or function. The
|
|
- list of strings was used to generate this documentation, it was
|
|
- processed by a simple and pretty raw script which produced a valid
|
|
- DobBook article. Finally Openjade was used process the DocBook article
|
|
- to produce this document.
|
|
- </para>
|
|
- </body>
|
|
-</modulefunction>";
|
|
+static char pow_module___doclist____doc__[] = "\n"
|
|
+"<modulefunction>\n"
|
|
+" <header>\n"
|
|
+" <name>__doclist__</name>\n"
|
|
+" </header>\n"
|
|
+" <body>\n"
|
|
+" <para>\n"
|
|
+" This function returns a list of all the doc strings in this\n"
|
|
+" module. The doc strings contain a mixture of DocBook markup and\n"
|
|
+" custom tags which semi-formally describe the class or function. The\n"
|
|
+" list of strings was used to generate this documentation, it was\n"
|
|
+" processed by a simple and pretty raw script which produced a valid\n"
|
|
+" DobBook article. Finally Openjade was used process the DocBook article\n"
|
|
+" to produce this document.\n"
|
|
+" </para>\n"
|
|
+" </body>\n"
|
|
+"</modulefunction>";
|
|
|
|
static PyObject *
|
|
pow_module___doclist__(PyObject *self, PyObject *args)
|