$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 +#include #include #include @@ -45,7 +45,10 @@ #include #include #include +#ifndef OPENSSL_NO_MD2 #include +#endif +#include #include #include @@ -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__ [] = " - -
- Python OpenSSL Wrappers v0.6.1 - Peter Shannon -
- - - This is the second release of POW and many of the missing gaps in - functionality have been plugged. The Ssl 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. - - -
"; +static char pow_module__doc__ [] = "\n" +"\n" +"
\n" +" Python OpenSSL Wrappers v0.6.1\n" +" Peter Shannon\n" +"
\n" +" \n" +" \n" +" This is the second release of POW and many of the missing gaps in\n" +" functionality have been plugged. The Ssl 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" +" \n" +" \n" +"
"; /*========== 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__[] = " - -
- X509 - pemWrite -
- - - This method returns a PEM encoded certificate as a - string. - - -
"; +static char X509_object_pem_write__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" pemWrite\n" +"
\n" +" \n" +" \n" +" This method returns a PEM encoded certificate as a\n" +" string.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- X509 - setPublicKey - key -
- - - This method sets the public key for this certificate object. The - parameter key should be an instance of - Asymmetric containing a public key. - - -
"; +static char X509_object_set_public_key__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" setPublicKey\n" +" key\n" +"
\n" +" \n" +" \n" +" This method sets the public key for this certificate object. The\n" +" parameter key should be an instance of\n" +" Asymmetric containing a public key.\n" +" \n" +" \n" +"
"; static PyObject * @@ -587,33 +590,33 @@ error: } -static char X509_object_sign__doc__[] = " - -
- X509 - sign - key - digest=MD5_DIGEST -
- - - This method signs a certificate with a private key. See the - example for the methods which should be invoked before signing a - certificate. key should be an instance of - Asymmetric containing a private key. - The optional parameter digest indicates - which digest function should be used to compute the hash to be - signed, it should be one of the following: - - - MD2_DIGEST - MD5_DIGEST - SHA_DIGEST - SHA1_DIGEST - RIPEMD160_DIGEST - - -
"; +static char X509_object_sign__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" sign\n" +" key\n" +" digest=MD5_DIGEST\n" +"
\n" +" \n" +" \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. key should be an instance of\n" +" Asymmetric containing a private key.\n" +" The optional parameter digest indicates \n" +" which digest function should be used to compute the hash to be \n" +" signed, it should be one of the following:\n" +" \n" +" \n" +" MD2_DIGEST\n" +" MD5_DIGEST\n" +" SHA_DIGEST\n" +" SHA1_DIGEST\n" +" RIPEMD160_DIGEST\n" +" \n" +" \n" +"
"; static PyObject * @@ -783,19 +786,19 @@ error: return NULL; } -static char X509_object_get_version__doc__[] = " - -
- X509 - getVersion -
- - - This method returns the version number from the version field of - this certificate. - - -
"; +static char X509_object_get_version__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" getVersion\n" +"
\n" +" \n" +" \n" +" This method returns the version number from the version field of\n" +" this certificate. \n" +" \n" +" \n" +"
"; static PyObject * @@ -816,21 +819,21 @@ error: return NULL; } -static char X509_object_set_version__doc__[] = " - -
- X509 - setVersion - version -
- - - This method sets the version number in the version field of - this certificate. version should be an - integer. - - -
"; +static char X509_object_set_version__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" setVersion\n" +" version\n" +"
\n" +" \n" +" \n" +" This method sets the version number in the version field of\n" +" this certificate. version should be an\n" +" integer.\n" +" \n" +" \n" +"
"; static PyObject * @@ -851,19 +854,19 @@ error: return NULL; } -static char X509_object_get_serial__doc__[] = " - -
- X509 - getSerial -
- - - This method get the serial number in the serial field of - this certificate. - - -
"; +static char X509_object_get_serial__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" getSerial\n" +"
\n" +" \n" +" \n" +" This method get the serial number in the serial field of\n" +" this certificate.\n" +" \n" +" \n" +"
"; static PyObject * @@ -888,21 +891,21 @@ error: return NULL; } -static char X509_object_set_serial__doc__[] = " - -
- X509 - setSerial - serial -
- - - This method sets the serial number in the serial field of - this certificate. serial should ba an - integer. - - -
"; +static char X509_object_set_serial__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" setSerial\n" +" serial\n" +"
\n" +" \n" +" \n" +" This method sets the serial number in the serial field of\n" +" this certificate. serial should ba an\n" +" integer.\n" +" \n" +" \n" +"
"; static PyObject * @@ -935,37 +938,37 @@ error: return NULL; } -static char X509_object_get_issuer__doc__[] = " - -
- X509 - getIssuer - format=SHORTNAME_FORMAT -
- - - 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: - - - c or countryName - st or stateOrProvinceName - o or organizationName - l or localityName - ou or organizationalUnitName - cn or commonName - - - 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. - - -
"; +static char X509_object_get_issuer__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" getIssuer\n" +" format=SHORTNAME_FORMAT\n" +"
\n" +" \n" +" \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" +" \n" +" \n" +" c or countryName\n" +" st or stateOrProvinceName\n" +" o or organizationName\n" +" l or localityName\n" +" ou or organizationalUnitName\n" +" cn or commonName\n" +" \n" +" \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" +" \n" +" \n" +"
"; static PyObject * @@ -991,21 +994,21 @@ error: return NULL; } -static char X509_object_get_subject__doc__[] = " - -
- X509 - getSubject - format=SHORTNAME_FORMAT -
- - - This method returns a tuple containg the subjects name. See - getIssuer for a description of the returned - object's format. - - -
"; +static char X509_object_get_subject__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" getSubject\n" +" format=SHORTNAME_FORMAT\n" +"
\n" +" \n" +" \n" +" This method returns a tuple containg the subjects name. See\n" +" getIssuer for a description of the returned\n" +" object's format.\n" +" \n" +" \n" +"
"; static PyObject * @@ -1082,21 +1085,21 @@ error: return NULL; } -static char X509_object_set_subject__doc__[] = " - -
- X509 - setSubject - name -
- - - This method is used to set the subjects name. - name can be comprised of lists or tuples in - the format described in the getIssuer method. - - -
"; +static char X509_object_set_subject__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" setSubject\n" +" name\n" +"
\n" +" \n" +" \n" +" This method is used to set the subjects name.\n" +" name can be comprised of lists or tuples in\n" +" the format described in the getIssuer method.\n" +" \n" +" \n" +"
"; static PyObject * @@ -1129,21 +1132,21 @@ error: return NULL; } -static char X509_object_set_issuer__doc__[] = " - -
- X509 - setIssuer - name -
- - - This method is used to set the issuers name. - name can be comprised of lists or tuples in - the format described in the getissuer method. - - -
"; +static char X509_object_set_issuer__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" setIssuer\n" +" name\n" +"
\n" +" \n" +" \n" +" This method is used to set the issuers name.\n" +" name can be comprised of lists or tuples in\n" +" the format described in the getissuer method.\n" +" \n" +" \n" +"
"; static PyObject * @@ -1176,21 +1179,21 @@ error: return NULL; } -static char X509_object_get_not_before__doc__[] = " - -
- X509 - getNotBefore -
- - - This method returns a tuple containing two integers. The first - number represents the time in seconds and is the same as the C - time_t typedef and the second represents the time zone offset in - seconds. - - -
"; +static char X509_object_get_not_before__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" getNotBefore\n" +"
\n" +" \n" +" \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" +" time_t typedef and the second represents the time zone offset in\n" +" seconds.\n" +" \n" +" \n" +"
"; static PyObject * @@ -1211,21 +1214,21 @@ error: return NULL; } -static char X509_object_get_not_after__doc__[] = " - -
- X509 - getNotAfter -
- - - This method returns a tuple containing two integers. The first - number represents the time in seconds and is the same as the C - time_t typedef and the second represents the time zone offset in - seconds. - - -
"; +static char X509_object_get_not_after__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" getNotAfter\n" +"
\n" +" \n" +" \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" +" time_t typedef and the second represents the time zone offset in\n" +" seconds.\n" +" \n" +" \n" +"
"; static PyObject * @@ -1246,23 +1249,23 @@ error: return NULL; } -static char X509_object_set_not_after__doc__[] = " - -
- X509 - setNotAfter - time -
- - - This method sets part of the Validity - sequence of the certificate, the notAfter - time. time should be a time in seconds, - as generated by the time function in the Python - Standard Library. - - -
"; +static char X509_object_set_not_after__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" setNotAfter\n" +" time\n" +"
\n" +" \n" +" \n" +" This method sets part of the Validity\n" +" sequence of the certificate, the notAfter\n" +" time. time should be a time in seconds,\n" +" as generated by the time function in the Python\n" +" Standard Library.\n" +" \n" +" \n" +"
"; static PyObject * @@ -1283,23 +1286,23 @@ error: return NULL; } -static char X509_object_set_not_before__doc__[] = " - -
- X509 - setNotBefore - time -
- - - This method sets part of the Validity - sequence of the certificate, the notBefore - time. time should be a time in seconds, - as generated by the time function in the Python - Standard Library. - - -
"; +static char X509_object_set_not_before__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" setNotBefore\n" +" time\n" +"
\n" +" \n" +" \n" +" This method sets part of the Validity\n" +" sequence of the certificate, the notBefore\n" +" time. time should be a time in seconds,\n" +" as generated by the time function in the Python\n" +" Standard Library.\n" +" \n" +" \n" +"
"; static PyObject * @@ -1320,19 +1323,19 @@ error: return NULL; } -static char x509_object_pprint__doc__[] = " - -
- X509 - pprint -
- - - This method returns a formatted string showing the information - held in the certificate. - - -
"; +static char x509_object_pprint__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +" pprint\n" +"
\n" +" \n" +" \n" +" This method returns a formatted string showing the information\n" +" held in the certificate.\n" +" \n" +" \n" +"
"; static PyObject * @@ -1428,52 +1431,52 @@ X509_object_dealloc(x509_object *self, char *name) PyObject_Del(self); } -static char x509type__doc__[] = " - -
- X509 -
- - - This class provides access to a significant proportion of X509 - functionality of OpenSSL. - +static char x509type__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +"
\n" +" \n" +" \n" +" This class provides access to a significant proportion of X509 \n" +" functionality of OpenSSL.\n" +" \n" +"\n" +" \n" +" <classname>x509</classname> class usage\n" +" \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" +" \n" +" \n" +"\n" +" \n" +"
"; - - <classname>x509</classname> class usage - - 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() - - - - -
"; - - 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__[] = " - -
- X509Store - verify - certificate -
- - - The X509Store method - verify is based on the - X509_verify_cert. It handles certain aspects - of verification but not others. The certificate will be verified - against notBefore, - notAfter and trusted certificates. - It crucially will not handle checking the certificate against - CRLs. This functionality will probably make it into OpenSSL - 0.9.7. - - -
"; +static char x509_store_object_verify__doc__[] = "\n" +"\n" +"
\n" +" X509Store\n" +" verify\n" +" certificate\n" +"
\n" +" \n" +" \n" +" The X509Store method\n" +" verify is based on the\n" +" X509_verify_cert. It handles certain aspects\n" +" of verification but not others. The certificate will be verified\n" +" against notBefore, \n" +" notAfter 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" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Store - verifyChain - certificate - chain -
- - - The X509Store method verifyChain - is based on the X509_verify_cert but is initialised - with a X509 object to verify and list of - X509 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 notBefore, - notAfter and trusted certificates. It crucially will - not handle checking the certificate against CRLs. This functionality will - probably make it into OpenSSL 0.9.7. - - - 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. - - -
"; +static char x509_store_object_verify_chain__doc__[] = "\n" +"\n" +"
\n" +" X509Store\n" +" verifyChain\n" +" certificate\n" +" chain\n" +"
\n" +" \n" +" \n" +" The X509Store method verifyChain \n" +" is based on the X509_verify_cert but is initialised \n" +" with a X509 object to verify and list of \n" +" X509 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 notBefore, \n" +" notAfter 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" +" \n" +" \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" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Store - addTrust - cert -
- - - This method adds a new certificate to the store to be used in the - verification process. cert should be an - instance of X509. 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. - - -
"; +static char x509_store_object_add_trust__doc__[] = "\n" +"\n" +"
\n" +" X509Store\n" +" addTrust\n" +" cert\n" +"
\n" +" \n" +" \n" +" This method adds a new certificate to the store to be used in the\n" +" verification process. cert should be an\n" +" instance of X509. 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" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Store - addCrl - crl -
- - - This method adds a CRL to a store to be used for verification. - crl should be an instance of - X509Crl. - 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. - - -
"; +static char x509_store_object_add_crl__doc__[] = "\n" +"\n" +"
\n" +" X509Store\n" +" addCrl\n" +" crl\n" +"
\n" +" \n" +" \n" +" This method adds a CRL to a store to be used for verification.\n" +" crl should be an instance of\n" +" X509Crl.\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" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Store -
- - - This class provides preliminary access to OpenSSL X509 verification - facilities. - +static char x509_storetype__doc__[] = "\n" +"\n" +"
\n" +" X509Store\n" +"
\n" +" \n" +" \n" +" This class provides preliminary access to OpenSSL X509 verification\n" +" facilities.\n" +" \n" +"\n" +" \n" +" <classname>x509_store</classname> class usage\n" +" \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" +" \n" +" \n" +" \n" +"
"; - - <classname>x509_store</classname> class usage - - 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!.' - - - -
"; - - 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__[] = " - -
- X509Crl - getVersion -
- - - This method returns the version number from the version field of - this CRL. - - -
"; +static char x509_crl_object_get_version__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" getVersion\n" +"
\n" +" \n" +" \n" +" This method returns the version number from the version field of\n" +" this CRL. \n" +" \n" +" \n" +"
"; static PyObject * @@ -1878,21 +1881,21 @@ error: return NULL; } -static char x509_crl_object_set_version__doc__[] = " - -
- X509Crl - setVersion - version -
- - - This method sets the version number in the version field of - this CRL. version should be an - integer. - - -
"; +static char x509_crl_object_set_version__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" setVersion\n" +" version\n" +"
\n" +" \n" +" \n" +" This method sets the version number in the version field of\n" +" this CRL. version should be an\n" +" integer.\n" +" \n" +" \n" +"
"; static PyObject * @@ -1922,21 +1925,21 @@ error: return NULL; } -static char x509_crl_object_get_issuer__doc__[] = " - -
- X509Crl - getIssuer - format=SHORTNAME_FORMAT -
- - - This method returns a tuple containg the issuers name. See the - getIssuer method of - X509 for more details. - - -
"; +static char x509_crl_object_get_issuer__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" getIssuer\n" +" format=SHORTNAME_FORMAT\n" +"
\n" +" \n" +" \n" +" This method returns a tuple containg the issuers name. See the\n" +" getIssuer method of\n" +" X509 for more details.\n" +" \n" +" \n" +"
"; static PyObject * @@ -1958,22 +1961,22 @@ error: return NULL; } -static char x509_crl_object_set_issuer__doc__[] = " - -
- X509Crl - setIssuer - name -
- - - This method is used to set the issuers name. - name can be comprised of lists or tuples in - the format described in the getIssuer method - of X509. - - -
"; +static char x509_crl_object_set_issuer__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" setIssuer\n" +" name\n" +"
\n" +" \n" +" \n" +" This method is used to set the issuers name.\n" +" name can be comprised of lists or tuples in\n" +" the format described in the getIssuer method\n" +" of X509.\n" +" \n" +" \n" +"
"; static PyObject * @@ -2009,22 +2012,22 @@ error: return NULL; } -static char x509_crl_object_set_this_update__doc__[] = " - -
- X509Crl - setThisUpdate - time -
- - - This method sets the thisUpdate - field of this CRL. time should be a time in seconds, - as generated by the time function in the Python - Standard Library. - - -
"; +static char x509_crl_object_set_this_update__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" setThisUpdate\n" +" time\n" +"
\n" +" \n" +" \n" +" This method sets the thisUpdate\n" +" field of this CRL. time should be a time in seconds,\n" +" as generated by the time function in the Python\n" +" Standard Library.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Crl - getThisUpdate -
- - - This method returns a tuple containing two integers. The first - number represents the time in seconds and is the same as the C - time_t typedef and the second represents the time zone offset in - seconds. - - -
"; +static char x509_crl_object_get_this_update__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" getThisUpdate\n" +"
\n" +" \n" +" \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" +" time_t typedef and the second represents the time zone offset in\n" +" seconds.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Crl - setNextUpdate - time -
- - - This method sets the thisUpdate - field of this CRL. time should be a time in seconds, - as generated by the time function in the Python - Standard Library. - - -
"; +static char x509_crl_object_set_next_update__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" setNextUpdate\n" +" time\n" +"
\n" +" \n" +" \n" +" This method sets the thisUpdate\n" +" field of this CRL. time should be a time in seconds,\n" +" as generated by the time function in the Python\n" +" Standard Library.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Crl - getNextUpdate -
- - - This method returns a tuple containing two integers. The first - number represents the time in seconds and is the same as the C - time_t typedef and the second represents the time zone offset in - seconds. - - -
"; +static char x509_crl_object_get_next_update__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" getNextUpdate\n" +"
\n" +" \n" +" \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" +" time_t typedef and the second represents the time zone offset in\n" +" seconds.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Crl - setRevoked - revoked -
- - - This method sets the sequence of revoked certificates in this CRL. - revoked should be a list or tuple of - X509Revoked. - - - <function>setRevoked</function> function usage - - 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" +"\n" +"
\n" +" X509Crl\n" +" setRevoked\n" +" revoked\n" +"
\n" +" \n" +" \n" +" This method sets the sequence of revoked certificates in this CRL.\n" +" revoked should be a list or tuple of \n" +" X509Revoked.\n" +" \n" +" \n" +" <function>setRevoked</function> function usage\n" +" \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" +" \n" +" \n" +"\n" +" \n" +"
"; - 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() -
-
- - -
"; - 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__[] = " - -
- X509Crl - getRevoked -
- - - This method returns a tuple of X509Revoked - objects described in the CRL. - - - <function>getRevoked</function> function usage - - publicFile = open('test/public.key', 'r') - crlFile = open('test/crl.pem', 'r') +static char x509_crl_object_get_revoked__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" getRevoked\n" +"
\n" +" \n" +" \n" +" This method returns a tuple of X509Revoked\n" +" objects described in the CRL.\n" +" \n" +" \n" +" <function>getRevoked</function> function usage\n" +" \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" +" \n" +" \n" +"\n" +" \n" +"
"; - 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() -
-
- - -
"; - 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__[] = " - -
- X509Crl - sign - key - digest=MD5_DIGEST -
- - - key should be an instance of - Asymmetric and contain a private key. - digest indicates - which digest function should be used to compute the hash to be - signed, it should be one of the following: - - - MD2_DIGEST - MD5_DIGEST - SHA_DIGEST - SHA1_DIGEST - RIPEMD160_DIGEST - - +static char x509_crl_object_sign__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" sign\n" +" key\n" +" digest=MD5_DIGEST\n" +"
\n" +" \n" +" \n" +" key should be an instance of\n" +" Asymmetric and contain a private key.\n" +" digest indicates \n" +" which digest function should be used to compute the hash to be \n" +" signed, it should be one of the following:\n" +" \n" +" \n" +" MD2_DIGEST\n" +" MD5_DIGEST\n" +" SHA_DIGEST\n" +" SHA1_DIGEST\n" +" RIPEMD160_DIGEST\n" +" \n" +" \n" +"\n" +"
"; -
"; - static PyObject * x509_crl_object_sign(x509_crl_object *self, PyObject *args) { @@ -2430,26 +2433,26 @@ error: } -static char x509_crl_object_verify__doc__[] = " - -
- X509Crl - verify - key -
- - - The X509Crl method - verify is based on the - X509_CRL_verify function. Unlike the - X509 function of the same name, this - function simply checks the CRL was signed with the private key - which corresponds the parameter key. - key should be an instance of - Asymmetric and contain a public key. - - -
"; +static char x509_crl_object_verify__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" verify\n" +" key\n" +"
\n" +" \n" +" \n" +" The X509Crl method\n" +" verify is based on the\n" +" X509_CRL_verify function. Unlike the\n" +" X509 function of the same name, this\n" +" function simply checks the CRL was signed with the private key\n" +" which corresponds the parameter key.\n" +" key should be an instance of\n" +" Asymmetric and contain a public key.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Crl - pemWrite -
- - - This method returns a PEM encoded CRL as a - string. - - -
"; +static char x509_crl_object_pem_write__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" pemWrite\n" +"
\n" +" \n" +" \n" +" This method returns a PEM encoded CRL as a\n" +" string.\n" +" \n" +" \n" +"
"; static PyObject * @@ -2546,19 +2549,19 @@ error: return NULL; } -static char x509_crl_object_pprint__doc__[] = " - -
- X509Crl - pprint -
- - - This method returns a formatted string showing the information - held in the CRL. - - -
"; +static char x509_crl_object_pprint__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +" pprint\n" +"
\n" +" \n" +" \n" +" This method returns a formatted string showing the information\n" +" held in the CRL.\n" +" \n" +" \n" +"
"; static PyObject * @@ -2650,18 +2653,18 @@ x509_crl_object_dealloc(x509_crl_object *self, char *n PyObject_Del(self); } -static char x509_crltype__doc__[] = " - -
- X509Crl -
- - - This class provides access to OpenSSL X509 CRL management - facilities. - - -
"; +static char x509_crltype__doc__[] = "\n" +"\n" +"
\n" +" X509Crl\n" +"
\n" +" \n" +" \n" +" This class provides access to OpenSSL X509 CRL management\n" +" facilities.\n" +" \n" +" \n" +"
"; static PyTypeObject x509_crltype = { @@ -2708,21 +2711,21 @@ error: return NULL; } -static char x509_revoked_object_set_serial__doc__[] = " - -
- X509Revoked - setSerial - serial -
- - - This method sets the serial number in the serial field of - this object. serial should be an - integer. - - -
"; +static char x509_revoked_object_set_serial__doc__[] = "\n" +"\n" +"
\n" +" X509Revoked\n" +" setSerial\n" +" serial\n" +"
\n" +" \n" +" \n" +" This method sets the serial number in the serial field of\n" +" this object. serial should be an\n" +" integer.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Revoked - getSerial -
- - - This method gets the serial number in the serial field of - this object. - - -
"; +static char x509_revoked_object_get_serial__doc__[] = " \n" +"\n" +"
\n" +" X509Revoked\n" +" getSerial\n" +"
\n" +" \n" +" \n" +" This method gets the serial number in the serial field of\n" +" this object.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Revoked - getDate -
- - - This method returns a tuple containing two integers representing - revocationDate. The first - number represents the time in seconds and is the same as the C - time_t typedef and the second represents the time zone offset in - seconds. - - -
"; +static char x509_revoked_object_get_date__doc__[] = "\n" +"\n" +"
\n" +" X509Revoked\n" +" getDate\n" +"
\n" +" \n" +" \n" +" This method returns a tuple containing two integers representing\n" +" revocationDate. The first\n" +" number represents the time in seconds and is the same as the C \n" +" time_t typedef and the second represents the time zone offset in\n" +" seconds.\n" +" \n" +" \n" +"
"; static PyObject * @@ -2805,22 +2808,22 @@ error: return NULL; } -static char x509_revoked_object_set_date__doc__[] = " - -
- X509Revoked - setDate - time -
- - - This method sets the revocationDate - field of this object. time should be a time in seconds, - as generated by the time function in the Python - Standard Library. - - -
"; +static char x509_revoked_object_set_date__doc__[] = "\n" +"\n" +"
\n" +" X509Revoked\n" +" setDate\n" +" time\n" +"
\n" +" \n" +" \n" +" This method sets the revocationDate\n" +" field of this object. time should be a time in seconds,\n" +" as generated by the time function in the Python\n" +" Standard Library.\n" +" \n" +" \n" +"
"; static PyObject * @@ -2867,24 +2870,24 @@ x509_revoked_object_dealloc(x509_revoked_object *self, PyObject_Del(self); } -static char x509_revokedtype__doc__[] = " - -
- X509Revoked -
- - - 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. - X509Revoked existing as an object in its - own right will make adding this support easier, while avoiding - backwards compatibility issues. - - -
"; +static char x509_revokedtype__doc__[] = "\n" +"\n" +"
\n" +" X509Revoked\n" +"
\n" +" \n" +" \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" +" X509Revoked existing as an object in its\n" +" own right will make adding this support easier, while avoiding\n" +" backwards compatibility issues.\n" +" \n" +" \n" +"
"; static PyTypeObject x509_revokedtype = { @@ -2914,21 +2917,21 @@ static PyTypeObject x509_revokedtype = { /*========== x509 revoked Code ==========*/ /*========== ssl Code ==========*/ -static char ssl_object_use_certificate__doc__[] = " - -
- Ssl - useCertificate - cert -
- - - The parameter cert must be an - instance of the X590 class and must be - called before setFd. - - -
"; +static char ssl_object_use_certificate__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" useCertificate\n" +" cert\n" +"
\n" +" \n" +" \n" +" The parameter cert must be an\n" +" instance of the X590 class and must be\n" +" called before setFd. \n" +" \n" +" \n" +"
"; 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__[] = " - -
- Ssl - useKey - key -
- - - The parameter key must be an - instance of the Asymmetric class and - must contain the private key. This function cannot be called - after useKey. - - -
"; +static char ssl_object_use_key__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" useKey\n" +" key\n" +"
\n" +" \n" +" \n" +" The parameter key must be an\n" +" instance of the Asymmetric class and\n" +" must contain the private key. This function cannot be called \n" +" after useKey.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- Ssl - checkKey -
- - - This simple method will return 1 if the public key, contained in - the X509 certificate this Ssl instance is using, - matches the private key this Ssl instance is using. - Otherwise it will return 0. - - -
"; +static char ssl_object_check_key__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" checkKey\n" +"
\n" +" \n" +" \n" +" This simple method will return 1 if the public key, contained in\n" +" the X509 certificate this Ssl instance is using,\n" +" matches the private key this Ssl instance is using.\n" +" Otherwise it will return 0.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- Ssl - setFd - descriptor -
- - - This function is used to associate a file descriptor with a - Ssl object. The file descriptor should - belong to an open TCP connection. Once this function has - been called, calling useKey or - useCertificate will, fail rasing exceptions. - - -
"; +static char ssl_object_set_fd__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" setFd\n" +" descriptor\n" +"
\n" +" \n" +" \n" +" This function is used to associate a file descriptor with a\n" +" Ssl object. The file descriptor should\n" +" belong to an open TCP connection. Once this function has\n" +" been called, calling useKey or\n" +" useCertificate will, fail rasing exceptions.\n" +" \n" +" \n" +"
"; static PyObject * ssl_object_set_fd(ssl_object *self, PyObject *args) @@ -3086,57 +3089,57 @@ error: return NULL; } -static char ssl_object_accept__doc__[] = " - -
- Ssl - accept -
- - - This function will attempt the SSL level accept with a - client. The Ssl object must have been - created using a XXXXX_SERVER_METHOD or - a XXXXX_METHOD and this function should only be - called after useKey, - useCertificate and - setFd functions have been called. - +static char ssl_object_accept__doc__[] = " \n" +"\n" +"
\n" +" Ssl\n" +" accept\n" +"
\n" +" \n" +" \n" +" This function will attempt the SSL level accept with a\n" +" client. The Ssl object must have been\n" +" created using a XXXXX_SERVER_METHOD or\n" +" a XXXXX_METHOD and this function should only be\n" +" called after useKey,\n" +" useCertificate and\n" +" setFd functions have been called.\n" +" \n" +"\n" +" \n" +" <function>accept</function> function usage\n" +" \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" +" \n" +" \n" +" \n" +"
"; - - <function>accept</function> function usage - - 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() - - - -
"; - static PyObject * ssl_object_accept(ssl_object *self, PyObject *args) { @@ -3159,38 +3162,38 @@ error: return NULL; } -static char ssl_object_connect__doc__[] = " - -
- Ssl - connect -
- - - This function will attempt the SSL level connection with a - server. The Ssl object must have been - created using a XXXXX_CLIENT_METHOD or - a XXXXX_METHOD and this function should only be - called after setFd has already been - called. - +static char ssl_object_connect__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" connect\n" +"
\n" +" \n" +" \n" +" This function will attempt the SSL level connection with a\n" +" server. The Ssl object must have been\n" +" created using a XXXXX_CLIENT_METHOD or\n" +" a XXXXX_METHOD and this function should only be\n" +" called after setFd has already been\n" +" called.\n" +" \n" +"\n" +" \n" +" <function>connect</function> function usage\n" +" \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" +" \n" +" \n" +" \n" +"
"; - - <function>connect</function> function usage - - 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) - - - -
"; - 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__[] = " - -
- Ssl - write - string -
- - - This method writes the string to the - Ssl object, to be read by it's peer. This - function is analogous to the socket - classes write function. - - -
"; +static char ssl_object_write__doc__[] = " \n" +"\n" +"
\n" +" Ssl\n" +" write\n" +" string\n" +"
\n" +" \n" +" \n" +" This method writes the string to the\n" +" Ssl object, to be read by it's peer. This\n" +" function is analogous to the socket\n" +" classes write function.\n" +" \n" +" \n" +"
"; static PyObject * ssl_object_write(ssl_object *self, PyObject *args) @@ -3249,22 +3252,22 @@ error: return NULL; } -static char ssl_object_read__doc__[] = " - -
- Ssl - read - amount=1024 -
- - - This method reads up to amount characters from the - Ssl object. This - function is analogous to the socket - classes read function. - - -
"; +static char ssl_object_read__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" read\n" +" amount=1024\n" +"
\n" +" \n" +" \n" +" This method reads up to amount characters from the\n" +" Ssl object. This\n" +" function is analogous to the socket\n" +" classes read function.\n" +" \n" +" \n" +"
"; static PyObject * ssl_object_read(ssl_object *self, PyObject *args) @@ -3304,20 +3307,20 @@ error: return NULL; } -static char ssl_object_peer_certificate__doc__[] = " - -
- Ssl - peerCertificate -
- - - This method returns any peer certificate presented in the initial - SSL negotiation or None. If a certificate is - returned, it will be an instance of X509. - - -
"; +static char ssl_object_peer_certificate__doc__[] = " \n" +"\n" +"
\n" +" Ssl\n" +" peerCertificate\n" +"
\n" +" \n" +" \n" +" This method returns any peer certificate presented in the initial\n" +" SSL negotiation or None. If a certificate is\n" +" returned, it will be an instance of X509.\n" +" \n" +" \n" +"
"; static PyObject * @@ -3357,19 +3360,19 @@ error: return NULL; } -static char ssl_object_clear__doc__[] = " - -
- Ssl - clear -
- - - This method will clear the SSL session ready for - a new SSL connection. It will not effect the underlying socket. - - -
"; +static char ssl_object_clear__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" clear\n" +"
\n" +" \n" +" \n" +" This method will clear the SSL session ready for\n" +" a new SSL connection. It will not effect the underlying socket.\n" +" \n" +" \n" +"
"; static PyObject * ssl_object_clear(ssl_object *self, PyObject *args) @@ -3387,32 +3390,32 @@ error: return NULL; } -static char ssl_object_shutdown__doc__[] = " - -
- Ssl - shutdown -
- - - This method will issue a shutdown 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, - shutdown must be called again. If no - exception is raised, the handshake is complete. - - - 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. - - -
"; +static char ssl_object_shutdown__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" shutdown\n" +"
\n" +" \n" +" \n" +" This method will issue a shutdown 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" +" shutdown must be called again. If no\n" +" exception is raised, the handshake is complete. \n" +" \n" +" \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" +" \n" +" \n" +"
"; static PyObject * ssl_object_shutdown(ssl_object *self, PyObject *args) @@ -3438,28 +3441,28 @@ error: return NULL; } -static char ssl_object_get_shutdown__doc__[] = " - -
- Ssl - getShutdown -
- - - This function returns an integer indicating the state of the - SSL connection. SSL_RECIEVED_SHUTDOWN - will be set the if it's peer sends a shutdown - signal or the underlying socket - receives a close notify . The possible values are: - - - SSL_NO_SHUTDOWN - SSL_SENT_SHUTDOWN - SSL_RECIEVED_SHUTDOWN - SSL_SENT_SHUTDOWN | SSL_RECIEVED_SHUTDOWN - - -
"; +static char ssl_object_get_shutdown__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" getShutdown\n" +"
\n" +" \n" +" \n" +" This function returns an integer indicating the state of the\n" +" SSL connection. SSL_RECIEVED_SHUTDOWN\n" +" will be set the if it's peer sends a shutdown\n" +" signal or the underlying socket\n" +" receives a close notify . The possible values are:\n" +" \n" +" \n" +" SSL_NO_SHUTDOWN\n" +" SSL_SENT_SHUTDOWN\n" +" SSL_RECIEVED_SHUTDOWN\n" +" SSL_SENT_SHUTDOWN | SSL_RECIEVED_SHUTDOWN\n" +" \n" +" \n" +"
"; 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__[] = " - -
- Ssl - getCiphers -
- - - This function returns a list of available ciphers ordered from - most favoured to least. This function must be called after - setFd. - - -
"; +static char ssl_object_get_ciphers__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" getCiphers\n" +"
\n" +" \n" +" \n" +" This function returns a list of available ciphers ordered from\n" +" most favoured to least. This function must be called after\n" +" setFd. \n" +" \n" +" \n" +"
"; 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__[] = " - -
- Ssl - setCiphers - ciphers -
- - - setCiphers - can help protect against certain types of attacks which try to - coerce the server, client or both to negotiate a weak cipher. - ciphers should be a list of strings, as - produced by getCiphers and described in the - OpenSSL man page ciphers. setCiphers should - only be called after setFd. - - -
"; +static char ssl_object_set_ciphers__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" setCiphers\n" +" ciphers\n" +"
\n" +" \n" +" \n" +" setCiphers\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" +" ciphers should be a list of strings, as\n" +" produced by getCiphers and described in the\n" +" OpenSSL man page ciphers. setCiphers should\n" +" only be called after setFd.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- Ssl - getCipher -
- - - This function returns the current cipher in use. - - -
"; +static char ssl_object_get_cipher__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" getCipher\n" +"
\n" +" \n" +" \n" +" This function returns the current cipher in use.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- Ssl - setVerifyMode - mode -
- - - This function sets the behaviour of the SSL handshake. The - parameter mode should be one of the - following: - - - SSL_VERIFY_NONE - SSL_VERIFY_PEER - - - See the OpenSSL man page SSL_CTX_set_verify - for details. This function must be called after setfd - has been called. - - -
"; +static char ssl_object_set_verify_mode__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" setVerifyMode\n" +" mode\n" +"
\n" +" \n" +" \n" +" This function sets the behaviour of the SSL handshake. The\n" +" parameter mode should be one of the\n" +" following:\n" +" \n" +" \n" +" SSL_VERIFY_NONE\n" +" SSL_VERIFY_PEER\n" +" \n" +" \n" +" See the OpenSSL man page SSL_CTX_set_verify \n" +" for details. This function must be called after setfd \n" +" has been called.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- Ssl -
- - - 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. - - -
"; +static char ssltype__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +"
\n" +" \n" +" \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" +" \n" +" \n" +"
"; static PyTypeObject ssltype = { PyObject_HEAD_INIT(&PyType_Type) @@ -3901,31 +3904,31 @@ error: return NULL; } -static char asymmetric_object_pem_write__doc__[] = " - -
- Asymmetric - pemWrite - keytype - ciphertype=None - passphrase=None -
- - - This method is used to write Asymmetric - objects out to strings. The first argument should be either - RSA_PUBLIC_KEY or - RSA_PRIVATE_KEY. Private keys are often - saved in encrypted files to offer extra security above access - control mechanisms. If the keytype is - RSA_PRIVATE_KEY a - ciphertype and - passphrase can also be specified. The - ciphertype should be one of those listed in - the Symmetric class section. - - -
"; +static char asymmetric_object_pem_write__doc__[] = "\n" +"\n" +"
\n" +" Asymmetric\n" +" pemWrite\n" +" keytype\n" +" ciphertype=None\n" +" passphrase=None\n" +"
\n" +" \n" +" \n" +" This method is used to write Asymmetric\n" +" objects out to strings. The first argument should be either\n" +" RSA_PUBLIC_KEY or\n" +" RSA_PRIVATE_KEY. Private keys are often\n" +" saved in encrypted files to offer extra security above access\n" +" control mechanisms. If the keytype is\n" +" RSA_PRIVATE_KEY a\n" +" ciphertype and\n" +" passphrase can also be specified. The\n" +" ciphertype should be one of those listed in\n" +" the Symmetric class section.\n" +" \n" +" \n" +"
"; static PyObject * @@ -4012,22 +4015,22 @@ error: return NULL; } -static char asymmetric_object_public_encrypt__doc__[] = " - -
- Asymmetric - publicEncrypt - plaintext -
- - - This method is used to encrypt the plaintext - 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. - - -
"; +static char asymmetric_object_public_encrypt__doc__[] = "\n" +"\n" +"
\n" +" Asymmetric\n" +" publicEncrypt\n" +" plaintext\n" +"
\n" +" \n" +" \n" +" This method is used to encrypt the plaintext\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" +" \n" +" \n" +"
"; 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__[] = " - -
- Asymmetric - privateEncrypt - plaintext -
- - - This method is used to encrypt the plaintext - 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. - - -
"; +static char asymmetric_object_private_encrypt__doc__[] = "\n" +"\n" +"
\n" +" Asymmetric\n" +" privateEncrypt\n" +" plaintext\n" +"
\n" +" \n" +" \n" +" This method is used to encrypt the plaintext\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" +" \n" +" \n" +"
"; 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__[] = " - -
- Asymmetric - publicDecrypt - ciphertext -
- - - This method is used to decrypt the - ciphertext which has been encrypted - using the corresponding private key and the - privateEncrypt function. - - -
"; +static char asymmetric_object_public_decrypt__doc__[] = "\n" +"\n" +"
\n" +" Asymmetric\n" +" publicDecrypt\n" +" ciphertext\n" +"
\n" +" \n" +" \n" +" This method is used to decrypt the\n" +" ciphertext which has been encrypted\n" +" using the corresponding private key and the\n" +" privateEncrypt function. \n" +" \n" +" \n" +"
"; static PyObject * @@ -4196,21 +4199,21 @@ error: return NULL; } -static char asymmetric_object_private_decrypt__doc__[] = " - -
- Asymmetric - privateDecrypt - ciphertext -
- - - This method is used to decrypt ciphertext which has been encrypted - using the corresponding public key and the - publicEncrypt function. - - -
"; +static char asymmetric_object_private_decrypt__doc__[] = "\n" +"\n" +"
\n" +" Asymmetric\n" +" privateDecrypt\n" +" ciphertext\n" +"
\n" +" \n" +" \n" +" This method is used to decrypt ciphertext which has been encrypted\n" +" using the corresponding public key and the\n" +" publicEncrypt function. \n" +" \n" +" \n" +"
"; static PyObject * asymmetric_object_private_decrypt(asymmetric_object *self, PyObject *args) @@ -4254,38 +4257,38 @@ error: return NULL; } -static char asymmetric_object_sign__doc__[] = " - -
- Asymmetric - sign - digesttext - digesttype -
- - - This method is used to produce a signed digest text. - This instance of - Asymmetric should be a private key used for - signing. The parameter - digesttext should be a digest of the - data to protect against alteration and - finally digesttype should be one of the - following: - - - MD2_DIGEST - MD5_DIGEST - SHA_DIGEST - SHA1_DIGEST - RIPEMD160_DIGEST - - - If the procedure was successful, a string containing the signed - digest is returned. - - -
"; +static char asymmetric_object_sign__doc__[] = "\n" +"\n" +"
\n" +" Asymmetric\n" +" sign\n" +" digesttext\n" +" digesttype\n" +"
\n" +" \n" +" \n" +" This method is used to produce a signed digest text. \n" +" This instance of\n" +" Asymmetric should be a private key used for\n" +" signing. The parameter\n" +" digesttext should be a digest of the \n" +" data to protect against alteration and\n" +" finally digesttype should be one of the\n" +" following:\n" +" \n" +" \n" +" MD2_DIGEST\n" +" MD5_DIGEST\n" +" SHA_DIGEST\n" +" SHA1_DIGEST\n" +" RIPEMD160_DIGEST\n" +" \n" +" \n" +" If the procedure was successful, a string containing the signed\n" +" digest is returned. \n" +" \n" +" \n" +"
"; 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__[] = " - -
- Asymmetric - verify - signedtext - digesttext - digesttype -
- - - This method is used to verify a signed digest text. - - - <function>verify</function> method usage - - 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" +"\n" +"
\n" +" Asymmetric\n" +" verify\n" +" signedtext\n" +" digesttext\n" +" digesttype\n" +"
\n" +" \n" +" \n" +" This method is used to verify a signed digest text. \n" +" \n" +" \n" +" <function>verify</function> method usage\n" +" \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" +" \n" +" \n" +" \n" +" The parameter signedtext should be a \n" +" signed digest text. This instance of\n" +" Asymmetric should correspond to the private\n" +" key used to sign the digest. The parameter\n" +" digesttext should be a digest of the same\n" +" data used to produce the signedtext and\n" +" finally digesttype should be one of the\n" +" following:\n" +" \n" +" \n" +" MD2_DIGEST\n" +" MD5_DIGEST\n" +" SHA_DIGEST\n" +" SHA1_DIGEST\n" +" RIPEMD160_DIGEST\n" +" \n" +" \n" +" If the procedure was successful, 1 is returned, otherwise 0 is\n" +" returned.\n" +" \n" +" \n" +"
"; - 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!' -
-
- - The parameter signedtext should be a - signed digest text. This instance of - Asymmetric should correspond to the private - key used to sign the digest. The parameter - digesttext should be a digest of the same - data used to produce the signedtext and - finally digesttype should be one of the - following: - - - MD2_DIGEST - MD5_DIGEST - SHA_DIGEST - SHA1_DIGEST - RIPEMD160_DIGEST - - - If the procedure was successful, 1 is returned, otherwise 0 is - returned. - - -
"; - 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__[] = " - -
- Asymmetric -
- - - 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. - - -
"; +static char asymmetrictype__doc__[] = "\n" +"\n" +"
\n" +" Asymmetric\n" +"
\n" +" \n" +" \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" +" \n" +" \n" +"
"; static PyTypeObject asymmetrictype = { PyObject_HEAD_INIT(&PyType_Type) @@ -4545,27 +4552,27 @@ error: return NULL; } -static char symmetric_object_encrypt_init__doc__[] = " - -
- Symmetric - encryptInit - key - initialvalue='' -
- - - 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 initialvalue serves - a similar purpose the the salt supplied to the Unix - crypt function. - The initialvalue 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. - - -
"; +static char symmetric_object_encrypt_init__doc__[] = "\n" +"\n" +"
\n" +" Symmetric\n" +" encryptInit\n" +" key\n" +" initialvalue=''\n" +"
\n" +" \n" +" \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 initialvalue serves\n" +" a similar purpose the the salt supplied to the Unix\n" +" crypt function.\n" +" The initialvalue 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" +" \n" +" \n" +"
"; static PyObject * @@ -4593,23 +4600,23 @@ error: return NULL; } -static char symmetric_object_decrypt_init__doc__[] = " - -
- Symmetric - decryptInit - key - initialvalue='' -
- - - 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 initialvalue - used to encrypt the data. - - -
"; +static char symmetric_object_decrypt_init__doc__[] = "\n" +"\n" +"
\n" +" Symmetric\n" +" decryptInit\n" +" key\n" +" initialvalue=''\n" +"
\n" +" \n" +" \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 initialvalue \n" +" used to encrypt the data.\n" +" \n" +" \n" +"
"; static PyObject * symmetric_object_decrypt_init(symmetric_object *self, PyObject *args) @@ -4636,21 +4643,21 @@ error: return NULL; } -static char symmetric_object_update__doc__[] = " - -
- Symmetric - update - data -
- - - This method is used to process the bulk of data being encrypted - or decrypted by the cipher object. data - should be a string. - - -
"; +static char symmetric_object_update__doc__[] = "\n" +"\n" +"
\n" +" Symmetric\n" +" update\n" +" data\n" +"
\n" +" \n" +" \n" +" This method is used to process the bulk of data being encrypted\n" +" or decrypted by the cipher object. data\n" +" should be a string.\n" +" \n" +" \n" +"
"; static PyObject * symmetric_object_update(symmetric_object *self, PyObject *args) @@ -4682,22 +4689,22 @@ error: return NULL; } -static char symmetric_object_final__doc__[] = " - -
- Symmetric - final - size=1024 -
- - - 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 size. - - -
"; +static char symmetric_object_final__doc__[] = "\n" +"\n" +"
\n" +" Symmetric\n" +" final\n" +" size=1024\n" +"
\n" +" \n" +" \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 size. \n" +" \n" +" \n" +"
"; static PyObject * @@ -4755,45 +4762,45 @@ symmetric_object_dealloc(symmetric_object *self, char PyObject_Del(self); } -static char symmetrictype__doc__[] = " - -
- Symmetric -
- - - This class provides access to all the symmetric ciphers in OpenSSL. - Initialisation of the cipher structures is performed late, only - when encryptInit or - decryptInit is called, the - constructor only records the cipher type. It is possible to reuse - the Symmetric objects by calling - encryptInit or decryptInit - again. - - - <classname>Symmetric</classname> class usage - - passphrase = 'my silly passphrase' - md5 = POW.Digest( POW.MD5_DIGEST ) - md5.update( passphrase ) - password = md5.digest()[:8] +static char symmetrictype__doc__[] = "\n" +"\n" +"
\n" +" Symmetric\n" +"
\n" +" \n" +" \n" +" This class provides access to all the symmetric ciphers in OpenSSL.\n" +" Initialisation of the cipher structures is performed late, only\n" +" when encryptInit or\n" +" decryptInit is called, the\n" +" constructor only records the cipher type. It is possible to reuse\n" +" the Symmetric objects by calling\n" +" encryptInit or decryptInit\n" +" again.\n" +" \n" +" \n" +" <classname>Symmetric</classname> class usage\n" +" \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" +" \n" +" \n" +" \n" +"
"; - 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 -
-
- -
"; - - static PyTypeObject symmetrictype = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ @@ -4854,21 +4861,21 @@ error: return NULL; } -static char digest_object_update__doc__[] = " - -
- Digest - update - data -
- - - This method updates the internal structures of the - Digest object with data. - data should be a string. - - -
"; +static char digest_object_update__doc__[] = "\n" +"\n" +"
\n" +" Digest\n" +" update\n" +" data\n" +"
\n" +" \n" +" \n" +" This method updates the internal structures of the \n" +" Digest object with data.\n" +" data should be a string.\n" +" \n" +" \n" +"
"; static PyObject * digest_object_update(digest_object *self, PyObject *args) @@ -4888,19 +4895,19 @@ error: return NULL; } -static char digest_object_copy__doc__[] = " - -
- Digest - copy -
- - - This method returns a copy of the Digest - object. - - -
"; +static char digest_object_copy__doc__[] = "\n" +"\n" +"
\n" +" Digest\n" +" copy\n" +"
\n" +" \n" +" \n" +" This method returns a copy of the Digest\n" +" object.\n" +" \n" +" \n" +"
"; static PyObject * digest_object_copy(digest_object *self, PyObject *args) @@ -4921,21 +4928,21 @@ error: return NULL; } -static char digest_object_digest__doc__[] = " - -
- Digest - digest -
- - - 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 digest - object. - - -
"; +static char digest_object_digest__doc__[] = "\n" +"\n" +"
\n" +" Digest\n" +" digest\n" +"
\n" +" \n" +" \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 digest\n" +" object.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- Digest -
- - - 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 hexdigest - function. - - - <classname>digest</classname> class usage - - plain_text = 'Hello World!' - sha1 = POW.Digest( POW.SHA1_DIGEST ) - sha1.update( plain_text ) - print '\tPlain text: Hello World! =>', sha1.digest() - - - -
"; +static char digesttype__doc__[] = "\n" +"\n" +"
\n" +" Digest\n" +"
\n" +" \n" +" \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 hexdigest\n" +" function.\n" +" \n" +" \n" +" <classname>digest</classname> class usage\n" +" \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" +" \n" +" \n" +" \n" +"
"; static PyTypeObject digesttype = { PyObject_HEAD_INIT(&PyType_Type) @@ -5074,21 +5081,21 @@ error: return NULL; } -static char hmac_object_update__doc__[] = " - -
- Hmac - update - data -
- - - This method updates the internal structures of the - Hmac object with data. - data should be a string. - - -
"; +static char hmac_object_update__doc__[] = "\n" +"\n" +"
\n" +" Hmac\n" +" update\n" +" data\n" +"
\n" +" \n" +" \n" +" This method updates the internal structures of the \n" +" Hmac object with data.\n" +" data should be a string.\n" +" \n" +" \n" +"
"; static PyObject * hmac_object_update(hmac_object *self, PyObject *args) @@ -5108,19 +5115,19 @@ error: return NULL; } -static char hmac_object_copy__doc__[] = " - -
- Hmac - copy -
- - - This method returns a copy of the Hmac - object. - - -
"; +static char hmac_object_copy__doc__[] = "\n" +"\n" +"
\n" +" Hmac\n" +" copy\n" +"
\n" +" \n" +" \n" +" This method returns a copy of the Hmac\n" +" object.\n" +" \n" +" \n" +"
"; static PyObject * hmac_object_copy(hmac_object *self, PyObject *args) @@ -5140,21 +5147,21 @@ error: return NULL; } -static char hmac_object_mac__doc__[] = " - -
- Hmac - mac -
- - - 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 Hmac - object. - - -
"; +static char hmac_object_mac__doc__[] = "\n" +"\n" +"
\n" +" Hmac\n" +" mac\n" +"
\n" +" \n" +" \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 Hmac\n" +" object.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- Hmac -
- - - 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. - - -
"; +static char hmactype__doc__[] = "\n" +"\n" +"
\n" +" Hmac\n" +"
\n" +" \n" +" \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" +" \n" +" \n" +"
"; 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__[] = " - -
- Ssl - protocol=SSLV23METHOD -
- - - This constructor creates a new Ssl object which will behave as a client - or server, depending on the protocol value passed. The - protocol also determines the protocol type - and version and should be one of the following: - +static char pow_module_new_ssl__doc__[] = "\n" +"\n" +"
\n" +" Ssl\n" +" protocol=SSLV23METHOD\n" +"
\n" +" \n" +" \n" +" This constructor creates a new Ssl object which will behave as a client\n" +" or server, depending on the protocol value passed. The\n" +" protocol also determines the protocol type\n" +" and version and should be one of the following:\n" +" \n" +"\n" +" \n" +" SSLV2_SERVER_METHOD\n" +" SSLV2_CLIENT_METHOD\n" +" SSLV2_METHOD\n" +" SSLV3_SERVER_METHOD\n" +" SSLV3_CLIENT_METHOD\n" +" SSLV3_METHOD\n" +" TLSV1_SERVER_METHOD\n" +" TLSV1_CLIENT_METHOD\n" +" TLSV1_METHOD\n" +" SSLV23_SERVER_METHOD\n" +" SSLV23_CLIENT_METHOD\n" +" SSLV23_METHOD\n" +" \n" +" \n" +"
"; - - SSLV2_SERVER_METHOD - SSLV2_CLIENT_METHOD - SSLV2_METHOD - SSLV3_SERVER_METHOD - SSLV3_CLIENT_METHOD - SSLV3_METHOD - TLSV1_SERVER_METHOD - TLSV1_CLIENT_METHOD - TLSV1_METHOD - SSLV23_SERVER_METHOD - SSLV23_CLIENT_METHOD - SSLV23_METHOD - - -
"; - static PyObject * pow_module_new_ssl (PyObject *self, PyObject *args) { @@ -5299,19 +5306,19 @@ error: return NULL; } -static char pow_module_new_x509__doc__[] = " - -
- X509 -
- - - 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. - - -
"; +static char pow_module_new_x509__doc__[] = "\n" +"\n" +"
\n" +" X509\n" +"
\n" +" \n" +" \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" +" \n" +" \n" +"
"; static PyObject * pow_module_new_x509 (PyObject *self, PyObject *args) @@ -5331,46 +5338,46 @@ error: return NULL; } -static char pow_module_new_asymmetric__doc__[] = " - -
- Asymmetric - ciphertype=RSA_CIPHER - keylength=1024 -
- - - This constructor builds a new cipher object. Only RSA ciphers - are currently support, so the first argument should always be - RSA_CIPHER. The second argument, - keylength, - 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. - - - <classname>asymmetric</classname> class usage - - privateFile = open('test/private.key', 'w') - publicFile = open('test/public.key', 'w') +static char pow_module_new_asymmetric__doc__[] = "\n" +"\n" +"
\n" +" Asymmetric\n" +" ciphertype=RSA_CIPHER\n" +" keylength=1024\n" +"
\n" +" \n" +" \n" +" This constructor builds a new cipher object. Only RSA ciphers\n" +" are currently support, so the first argument should always be\n" +" RSA_CIPHER. The second argument,\n" +" keylength,\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" +" \n" +" \n" +" <classname>asymmetric</classname> class usage\n" +" \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" +" \n" +" \n" +" \n" +"
"; - 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() -
-
- -
"; - static PyObject * pow_module_new_asymmetric (PyObject *self, PyObject *args) { @@ -5386,27 +5393,27 @@ error: return NULL; } -static char pow_module_new_digest__doc__[] = " - -
- Digest - type -
- - - This constructor creates a new Digest - object. The parameter type specifies what kind - of digest to create and should be one of the following: - - - MD2_DIGEST - MD5_DIGEST - SHA_DIGEST - SHA1_DIGEST - RIPEMD160_DIGEST - - -
"; +static char pow_module_new_digest__doc__[] = "\n" +"\n" +"
\n" +" Digest\n" +" type\n" +"
\n" +" \n" +" \n" +" This constructor creates a new Digest\n" +" object. The parameter type specifies what kind\n" +" of digest to create and should be one of the following: \n" +" \n" +" \n" +" MD2_DIGEST\n" +" MD5_DIGEST\n" +" SHA_DIGEST\n" +" SHA1_DIGEST\n" +" RIPEMD160_DIGEST\n" +" \n" +" \n" +"
"; static PyObject * pow_module_new_digest (PyObject *self, PyObject *args) @@ -5423,28 +5430,28 @@ error: return NULL; } -static char pow_module_new_hmac__doc__[] = " - -
- Hmac - type - key -
- - - This constructor creates a new Hmac - object. The parameter key should be a - string and type should be one of the following: - - - MD2_DIGEST - MD5_DIGEST - SHA_DIGEST - SHA1_DIGEST - RIPEMD160_DIGEST - - -
"; +static char pow_module_new_hmac__doc__[] = "\n" +"\n" +"
\n" +" Hmac\n" +" type\n" +" key\n" +"
\n" +" \n" +" \n" +" This constructor creates a new Hmac\n" +" object. The parameter key should be a\n" +" string and type should be one of the following: \n" +" \n" +" \n" +" MD2_DIGEST\n" +" MD5_DIGEST\n" +" SHA_DIGEST\n" +" SHA1_DIGEST\n" +" RIPEMD160_DIGEST\n" +" \n" +" \n" +"
"; static PyObject * pow_module_new_hmac (PyObject *self, PyObject *args) @@ -5462,37 +5469,37 @@ error: return NULL; } -static char pow_module_pem_read__doc__[] = " - -
- pemRead - type - string - pass=None -
- - - This function attempts to parse the string according to the PEM - type passed. type should be one of the - following: - - - RSA_PUBLIC_KEY - RSA_PRIVATE_KEY - X509_CERTIFICATE - X509_CRL - - - pass should only be provided if an encrypted - Asymmetric 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 Asymmetric, - X509 or X509Crl. - - -
"; +static char pow_module_pem_read__doc__[] = "\n" +"\n" +"
\n" +" pemRead\n" +" type\n" +" string\n" +" pass=None\n" +"
\n" +" \n" +" \n" +" This function attempts to parse the string according to the PEM\n" +" type passed. type should be one of the\n" +" following:\n" +" \n" +" \n" +" RSA_PUBLIC_KEY\n" +" RSA_PRIVATE_KEY\n" +" X509_CERTIFICATE\n" +" X509_CRL\n" +" \n" +" \n" +" pass should only be provided if an encrypted\n" +" Asymmetric 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 Asymmetric, \n" +" X509 or X509Crl.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Store -
- - - This constructor takes no arguments. The - X509Store returned cannot be used for - verifying certificates until at least one trusted certificate has been - added. - - -
"; +static char pow_module_new_x509_store__doc__[] = "\n" +"\n" +"
\n" +" X509Store\n" +"
\n" +" \n" +" \n" +" This constructor takes no arguments. The\n" +" X509Store returned cannot be used for\n" +" verifying certificates until at least one trusted certificate has been\n" +" added.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- Symmetric - type -
- - - This constructor creates a new Symmetric - object. The parameter type specifies which kind - of cipher to create. type should be one of the following: - - - DES_ECB - DES_EDE - DES_EDE3 - DES_CFB - DES_EDE_CFB - DES_EDE3_CFB - DES_OFB - DES_EDE_OFB - DES_EDE3_OFB - DES_CBC - DES_EDE_CBC - DES_EDE3_CBC - DESX_CBC - RC4 - RC4_40 - IDEA_ECB - IDEA_CFB - IDEA_OFB - IDEA_CBC - RC2_ECB - RC2_CBC - RC2_40_CBC - RC2_CFB - RC2_OFB - BF_ECB - BF_CBC - BF_CFB - BF_OFB - CAST5_ECB - CAST5_CBC - CAST5_CFB - CAST5_OFB - RC5_32_12_16_CBC - RC5_32_12_16_CFB - RC5_32_12_16_ECB - RC5_32_12_16_OFB - - - 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. - - -
"; +static char pow_module_new_symmetric__doc__[] = "\n" +"\n" +"
\n" +" Symmetric\n" +" type\n" +"
\n" +" \n" +" \n" +" This constructor creates a new Symmetric\n" +" object. The parameter type specifies which kind\n" +" of cipher to create. type should be one of the following: \n" +" \n" +" \n" +" DES_ECB \n" +" DES_EDE\n" +" DES_EDE3 \n" +" DES_CFB \n" +" DES_EDE_CFB \n" +" DES_EDE3_CFB\n" +" DES_OFB\n" +" DES_EDE_OFB\n" +" DES_EDE3_OFB\n" +" DES_CBC\n" +" DES_EDE_CBC\n" +" DES_EDE3_CBC\n" +" DESX_CBC\n" +" RC4\n" +" RC4_40\n" +" IDEA_ECB\n" +" IDEA_CFB\n" +" IDEA_OFB\n" +" IDEA_CBC\n" +" RC2_ECB\n" +" RC2_CBC\n" +" RC2_40_CBC\n" +" RC2_CFB\n" +" RC2_OFB\n" +" BF_ECB\n" +" BF_CBC\n" +" BF_CFB\n" +" BF_OFB\n" +" CAST5_ECB\n" +" CAST5_CBC\n" +" CAST5_CFB\n" +" CAST5_OFB\n" +" RC5_32_12_16_CBC\n" +" RC5_32_12_16_CFB\n" +" RC5_32_12_16_ECB\n" +" RC5_32_12_16_OFB\n" +" \n" +" \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" +" \n" +" \n" +"
"; 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__[] = " ; - -
- x509_crl -
- - - This constructor builds an empty CRL. - - -
"; +static char pow_module_new_x509_crl__doc__[] = " ;\n" +"\n" +"
\n" +" x509_crl\n" +"
\n" +" \n" +" \n" +" This constructor builds an empty CRL.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- X509Revoked - serial - date -
- - - This constructor builds a X509 Revoked structure. Both arguments - are integers, date is the same as the C - time_t typedef and can be - generated with the Python Standard Library function - time. - - -
"; +static char pow_module_new_x509_revoked__doc__[] = "\n" +"\n" +"
\n" +" X509Revoked\n" +" serial\n" +" date\n" +"
\n" +" \n" +" \n" +" This constructor builds a X509 Revoked structure. Both arguments\n" +" are integers, date is the same as the C\n" +" time_t typedef and can be\n" +" generated with the Python Standard Library function\n" +" time.\n" +" \n" +" \n" +"
"; 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__[] = " ; - -
- getError -
- - - Pops an error off the global error stack and returns it as a string. - - -
"; +static char pow_module_get_error__doc__[] = " ;\n" +"\n" +"
\n" +" getError\n" +"
\n" +" \n" +" \n" +" Pops an error off the global error stack and returns it as a string.\n" +" \n" +" \n" +"
"; static PyObject * pow_module_get_error(PyObject *self, PyObject *args) @@ -5742,17 +5749,17 @@ error: return NULL; } -static char pow_module_clear_error__doc__[] = " - -
- clearError -
- - - Removes all errors from the global error stack. - - -
"; +static char pow_module_clear_error__doc__[] = "\n" +"\n" +"
\n" +" clearError\n" +"
\n" +" \n" +" \n" +" Removes all errors from the global error stack.\n" +" \n" +" \n" +"
"; static PyObject * pow_module_clear_error(PyObject *self, PyObject *args) @@ -5769,28 +5776,28 @@ error: return NULL; } -static char pow_module_seed__doc__[] = " - -
- seed - data -
- - - The seed 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 seed and add are very - similar, except the entropy of the data is assumed to be equal to - the length for seed. 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. - - -
"; +static char pow_module_seed__doc__[] = "\n" +"\n" +"
\n" +" seed\n" +" data\n" +"
\n" +" \n" +" \n" +" The seed 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 seed and add are very\n" +" similar, except the entropy of the data is assumed to be equal to\n" +" the length for seed. 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" +" \n" +" \n" +"
"; static PyObject * pow_module_seed(PyObject *self, PyObject *args) @@ -5810,22 +5817,22 @@ error: return NULL; } -static char pow_module_add__doc__[] = " - -
- add - data - entropy -
- - - The add function adds data to OpenSSLs PRNG - state. data should be data obtained from a - random source and entropy is an estimation of the number of random - bytes in data. - - -
"; +static char pow_module_add__doc__[] = "\n" +"\n" +"
\n" +" add\n" +" data\n" +" entropy\n" +"
\n" +" \n" +" \n" +" The add function adds data to OpenSSLs PRNG\n" +" state. data should be data obtained from a\n" +" random source and entropy is an estimation of the number of random\n" +" bytes in data.\n" +" \n" +" \n" +"
"; static PyObject * pow_module_add(PyObject *self, PyObject *args) @@ -5846,20 +5853,20 @@ error: return NULL; } -static char pow_module_write_random_file__doc__[] = " - -
- writeRandomFile - filename -
- - - This function writes the current random state to a file. Clearly - this function should be used in conjunction with - readRandomFile. - - -
"; +static char pow_module_write_random_file__doc__[] = "\n" +"\n" +"
\n" +" writeRandomFile\n" +" filename\n" +"
\n" +" \n" +" \n" +" This function writes the current random state to a file. Clearly\n" +" this function should be used in conjunction with\n" +" readRandomFile.\n" +" \n" +" \n" +"
"; 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__[] = " - -
- readRandomFile - filename -
- - - 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 - add function, with data from other - suitable random sources. - - -
"; +static char pow_module_read_random_file__doc__[] = "\n" +"\n" +"
\n" +" readRandomFile\n" +" filename\n" +"
\n" +" \n" +" \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" +" add function, with data from other\n" +" suitable random sources.\n" +" \n" +" \n" +"
"; static PyObject * pow_module_read_random_file(PyObject *self, PyObject *args) @@ -5915,23 +5922,23 @@ error: return NULL; } -static char pow_module___doclist____doc__[] = " - -
- __doclist__ -
- - - 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. - - -
"; +static char pow_module___doclist____doc__[] = "\n" +"\n" +"
\n" +" __doclist__\n" +"
\n" +" \n" +" \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" +" \n" +" \n" +"
"; static PyObject * pow_module___doclist__(PyObject *self, PyObject *args)