~myers-1/pyopenssl/npn

« back to all changes in this revision

Viewing changes to doc/pyOpenSSL.txt

  • Committer: Jean-Paul Calderone
  • Date: 2010-01-25 22:55:30 UTC
  • mfrom: (126 trunk)
  • mto: This revision was merged to the branch mainline in revision 129.
  • Revision ID: exarkun@divmod.com-20100125225530-5e9nsb6bzoesoz42
merge trunk and resolve simple conflict

Show diffs side-by-side

added added

removed removed

Lines of Context:
130
130
3.1 crypto -- Generic cryptographic module
131
131
 
132
132
   X509Type
133
 
          A Python type object representing the X509 object type.
 
133
          See X509.
134
134
 
135
 
   X509()
136
 
          Factory function that creates an X509 object.
 
135
   class X509()
 
136
          A class representing X.509 certificates.
137
137
 
138
138
   X509NameType
139
 
          A Python type object representing the X509Name object type.
140
 
 
141
 
   X509Name(x509name)
142
 
          Factory function that creates a copy of x509name.
 
139
          See X509Name.
 
140
 
 
141
   class X509Name(x509name)
 
142
          A class representing X.509 Distinguished Names.
 
143
 
 
144
          This constructor creates a copy of x509name which should be an
 
145
          instance of X509Name.
143
146
 
144
147
   X509ReqType
145
 
          A Python type object representing the X509Req object type.
 
148
          See X509Req.
146
149
 
147
 
   X509Req()
148
 
          Factory function that creates an X509Req object.
 
150
   class X509Req()
 
151
          A class representing X.509 certificate requests.
149
152
 
150
153
   X509StoreType
151
154
          A Python type object representing the X509Store object type.
152
155
 
153
156
   PKeyType
154
 
          A Python type object representing the PKey object type.
 
157
          See PKey.
155
158
 
156
 
   PKey()
157
 
          Factory function that creates a PKey object.
 
159
   class PKey()
 
160
          A class representing DSA or RSA keys.
158
161
 
159
162
   PKCS7Type
160
163
          A Python type object representing the PKCS7 object type.
163
166
          A Python type object representing the PKCS12 object type.
164
167
 
165
168
   X509ExtensionType
166
 
          A Python type object representing the X509Extension object type.
 
169
          See X509Extension.
167
170
 
168
 
   X509Extension(typename, critical, value)
169
 
          Factory function that creates a X509Extension object.
 
171
   class X509Extension(typename, critical, value[, subject][, issuer])
 
172
          A class representing an X.509 v3 certificate extensions. See
 
173
          http://openssl.org/docs/apps/x509v3_config.html#STANDARD_EXTENSI
 
174
          ONSfor typename strings and their options. Optional parameters
 
175
          subject and issuer must be X509 objects.
170
176
 
171
177
   NetscapeSPKIType
172
 
          A Python type object representing the NetscapeSPKI object type.
173
 
 
174
 
   NetscapeSPKI([enc])
175
 
          Factory function that creates a NetscapeSPKI object. If the enc
176
 
          argument is present, it should be a base64-encoded string
177
 
          representing a NetscapeSPKI object, as returned by the
 
178
          See NetscapeSPKI.
 
179
 
 
180
   class NetscapeSPKI([enc])
 
181
          A class representing Netscape SPKI objects.
 
182
 
 
183
          If the enc argument is present, it should be a base64-encoded
 
184
          string representing a NetscapeSPKI object, as returned by the
178
185
          b64_encode method.
179
186
 
180
187
   FILETYPE_PEM
227
234
 
228
235
   load_pkcs12(buffer[, passphrase])
229
236
          Load pkcs12 data from the string buffer. If the pkcs12 structure
230
 
          is encrypted, a passphrase must be included.
 
237
          is encrypted, a passphrase must be included. The MAC is always
 
238
          checked and thus required.
 
239
 
 
240
          See also the man page for the C function PKCS12_parse.
231
241
 
232
242
 
233
243
  3.1.1 X509 objects
455
465
 
456
466
   PKCS12 objects have the following methods:
457
467
 
 
468
   export([passphrase=None][, iter=2048][, maciter=1])
 
469
          Returns a PKCS12 object as a string.
 
470
 
 
471
          The optional passphrase must be a string not a callback.
 
472
 
 
473
          See also the man page for the C function PKCS12_create.
 
474
 
 
475
   get_ca_certificates()
 
476
          Return CA certificates within the PKCS12 object as a tuple.
 
477
          Returns None if no CA certificates are present.
 
478
 
458
479
   get_certificate()
459
480
          Return certificate portion of the PKCS12 structure.
460
481
 
 
482
   get_friendlyname()
 
483
          Return friendlyName portion of the PKCS12 structure.
 
484
 
461
485
   get_privatekey()
462
486
          Return private key portion of the PKCS12 structure
463
487
 
464
 
   get_ca_certificates()
465
 
          Return CA certificates within the PKCS12 object as a tuple.
466
 
          Returns None if no CA certificates are present.
 
488
   set_ca_certificates(cacerts)
 
489
          Replace or set the CA certificates within the PKCS12 object with
 
490
          the sequence cacerts.
 
491
 
 
492
          Set cacerts to None to remove all CA certificates.
 
493
 
 
494
   set_certificate(cert)
 
495
          Replace or set the certificate portion of the PKCS12 structure.
 
496
 
 
497
   set_friendlyname(name)
 
498
          Replace or set the friendlyName portion of the PKCS12 structure.
 
499
 
 
500
   set_privatekey(pkey)
 
501
          Replace or set private key portion of the PKCS12 structure
467
502
 
468
503
 
469
504
  3.1.8 X509Extension objects
511
546
          contained in string, measured in bytes. For more information,
512
547
          see e.g. RFC 1750.
513
548
 
 
549
   bytes(num_bytes)
 
550
          Get some random bytes from the PRNG as a string.
 
551
 
 
552
          This is a wrapper for the C function RAND_bytes.
 
553
 
 
554
   cleanup()
 
555
          Erase the memory used by the PRNG.
 
556
 
 
557
          This is a wrapper for the C function RAND_cleanup.
 
558
 
514
559
   egd(path[, bytes])
515
560
          Query the Entropy Gathering Daemon^2 on socket path for bytes
516
561
          bytes of random data and and uses add to seed the PRNG. The
538
583
          path. This file can then be used with load_file to seed the PRNG
539
584
          again.
540
585
 
 
586
   exception Error
 
587
          If the current RAND method supports any errors, this is raised
 
588
          when needed. The default method does not raise this when the
 
589
          entropy pool is depleted.
 
590
 
 
591
          Whenever this exception is raised directly, it has a list of
 
592
          error messages from the OpenSSL error queue, where each item is
 
593
          a tuple (lib, function, reason). Here lib, function and reason
 
594
          are all strings, describing where and what the problem is. See
 
595
          err(3) for more information.
 
596
 
541
597
 
542
598
3.3 SSL -- An interface to the SSL-specific parts of OpenSSL
543
599
 
587
643
          want to use SSLv2.
588
644
 
589
645
   ContextType
590
 
          A Python type object representing the Context object type.
591
 
 
592
 
   Context(method)
593
 
          Factory function that creates a new Context object given an SSL
594
 
          method. The method should be SSLv2_METHOD, SSLv3_METHOD,
595
 
          SSLv23_METHOD or TLSv1_METHOD.
 
646
          See Context.
 
647
 
 
648
   class Context(method)
 
649
          A class representing SSL contexts. Contexts define the
 
650
          parameters of one or more SSL connections.
 
651
 
 
652
          method should be SSLv2_METHOD, SSLv3_METHOD, SSLv23_METHOD or
 
653
          TLSv1_METHOD.
596
654
 
597
655
   ConnectionType
598
 
          A Python type object representing the Connection object type.
599
 
 
600
 
   Connection(context, socket)
601
 
          Factory fucnction that creates a new Connection object given an
602
 
          SSL context and a socket ^3 object.
 
656
          See Connection.
 
657
 
 
658
   class Connection(context, socket)
 
659
          A class representing SSL connections.
 
660
 
 
661
          context should be an instance of Context and socket should be a
 
662
          socket ^3 object. socket may be None; in this case, the
 
663
          Connection is created with a memory BIO: see the bio_read,
 
664
          bio_write, and bio_shutdown methods.
603
665
 
604
666
   exception Error
605
667
          This exception is used as a base class for the other SSL-related
627
689
          called again later, with the same arguments. Any I/O method can
628
690
          lead to this since new handshakes can occur at any time.
629
691
 
 
692
          The wanted read is for dirty data sent over the network, not the
 
693
          clean data inside the tunnel. For a socket based SSL connection,
 
694
          read means data coming at us over the network. Until that read
 
695
          succeeds, the attempted OpenSSL.SSL.Connection.recv,
 
696
          OpenSSL.SSL.Connection.send, or
 
697
          OpenSSL.SSL.Connection.do_handshake is prevented or incomplete.
 
698
          You probably want to select() on the socket before trying again.
 
699
 
630
700
   exception WantWriteError
631
 
          See WantReadError.
 
701
          See WantReadError. The socket send buffer may be too full to
 
702
          write more data.
632
703
 
633
704
   exception WantX509LookupError
634
705
          The operation did not complete because an application callback
676
747
          Read a file with PEM-formatted certificates that will be sent to
677
748
          the client when requesting a client certificate.
678
749
 
 
750
   set_client_ca_list(certificate_authorities)
 
751
          Replace the current list of preferred certificate signers that
 
752
          would be sent to the client when requesting a client certificate
 
753
          with the certificate_authorities sequence of
 
754
          OpenSSL.crypto.X509Names.
 
755
 
 
756
          New in version 0.10.
 
757
 
 
758
   add_client_ca(certificate_authority)
 
759
          Extract a OpenSSL.crypto.X509Name from the certificate_authority
 
760
          OpenSSL.crypto.X509 certificate and add it to the list of
 
761
          preferred certificate signers sent to the client when requesting
 
762
          a client certificate.
 
763
 
 
764
          New in version 0.10.
 
765
 
679
766
   load_verify_locations(pemfile, capath)
680
767
          Specify where CA certificates for verification purposes are
681
768
          located. These are trusted certificates. Note that the
827
914
          parameter and just return a string, but not it returns the
828
915
          entire list in one go.
829
916
 
 
917
   get_client_ca_list()
 
918
          Retrieve the list of preferred client certificate issuers sent
 
919
          by the server as OpenSSL.crypto.X509Name objects.
 
920
 
 
921
          If this is a client Connection, the list will be empty until the
 
922
          connection with the server is established.
 
923
 
 
924
          If this is a server Connection, return the list of certificate
 
925
          authorities that will be sent or has been sent to the client, as
 
926
          controlled by this Connection's Context.
 
927
 
 
928
          New in version 0.10.
 
929
 
830
930
   get_context()
831
931
          Retrieve the Context object associated with this Connection.
832
932
 
851
951
          representing the data received. The maximum amount of data to be
852
952
          received at once, is specified by bufsize.
853
953
 
 
954
   bio_write(bytes)
 
955
          If the Connection was created with a memory BIO, this method can
 
956
          be used to add bytes to the read end of that memory BIO. The
 
957
          Connection can then read the bytes (for example, in response to
 
958
          a call to recv).
 
959
 
854
960
   renegotiate()
855
961
          Renegotiate the SSL session. Call this if you wish to change
856
962
          cipher suites or anything like that.
858
964
   send(string)
859
965
          Send the string data to the Connection.
860
966
 
 
967
   bio_read(bufsize)
 
968
          If the Connection was created with a memory BIO, this method can
 
969
          be used to read bytes from the write end of that memory BIO.
 
970
          Many Connection methods will add bytes which must be read in
 
971
          this manner or the buffer will eventually fill up and the
 
972
          Connection will be able to take no further actions.
 
973
 
861
974
   sendall(string)
862
975
          Send all of the string data to the Connection. This calls send
863
976
          repeatedly until all data is sent. If an error occurs, it's
898
1011
   sock_shutdown(how)
899
1012
          Call the shutdown method of the underlying socket.
900
1013
 
 
1014
   bio_shutdown()
 
1015
          If the Connection was created with a memory BIO, this method can
 
1016
          be used to indicate that ``end of file'' has been reached on the
 
1017
          read end of that memory BIO.
 
1018
 
901
1019
   state_string()
902
1020
          Retrieve a verbose string detailing the state of the Connection.
903
1021
 
 
1022
   client_random()
 
1023
          Retrieve the random value used with the client hello message.
 
1024
 
 
1025
   server_random()
 
1026
          Retrieve the random value used with the server hello message.
 
1027
 
 
1028
   master_key()
 
1029
          Retrieve the value of the master key for this session.
 
1030
 
904
1031
   want_read()
905
1032
          Checks if more data has to be read from the transport layer to
906
1033
          complete an operation.
1031
1158
                            Python OpenSSL Manual
1032
1159
     __________________________________________________________________
1033
1160
 
1034
 
   Release 0.9.
 
1161
   Release 0.10.