partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | Checker_X509_REVOKED_dup.check_X509_REVOKED_dup | Copy an empty Revoked object repeatedly. The copy is not garbage
collected, therefore it needs to be manually freed. | leakcheck/crypto.py | def check_X509_REVOKED_dup(self):
"""
Copy an empty Revoked object repeatedly. The copy is not garbage
collected, therefore it needs to be manually freed.
"""
for i in xrange(self.iterations * 100):
revoked_copy = _X509_REVOKED_dup(Revoked()._revoked)
_lib... | def check_X509_REVOKED_dup(self):
"""
Copy an empty Revoked object repeatedly. The copy is not garbage
collected, therefore it needs to be manually freed.
"""
for i in xrange(self.iterations * 100):
revoked_copy = _X509_REVOKED_dup(Revoked()._revoked)
_lib... | [
"Copy",
"an",
"empty",
"Revoked",
"object",
"repeatedly",
".",
"The",
"copy",
"is",
"not",
"garbage",
"collected",
"therefore",
"it",
"needs",
"to",
"be",
"manually",
"freed",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/leakcheck/crypto.py#L137-L144 | [
"def",
"check_X509_REVOKED_dup",
"(",
"self",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"self",
".",
"iterations",
"*",
"100",
")",
":",
"revoked_copy",
"=",
"_X509_REVOKED_dup",
"(",
"Revoked",
"(",
")",
".",
"_revoked",
")",
"_lib",
".",
"X509_REVOKED_f... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Checker_EllipticCurve.check_to_EC_KEY | Repeatedly create an EC_KEY* from an :py:obj:`_EllipticCurve`. The
structure should be automatically garbage collected. | leakcheck/crypto.py | def check_to_EC_KEY(self):
"""
Repeatedly create an EC_KEY* from an :py:obj:`_EllipticCurve`. The
structure should be automatically garbage collected.
"""
curves = get_elliptic_curves()
if curves:
curve = next(iter(curves))
for i in xrange(self.it... | def check_to_EC_KEY(self):
"""
Repeatedly create an EC_KEY* from an :py:obj:`_EllipticCurve`. The
structure should be automatically garbage collected.
"""
curves = get_elliptic_curves()
if curves:
curve = next(iter(curves))
for i in xrange(self.it... | [
"Repeatedly",
"create",
"an",
"EC_KEY",
"*",
"from",
"an",
":",
"py",
":",
"obj",
":",
"_EllipticCurve",
".",
"The",
"structure",
"should",
"be",
"automatically",
"garbage",
"collected",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/leakcheck/crypto.py#L152-L161 | [
"def",
"check_to_EC_KEY",
"(",
"self",
")",
":",
"curves",
"=",
"get_elliptic_curves",
"(",
")",
"if",
"curves",
":",
"curve",
"=",
"next",
"(",
"iter",
"(",
"curves",
")",
")",
"for",
"i",
"in",
"xrange",
"(",
"self",
".",
"iterations",
"*",
"1000",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | main | Connect to an SNI-enabled server and request a specific hostname, specified
by argv[1], of it. | examples/sni/client.py | def main():
"""
Connect to an SNI-enabled server and request a specific hostname, specified
by argv[1], of it.
"""
if len(argv) < 2:
print('Usage: %s <hostname>' % (argv[0],))
return 1
client = socket()
print('Connecting...', end="")
stdout.flush()
client.connect(('... | def main():
"""
Connect to an SNI-enabled server and request a specific hostname, specified
by argv[1], of it.
"""
if len(argv) < 2:
print('Usage: %s <hostname>' % (argv[0],))
return 1
client = socket()
print('Connecting...', end="")
stdout.flush()
client.connect(('... | [
"Connect",
"to",
"an",
"SNI",
"-",
"enabled",
"server",
"and",
"request",
"a",
"specific",
"hostname",
"specified",
"by",
"argv",
"[",
"1",
"]",
"of",
"it",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/examples/sni/client.py#L12-L33 | [
"def",
"main",
"(",
")",
":",
"if",
"len",
"(",
"argv",
")",
"<",
"2",
":",
"print",
"(",
"'Usage: %s <hostname>'",
"%",
"(",
"argv",
"[",
"0",
"]",
",",
")",
")",
"return",
"1",
"client",
"=",
"socket",
"(",
")",
"print",
"(",
"'Connecting...'",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | createKeyPair | Create a public/private key pair.
Arguments: type - Key type, must be one of TYPE_RSA and TYPE_DSA
bits - Number of bits to use in the key
Returns: The public/private key pair in a PKey object | examples/certgen.py | def createKeyPair(type, bits):
"""
Create a public/private key pair.
Arguments: type - Key type, must be one of TYPE_RSA and TYPE_DSA
bits - Number of bits to use in the key
Returns: The public/private key pair in a PKey object
"""
pkey = crypto.PKey()
pkey.generate_key(typ... | def createKeyPair(type, bits):
"""
Create a public/private key pair.
Arguments: type - Key type, must be one of TYPE_RSA and TYPE_DSA
bits - Number of bits to use in the key
Returns: The public/private key pair in a PKey object
"""
pkey = crypto.PKey()
pkey.generate_key(typ... | [
"Create",
"a",
"public",
"/",
"private",
"key",
"pair",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/examples/certgen.py#L17-L27 | [
"def",
"createKeyPair",
"(",
"type",
",",
"bits",
")",
":",
"pkey",
"=",
"crypto",
".",
"PKey",
"(",
")",
"pkey",
".",
"generate_key",
"(",
"type",
",",
"bits",
")",
"return",
"pkey"
] | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | createCertRequest | Create a certificate request.
Arguments: pkey - The key to associate with the request
digest - Digestion method to use for signing, default is sha256
**name - The name of the subject of the request, possible
arguments are:
C - Co... | examples/certgen.py | def createCertRequest(pkey, digest="sha256", **name):
"""
Create a certificate request.
Arguments: pkey - The key to associate with the request
digest - Digestion method to use for signing, default is sha256
**name - The name of the subject of the request, possible
... | def createCertRequest(pkey, digest="sha256", **name):
"""
Create a certificate request.
Arguments: pkey - The key to associate with the request
digest - Digestion method to use for signing, default is sha256
**name - The name of the subject of the request, possible
... | [
"Create",
"a",
"certificate",
"request",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/examples/certgen.py#L30-L55 | [
"def",
"createCertRequest",
"(",
"pkey",
",",
"digest",
"=",
"\"sha256\"",
",",
"*",
"*",
"name",
")",
":",
"req",
"=",
"crypto",
".",
"X509Req",
"(",
")",
"subj",
"=",
"req",
".",
"get_subject",
"(",
")",
"for",
"key",
",",
"value",
"in",
"name",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | createCertificate | Generate a certificate given a certificate request.
Arguments: req - Certificate request to use
issuerCert - The certificate of the issuer
issuerKey - The private key of the issuer
serial - Serial number for the certificate
notBefore - Timest... | examples/certgen.py | def createCertificate(req, issuerCertKey, serial, validityPeriod,
digest="sha256"):
"""
Generate a certificate given a certificate request.
Arguments: req - Certificate request to use
issuerCert - The certificate of the issuer
issuerKey - The priv... | def createCertificate(req, issuerCertKey, serial, validityPeriod,
digest="sha256"):
"""
Generate a certificate given a certificate request.
Arguments: req - Certificate request to use
issuerCert - The certificate of the issuer
issuerKey - The priv... | [
"Generate",
"a",
"certificate",
"given",
"a",
"certificate",
"request",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/examples/certgen.py#L58-L84 | [
"def",
"createCertificate",
"(",
"req",
",",
"issuerCertKey",
",",
"serial",
",",
"validityPeriod",
",",
"digest",
"=",
"\"sha256\"",
")",
":",
"issuerCert",
",",
"issuerKey",
"=",
"issuerCertKey",
"notBefore",
",",
"notAfter",
"=",
"validityPeriod",
"cert",
"="... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | _make_requires | Builds a decorator that ensures that functions that rely on OpenSSL
functions that are not present in this build raise NotImplementedError,
rather than AttributeError coming out of cryptography.
:param flag: A cryptography flag that guards the functions, e.g.
``Cryptography_HAS_NEXTPROTONEG``.
... | src/OpenSSL/SSL.py | def _make_requires(flag, error):
"""
Builds a decorator that ensures that functions that rely on OpenSSL
functions that are not present in this build raise NotImplementedError,
rather than AttributeError coming out of cryptography.
:param flag: A cryptography flag that guards the functions, e.g.
... | def _make_requires(flag, error):
"""
Builds a decorator that ensures that functions that rely on OpenSSL
functions that are not present in this build raise NotImplementedError,
rather than AttributeError coming out of cryptography.
:param flag: A cryptography flag that guards the functions, e.g.
... | [
"Builds",
"a",
"decorator",
"that",
"ensures",
"that",
"functions",
"that",
"rely",
"on",
"OpenSSL",
"functions",
"that",
"are",
"not",
"present",
"in",
"this",
"build",
"raise",
"NotImplementedError",
"rather",
"than",
"AttributeError",
"coming",
"out",
"of",
"... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L635-L654 | [
"def",
"_make_requires",
"(",
"flag",
",",
"error",
")",
":",
"def",
"_requires_decorator",
"(",
"func",
")",
":",
"if",
"not",
"flag",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"explode",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"rai... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.load_verify_locations | Let SSL know where we can find trusted certificates for the certificate
chain. Note that the certificates have to be in PEM format.
If capath is passed, it must be a directory prepared using the
``c_rehash`` tool included with OpenSSL. Either, but not both, of
*pemfile* or *capath* ma... | src/OpenSSL/SSL.py | def load_verify_locations(self, cafile, capath=None):
"""
Let SSL know where we can find trusted certificates for the certificate
chain. Note that the certificates have to be in PEM format.
If capath is passed, it must be a directory prepared using the
``c_rehash`` tool include... | def load_verify_locations(self, cafile, capath=None):
"""
Let SSL know where we can find trusted certificates for the certificate
chain. Note that the certificates have to be in PEM format.
If capath is passed, it must be a directory prepared using the
``c_rehash`` tool include... | [
"Let",
"SSL",
"know",
"where",
"we",
"can",
"find",
"trusted",
"certificates",
"for",
"the",
"certificate",
"chain",
".",
"Note",
"that",
"the",
"certificates",
"have",
"to",
"be",
"in",
"PEM",
"format",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L745-L775 | [
"def",
"load_verify_locations",
"(",
"self",
",",
"cafile",
",",
"capath",
"=",
"None",
")",
":",
"if",
"cafile",
"is",
"None",
":",
"cafile",
"=",
"_ffi",
".",
"NULL",
"else",
":",
"cafile",
"=",
"_path_string",
"(",
"cafile",
")",
"if",
"capath",
"is... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_passwd_cb | Set the passphrase callback. This function will be called
when a private key with a passphrase is loaded.
:param callback: The Python callback to use. This must accept three
positional arguments. First, an integer giving the maximum length
of the passphrase it may return. If... | src/OpenSSL/SSL.py | def set_passwd_cb(self, callback, userdata=None):
"""
Set the passphrase callback. This function will be called
when a private key with a passphrase is loaded.
:param callback: The Python callback to use. This must accept three
positional arguments. First, an integer givi... | def set_passwd_cb(self, callback, userdata=None):
"""
Set the passphrase callback. This function will be called
when a private key with a passphrase is loaded.
:param callback: The Python callback to use. This must accept three
positional arguments. First, an integer givi... | [
"Set",
"the",
"passphrase",
"callback",
".",
"This",
"function",
"will",
"be",
"called",
"when",
"a",
"private",
"key",
"with",
"a",
"passphrase",
"is",
"loaded",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L784-L810 | [
"def",
"set_passwd_cb",
"(",
"self",
",",
"callback",
",",
"userdata",
"=",
"None",
")",
":",
"if",
"not",
"callable",
"(",
"callback",
")",
":",
"raise",
"TypeError",
"(",
"\"callback must be callable\"",
")",
"self",
".",
"_passphrase_helper",
"=",
"self",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_default_verify_paths | Specify that the platform provided CA certificates are to be used for
verification purposes. This method has some caveats related to the
binary wheels that cryptography (pyOpenSSL's primary dependency) ships:
* macOS will only load certificates using this method if the user has
th... | src/OpenSSL/SSL.py | def set_default_verify_paths(self):
"""
Specify that the platform provided CA certificates are to be used for
verification purposes. This method has some caveats related to the
binary wheels that cryptography (pyOpenSSL's primary dependency) ships:
* macOS will only load certi... | def set_default_verify_paths(self):
"""
Specify that the platform provided CA certificates are to be used for
verification purposes. This method has some caveats related to the
binary wheels that cryptography (pyOpenSSL's primary dependency) ships:
* macOS will only load certi... | [
"Specify",
"that",
"the",
"platform",
"provided",
"CA",
"certificates",
"are",
"to",
"be",
"used",
"for",
"verification",
"purposes",
".",
"This",
"method",
"has",
"some",
"caveats",
"related",
"to",
"the",
"binary",
"wheels",
"that",
"cryptography",
"(",
"pyO... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L812-L859 | [
"def",
"set_default_verify_paths",
"(",
"self",
")",
":",
"# SSL_CTX_set_default_verify_paths will attempt to load certs from",
"# both a cafile and capath that are set at compile time. However,",
"# it will first check environment variables and, if present, load",
"# those paths instead",
"set_... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context._check_env_vars_set | Check to see if the default cert dir/file environment vars are present.
:return: bool | src/OpenSSL/SSL.py | def _check_env_vars_set(self, dir_env_var, file_env_var):
"""
Check to see if the default cert dir/file environment vars are present.
:return: bool
"""
return (
os.environ.get(file_env_var) is not None or
os.environ.get(dir_env_var) is not None
) | def _check_env_vars_set(self, dir_env_var, file_env_var):
"""
Check to see if the default cert dir/file environment vars are present.
:return: bool
"""
return (
os.environ.get(file_env_var) is not None or
os.environ.get(dir_env_var) is not None
) | [
"Check",
"to",
"see",
"if",
"the",
"default",
"cert",
"dir",
"/",
"file",
"environment",
"vars",
"are",
"present",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L861-L870 | [
"def",
"_check_env_vars_set",
"(",
"self",
",",
"dir_env_var",
",",
"file_env_var",
")",
":",
"return",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"file_env_var",
")",
"is",
"not",
"None",
"or",
"os",
".",
"environ",
".",
"get",
"(",
"dir_env_var",
")",... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context._fallback_default_verify_paths | Default verify paths are based on the compiled version of OpenSSL.
However, when pyca/cryptography is compiled as a manylinux1 wheel
that compiled location can potentially be wrong. So, like Go, we
will try a predefined set of paths and attempt to load roots
from there.
:return:... | src/OpenSSL/SSL.py | def _fallback_default_verify_paths(self, file_path, dir_path):
"""
Default verify paths are based on the compiled version of OpenSSL.
However, when pyca/cryptography is compiled as a manylinux1 wheel
that compiled location can potentially be wrong. So, like Go, we
will try a pred... | def _fallback_default_verify_paths(self, file_path, dir_path):
"""
Default verify paths are based on the compiled version of OpenSSL.
However, when pyca/cryptography is compiled as a manylinux1 wheel
that compiled location can potentially be wrong. So, like Go, we
will try a pred... | [
"Default",
"verify",
"paths",
"are",
"based",
"on",
"the",
"compiled",
"version",
"of",
"OpenSSL",
".",
"However",
"when",
"pyca",
"/",
"cryptography",
"is",
"compiled",
"as",
"a",
"manylinux1",
"wheel",
"that",
"compiled",
"location",
"can",
"potentially",
"b... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L872-L890 | [
"def",
"_fallback_default_verify_paths",
"(",
"self",
",",
"file_path",
",",
"dir_path",
")",
":",
"for",
"cafile",
"in",
"file_path",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"cafile",
")",
":",
"self",
".",
"load_verify_locations",
"(",
"cafile",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.use_certificate_chain_file | Load a certificate chain from a file.
:param certfile: The name of the certificate chain file (``bytes`` or
``unicode``). Must be PEM encoded.
:return: None | src/OpenSSL/SSL.py | def use_certificate_chain_file(self, certfile):
"""
Load a certificate chain from a file.
:param certfile: The name of the certificate chain file (``bytes`` or
``unicode``). Must be PEM encoded.
:return: None
"""
certfile = _path_string(certfile)
r... | def use_certificate_chain_file(self, certfile):
"""
Load a certificate chain from a file.
:param certfile: The name of the certificate chain file (``bytes`` or
``unicode``). Must be PEM encoded.
:return: None
"""
certfile = _path_string(certfile)
r... | [
"Load",
"a",
"certificate",
"chain",
"from",
"a",
"file",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L892-L907 | [
"def",
"use_certificate_chain_file",
"(",
"self",
",",
"certfile",
")",
":",
"certfile",
"=",
"_path_string",
"(",
"certfile",
")",
"result",
"=",
"_lib",
".",
"SSL_CTX_use_certificate_chain_file",
"(",
"self",
".",
"_context",
",",
"certfile",
")",
"if",
"not",... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.use_certificate_file | Load a certificate from a file
:param certfile: The name of the certificate file (``bytes`` or
``unicode``).
:param filetype: (optional) The encoding of the file, which is either
:const:`FILETYPE_PEM` or :const:`FILETYPE_ASN1`. The default is
:const:`FILETYPE_PEM`.
... | src/OpenSSL/SSL.py | def use_certificate_file(self, certfile, filetype=FILETYPE_PEM):
"""
Load a certificate from a file
:param certfile: The name of the certificate file (``bytes`` or
``unicode``).
:param filetype: (optional) The encoding of the file, which is either
:const:`FILETYP... | def use_certificate_file(self, certfile, filetype=FILETYPE_PEM):
"""
Load a certificate from a file
:param certfile: The name of the certificate file (``bytes`` or
``unicode``).
:param filetype: (optional) The encoding of the file, which is either
:const:`FILETYP... | [
"Load",
"a",
"certificate",
"from",
"a",
"file"
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L909-L929 | [
"def",
"use_certificate_file",
"(",
"self",
",",
"certfile",
",",
"filetype",
"=",
"FILETYPE_PEM",
")",
":",
"certfile",
"=",
"_path_string",
"(",
"certfile",
")",
"if",
"not",
"isinstance",
"(",
"filetype",
",",
"integer_types",
")",
":",
"raise",
"TypeError"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.use_certificate | Load a certificate from a X509 object
:param cert: The X509 object
:return: None | src/OpenSSL/SSL.py | def use_certificate(self, cert):
"""
Load a certificate from a X509 object
:param cert: The X509 object
:return: None
"""
if not isinstance(cert, X509):
raise TypeError("cert must be an X509 instance")
use_result = _lib.SSL_CTX_use_certificate(self._... | def use_certificate(self, cert):
"""
Load a certificate from a X509 object
:param cert: The X509 object
:return: None
"""
if not isinstance(cert, X509):
raise TypeError("cert must be an X509 instance")
use_result = _lib.SSL_CTX_use_certificate(self._... | [
"Load",
"a",
"certificate",
"from",
"a",
"X509",
"object"
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L931-L943 | [
"def",
"use_certificate",
"(",
"self",
",",
"cert",
")",
":",
"if",
"not",
"isinstance",
"(",
"cert",
",",
"X509",
")",
":",
"raise",
"TypeError",
"(",
"\"cert must be an X509 instance\"",
")",
"use_result",
"=",
"_lib",
".",
"SSL_CTX_use_certificate",
"(",
"s... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.add_extra_chain_cert | Add certificate to chain
:param certobj: The X509 certificate object to add to the chain
:return: None | src/OpenSSL/SSL.py | def add_extra_chain_cert(self, certobj):
"""
Add certificate to chain
:param certobj: The X509 certificate object to add to the chain
:return: None
"""
if not isinstance(certobj, X509):
raise TypeError("certobj must be an X509 instance")
copy = _lib.... | def add_extra_chain_cert(self, certobj):
"""
Add certificate to chain
:param certobj: The X509 certificate object to add to the chain
:return: None
"""
if not isinstance(certobj, X509):
raise TypeError("certobj must be an X509 instance")
copy = _lib.... | [
"Add",
"certificate",
"to",
"chain"
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L945-L960 | [
"def",
"add_extra_chain_cert",
"(",
"self",
",",
"certobj",
")",
":",
"if",
"not",
"isinstance",
"(",
"certobj",
",",
"X509",
")",
":",
"raise",
"TypeError",
"(",
"\"certobj must be an X509 instance\"",
")",
"copy",
"=",
"_lib",
".",
"X509_dup",
"(",
"certobj"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.use_privatekey_file | Load a private key from a file
:param keyfile: The name of the key file (``bytes`` or ``unicode``)
:param filetype: (optional) The encoding of the file, which is either
:const:`FILETYPE_PEM` or :const:`FILETYPE_ASN1`. The default is
:const:`FILETYPE_PEM`.
:return: None | src/OpenSSL/SSL.py | def use_privatekey_file(self, keyfile, filetype=_UNSPECIFIED):
"""
Load a private key from a file
:param keyfile: The name of the key file (``bytes`` or ``unicode``)
:param filetype: (optional) The encoding of the file, which is either
:const:`FILETYPE_PEM` or :const:`FILETY... | def use_privatekey_file(self, keyfile, filetype=_UNSPECIFIED):
"""
Load a private key from a file
:param keyfile: The name of the key file (``bytes`` or ``unicode``)
:param filetype: (optional) The encoding of the file, which is either
:const:`FILETYPE_PEM` or :const:`FILETY... | [
"Load",
"a",
"private",
"key",
"from",
"a",
"file"
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L968-L989 | [
"def",
"use_privatekey_file",
"(",
"self",
",",
"keyfile",
",",
"filetype",
"=",
"_UNSPECIFIED",
")",
":",
"keyfile",
"=",
"_path_string",
"(",
"keyfile",
")",
"if",
"filetype",
"is",
"_UNSPECIFIED",
":",
"filetype",
"=",
"FILETYPE_PEM",
"elif",
"not",
"isinst... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.use_privatekey | Load a private key from a PKey object
:param pkey: The PKey object
:return: None | src/OpenSSL/SSL.py | def use_privatekey(self, pkey):
"""
Load a private key from a PKey object
:param pkey: The PKey object
:return: None
"""
if not isinstance(pkey, PKey):
raise TypeError("pkey must be a PKey instance")
use_result = _lib.SSL_CTX_use_PrivateKey(self._con... | def use_privatekey(self, pkey):
"""
Load a private key from a PKey object
:param pkey: The PKey object
:return: None
"""
if not isinstance(pkey, PKey):
raise TypeError("pkey must be a PKey instance")
use_result = _lib.SSL_CTX_use_PrivateKey(self._con... | [
"Load",
"a",
"private",
"key",
"from",
"a",
"PKey",
"object"
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L991-L1003 | [
"def",
"use_privatekey",
"(",
"self",
",",
"pkey",
")",
":",
"if",
"not",
"isinstance",
"(",
"pkey",
",",
"PKey",
")",
":",
"raise",
"TypeError",
"(",
"\"pkey must be a PKey instance\"",
")",
"use_result",
"=",
"_lib",
".",
"SSL_CTX_use_PrivateKey",
"(",
"self... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.load_client_ca | Load the trusted certificates that will be sent to the client. Does
not actually imply any of the certificates are trusted; that must be
configured separately.
:param bytes cafile: The path to a certificates file in PEM format.
:return: None | src/OpenSSL/SSL.py | def load_client_ca(self, cafile):
"""
Load the trusted certificates that will be sent to the client. Does
not actually imply any of the certificates are trusted; that must be
configured separately.
:param bytes cafile: The path to a certificates file in PEM format.
:ret... | def load_client_ca(self, cafile):
"""
Load the trusted certificates that will be sent to the client. Does
not actually imply any of the certificates are trusted; that must be
configured separately.
:param bytes cafile: The path to a certificates file in PEM format.
:ret... | [
"Load",
"the",
"trusted",
"certificates",
"that",
"will",
"be",
"sent",
"to",
"the",
"client",
".",
"Does",
"not",
"actually",
"imply",
"any",
"of",
"the",
"certificates",
"are",
"trusted",
";",
"that",
"must",
"be",
"configured",
"separately",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1015-L1028 | [
"def",
"load_client_ca",
"(",
"self",
",",
"cafile",
")",
":",
"ca_list",
"=",
"_lib",
".",
"SSL_load_client_CA_file",
"(",
"_text_to_bytes_and_warn",
"(",
"\"cafile\"",
",",
"cafile",
")",
")",
"_openssl_assert",
"(",
"ca_list",
"!=",
"_ffi",
".",
"NULL",
")"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_session_id | Set the session id to *buf* within which a session can be reused for
this Context object. This is needed when doing session resumption,
because there is no way for a stored session to know which Context
object it is associated with.
:param bytes buf: The session id.
:returns: ... | src/OpenSSL/SSL.py | def set_session_id(self, buf):
"""
Set the session id to *buf* within which a session can be reused for
this Context object. This is needed when doing session resumption,
because there is no way for a stored session to know which Context
object it is associated with.
:p... | def set_session_id(self, buf):
"""
Set the session id to *buf* within which a session can be reused for
this Context object. This is needed when doing session resumption,
because there is no way for a stored session to know which Context
object it is associated with.
:p... | [
"Set",
"the",
"session",
"id",
"to",
"*",
"buf",
"*",
"within",
"which",
"a",
"session",
"can",
"be",
"reused",
"for",
"this",
"Context",
"object",
".",
"This",
"is",
"needed",
"when",
"doing",
"session",
"resumption",
"because",
"there",
"is",
"no",
"wa... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1030-L1048 | [
"def",
"set_session_id",
"(",
"self",
",",
"buf",
")",
":",
"buf",
"=",
"_text_to_bytes_and_warn",
"(",
"\"buf\"",
",",
"buf",
")",
"_openssl_assert",
"(",
"_lib",
".",
"SSL_CTX_set_session_id_context",
"(",
"self",
".",
"_context",
",",
"buf",
",",
"len",
"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_session_cache_mode | Set the behavior of the session cache used by all connections using
this Context. The previously set mode is returned. See
:const:`SESS_CACHE_*` for details about particular modes.
:param mode: One or more of the SESS_CACHE_* flags (combine using
bitwise or)
:returns: The ... | src/OpenSSL/SSL.py | def set_session_cache_mode(self, mode):
"""
Set the behavior of the session cache used by all connections using
this Context. The previously set mode is returned. See
:const:`SESS_CACHE_*` for details about particular modes.
:param mode: One or more of the SESS_CACHE_* flags (... | def set_session_cache_mode(self, mode):
"""
Set the behavior of the session cache used by all connections using
this Context. The previously set mode is returned. See
:const:`SESS_CACHE_*` for details about particular modes.
:param mode: One or more of the SESS_CACHE_* flags (... | [
"Set",
"the",
"behavior",
"of",
"the",
"session",
"cache",
"used",
"by",
"all",
"connections",
"using",
"this",
"Context",
".",
"The",
"previously",
"set",
"mode",
"is",
"returned",
".",
"See",
":",
"const",
":",
"SESS_CACHE_",
"*",
"for",
"details",
"abou... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1050-L1065 | [
"def",
"set_session_cache_mode",
"(",
"self",
",",
"mode",
")",
":",
"if",
"not",
"isinstance",
"(",
"mode",
",",
"integer_types",
")",
":",
"raise",
"TypeError",
"(",
"\"mode must be an integer\"",
")",
"return",
"_lib",
".",
"SSL_CTX_set_session_cache_mode",
"("... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_verify | et the verification flags for this Context object to *mode* and specify
that *callback* should be used for verification callbacks.
:param mode: The verify mode, this should be one of
:const:`VERIFY_NONE` and :const:`VERIFY_PEER`. If
:const:`VERIFY_PEER` is used, *mode* can be OR... | src/OpenSSL/SSL.py | def set_verify(self, mode, callback):
"""
et the verification flags for this Context object to *mode* and specify
that *callback* should be used for verification callbacks.
:param mode: The verify mode, this should be one of
:const:`VERIFY_NONE` and :const:`VERIFY_PEER`. If
... | def set_verify(self, mode, callback):
"""
et the verification flags for this Context object to *mode* and specify
that *callback* should be used for verification callbacks.
:param mode: The verify mode, this should be one of
:const:`VERIFY_NONE` and :const:`VERIFY_PEER`. If
... | [
"et",
"the",
"verification",
"flags",
"for",
"this",
"Context",
"object",
"to",
"*",
"mode",
"*",
"and",
"specify",
"that",
"*",
"callback",
"*",
"should",
"be",
"used",
"for",
"verification",
"callbacks",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1077-L1104 | [
"def",
"set_verify",
"(",
"self",
",",
"mode",
",",
"callback",
")",
":",
"if",
"not",
"isinstance",
"(",
"mode",
",",
"integer_types",
")",
":",
"raise",
"TypeError",
"(",
"\"mode must be an integer\"",
")",
"if",
"not",
"callable",
"(",
"callback",
")",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_verify_depth | Set the maximum depth for the certificate chain verification that shall
be allowed for this Context object.
:param depth: An integer specifying the verify depth
:return: None | src/OpenSSL/SSL.py | def set_verify_depth(self, depth):
"""
Set the maximum depth for the certificate chain verification that shall
be allowed for this Context object.
:param depth: An integer specifying the verify depth
:return: None
"""
if not isinstance(depth, integer_types):
... | def set_verify_depth(self, depth):
"""
Set the maximum depth for the certificate chain verification that shall
be allowed for this Context object.
:param depth: An integer specifying the verify depth
:return: None
"""
if not isinstance(depth, integer_types):
... | [
"Set",
"the",
"maximum",
"depth",
"for",
"the",
"certificate",
"chain",
"verification",
"that",
"shall",
"be",
"allowed",
"for",
"this",
"Context",
"object",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1106-L1117 | [
"def",
"set_verify_depth",
"(",
"self",
",",
"depth",
")",
":",
"if",
"not",
"isinstance",
"(",
"depth",
",",
"integer_types",
")",
":",
"raise",
"TypeError",
"(",
"\"depth must be an integer\"",
")",
"_lib",
".",
"SSL_CTX_set_verify_depth",
"(",
"self",
".",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.load_tmp_dh | Load parameters for Ephemeral Diffie-Hellman
:param dhfile: The file to load EDH parameters from (``bytes`` or
``unicode``).
:return: None | src/OpenSSL/SSL.py | def load_tmp_dh(self, dhfile):
"""
Load parameters for Ephemeral Diffie-Hellman
:param dhfile: The file to load EDH parameters from (``bytes`` or
``unicode``).
:return: None
"""
dhfile = _path_string(dhfile)
bio = _lib.BIO_new_file(dhfile, b"r")
... | def load_tmp_dh(self, dhfile):
"""
Load parameters for Ephemeral Diffie-Hellman
:param dhfile: The file to load EDH parameters from (``bytes`` or
``unicode``).
:return: None
"""
dhfile = _path_string(dhfile)
bio = _lib.BIO_new_file(dhfile, b"r")
... | [
"Load",
"parameters",
"for",
"Ephemeral",
"Diffie",
"-",
"Hellman"
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1137-L1155 | [
"def",
"load_tmp_dh",
"(",
"self",
",",
"dhfile",
")",
":",
"dhfile",
"=",
"_path_string",
"(",
"dhfile",
")",
"bio",
"=",
"_lib",
".",
"BIO_new_file",
"(",
"dhfile",
",",
"b\"r\"",
")",
"if",
"bio",
"==",
"_ffi",
".",
"NULL",
":",
"_raise_current_error"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_cipher_list | Set the list of ciphers to be used in this context.
See the OpenSSL manual for more information (e.g.
:manpage:`ciphers(1)`).
:param bytes cipher_list: An OpenSSL cipher string.
:return: None | src/OpenSSL/SSL.py | def set_cipher_list(self, cipher_list):
"""
Set the list of ciphers to be used in this context.
See the OpenSSL manual for more information (e.g.
:manpage:`ciphers(1)`).
:param bytes cipher_list: An OpenSSL cipher string.
:return: None
"""
cipher_list = ... | def set_cipher_list(self, cipher_list):
"""
Set the list of ciphers to be used in this context.
See the OpenSSL manual for more information (e.g.
:manpage:`ciphers(1)`).
:param bytes cipher_list: An OpenSSL cipher string.
:return: None
"""
cipher_list = ... | [
"Set",
"the",
"list",
"of",
"ciphers",
"to",
"be",
"used",
"in",
"this",
"context",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1169-L1208 | [
"def",
"set_cipher_list",
"(",
"self",
",",
"cipher_list",
")",
":",
"cipher_list",
"=",
"_text_to_bytes_and_warn",
"(",
"\"cipher_list\"",
",",
"cipher_list",
")",
"if",
"not",
"isinstance",
"(",
"cipher_list",
",",
"bytes",
")",
":",
"raise",
"TypeError",
"(",... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_client_ca_list | Set the list of preferred client certificate signers for this server
context.
This list of certificate authorities will be sent to the client when
the server requests a client certificate.
:param certificate_authorities: a sequence of X509Names.
:return: None
.. versio... | src/OpenSSL/SSL.py | def set_client_ca_list(self, certificate_authorities):
"""
Set the list of preferred client certificate signers for this server
context.
This list of certificate authorities will be sent to the client when
the server requests a client certificate.
:param certificate_aut... | def set_client_ca_list(self, certificate_authorities):
"""
Set the list of preferred client certificate signers for this server
context.
This list of certificate authorities will be sent to the client when
the server requests a client certificate.
:param certificate_aut... | [
"Set",
"the",
"list",
"of",
"preferred",
"client",
"certificate",
"signers",
"for",
"this",
"server",
"context",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1210-L1245 | [
"def",
"set_client_ca_list",
"(",
"self",
",",
"certificate_authorities",
")",
":",
"name_stack",
"=",
"_lib",
".",
"sk_X509_NAME_new_null",
"(",
")",
"_openssl_assert",
"(",
"name_stack",
"!=",
"_ffi",
".",
"NULL",
")",
"try",
":",
"for",
"ca_name",
"in",
"ce... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.add_client_ca | Add the CA certificate to the list of preferred signers for this
context.
The list of certificate authorities will be sent to the client when the
server requests a client certificate.
:param certificate_authority: certificate authority's X509 certificate.
:return: None
... | src/OpenSSL/SSL.py | def add_client_ca(self, certificate_authority):
"""
Add the CA certificate to the list of preferred signers for this
context.
The list of certificate authorities will be sent to the client when the
server requests a client certificate.
:param certificate_authority: cert... | def add_client_ca(self, certificate_authority):
"""
Add the CA certificate to the list of preferred signers for this
context.
The list of certificate authorities will be sent to the client when the
server requests a client certificate.
:param certificate_authority: cert... | [
"Add",
"the",
"CA",
"certificate",
"to",
"the",
"list",
"of",
"preferred",
"signers",
"for",
"this",
"context",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1247-L1265 | [
"def",
"add_client_ca",
"(",
"self",
",",
"certificate_authority",
")",
":",
"if",
"not",
"isinstance",
"(",
"certificate_authority",
",",
"X509",
")",
":",
"raise",
"TypeError",
"(",
"\"certificate_authority must be an X509 instance\"",
")",
"add_result",
"=",
"_lib"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_timeout | Set the timeout for newly created sessions for this Context object to
*timeout*. The default value is 300 seconds. See the OpenSSL manual
for more information (e.g. :manpage:`SSL_CTX_set_timeout(3)`).
:param timeout: The timeout in (whole) seconds
:return: The previous session timeout | src/OpenSSL/SSL.py | def set_timeout(self, timeout):
"""
Set the timeout for newly created sessions for this Context object to
*timeout*. The default value is 300 seconds. See the OpenSSL manual
for more information (e.g. :manpage:`SSL_CTX_set_timeout(3)`).
:param timeout: The timeout in (whole) se... | def set_timeout(self, timeout):
"""
Set the timeout for newly created sessions for this Context object to
*timeout*. The default value is 300 seconds. See the OpenSSL manual
for more information (e.g. :manpage:`SSL_CTX_set_timeout(3)`).
:param timeout: The timeout in (whole) se... | [
"Set",
"the",
"timeout",
"for",
"newly",
"created",
"sessions",
"for",
"this",
"Context",
"object",
"to",
"*",
"timeout",
"*",
".",
"The",
"default",
"value",
"is",
"300",
"seconds",
".",
"See",
"the",
"OpenSSL",
"manual",
"for",
"more",
"information",
"("... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1267-L1279 | [
"def",
"set_timeout",
"(",
"self",
",",
"timeout",
")",
":",
"if",
"not",
"isinstance",
"(",
"timeout",
",",
"integer_types",
")",
":",
"raise",
"TypeError",
"(",
"\"timeout must be an integer\"",
")",
"return",
"_lib",
".",
"SSL_CTX_set_timeout",
"(",
"self",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_info_callback | Set the information callback to *callback*. This function will be
called from time to time during SSL handshakes.
:param callback: The Python callback to use. This should take three
arguments: a Connection object and two integers. The first integer
specifies where in the SSL h... | src/OpenSSL/SSL.py | def set_info_callback(self, callback):
"""
Set the information callback to *callback*. This function will be
called from time to time during SSL handshakes.
:param callback: The Python callback to use. This should take three
arguments: a Connection object and two integers. ... | def set_info_callback(self, callback):
"""
Set the information callback to *callback*. This function will be
called from time to time during SSL handshakes.
:param callback: The Python callback to use. This should take three
arguments: a Connection object and two integers. ... | [
"Set",
"the",
"information",
"callback",
"to",
"*",
"callback",
"*",
".",
"This",
"function",
"will",
"be",
"called",
"from",
"time",
"to",
"time",
"during",
"SSL",
"handshakes",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1290-L1307 | [
"def",
"set_info_callback",
"(",
"self",
",",
"callback",
")",
":",
"@",
"wraps",
"(",
"callback",
")",
"def",
"wrapper",
"(",
"ssl",
",",
"where",
",",
"return_code",
")",
":",
"callback",
"(",
"Connection",
".",
"_reverse_mapping",
"[",
"ssl",
"]",
","... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.get_cert_store | Get the certificate store for the context. This can be used to add
"trusted" certificates without using the
:meth:`load_verify_locations` method.
:return: A X509Store object or None if it does not have one. | src/OpenSSL/SSL.py | def get_cert_store(self):
"""
Get the certificate store for the context. This can be used to add
"trusted" certificates without using the
:meth:`load_verify_locations` method.
:return: A X509Store object or None if it does not have one.
"""
store = _lib.SSL_CTX_... | def get_cert_store(self):
"""
Get the certificate store for the context. This can be used to add
"trusted" certificates without using the
:meth:`load_verify_locations` method.
:return: A X509Store object or None if it does not have one.
"""
store = _lib.SSL_CTX_... | [
"Get",
"the",
"certificate",
"store",
"for",
"the",
"context",
".",
"This",
"can",
"be",
"used",
"to",
"add",
"trusted",
"certificates",
"without",
"using",
"the",
":",
"meth",
":",
"load_verify_locations",
"method",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1326-L1341 | [
"def",
"get_cert_store",
"(",
"self",
")",
":",
"store",
"=",
"_lib",
".",
"SSL_CTX_get_cert_store",
"(",
"self",
".",
"_context",
")",
"if",
"store",
"==",
"_ffi",
".",
"NULL",
":",
"# TODO: This is untested.",
"return",
"None",
"pystore",
"=",
"X509Store",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_options | Add options. Options set before are not cleared!
This method should be used with the :const:`OP_*` constants.
:param options: The options to add.
:return: The new option bitmask. | src/OpenSSL/SSL.py | def set_options(self, options):
"""
Add options. Options set before are not cleared!
This method should be used with the :const:`OP_*` constants.
:param options: The options to add.
:return: The new option bitmask.
"""
if not isinstance(options, integer_types):
... | def set_options(self, options):
"""
Add options. Options set before are not cleared!
This method should be used with the :const:`OP_*` constants.
:param options: The options to add.
:return: The new option bitmask.
"""
if not isinstance(options, integer_types):
... | [
"Add",
"options",
".",
"Options",
"set",
"before",
"are",
"not",
"cleared!",
"This",
"method",
"should",
"be",
"used",
"with",
"the",
":",
"const",
":",
"OP_",
"*",
"constants",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1343-L1354 | [
"def",
"set_options",
"(",
"self",
",",
"options",
")",
":",
"if",
"not",
"isinstance",
"(",
"options",
",",
"integer_types",
")",
":",
"raise",
"TypeError",
"(",
"\"options must be an integer\"",
")",
"return",
"_lib",
".",
"SSL_CTX_set_options",
"(",
"self",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_mode | Add modes via bitmask. Modes set before are not cleared! This method
should be used with the :const:`MODE_*` constants.
:param mode: The mode to add.
:return: The new mode bitmask. | src/OpenSSL/SSL.py | def set_mode(self, mode):
"""
Add modes via bitmask. Modes set before are not cleared! This method
should be used with the :const:`MODE_*` constants.
:param mode: The mode to add.
:return: The new mode bitmask.
"""
if not isinstance(mode, integer_types):
... | def set_mode(self, mode):
"""
Add modes via bitmask. Modes set before are not cleared! This method
should be used with the :const:`MODE_*` constants.
:param mode: The mode to add.
:return: The new mode bitmask.
"""
if not isinstance(mode, integer_types):
... | [
"Add",
"modes",
"via",
"bitmask",
".",
"Modes",
"set",
"before",
"are",
"not",
"cleared!",
"This",
"method",
"should",
"be",
"used",
"with",
"the",
":",
"const",
":",
"MODE_",
"*",
"constants",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1356-L1367 | [
"def",
"set_mode",
"(",
"self",
",",
"mode",
")",
":",
"if",
"not",
"isinstance",
"(",
"mode",
",",
"integer_types",
")",
":",
"raise",
"TypeError",
"(",
"\"mode must be an integer\"",
")",
"return",
"_lib",
".",
"SSL_CTX_set_mode",
"(",
"self",
".",
"_conte... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_tlsext_servername_callback | Specify a callback function to be called when clients specify a server
name.
:param callback: The callback function. It will be invoked with one
argument, the Connection instance.
.. versionadded:: 0.13 | src/OpenSSL/SSL.py | def set_tlsext_servername_callback(self, callback):
"""
Specify a callback function to be called when clients specify a server
name.
:param callback: The callback function. It will be invoked with one
argument, the Connection instance.
.. versionadded:: 0.13
... | def set_tlsext_servername_callback(self, callback):
"""
Specify a callback function to be called when clients specify a server
name.
:param callback: The callback function. It will be invoked with one
argument, the Connection instance.
.. versionadded:: 0.13
... | [
"Specify",
"a",
"callback",
"function",
"to",
"be",
"called",
"when",
"clients",
"specify",
"a",
"server",
"name",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1369-L1387 | [
"def",
"set_tlsext_servername_callback",
"(",
"self",
",",
"callback",
")",
":",
"@",
"wraps",
"(",
"callback",
")",
"def",
"wrapper",
"(",
"ssl",
",",
"alert",
",",
"arg",
")",
":",
"callback",
"(",
"Connection",
".",
"_reverse_mapping",
"[",
"ssl",
"]",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_tlsext_use_srtp | Enable support for negotiating SRTP keying material.
:param bytes profiles: A colon delimited list of protection profile
names, like ``b'SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32'``.
:return: None | src/OpenSSL/SSL.py | def set_tlsext_use_srtp(self, profiles):
"""
Enable support for negotiating SRTP keying material.
:param bytes profiles: A colon delimited list of protection profile
names, like ``b'SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32'``.
:return: None
"""
if not is... | def set_tlsext_use_srtp(self, profiles):
"""
Enable support for negotiating SRTP keying material.
:param bytes profiles: A colon delimited list of protection profile
names, like ``b'SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32'``.
:return: None
"""
if not is... | [
"Enable",
"support",
"for",
"negotiating",
"SRTP",
"keying",
"material",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1389-L1402 | [
"def",
"set_tlsext_use_srtp",
"(",
"self",
",",
"profiles",
")",
":",
"if",
"not",
"isinstance",
"(",
"profiles",
",",
"bytes",
")",
":",
"raise",
"TypeError",
"(",
"\"profiles must be a byte string.\"",
")",
"_openssl_assert",
"(",
"_lib",
".",
"SSL_CTX_set_tlsex... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_npn_advertise_callback | Specify a callback function that will be called when offering `Next
Protocol Negotiation
<https://technotes.googlecode.com/git/nextprotoneg.html>`_ as a server.
:param callback: The callback function. It will be invoked with one
argument, the :class:`Connection` instance. It shoul... | src/OpenSSL/SSL.py | def set_npn_advertise_callback(self, callback):
"""
Specify a callback function that will be called when offering `Next
Protocol Negotiation
<https://technotes.googlecode.com/git/nextprotoneg.html>`_ as a server.
:param callback: The callback function. It will be invoked with o... | def set_npn_advertise_callback(self, callback):
"""
Specify a callback function that will be called when offering `Next
Protocol Negotiation
<https://technotes.googlecode.com/git/nextprotoneg.html>`_ as a server.
:param callback: The callback function. It will be invoked with o... | [
"Specify",
"a",
"callback",
"function",
"that",
"will",
"be",
"called",
"when",
"offering",
"Next",
"Protocol",
"Negotiation",
"<https",
":",
"//",
"technotes",
".",
"googlecode",
".",
"com",
"/",
"git",
"/",
"nextprotoneg",
".",
"html",
">",
"_",
"as",
"a... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1405-L1422 | [
"def",
"set_npn_advertise_callback",
"(",
"self",
",",
"callback",
")",
":",
"_warn_npn",
"(",
")",
"self",
".",
"_npn_advertise_helper",
"=",
"_NpnAdvertiseHelper",
"(",
"callback",
")",
"self",
".",
"_npn_advertise_callback",
"=",
"self",
".",
"_npn_advertise_help... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_npn_select_callback | Specify a callback function that will be called when a server offers
Next Protocol Negotiation options.
:param callback: The callback function. It will be invoked with two
arguments: the Connection, and a list of offered protocols as
bytestrings, e.g. ``[b'http/1.1', b'spdy/2']... | src/OpenSSL/SSL.py | def set_npn_select_callback(self, callback):
"""
Specify a callback function that will be called when a server offers
Next Protocol Negotiation options.
:param callback: The callback function. It will be invoked with two
arguments: the Connection, and a list of offered prot... | def set_npn_select_callback(self, callback):
"""
Specify a callback function that will be called when a server offers
Next Protocol Negotiation options.
:param callback: The callback function. It will be invoked with two
arguments: the Connection, and a list of offered prot... | [
"Specify",
"a",
"callback",
"function",
"that",
"will",
"be",
"called",
"when",
"a",
"server",
"offers",
"Next",
"Protocol",
"Negotiation",
"options",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1425-L1441 | [
"def",
"set_npn_select_callback",
"(",
"self",
",",
"callback",
")",
":",
"_warn_npn",
"(",
")",
"self",
".",
"_npn_select_helper",
"=",
"_NpnSelectHelper",
"(",
"callback",
")",
"self",
".",
"_npn_select_callback",
"=",
"self",
".",
"_npn_select_helper",
".",
"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_alpn_protos | Specify the protocols that the client is prepared to speak after the
TLS connection has been negotiated using Application Layer Protocol
Negotiation.
:param protos: A list of the protocols to be offered to the server.
This list should be a Python list of bytestrings representing the... | src/OpenSSL/SSL.py | def set_alpn_protos(self, protos):
"""
Specify the protocols that the client is prepared to speak after the
TLS connection has been negotiated using Application Layer Protocol
Negotiation.
:param protos: A list of the protocols to be offered to the server.
This list ... | def set_alpn_protos(self, protos):
"""
Specify the protocols that the client is prepared to speak after the
TLS connection has been negotiated using Application Layer Protocol
Negotiation.
:param protos: A list of the protocols to be offered to the server.
This list ... | [
"Specify",
"the",
"protocols",
"that",
"the",
"client",
"is",
"prepared",
"to",
"speak",
"after",
"the",
"TLS",
"connection",
"has",
"been",
"negotiated",
"using",
"Application",
"Layer",
"Protocol",
"Negotiation",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1444-L1463 | [
"def",
"set_alpn_protos",
"(",
"self",
",",
"protos",
")",
":",
"# Take the list of protocols and join them together, prefixing them",
"# with their lengths.",
"protostr",
"=",
"b''",
".",
"join",
"(",
"chain",
".",
"from_iterable",
"(",
"(",
"int2byte",
"(",
"len",
"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_alpn_select_callback | Specify a callback function that will be called on the server when a
client offers protocols using ALPN.
:param callback: The callback function. It will be invoked with two
arguments: the Connection, and a list of offered protocols as
bytestrings, e.g ``[b'http/1.1', b'spdy/2']... | src/OpenSSL/SSL.py | def set_alpn_select_callback(self, callback):
"""
Specify a callback function that will be called on the server when a
client offers protocols using ALPN.
:param callback: The callback function. It will be invoked with two
arguments: the Connection, and a list of offered pr... | def set_alpn_select_callback(self, callback):
"""
Specify a callback function that will be called on the server when a
client offers protocols using ALPN.
:param callback: The callback function. It will be invoked with two
arguments: the Connection, and a list of offered pr... | [
"Specify",
"a",
"callback",
"function",
"that",
"will",
"be",
"called",
"on",
"the",
"server",
"when",
"a",
"client",
"offers",
"protocols",
"using",
"ALPN",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1466-L1479 | [
"def",
"set_alpn_select_callback",
"(",
"self",
",",
"callback",
")",
":",
"self",
".",
"_alpn_select_helper",
"=",
"_ALPNSelectHelper",
"(",
"callback",
")",
"self",
".",
"_alpn_select_callback",
"=",
"self",
".",
"_alpn_select_helper",
".",
"callback",
"_lib",
"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context._set_ocsp_callback | This internal helper does the common work for
``set_ocsp_server_callback`` and ``set_ocsp_client_callback``, which is
almost all of it. | src/OpenSSL/SSL.py | def _set_ocsp_callback(self, helper, data):
"""
This internal helper does the common work for
``set_ocsp_server_callback`` and ``set_ocsp_client_callback``, which is
almost all of it.
"""
self._ocsp_helper = helper
self._ocsp_callback = helper.callback
if ... | def _set_ocsp_callback(self, helper, data):
"""
This internal helper does the common work for
``set_ocsp_server_callback`` and ``set_ocsp_client_callback``, which is
almost all of it.
"""
self._ocsp_helper = helper
self._ocsp_callback = helper.callback
if ... | [
"This",
"internal",
"helper",
"does",
"the",
"common",
"work",
"for",
"set_ocsp_server_callback",
"and",
"set_ocsp_client_callback",
"which",
"is",
"almost",
"all",
"of",
"it",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1481-L1499 | [
"def",
"_set_ocsp_callback",
"(",
"self",
",",
"helper",
",",
"data",
")",
":",
"self",
".",
"_ocsp_helper",
"=",
"helper",
"self",
".",
"_ocsp_callback",
"=",
"helper",
".",
"callback",
"if",
"data",
"is",
"None",
":",
"self",
".",
"_ocsp_data",
"=",
"_... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_ocsp_server_callback | Set a callback to provide OCSP data to be stapled to the TLS handshake
on the server side.
:param callback: The callback function. It will be invoked with two
arguments: the Connection, and the optional arbitrary data you have
provided. The callback must return a bytestring that... | src/OpenSSL/SSL.py | def set_ocsp_server_callback(self, callback, data=None):
"""
Set a callback to provide OCSP data to be stapled to the TLS handshake
on the server side.
:param callback: The callback function. It will be invoked with two
arguments: the Connection, and the optional arbitrary d... | def set_ocsp_server_callback(self, callback, data=None):
"""
Set a callback to provide OCSP data to be stapled to the TLS handshake
on the server side.
:param callback: The callback function. It will be invoked with two
arguments: the Connection, and the optional arbitrary d... | [
"Set",
"a",
"callback",
"to",
"provide",
"OCSP",
"data",
"to",
"be",
"stapled",
"to",
"the",
"TLS",
"handshake",
"on",
"the",
"server",
"side",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1501-L1517 | [
"def",
"set_ocsp_server_callback",
"(",
"self",
",",
"callback",
",",
"data",
"=",
"None",
")",
":",
"helper",
"=",
"_OCSPServerCallbackHelper",
"(",
"callback",
")",
"self",
".",
"_set_ocsp_callback",
"(",
"helper",
",",
"data",
")"
] | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Context.set_ocsp_client_callback | Set a callback to validate OCSP data stapled to the TLS handshake on
the client side.
:param callback: The callback function. It will be invoked with three
arguments: the Connection, a bytestring containing the stapled OCSP
assertion, and the optional arbitrary data you have pro... | src/OpenSSL/SSL.py | def set_ocsp_client_callback(self, callback, data=None):
"""
Set a callback to validate OCSP data stapled to the TLS handshake on
the client side.
:param callback: The callback function. It will be invoked with three
arguments: the Connection, a bytestring containing the sta... | def set_ocsp_client_callback(self, callback, data=None):
"""
Set a callback to validate OCSP data stapled to the TLS handshake on
the client side.
:param callback: The callback function. It will be invoked with three
arguments: the Connection, a bytestring containing the sta... | [
"Set",
"a",
"callback",
"to",
"validate",
"OCSP",
"data",
"stapled",
"to",
"the",
"TLS",
"handshake",
"on",
"the",
"client",
"side",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1519-L1537 | [
"def",
"set_ocsp_client_callback",
"(",
"self",
",",
"callback",
",",
"data",
"=",
"None",
")",
":",
"helper",
"=",
"_OCSPClientCallbackHelper",
"(",
"callback",
")",
"self",
".",
"_set_ocsp_callback",
"(",
"helper",
",",
"data",
")"
] | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.set_context | Switch this connection to a new session context.
:param context: A :class:`Context` instance giving the new session
context to use. | src/OpenSSL/SSL.py | def set_context(self, context):
"""
Switch this connection to a new session context.
:param context: A :class:`Context` instance giving the new session
context to use.
"""
if not isinstance(context, Context):
raise TypeError("context must be a Context ins... | def set_context(self, context):
"""
Switch this connection to a new session context.
:param context: A :class:`Context` instance giving the new session
context to use.
"""
if not isinstance(context, Context):
raise TypeError("context must be a Context ins... | [
"Switch",
"this",
"connection",
"to",
"a",
"new",
"session",
"context",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1659-L1670 | [
"def",
"set_context",
"(",
"self",
",",
"context",
")",
":",
"if",
"not",
"isinstance",
"(",
"context",
",",
"Context",
")",
":",
"raise",
"TypeError",
"(",
"\"context must be a Context instance\"",
")",
"_lib",
".",
"SSL_set_SSL_CTX",
"(",
"self",
".",
"_ssl"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_servername | Retrieve the servername extension value if provided in the client hello
message, or None if there wasn't one.
:return: A byte string giving the server name or :data:`None`.
.. versionadded:: 0.13 | src/OpenSSL/SSL.py | def get_servername(self):
"""
Retrieve the servername extension value if provided in the client hello
message, or None if there wasn't one.
:return: A byte string giving the server name or :data:`None`.
.. versionadded:: 0.13
"""
name = _lib.SSL_get_servername(
... | def get_servername(self):
"""
Retrieve the servername extension value if provided in the client hello
message, or None if there wasn't one.
:return: A byte string giving the server name or :data:`None`.
.. versionadded:: 0.13
"""
name = _lib.SSL_get_servername(
... | [
"Retrieve",
"the",
"servername",
"extension",
"value",
"if",
"provided",
"in",
"the",
"client",
"hello",
"message",
"or",
"None",
"if",
"there",
"wasn",
"t",
"one",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1672-L1687 | [
"def",
"get_servername",
"(",
"self",
")",
":",
"name",
"=",
"_lib",
".",
"SSL_get_servername",
"(",
"self",
".",
"_ssl",
",",
"_lib",
".",
"TLSEXT_NAMETYPE_host_name",
")",
"if",
"name",
"==",
"_ffi",
".",
"NULL",
":",
"return",
"None",
"return",
"_ffi",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.set_tlsext_host_name | Set the value of the servername extension to send in the client hello.
:param name: A byte string giving the name.
.. versionadded:: 0.13 | src/OpenSSL/SSL.py | def set_tlsext_host_name(self, name):
"""
Set the value of the servername extension to send in the client hello.
:param name: A byte string giving the name.
.. versionadded:: 0.13
"""
if not isinstance(name, bytes):
raise TypeError("name must be a byte strin... | def set_tlsext_host_name(self, name):
"""
Set the value of the servername extension to send in the client hello.
:param name: A byte string giving the name.
.. versionadded:: 0.13
"""
if not isinstance(name, bytes):
raise TypeError("name must be a byte strin... | [
"Set",
"the",
"value",
"of",
"the",
"servername",
"extension",
"to",
"send",
"in",
"the",
"client",
"hello",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1689-L1703 | [
"def",
"set_tlsext_host_name",
"(",
"self",
",",
"name",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"bytes",
")",
":",
"raise",
"TypeError",
"(",
"\"name must be a byte string\"",
")",
"elif",
"b\"\\0\"",
"in",
"name",
":",
"raise",
"TypeError",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.send | Send data on the connection. NOTE: If you get one of the WantRead,
WantWrite or WantX509Lookup exceptions on this, you have to call the
method again with the SAME buffer.
:param buf: The string, buffer or memoryview to send
:param flags: (optional) Included for compatibility with the so... | src/OpenSSL/SSL.py | def send(self, buf, flags=0):
"""
Send data on the connection. NOTE: If you get one of the WantRead,
WantWrite or WantX509Lookup exceptions on this, you have to call the
method again with the SAME buffer.
:param buf: The string, buffer or memoryview to send
:param flags:... | def send(self, buf, flags=0):
"""
Send data on the connection. NOTE: If you get one of the WantRead,
WantWrite or WantX509Lookup exceptions on this, you have to call the
method again with the SAME buffer.
:param buf: The string, buffer or memoryview to send
:param flags:... | [
"Send",
"data",
"on",
"the",
"connection",
".",
"NOTE",
":",
"If",
"you",
"get",
"one",
"of",
"the",
"WantRead",
"WantWrite",
"or",
"WantX509Lookup",
"exceptions",
"on",
"this",
"you",
"have",
"to",
"call",
"the",
"method",
"again",
"with",
"the",
"SAME",
... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1714-L1739 | [
"def",
"send",
"(",
"self",
",",
"buf",
",",
"flags",
"=",
"0",
")",
":",
"# Backward compatibility",
"buf",
"=",
"_text_to_bytes_and_warn",
"(",
"\"buf\"",
",",
"buf",
")",
"if",
"isinstance",
"(",
"buf",
",",
"memoryview",
")",
":",
"buf",
"=",
"buf",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.sendall | Send "all" data on the connection. This calls send() repeatedly until
all data is sent. If an error occurs, it's impossible to tell how much
data has been sent.
:param buf: The string, buffer or memoryview to send
:param flags: (optional) Included for compatibility with the socket
... | src/OpenSSL/SSL.py | def sendall(self, buf, flags=0):
"""
Send "all" data on the connection. This calls send() repeatedly until
all data is sent. If an error occurs, it's impossible to tell how much
data has been sent.
:param buf: The string, buffer or memoryview to send
:param flags: (optio... | def sendall(self, buf, flags=0):
"""
Send "all" data on the connection. This calls send() repeatedly until
all data is sent. If an error occurs, it's impossible to tell how much
data has been sent.
:param buf: The string, buffer or memoryview to send
:param flags: (optio... | [
"Send",
"all",
"data",
"on",
"the",
"connection",
".",
"This",
"calls",
"send",
"()",
"repeatedly",
"until",
"all",
"data",
"is",
"sent",
".",
"If",
"an",
"error",
"occurs",
"it",
"s",
"impossible",
"to",
"tell",
"how",
"much",
"data",
"has",
"been",
"... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1742-L1776 | [
"def",
"sendall",
"(",
"self",
",",
"buf",
",",
"flags",
"=",
"0",
")",
":",
"buf",
"=",
"_text_to_bytes_and_warn",
"(",
"\"buf\"",
",",
"buf",
")",
"if",
"isinstance",
"(",
"buf",
",",
"memoryview",
")",
":",
"buf",
"=",
"buf",
".",
"tobytes",
"(",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.recv | Receive data on the connection.
:param bufsiz: The maximum number of bytes to read
:param flags: (optional) The only supported flag is ``MSG_PEEK``,
all other flags are ignored.
:return: The string read from the Connection | src/OpenSSL/SSL.py | def recv(self, bufsiz, flags=None):
"""
Receive data on the connection.
:param bufsiz: The maximum number of bytes to read
:param flags: (optional) The only supported flag is ``MSG_PEEK``,
all other flags are ignored.
:return: The string read from the Connection
... | def recv(self, bufsiz, flags=None):
"""
Receive data on the connection.
:param bufsiz: The maximum number of bytes to read
:param flags: (optional) The only supported flag is ``MSG_PEEK``,
all other flags are ignored.
:return: The string read from the Connection
... | [
"Receive",
"data",
"on",
"the",
"connection",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1778-L1793 | [
"def",
"recv",
"(",
"self",
",",
"bufsiz",
",",
"flags",
"=",
"None",
")",
":",
"buf",
"=",
"_no_zero_allocator",
"(",
"\"char[]\"",
",",
"bufsiz",
")",
"if",
"flags",
"is",
"not",
"None",
"and",
"flags",
"&",
"socket",
".",
"MSG_PEEK",
":",
"result",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.recv_into | Receive data on the connection and copy it directly into the provided
buffer, rather than creating a new string.
:param buffer: The buffer to copy into.
:param nbytes: (optional) The maximum number of bytes to read into the
buffer. If not present, defaults to the size of the buffer.... | src/OpenSSL/SSL.py | def recv_into(self, buffer, nbytes=None, flags=None):
"""
Receive data on the connection and copy it directly into the provided
buffer, rather than creating a new string.
:param buffer: The buffer to copy into.
:param nbytes: (optional) The maximum number of bytes to read into t... | def recv_into(self, buffer, nbytes=None, flags=None):
"""
Receive data on the connection and copy it directly into the provided
buffer, rather than creating a new string.
:param buffer: The buffer to copy into.
:param nbytes: (optional) The maximum number of bytes to read into t... | [
"Receive",
"data",
"on",
"the",
"connection",
"and",
"copy",
"it",
"directly",
"into",
"the",
"provided",
"buffer",
"rather",
"than",
"creating",
"a",
"new",
"string",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1796-L1831 | [
"def",
"recv_into",
"(",
"self",
",",
"buffer",
",",
"nbytes",
"=",
"None",
",",
"flags",
"=",
"None",
")",
":",
"if",
"nbytes",
"is",
"None",
":",
"nbytes",
"=",
"len",
"(",
"buffer",
")",
"else",
":",
"nbytes",
"=",
"min",
"(",
"nbytes",
",",
"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.bio_read | If the Connection was created with a memory BIO, this method can be
used to read bytes from the write end of that memory BIO. Many
Connection methods will add bytes which must be read in this manner or
the buffer will eventually fill up and the Connection will be able to
take no further... | src/OpenSSL/SSL.py | def bio_read(self, bufsiz):
"""
If the Connection was created with a memory BIO, this method can be
used to read bytes from the write end of that memory BIO. Many
Connection methods will add bytes which must be read in this manner or
the buffer will eventually fill up and the Co... | def bio_read(self, bufsiz):
"""
If the Connection was created with a memory BIO, this method can be
used to read bytes from the write end of that memory BIO. Many
Connection methods will add bytes which must be read in this manner or
the buffer will eventually fill up and the Co... | [
"If",
"the",
"Connection",
"was",
"created",
"with",
"a",
"memory",
"BIO",
"this",
"method",
"can",
"be",
"used",
"to",
"read",
"bytes",
"from",
"the",
"write",
"end",
"of",
"that",
"memory",
"BIO",
".",
"Many",
"Connection",
"methods",
"will",
"add",
"b... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1851-L1873 | [
"def",
"bio_read",
"(",
"self",
",",
"bufsiz",
")",
":",
"if",
"self",
".",
"_from_ssl",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"\"Connection sock was not None\"",
")",
"if",
"not",
"isinstance",
"(",
"bufsiz",
",",
"integer_types",
")",
":",
"raise",... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.bio_write | If the Connection was created with a memory BIO, this method can be
used to add bytes to the read end of that memory BIO. The Connection
can then read the bytes (for example, in response to a call to
:meth:`recv`).
:param buf: The string to put into the memory BIO.
:return: The... | src/OpenSSL/SSL.py | def bio_write(self, buf):
"""
If the Connection was created with a memory BIO, this method can be
used to add bytes to the read end of that memory BIO. The Connection
can then read the bytes (for example, in response to a call to
:meth:`recv`).
:param buf: The string to... | def bio_write(self, buf):
"""
If the Connection was created with a memory BIO, this method can be
used to add bytes to the read end of that memory BIO. The Connection
can then read the bytes (for example, in response to a call to
:meth:`recv`).
:param buf: The string to... | [
"If",
"the",
"Connection",
"was",
"created",
"with",
"a",
"memory",
"BIO",
"this",
"method",
"can",
"be",
"used",
"to",
"add",
"bytes",
"to",
"the",
"read",
"end",
"of",
"that",
"memory",
"BIO",
".",
"The",
"Connection",
"can",
"then",
"read",
"the",
"... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1875-L1893 | [
"def",
"bio_write",
"(",
"self",
",",
"buf",
")",
":",
"buf",
"=",
"_text_to_bytes_and_warn",
"(",
"\"buf\"",
",",
"buf",
")",
"if",
"self",
".",
"_into_ssl",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"\"Connection sock was not None\"",
")",
"result",
"=... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.renegotiate | Renegotiate the session.
:return: True if the renegotiation can be started, False otherwise
:rtype: bool | src/OpenSSL/SSL.py | def renegotiate(self):
"""
Renegotiate the session.
:return: True if the renegotiation can be started, False otherwise
:rtype: bool
"""
if not self.renegotiate_pending():
_openssl_assert(_lib.SSL_renegotiate(self._ssl) == 1)
return True
re... | def renegotiate(self):
"""
Renegotiate the session.
:return: True if the renegotiation can be started, False otherwise
:rtype: bool
"""
if not self.renegotiate_pending():
_openssl_assert(_lib.SSL_renegotiate(self._ssl) == 1)
return True
re... | [
"Renegotiate",
"the",
"session",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1895-L1905 | [
"def",
"renegotiate",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"renegotiate_pending",
"(",
")",
":",
"_openssl_assert",
"(",
"_lib",
".",
"SSL_renegotiate",
"(",
"self",
".",
"_ssl",
")",
"==",
"1",
")",
"return",
"True",
"return",
"False"
] | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.do_handshake | Perform an SSL handshake (usually called after :meth:`renegotiate` or
one of :meth:`set_accept_state` or :meth:`set_accept_state`). This can
raise the same exceptions as :meth:`send` and :meth:`recv`.
:return: None. | src/OpenSSL/SSL.py | def do_handshake(self):
"""
Perform an SSL handshake (usually called after :meth:`renegotiate` or
one of :meth:`set_accept_state` or :meth:`set_accept_state`). This can
raise the same exceptions as :meth:`send` and :meth:`recv`.
:return: None.
"""
result = _lib.S... | def do_handshake(self):
"""
Perform an SSL handshake (usually called after :meth:`renegotiate` or
one of :meth:`set_accept_state` or :meth:`set_accept_state`). This can
raise the same exceptions as :meth:`send` and :meth:`recv`.
:return: None.
"""
result = _lib.S... | [
"Perform",
"an",
"SSL",
"handshake",
"(",
"usually",
"called",
"after",
":",
"meth",
":",
"renegotiate",
"or",
"one",
"of",
":",
"meth",
":",
"set_accept_state",
"or",
":",
"meth",
":",
"set_accept_state",
")",
".",
"This",
"can",
"raise",
"the",
"same",
... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1907-L1916 | [
"def",
"do_handshake",
"(",
"self",
")",
":",
"result",
"=",
"_lib",
".",
"SSL_do_handshake",
"(",
"self",
".",
"_ssl",
")",
"self",
".",
"_raise_ssl_error",
"(",
"self",
".",
"_ssl",
",",
"result",
")"
] | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.connect | Call the :meth:`connect` method of the underlying socket and set up SSL
on the socket, using the :class:`Context` object supplied to this
:class:`Connection` object at creation.
:param addr: A remote address
:return: What the socket's connect method returns | src/OpenSSL/SSL.py | def connect(self, addr):
"""
Call the :meth:`connect` method of the underlying socket and set up SSL
on the socket, using the :class:`Context` object supplied to this
:class:`Connection` object at creation.
:param addr: A remote address
:return: What the socket's connect... | def connect(self, addr):
"""
Call the :meth:`connect` method of the underlying socket and set up SSL
on the socket, using the :class:`Context` object supplied to this
:class:`Connection` object at creation.
:param addr: A remote address
:return: What the socket's connect... | [
"Call",
"the",
":",
"meth",
":",
"connect",
"method",
"of",
"the",
"underlying",
"socket",
"and",
"set",
"up",
"SSL",
"on",
"the",
"socket",
"using",
"the",
":",
"class",
":",
"Context",
"object",
"supplied",
"to",
"this",
":",
"class",
":",
"Connection"... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1937-L1947 | [
"def",
"connect",
"(",
"self",
",",
"addr",
")",
":",
"_lib",
".",
"SSL_set_connect_state",
"(",
"self",
".",
"_ssl",
")",
"return",
"self",
".",
"_socket",
".",
"connect",
"(",
"addr",
")"
] | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.connect_ex | Call the :meth:`connect_ex` method of the underlying socket and set up
SSL on the socket, using the Context object supplied to this Connection
object at creation. Note that if the :meth:`connect_ex` method of the
socket doesn't return 0, SSL won't be initialized.
:param addr: A remove a... | src/OpenSSL/SSL.py | def connect_ex(self, addr):
"""
Call the :meth:`connect_ex` method of the underlying socket and set up
SSL on the socket, using the Context object supplied to this Connection
object at creation. Note that if the :meth:`connect_ex` method of the
socket doesn't return 0, SSL won't ... | def connect_ex(self, addr):
"""
Call the :meth:`connect_ex` method of the underlying socket and set up
SSL on the socket, using the Context object supplied to this Connection
object at creation. Note that if the :meth:`connect_ex` method of the
socket doesn't return 0, SSL won't ... | [
"Call",
"the",
":",
"meth",
":",
"connect_ex",
"method",
"of",
"the",
"underlying",
"socket",
"and",
"set",
"up",
"SSL",
"on",
"the",
"socket",
"using",
"the",
"Context",
"object",
"supplied",
"to",
"this",
"Connection",
"object",
"at",
"creation",
".",
"N... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1949-L1961 | [
"def",
"connect_ex",
"(",
"self",
",",
"addr",
")",
":",
"connect_ex",
"=",
"self",
".",
"_socket",
".",
"connect_ex",
"self",
".",
"set_connect_state",
"(",
")",
"return",
"connect_ex",
"(",
"addr",
")"
] | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.accept | Call the :meth:`accept` method of the underlying socket and set up SSL
on the returned socket, using the Context object supplied to this
:class:`Connection` object at creation.
:return: A *(conn, addr)* pair where *conn* is the new
:class:`Connection` object created, and *address* i... | src/OpenSSL/SSL.py | def accept(self):
"""
Call the :meth:`accept` method of the underlying socket and set up SSL
on the returned socket, using the Context object supplied to this
:class:`Connection` object at creation.
:return: A *(conn, addr)* pair where *conn* is the new
:class:`Conne... | def accept(self):
"""
Call the :meth:`accept` method of the underlying socket and set up SSL
on the returned socket, using the Context object supplied to this
:class:`Connection` object at creation.
:return: A *(conn, addr)* pair where *conn* is the new
:class:`Conne... | [
"Call",
"the",
":",
"meth",
":",
"accept",
"method",
"of",
"the",
"underlying",
"socket",
"and",
"set",
"up",
"SSL",
"on",
"the",
"returned",
"socket",
"using",
"the",
"Context",
"object",
"supplied",
"to",
"this",
":",
"class",
":",
"Connection",
"object"... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1963-L1976 | [
"def",
"accept",
"(",
"self",
")",
":",
"client",
",",
"addr",
"=",
"self",
".",
"_socket",
".",
"accept",
"(",
")",
"conn",
"=",
"Connection",
"(",
"self",
".",
"_context",
",",
"client",
")",
"conn",
".",
"set_accept_state",
"(",
")",
"return",
"("... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.shutdown | Send the shutdown message to the Connection.
:return: True if the shutdown completed successfully (i.e. both sides
have sent closure alerts), False otherwise (in which case you
call :meth:`recv` or :meth:`send` when the connection becomes
readable/writeable). | src/OpenSSL/SSL.py | def shutdown(self):
"""
Send the shutdown message to the Connection.
:return: True if the shutdown completed successfully (i.e. both sides
have sent closure alerts), False otherwise (in which case you
call :meth:`recv` or :meth:`send` when the connection become... | def shutdown(self):
"""
Send the shutdown message to the Connection.
:return: True if the shutdown completed successfully (i.e. both sides
have sent closure alerts), False otherwise (in which case you
call :meth:`recv` or :meth:`send` when the connection become... | [
"Send",
"the",
"shutdown",
"message",
"to",
"the",
"Connection",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1991-L2006 | [
"def",
"shutdown",
"(",
"self",
")",
":",
"result",
"=",
"_lib",
".",
"SSL_shutdown",
"(",
"self",
".",
"_ssl",
")",
"if",
"result",
"<",
"0",
":",
"self",
".",
"_raise_ssl_error",
"(",
"self",
".",
"_ssl",
",",
"result",
")",
"elif",
"result",
">",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_cipher_list | Retrieve the list of ciphers used by the Connection object.
:return: A list of native cipher strings. | src/OpenSSL/SSL.py | def get_cipher_list(self):
"""
Retrieve the list of ciphers used by the Connection object.
:return: A list of native cipher strings.
"""
ciphers = []
for i in count():
result = _lib.SSL_get_cipher_list(self._ssl, i)
if result == _ffi.NULL:
... | def get_cipher_list(self):
"""
Retrieve the list of ciphers used by the Connection object.
:return: A list of native cipher strings.
"""
ciphers = []
for i in count():
result = _lib.SSL_get_cipher_list(self._ssl, i)
if result == _ffi.NULL:
... | [
"Retrieve",
"the",
"list",
"of",
"ciphers",
"used",
"by",
"the",
"Connection",
"object",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2008-L2020 | [
"def",
"get_cipher_list",
"(",
"self",
")",
":",
"ciphers",
"=",
"[",
"]",
"for",
"i",
"in",
"count",
"(",
")",
":",
"result",
"=",
"_lib",
".",
"SSL_get_cipher_list",
"(",
"self",
".",
"_ssl",
",",
"i",
")",
"if",
"result",
"==",
"_ffi",
".",
"NUL... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_client_ca_list | Get CAs whose certificates are suggested for client authentication.
:return: If this is a server connection, the list of certificate
authorities that will be sent or has been sent to the client, as
controlled by this :class:`Connection`'s :class:`Context`.
If this is a clie... | src/OpenSSL/SSL.py | def get_client_ca_list(self):
"""
Get CAs whose certificates are suggested for client authentication.
:return: If this is a server connection, the list of certificate
authorities that will be sent or has been sent to the client, as
controlled by this :class:`Connection`'... | def get_client_ca_list(self):
"""
Get CAs whose certificates are suggested for client authentication.
:return: If this is a server connection, the list of certificate
authorities that will be sent or has been sent to the client, as
controlled by this :class:`Connection`'... | [
"Get",
"CAs",
"whose",
"certificates",
"are",
"suggested",
"for",
"client",
"authentication",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2022-L2049 | [
"def",
"get_client_ca_list",
"(",
"self",
")",
":",
"ca_names",
"=",
"_lib",
".",
"SSL_get_client_CA_list",
"(",
"self",
".",
"_ssl",
")",
"if",
"ca_names",
"==",
"_ffi",
".",
"NULL",
":",
"# TODO: This is untested.",
"return",
"[",
"]",
"result",
"=",
"[",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.set_shutdown | Set the shutdown state of the Connection.
:param state: bitvector of SENT_SHUTDOWN, RECEIVED_SHUTDOWN.
:return: None | src/OpenSSL/SSL.py | def set_shutdown(self, state):
"""
Set the shutdown state of the Connection.
:param state: bitvector of SENT_SHUTDOWN, RECEIVED_SHUTDOWN.
:return: None
"""
if not isinstance(state, integer_types):
raise TypeError("state must be an integer")
_lib.SSL_... | def set_shutdown(self, state):
"""
Set the shutdown state of the Connection.
:param state: bitvector of SENT_SHUTDOWN, RECEIVED_SHUTDOWN.
:return: None
"""
if not isinstance(state, integer_types):
raise TypeError("state must be an integer")
_lib.SSL_... | [
"Set",
"the",
"shutdown",
"state",
"of",
"the",
"Connection",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2087-L2097 | [
"def",
"set_shutdown",
"(",
"self",
",",
"state",
")",
":",
"if",
"not",
"isinstance",
"(",
"state",
",",
"integer_types",
")",
":",
"raise",
"TypeError",
"(",
"\"state must be an integer\"",
")",
"_lib",
".",
"SSL_set_shutdown",
"(",
"self",
".",
"_ssl",
",... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.server_random | Retrieve the random value used with the server hello message.
:return: A string representing the state | src/OpenSSL/SSL.py | def server_random(self):
"""
Retrieve the random value used with the server hello message.
:return: A string representing the state
"""
session = _lib.SSL_get_session(self._ssl)
if session == _ffi.NULL:
return None
length = _lib.SSL_get_server_random(... | def server_random(self):
"""
Retrieve the random value used with the server hello message.
:return: A string representing the state
"""
session = _lib.SSL_get_session(self._ssl)
if session == _ffi.NULL:
return None
length = _lib.SSL_get_server_random(... | [
"Retrieve",
"the",
"random",
"value",
"used",
"with",
"the",
"server",
"hello",
"message",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2108-L2121 | [
"def",
"server_random",
"(",
"self",
")",
":",
"session",
"=",
"_lib",
".",
"SSL_get_session",
"(",
"self",
".",
"_ssl",
")",
"if",
"session",
"==",
"_ffi",
".",
"NULL",
":",
"return",
"None",
"length",
"=",
"_lib",
".",
"SSL_get_server_random",
"(",
"se... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.client_random | Retrieve the random value used with the client hello message.
:return: A string representing the state | src/OpenSSL/SSL.py | def client_random(self):
"""
Retrieve the random value used with the client hello message.
:return: A string representing the state
"""
session = _lib.SSL_get_session(self._ssl)
if session == _ffi.NULL:
return None
length = _lib.SSL_get_client_random... | def client_random(self):
"""
Retrieve the random value used with the client hello message.
:return: A string representing the state
"""
session = _lib.SSL_get_session(self._ssl)
if session == _ffi.NULL:
return None
length = _lib.SSL_get_client_random... | [
"Retrieve",
"the",
"random",
"value",
"used",
"with",
"the",
"client",
"hello",
"message",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2123-L2137 | [
"def",
"client_random",
"(",
"self",
")",
":",
"session",
"=",
"_lib",
".",
"SSL_get_session",
"(",
"self",
".",
"_ssl",
")",
"if",
"session",
"==",
"_ffi",
".",
"NULL",
":",
"return",
"None",
"length",
"=",
"_lib",
".",
"SSL_get_client_random",
"(",
"se... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.master_key | Retrieve the value of the master key for this session.
:return: A string representing the state | src/OpenSSL/SSL.py | def master_key(self):
"""
Retrieve the value of the master key for this session.
:return: A string representing the state
"""
session = _lib.SSL_get_session(self._ssl)
if session == _ffi.NULL:
return None
length = _lib.SSL_SESSION_get_master_key(sess... | def master_key(self):
"""
Retrieve the value of the master key for this session.
:return: A string representing the state
"""
session = _lib.SSL_get_session(self._ssl)
if session == _ffi.NULL:
return None
length = _lib.SSL_SESSION_get_master_key(sess... | [
"Retrieve",
"the",
"value",
"of",
"the",
"master",
"key",
"for",
"this",
"session",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2139-L2153 | [
"def",
"master_key",
"(",
"self",
")",
":",
"session",
"=",
"_lib",
".",
"SSL_get_session",
"(",
"self",
".",
"_ssl",
")",
"if",
"session",
"==",
"_ffi",
".",
"NULL",
":",
"return",
"None",
"length",
"=",
"_lib",
".",
"SSL_SESSION_get_master_key",
"(",
"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.export_keying_material | Obtain keying material for application use.
:param: label - a disambiguating label string as described in RFC 5705
:param: olen - the length of the exported key material in bytes
:param: context - a per-association context value
:return: the exported key material bytes or None | src/OpenSSL/SSL.py | def export_keying_material(self, label, olen, context=None):
"""
Obtain keying material for application use.
:param: label - a disambiguating label string as described in RFC 5705
:param: olen - the length of the exported key material in bytes
:param: context - a per-association... | def export_keying_material(self, label, olen, context=None):
"""
Obtain keying material for application use.
:param: label - a disambiguating label string as described in RFC 5705
:param: olen - the length of the exported key material in bytes
:param: context - a per-association... | [
"Obtain",
"keying",
"material",
"for",
"application",
"use",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2155-L2177 | [
"def",
"export_keying_material",
"(",
"self",
",",
"label",
",",
"olen",
",",
"context",
"=",
"None",
")",
":",
"outp",
"=",
"_no_zero_allocator",
"(",
"\"unsigned char[]\"",
",",
"olen",
")",
"context_buf",
"=",
"_ffi",
".",
"NULL",
"context_len",
"=",
"0",... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_certificate | Retrieve the local certificate (if any)
:return: The local certificate | src/OpenSSL/SSL.py | def get_certificate(self):
"""
Retrieve the local certificate (if any)
:return: The local certificate
"""
cert = _lib.SSL_get_certificate(self._ssl)
if cert != _ffi.NULL:
_lib.X509_up_ref(cert)
return X509._from_raw_x509_ptr(cert)
return N... | def get_certificate(self):
"""
Retrieve the local certificate (if any)
:return: The local certificate
"""
cert = _lib.SSL_get_certificate(self._ssl)
if cert != _ffi.NULL:
_lib.X509_up_ref(cert)
return X509._from_raw_x509_ptr(cert)
return N... | [
"Retrieve",
"the",
"local",
"certificate",
"(",
"if",
"any",
")"
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2188-L2198 | [
"def",
"get_certificate",
"(",
"self",
")",
":",
"cert",
"=",
"_lib",
".",
"SSL_get_certificate",
"(",
"self",
".",
"_ssl",
")",
"if",
"cert",
"!=",
"_ffi",
".",
"NULL",
":",
"_lib",
".",
"X509_up_ref",
"(",
"cert",
")",
"return",
"X509",
".",
"_from_r... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_peer_certificate | Retrieve the other side's certificate (if any)
:return: The peer's certificate | src/OpenSSL/SSL.py | def get_peer_certificate(self):
"""
Retrieve the other side's certificate (if any)
:return: The peer's certificate
"""
cert = _lib.SSL_get_peer_certificate(self._ssl)
if cert != _ffi.NULL:
return X509._from_raw_x509_ptr(cert)
return None | def get_peer_certificate(self):
"""
Retrieve the other side's certificate (if any)
:return: The peer's certificate
"""
cert = _lib.SSL_get_peer_certificate(self._ssl)
if cert != _ffi.NULL:
return X509._from_raw_x509_ptr(cert)
return None | [
"Retrieve",
"the",
"other",
"side",
"s",
"certificate",
"(",
"if",
"any",
")"
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2200-L2209 | [
"def",
"get_peer_certificate",
"(",
"self",
")",
":",
"cert",
"=",
"_lib",
".",
"SSL_get_peer_certificate",
"(",
"self",
".",
"_ssl",
")",
"if",
"cert",
"!=",
"_ffi",
".",
"NULL",
":",
"return",
"X509",
".",
"_from_raw_x509_ptr",
"(",
"cert",
")",
"return"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_peer_cert_chain | Retrieve the other side's certificate (if any)
:return: A list of X509 instances giving the peer's certificate chain,
or None if it does not have one. | src/OpenSSL/SSL.py | def get_peer_cert_chain(self):
"""
Retrieve the other side's certificate (if any)
:return: A list of X509 instances giving the peer's certificate chain,
or None if it does not have one.
"""
cert_stack = _lib.SSL_get_peer_cert_chain(self._ssl)
if cert_sta... | def get_peer_cert_chain(self):
"""
Retrieve the other side's certificate (if any)
:return: A list of X509 instances giving the peer's certificate chain,
or None if it does not have one.
"""
cert_stack = _lib.SSL_get_peer_cert_chain(self._ssl)
if cert_sta... | [
"Retrieve",
"the",
"other",
"side",
"s",
"certificate",
"(",
"if",
"any",
")"
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2211-L2228 | [
"def",
"get_peer_cert_chain",
"(",
"self",
")",
":",
"cert_stack",
"=",
"_lib",
".",
"SSL_get_peer_cert_chain",
"(",
"self",
".",
"_ssl",
")",
"if",
"cert_stack",
"==",
"_ffi",
".",
"NULL",
":",
"return",
"None",
"result",
"=",
"[",
"]",
"for",
"i",
"in"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_session | Returns the Session currently used.
:return: An instance of :class:`OpenSSL.SSL.Session` or
:obj:`None` if no session exists.
.. versionadded:: 0.14 | src/OpenSSL/SSL.py | def get_session(self):
"""
Returns the Session currently used.
:return: An instance of :class:`OpenSSL.SSL.Session` or
:obj:`None` if no session exists.
.. versionadded:: 0.14
"""
session = _lib.SSL_get1_session(self._ssl)
if session == _ffi.NULL:
... | def get_session(self):
"""
Returns the Session currently used.
:return: An instance of :class:`OpenSSL.SSL.Session` or
:obj:`None` if no session exists.
.. versionadded:: 0.14
"""
session = _lib.SSL_get1_session(self._ssl)
if session == _ffi.NULL:
... | [
"Returns",
"the",
"Session",
"currently",
"used",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2266-L2281 | [
"def",
"get_session",
"(",
"self",
")",
":",
"session",
"=",
"_lib",
".",
"SSL_get1_session",
"(",
"self",
".",
"_ssl",
")",
"if",
"session",
"==",
"_ffi",
".",
"NULL",
":",
"return",
"None",
"pysession",
"=",
"Session",
".",
"__new__",
"(",
"Session",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.set_session | Set the session to be used when the TLS/SSL connection is established.
:param session: A Session instance representing the session to use.
:returns: None
.. versionadded:: 0.14 | src/OpenSSL/SSL.py | def set_session(self, session):
"""
Set the session to be used when the TLS/SSL connection is established.
:param session: A Session instance representing the session to use.
:returns: None
.. versionadded:: 0.14
"""
if not isinstance(session, Session):
... | def set_session(self, session):
"""
Set the session to be used when the TLS/SSL connection is established.
:param session: A Session instance representing the session to use.
:returns: None
.. versionadded:: 0.14
"""
if not isinstance(session, Session):
... | [
"Set",
"the",
"session",
"to",
"be",
"used",
"when",
"the",
"TLS",
"/",
"SSL",
"connection",
"is",
"established",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2283-L2297 | [
"def",
"set_session",
"(",
"self",
",",
"session",
")",
":",
"if",
"not",
"isinstance",
"(",
"session",
",",
"Session",
")",
":",
"raise",
"TypeError",
"(",
"\"session must be a Session instance\"",
")",
"result",
"=",
"_lib",
".",
"SSL_set_session",
"(",
"sel... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection._get_finished_message | Helper to implement :meth:`get_finished` and
:meth:`get_peer_finished`.
:param function: Either :data:`SSL_get_finished`: or
:data:`SSL_get_peer_finished`.
:return: :data:`None` if the desired message has not yet been
received, otherwise the contents of the message.
... | src/OpenSSL/SSL.py | def _get_finished_message(self, function):
"""
Helper to implement :meth:`get_finished` and
:meth:`get_peer_finished`.
:param function: Either :data:`SSL_get_finished`: or
:data:`SSL_get_peer_finished`.
:return: :data:`None` if the desired message has not yet been
... | def _get_finished_message(self, function):
"""
Helper to implement :meth:`get_finished` and
:meth:`get_peer_finished`.
:param function: Either :data:`SSL_get_finished`: or
:data:`SSL_get_peer_finished`.
:return: :data:`None` if the desired message has not yet been
... | [
"Helper",
"to",
"implement",
":",
"meth",
":",
"get_finished",
"and",
":",
"meth",
":",
"get_peer_finished",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2299-L2331 | [
"def",
"_get_finished_message",
"(",
"self",
",",
"function",
")",
":",
"# The OpenSSL documentation says nothing about what might happen if the",
"# count argument given is zero. Specifically, it doesn't say whether",
"# the output buffer may be NULL in that case or not. Inspection of the",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_cipher_name | Obtain the name of the currently used cipher.
:returns: The name of the currently used cipher or :obj:`None`
if no connection has been established.
:rtype: :class:`unicode` or :class:`NoneType`
.. versionadded:: 0.15 | src/OpenSSL/SSL.py | def get_cipher_name(self):
"""
Obtain the name of the currently used cipher.
:returns: The name of the currently used cipher or :obj:`None`
if no connection has been established.
:rtype: :class:`unicode` or :class:`NoneType`
.. versionadded:: 0.15
"""
... | def get_cipher_name(self):
"""
Obtain the name of the currently used cipher.
:returns: The name of the currently used cipher or :obj:`None`
if no connection has been established.
:rtype: :class:`unicode` or :class:`NoneType`
.. versionadded:: 0.15
"""
... | [
"Obtain",
"the",
"name",
"of",
"the",
"currently",
"used",
"cipher",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2357-L2372 | [
"def",
"get_cipher_name",
"(",
"self",
")",
":",
"cipher",
"=",
"_lib",
".",
"SSL_get_current_cipher",
"(",
"self",
".",
"_ssl",
")",
"if",
"cipher",
"==",
"_ffi",
".",
"NULL",
":",
"return",
"None",
"else",
":",
"name",
"=",
"_ffi",
".",
"string",
"("... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_cipher_bits | Obtain the number of secret bits of the currently used cipher.
:returns: The number of secret bits of the currently used cipher
or :obj:`None` if no connection has been established.
:rtype: :class:`int` or :class:`NoneType`
.. versionadded:: 0.15 | src/OpenSSL/SSL.py | def get_cipher_bits(self):
"""
Obtain the number of secret bits of the currently used cipher.
:returns: The number of secret bits of the currently used cipher
or :obj:`None` if no connection has been established.
:rtype: :class:`int` or :class:`NoneType`
.. versiona... | def get_cipher_bits(self):
"""
Obtain the number of secret bits of the currently used cipher.
:returns: The number of secret bits of the currently used cipher
or :obj:`None` if no connection has been established.
:rtype: :class:`int` or :class:`NoneType`
.. versiona... | [
"Obtain",
"the",
"number",
"of",
"secret",
"bits",
"of",
"the",
"currently",
"used",
"cipher",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2374-L2388 | [
"def",
"get_cipher_bits",
"(",
"self",
")",
":",
"cipher",
"=",
"_lib",
".",
"SSL_get_current_cipher",
"(",
"self",
".",
"_ssl",
")",
"if",
"cipher",
"==",
"_ffi",
".",
"NULL",
":",
"return",
"None",
"else",
":",
"return",
"_lib",
".",
"SSL_CIPHER_get_bits... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_cipher_version | Obtain the protocol version of the currently used cipher.
:returns: The protocol name of the currently used cipher
or :obj:`None` if no connection has been established.
:rtype: :class:`unicode` or :class:`NoneType`
.. versionadded:: 0.15 | src/OpenSSL/SSL.py | def get_cipher_version(self):
"""
Obtain the protocol version of the currently used cipher.
:returns: The protocol name of the currently used cipher
or :obj:`None` if no connection has been established.
:rtype: :class:`unicode` or :class:`NoneType`
.. versionadded::... | def get_cipher_version(self):
"""
Obtain the protocol version of the currently used cipher.
:returns: The protocol name of the currently used cipher
or :obj:`None` if no connection has been established.
:rtype: :class:`unicode` or :class:`NoneType`
.. versionadded::... | [
"Obtain",
"the",
"protocol",
"version",
"of",
"the",
"currently",
"used",
"cipher",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2390-L2405 | [
"def",
"get_cipher_version",
"(",
"self",
")",
":",
"cipher",
"=",
"_lib",
".",
"SSL_get_current_cipher",
"(",
"self",
".",
"_ssl",
")",
"if",
"cipher",
"==",
"_ffi",
".",
"NULL",
":",
"return",
"None",
"else",
":",
"version",
"=",
"_ffi",
".",
"string",... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_protocol_version_name | Retrieve the protocol version of the current connection.
:returns: The TLS version of the current connection, for example
the value for TLS 1.2 would be ``TLSv1.2``or ``Unknown``
for connections that were not successfully established.
:rtype: :class:`unicode` | src/OpenSSL/SSL.py | def get_protocol_version_name(self):
"""
Retrieve the protocol version of the current connection.
:returns: The TLS version of the current connection, for example
the value for TLS 1.2 would be ``TLSv1.2``or ``Unknown``
for connections that were not successfully establis... | def get_protocol_version_name(self):
"""
Retrieve the protocol version of the current connection.
:returns: The TLS version of the current connection, for example
the value for TLS 1.2 would be ``TLSv1.2``or ``Unknown``
for connections that were not successfully establis... | [
"Retrieve",
"the",
"protocol",
"version",
"of",
"the",
"current",
"connection",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2407-L2417 | [
"def",
"get_protocol_version_name",
"(",
"self",
")",
":",
"version",
"=",
"_ffi",
".",
"string",
"(",
"_lib",
".",
"SSL_get_version",
"(",
"self",
".",
"_ssl",
")",
")",
"return",
"version",
".",
"decode",
"(",
"\"utf-8\"",
")"
] | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_next_proto_negotiated | Get the protocol that was negotiated by NPN.
:returns: A bytestring of the protocol name. If no protocol has been
negotiated yet, returns an empty string.
.. versionadded:: 0.15 | src/OpenSSL/SSL.py | def get_next_proto_negotiated(self):
"""
Get the protocol that was negotiated by NPN.
:returns: A bytestring of the protocol name. If no protocol has been
negotiated yet, returns an empty string.
.. versionadded:: 0.15
"""
_warn_npn()
data = _ffi.ne... | def get_next_proto_negotiated(self):
"""
Get the protocol that was negotiated by NPN.
:returns: A bytestring of the protocol name. If no protocol has been
negotiated yet, returns an empty string.
.. versionadded:: 0.15
"""
_warn_npn()
data = _ffi.ne... | [
"Get",
"the",
"protocol",
"that",
"was",
"negotiated",
"by",
"NPN",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2431-L2446 | [
"def",
"get_next_proto_negotiated",
"(",
"self",
")",
":",
"_warn_npn",
"(",
")",
"data",
"=",
"_ffi",
".",
"new",
"(",
"\"unsigned char **\"",
")",
"data_len",
"=",
"_ffi",
".",
"new",
"(",
"\"unsigned int *\"",
")",
"_lib",
".",
"SSL_get0_next_proto_negotiated... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.set_alpn_protos | Specify the client's ALPN protocol list.
These protocols are offered to the server during protocol negotiation.
:param protos: A list of the protocols to be offered to the server.
This list should be a Python list of bytestrings representing the
protocols to offer, e.g. ``[b'ht... | src/OpenSSL/SSL.py | def set_alpn_protos(self, protos):
"""
Specify the client's ALPN protocol list.
These protocols are offered to the server during protocol negotiation.
:param protos: A list of the protocols to be offered to the server.
This list should be a Python list of bytestrings repres... | def set_alpn_protos(self, protos):
"""
Specify the client's ALPN protocol list.
These protocols are offered to the server during protocol negotiation.
:param protos: A list of the protocols to be offered to the server.
This list should be a Python list of bytestrings repres... | [
"Specify",
"the",
"client",
"s",
"ALPN",
"protocol",
"list",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2449-L2468 | [
"def",
"set_alpn_protos",
"(",
"self",
",",
"protos",
")",
":",
"# Take the list of protocols and join them together, prefixing them",
"# with their lengths.",
"protostr",
"=",
"b''",
".",
"join",
"(",
"chain",
".",
"from_iterable",
"(",
"(",
"int2byte",
"(",
"len",
"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.get_alpn_proto_negotiated | Get the protocol that was negotiated by ALPN.
:returns: A bytestring of the protocol name. If no protocol has been
negotiated yet, returns an empty string. | src/OpenSSL/SSL.py | def get_alpn_proto_negotiated(self):
"""
Get the protocol that was negotiated by ALPN.
:returns: A bytestring of the protocol name. If no protocol has been
negotiated yet, returns an empty string.
"""
data = _ffi.new("unsigned char **")
data_len = _ffi.new("... | def get_alpn_proto_negotiated(self):
"""
Get the protocol that was negotiated by ALPN.
:returns: A bytestring of the protocol name. If no protocol has been
negotiated yet, returns an empty string.
"""
data = _ffi.new("unsigned char **")
data_len = _ffi.new("... | [
"Get",
"the",
"protocol",
"that",
"was",
"negotiated",
"by",
"ALPN",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2471-L2486 | [
"def",
"get_alpn_proto_negotiated",
"(",
"self",
")",
":",
"data",
"=",
"_ffi",
".",
"new",
"(",
"\"unsigned char **\"",
")",
"data_len",
"=",
"_ffi",
".",
"new",
"(",
"\"unsigned int *\"",
")",
"_lib",
".",
"SSL_get0_alpn_selected",
"(",
"self",
".",
"_ssl",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | Connection.request_ocsp | Called to request that the server sends stapled OCSP data, if
available. If this is not called on the client side then the server
will not send OCSP data. Should be used in conjunction with
:meth:`Context.set_ocsp_client_callback`. | src/OpenSSL/SSL.py | def request_ocsp(self):
"""
Called to request that the server sends stapled OCSP data, if
available. If this is not called on the client side then the server
will not send OCSP data. Should be used in conjunction with
:meth:`Context.set_ocsp_client_callback`.
"""
... | def request_ocsp(self):
"""
Called to request that the server sends stapled OCSP data, if
available. If this is not called on the client side then the server
will not send OCSP data. Should be used in conjunction with
:meth:`Context.set_ocsp_client_callback`.
"""
... | [
"Called",
"to",
"request",
"that",
"the",
"server",
"sends",
"stapled",
"OCSP",
"data",
"if",
"available",
".",
"If",
"this",
"is",
"not",
"called",
"on",
"the",
"client",
"side",
"then",
"the",
"server",
"will",
"not",
"send",
"OCSP",
"data",
".",
"Shou... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L2488-L2498 | [
"def",
"request_ocsp",
"(",
"self",
")",
":",
"rc",
"=",
"_lib",
".",
"SSL_set_tlsext_status_type",
"(",
"self",
".",
"_ssl",
",",
"_lib",
".",
"TLSEXT_STATUSTYPE_ocsp",
")",
"_openssl_assert",
"(",
"rc",
"==",
"1",
")"
] | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | _new_mem_buf | Allocate a new OpenSSL memory BIO.
Arrange for the garbage collector to clean it up automatically.
:param buffer: None or some bytes to use to put into the BIO so that they
can be read out. | src/OpenSSL/crypto.py | def _new_mem_buf(buffer=None):
"""
Allocate a new OpenSSL memory BIO.
Arrange for the garbage collector to clean it up automatically.
:param buffer: None or some bytes to use to put into the BIO so that they
can be read out.
"""
if buffer is None:
bio = _lib.BIO_new(_lib.BIO_s_... | def _new_mem_buf(buffer=None):
"""
Allocate a new OpenSSL memory BIO.
Arrange for the garbage collector to clean it up automatically.
:param buffer: None or some bytes to use to put into the BIO so that they
can be read out.
"""
if buffer is None:
bio = _lib.BIO_new(_lib.BIO_s_... | [
"Allocate",
"a",
"new",
"OpenSSL",
"memory",
"BIO",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L108-L131 | [
"def",
"_new_mem_buf",
"(",
"buffer",
"=",
"None",
")",
":",
"if",
"buffer",
"is",
"None",
":",
"bio",
"=",
"_lib",
".",
"BIO_new",
"(",
"_lib",
".",
"BIO_s_mem",
"(",
")",
")",
"free",
"=",
"_lib",
".",
"BIO_free",
"else",
":",
"data",
"=",
"_ffi"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | _bio_to_string | Copy the contents of an OpenSSL BIO object into a Python byte string. | src/OpenSSL/crypto.py | def _bio_to_string(bio):
"""
Copy the contents of an OpenSSL BIO object into a Python byte string.
"""
result_buffer = _ffi.new('char**')
buffer_length = _lib.BIO_get_mem_data(bio, result_buffer)
return _ffi.buffer(result_buffer[0], buffer_length)[:] | def _bio_to_string(bio):
"""
Copy the contents of an OpenSSL BIO object into a Python byte string.
"""
result_buffer = _ffi.new('char**')
buffer_length = _lib.BIO_get_mem_data(bio, result_buffer)
return _ffi.buffer(result_buffer[0], buffer_length)[:] | [
"Copy",
"the",
"contents",
"of",
"an",
"OpenSSL",
"BIO",
"object",
"into",
"a",
"Python",
"byte",
"string",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L134-L140 | [
"def",
"_bio_to_string",
"(",
"bio",
")",
":",
"result_buffer",
"=",
"_ffi",
".",
"new",
"(",
"'char**'",
")",
"buffer_length",
"=",
"_lib",
".",
"BIO_get_mem_data",
"(",
"bio",
",",
"result_buffer",
")",
"return",
"_ffi",
".",
"buffer",
"(",
"result_buffer"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | _set_asn1_time | The the time value of an ASN1 time object.
@param boundary: An ASN1_TIME pointer (or an object safely
castable to that type) which will have its value set.
@param when: A string representation of the desired time value.
@raise TypeError: If C{when} is not a L{bytes} string.
@raise ValueError: ... | src/OpenSSL/crypto.py | def _set_asn1_time(boundary, when):
"""
The the time value of an ASN1 time object.
@param boundary: An ASN1_TIME pointer (or an object safely
castable to that type) which will have its value set.
@param when: A string representation of the desired time value.
@raise TypeError: If C{when} i... | def _set_asn1_time(boundary, when):
"""
The the time value of an ASN1 time object.
@param boundary: An ASN1_TIME pointer (or an object safely
castable to that type) which will have its value set.
@param when: A string representation of the desired time value.
@raise TypeError: If C{when} i... | [
"The",
"the",
"time",
"value",
"of",
"an",
"ASN1",
"time",
"object",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L143-L162 | [
"def",
"_set_asn1_time",
"(",
"boundary",
",",
"when",
")",
":",
"if",
"not",
"isinstance",
"(",
"when",
",",
"bytes",
")",
":",
"raise",
"TypeError",
"(",
"\"when must be a byte string\"",
")",
"set_result",
"=",
"_lib",
".",
"ASN1_TIME_set_string",
"(",
"bou... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | _get_asn1_time | Retrieve the time value of an ASN1 time object.
@param timestamp: An ASN1_GENERALIZEDTIME* (or an object safely castable to
that type) from which the time value will be retrieved.
@return: The time value from C{timestamp} as a L{bytes} string in a certain
format. Or C{None} if the object cont... | src/OpenSSL/crypto.py | def _get_asn1_time(timestamp):
"""
Retrieve the time value of an ASN1 time object.
@param timestamp: An ASN1_GENERALIZEDTIME* (or an object safely castable to
that type) from which the time value will be retrieved.
@return: The time value from C{timestamp} as a L{bytes} string in a certain
... | def _get_asn1_time(timestamp):
"""
Retrieve the time value of an ASN1 time object.
@param timestamp: An ASN1_GENERALIZEDTIME* (or an object safely castable to
that type) from which the time value will be retrieved.
@return: The time value from C{timestamp} as a L{bytes} string in a certain
... | [
"Retrieve",
"the",
"time",
"value",
"of",
"an",
"ASN1",
"time",
"object",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L165-L202 | [
"def",
"_get_asn1_time",
"(",
"timestamp",
")",
":",
"string_timestamp",
"=",
"_ffi",
".",
"cast",
"(",
"'ASN1_STRING*'",
",",
"timestamp",
")",
"if",
"_lib",
".",
"ASN1_STRING_length",
"(",
"string_timestamp",
")",
"==",
"0",
":",
"return",
"None",
"elif",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | get_elliptic_curve | Return a single curve object selected by name.
See :py:func:`get_elliptic_curves` for information about curve objects.
:param name: The OpenSSL short name identifying the curve object to
retrieve.
:type name: :py:class:`unicode`
If the named curve is not supported then :py:class:`ValueError` ... | src/OpenSSL/crypto.py | def get_elliptic_curve(name):
"""
Return a single curve object selected by name.
See :py:func:`get_elliptic_curves` for information about curve objects.
:param name: The OpenSSL short name identifying the curve object to
retrieve.
:type name: :py:class:`unicode`
If the named curve is ... | def get_elliptic_curve(name):
"""
Return a single curve object selected by name.
See :py:func:`get_elliptic_curves` for information about curve objects.
:param name: The OpenSSL short name identifying the curve object to
retrieve.
:type name: :py:class:`unicode`
If the named curve is ... | [
"Return",
"a",
"single",
"curve",
"object",
"selected",
"by",
"name",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L490-L505 | [
"def",
"get_elliptic_curve",
"(",
"name",
")",
":",
"for",
"curve",
"in",
"get_elliptic_curves",
"(",
")",
":",
"if",
"curve",
".",
"name",
"==",
"name",
":",
"return",
"curve",
"raise",
"ValueError",
"(",
"\"unknown curve name\"",
",",
"name",
")"
] | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | load_certificate | Load a certificate (X509) from the string *buffer* encoded with the
type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param bytes buffer: The buffer the certificate is stored in
:return: The X509 object | src/OpenSSL/crypto.py | def load_certificate(type, buffer):
"""
Load a certificate (X509) from the string *buffer* encoded with the
type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param bytes buffer: The buffer the certificate is stored in
:return: The X509 object
"""
if isinsta... | def load_certificate(type, buffer):
"""
Load a certificate (X509) from the string *buffer* encoded with the
type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param bytes buffer: The buffer the certificate is stored in
:return: The X509 object
"""
if isinsta... | [
"Load",
"a",
"certificate",
"(",
"X509",
")",
"from",
"the",
"string",
"*",
"buffer",
"*",
"encoded",
"with",
"the",
"type",
"*",
"type",
"*",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1769-L1796 | [
"def",
"load_certificate",
"(",
"type",
",",
"buffer",
")",
":",
"if",
"isinstance",
"(",
"buffer",
",",
"_text_type",
")",
":",
"buffer",
"=",
"buffer",
".",
"encode",
"(",
"\"ascii\"",
")",
"bio",
"=",
"_new_mem_buf",
"(",
"buffer",
")",
"if",
"type",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | dump_certificate | Dump the certificate *cert* into a buffer string encoded with the type
*type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1, or
FILETYPE_TEXT)
:param cert: The certificate to dump
:return: The buffer with the dumped certificate in | src/OpenSSL/crypto.py | def dump_certificate(type, cert):
"""
Dump the certificate *cert* into a buffer string encoded with the type
*type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1, or
FILETYPE_TEXT)
:param cert: The certificate to dump
:return: The buffer with the dumped certificate in
... | def dump_certificate(type, cert):
"""
Dump the certificate *cert* into a buffer string encoded with the type
*type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1, or
FILETYPE_TEXT)
:param cert: The certificate to dump
:return: The buffer with the dumped certificate in
... | [
"Dump",
"the",
"certificate",
"*",
"cert",
"*",
"into",
"a",
"buffer",
"string",
"encoded",
"with",
"the",
"type",
"*",
"type",
"*",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1799-L1823 | [
"def",
"dump_certificate",
"(",
"type",
",",
"cert",
")",
":",
"bio",
"=",
"_new_mem_buf",
"(",
")",
"if",
"type",
"==",
"FILETYPE_PEM",
":",
"result_code",
"=",
"_lib",
".",
"PEM_write_bio_X509",
"(",
"bio",
",",
"cert",
".",
"_x509",
")",
"elif",
"type... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | dump_publickey | Dump a public key to a buffer.
:param type: The file type (one of :data:`FILETYPE_PEM` or
:data:`FILETYPE_ASN1`).
:param PKey pkey: The public key to dump
:return: The buffer with the dumped key in it.
:rtype: bytes | src/OpenSSL/crypto.py | def dump_publickey(type, pkey):
"""
Dump a public key to a buffer.
:param type: The file type (one of :data:`FILETYPE_PEM` or
:data:`FILETYPE_ASN1`).
:param PKey pkey: The public key to dump
:return: The buffer with the dumped key in it.
:rtype: bytes
"""
bio = _new_mem_buf()
... | def dump_publickey(type, pkey):
"""
Dump a public key to a buffer.
:param type: The file type (one of :data:`FILETYPE_PEM` or
:data:`FILETYPE_ASN1`).
:param PKey pkey: The public key to dump
:return: The buffer with the dumped key in it.
:rtype: bytes
"""
bio = _new_mem_buf()
... | [
"Dump",
"a",
"public",
"key",
"to",
"a",
"buffer",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1826-L1848 | [
"def",
"dump_publickey",
"(",
"type",
",",
"pkey",
")",
":",
"bio",
"=",
"_new_mem_buf",
"(",
")",
"if",
"type",
"==",
"FILETYPE_PEM",
":",
"write_bio",
"=",
"_lib",
".",
"PEM_write_bio_PUBKEY",
"elif",
"type",
"==",
"FILETYPE_ASN1",
":",
"write_bio",
"=",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | dump_privatekey | Dump the private key *pkey* into a buffer string encoded with the type
*type*. Optionally (if *type* is :const:`FILETYPE_PEM`) encrypting it
using *cipher* and *passphrase*.
:param type: The file type (one of :const:`FILETYPE_PEM`,
:const:`FILETYPE_ASN1`, or :const:`FILETYPE_TEXT`)
:param PKey... | src/OpenSSL/crypto.py | def dump_privatekey(type, pkey, cipher=None, passphrase=None):
"""
Dump the private key *pkey* into a buffer string encoded with the type
*type*. Optionally (if *type* is :const:`FILETYPE_PEM`) encrypting it
using *cipher* and *passphrase*.
:param type: The file type (one of :const:`FILETYPE_PEM`,... | def dump_privatekey(type, pkey, cipher=None, passphrase=None):
"""
Dump the private key *pkey* into a buffer string encoded with the type
*type*. Optionally (if *type* is :const:`FILETYPE_PEM`) encrypting it
using *cipher* and *passphrase*.
:param type: The file type (one of :const:`FILETYPE_PEM`,... | [
"Dump",
"the",
"private",
"key",
"*",
"pkey",
"*",
"into",
"a",
"buffer",
"string",
"encoded",
"with",
"the",
"type",
"*",
"type",
"*",
".",
"Optionally",
"(",
"if",
"*",
"type",
"*",
"is",
":",
"const",
":",
"FILETYPE_PEM",
")",
"encrypting",
"it",
... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1851-L1907 | [
"def",
"dump_privatekey",
"(",
"type",
",",
"pkey",
",",
"cipher",
"=",
"None",
",",
"passphrase",
"=",
"None",
")",
":",
"bio",
"=",
"_new_mem_buf",
"(",
")",
"if",
"not",
"isinstance",
"(",
"pkey",
",",
"PKey",
")",
":",
"raise",
"TypeError",
"(",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | load_publickey | Load a public key from a buffer.
:param type: The file type (one of :data:`FILETYPE_PEM`,
:data:`FILETYPE_ASN1`).
:param buffer: The buffer the key is stored in.
:type buffer: A Python string object, either unicode or bytestring.
:return: The PKey object.
:rtype: :class:`PKey` | src/OpenSSL/crypto.py | def load_publickey(type, buffer):
"""
Load a public key from a buffer.
:param type: The file type (one of :data:`FILETYPE_PEM`,
:data:`FILETYPE_ASN1`).
:param buffer: The buffer the key is stored in.
:type buffer: A Python string object, either unicode or bytestring.
:return: The PKey o... | def load_publickey(type, buffer):
"""
Load a public key from a buffer.
:param type: The file type (one of :data:`FILETYPE_PEM`,
:data:`FILETYPE_ASN1`).
:param buffer: The buffer the key is stored in.
:type buffer: A Python string object, either unicode or bytestring.
:return: The PKey o... | [
"Load",
"a",
"public",
"key",
"from",
"a",
"buffer",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2677-L2707 | [
"def",
"load_publickey",
"(",
"type",
",",
"buffer",
")",
":",
"if",
"isinstance",
"(",
"buffer",
",",
"_text_type",
")",
":",
"buffer",
"=",
"buffer",
".",
"encode",
"(",
"\"ascii\"",
")",
"bio",
"=",
"_new_mem_buf",
"(",
"buffer",
")",
"if",
"type",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | load_privatekey | Load a private key (PKey) from the string *buffer* encoded with the type
*type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param buffer: The buffer the key is stored in
:param passphrase: (optional) if encrypted PEM format, this can be
either the passphrase... | src/OpenSSL/crypto.py | def load_privatekey(type, buffer, passphrase=None):
"""
Load a private key (PKey) from the string *buffer* encoded with the type
*type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param buffer: The buffer the key is stored in
:param passphrase: (optional) if encrypted PEM ... | def load_privatekey(type, buffer, passphrase=None):
"""
Load a private key (PKey) from the string *buffer* encoded with the type
*type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param buffer: The buffer the key is stored in
:param passphrase: (optional) if encrypted PEM ... | [
"Load",
"a",
"private",
"key",
"(",
"PKey",
")",
"from",
"the",
"string",
"*",
"buffer",
"*",
"encoded",
"with",
"the",
"type",
"*",
"type",
"*",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2710-L2743 | [
"def",
"load_privatekey",
"(",
"type",
",",
"buffer",
",",
"passphrase",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"buffer",
",",
"_text_type",
")",
":",
"buffer",
"=",
"buffer",
".",
"encode",
"(",
"\"ascii\"",
")",
"bio",
"=",
"_new_mem_buf",
"("... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | dump_certificate_request | Dump the certificate request *req* into a buffer string encoded with the
type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param req: The certificate request to dump
:return: The buffer with the dumped certificate request in | src/OpenSSL/crypto.py | def dump_certificate_request(type, req):
"""
Dump the certificate request *req* into a buffer string encoded with the
type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param req: The certificate request to dump
:return: The buffer with the dumped certificate request ... | def dump_certificate_request(type, req):
"""
Dump the certificate request *req* into a buffer string encoded with the
type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param req: The certificate request to dump
:return: The buffer with the dumped certificate request ... | [
"Dump",
"the",
"certificate",
"request",
"*",
"req",
"*",
"into",
"a",
"buffer",
"string",
"encoded",
"with",
"the",
"type",
"*",
"type",
"*",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2746-L2771 | [
"def",
"dump_certificate_request",
"(",
"type",
",",
"req",
")",
":",
"bio",
"=",
"_new_mem_buf",
"(",
")",
"if",
"type",
"==",
"FILETYPE_PEM",
":",
"result_code",
"=",
"_lib",
".",
"PEM_write_bio_X509_REQ",
"(",
"bio",
",",
"req",
".",
"_req",
")",
"elif"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | load_certificate_request | Load a certificate request (X509Req) from the string *buffer* encoded with
the type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param buffer: The buffer the certificate request is stored in
:return: The X509Req object | src/OpenSSL/crypto.py | def load_certificate_request(type, buffer):
"""
Load a certificate request (X509Req) from the string *buffer* encoded with
the type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param buffer: The buffer the certificate request is stored in
:return: The X509Req object
... | def load_certificate_request(type, buffer):
"""
Load a certificate request (X509Req) from the string *buffer* encoded with
the type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param buffer: The buffer the certificate request is stored in
:return: The X509Req object
... | [
"Load",
"a",
"certificate",
"request",
"(",
"X509Req",
")",
"from",
"the",
"string",
"*",
"buffer",
"*",
"encoded",
"with",
"the",
"type",
"*",
"type",
"*",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2774-L2799 | [
"def",
"load_certificate_request",
"(",
"type",
",",
"buffer",
")",
":",
"if",
"isinstance",
"(",
"buffer",
",",
"_text_type",
")",
":",
"buffer",
"=",
"buffer",
".",
"encode",
"(",
"\"ascii\"",
")",
"bio",
"=",
"_new_mem_buf",
"(",
"buffer",
")",
"if",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | sign | Sign a data string using the given key and message digest.
:param pkey: PKey to sign with
:param data: data to be signed
:param digest: message digest to use
:return: signature
.. versionadded:: 0.11 | src/OpenSSL/crypto.py | def sign(pkey, data, digest):
"""
Sign a data string using the given key and message digest.
:param pkey: PKey to sign with
:param data: data to be signed
:param digest: message digest to use
:return: signature
.. versionadded:: 0.11
"""
data = _text_to_bytes_and_warn("data", data)... | def sign(pkey, data, digest):
"""
Sign a data string using the given key and message digest.
:param pkey: PKey to sign with
:param data: data to be signed
:param digest: message digest to use
:return: signature
.. versionadded:: 0.11
"""
data = _text_to_bytes_and_warn("data", data)... | [
"Sign",
"a",
"data",
"string",
"using",
"the",
"given",
"key",
"and",
"message",
"digest",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2802-L2833 | [
"def",
"sign",
"(",
"pkey",
",",
"data",
",",
"digest",
")",
":",
"data",
"=",
"_text_to_bytes_and_warn",
"(",
"\"data\"",
",",
"data",
")",
"digest_obj",
"=",
"_lib",
".",
"EVP_get_digestbyname",
"(",
"_byte_string",
"(",
"digest",
")",
")",
"if",
"digest... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | verify | Verify the signature for a data string.
:param cert: signing certificate (X509 object) corresponding to the
private key which generated the signature.
:param signature: signature returned by sign function
:param data: data to be verified
:param digest: message digest to use
:return: ``None`... | src/OpenSSL/crypto.py | def verify(cert, signature, data, digest):
"""
Verify the signature for a data string.
:param cert: signing certificate (X509 object) corresponding to the
private key which generated the signature.
:param signature: signature returned by sign function
:param data: data to be verified
:p... | def verify(cert, signature, data, digest):
"""
Verify the signature for a data string.
:param cert: signing certificate (X509 object) corresponding to the
private key which generated the signature.
:param signature: signature returned by sign function
:param data: data to be verified
:p... | [
"Verify",
"the",
"signature",
"for",
"a",
"data",
"string",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2836-L2869 | [
"def",
"verify",
"(",
"cert",
",",
"signature",
",",
"data",
",",
"digest",
")",
":",
"data",
"=",
"_text_to_bytes_and_warn",
"(",
"\"data\"",
",",
"data",
")",
"digest_obj",
"=",
"_lib",
".",
"EVP_get_digestbyname",
"(",
"_byte_string",
"(",
"digest",
")",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | dump_crl | Dump a certificate revocation list to a buffer.
:param type: The file type (one of ``FILETYPE_PEM``, ``FILETYPE_ASN1``, or
``FILETYPE_TEXT``).
:param CRL crl: The CRL to dump.
:return: The buffer with the CRL.
:rtype: bytes | src/OpenSSL/crypto.py | def dump_crl(type, crl):
"""
Dump a certificate revocation list to a buffer.
:param type: The file type (one of ``FILETYPE_PEM``, ``FILETYPE_ASN1``, or
``FILETYPE_TEXT``).
:param CRL crl: The CRL to dump.
:return: The buffer with the CRL.
:rtype: bytes
"""
bio = _new_mem_buf()
... | def dump_crl(type, crl):
"""
Dump a certificate revocation list to a buffer.
:param type: The file type (one of ``FILETYPE_PEM``, ``FILETYPE_ASN1``, or
``FILETYPE_TEXT``).
:param CRL crl: The CRL to dump.
:return: The buffer with the CRL.
:rtype: bytes
"""
bio = _new_mem_buf()
... | [
"Dump",
"a",
"certificate",
"revocation",
"list",
"to",
"a",
"buffer",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2872-L2897 | [
"def",
"dump_crl",
"(",
"type",
",",
"crl",
")",
":",
"bio",
"=",
"_new_mem_buf",
"(",
")",
"if",
"type",
"==",
"FILETYPE_PEM",
":",
"ret",
"=",
"_lib",
".",
"PEM_write_bio_X509_CRL",
"(",
"bio",
",",
"crl",
".",
"_crl",
")",
"elif",
"type",
"==",
"F... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | load_crl | Load Certificate Revocation List (CRL) data from a string *buffer*.
*buffer* encoded with the type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param buffer: The buffer the CRL is stored in
:return: The PKey object | src/OpenSSL/crypto.py | def load_crl(type, buffer):
"""
Load Certificate Revocation List (CRL) data from a string *buffer*.
*buffer* encoded with the type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param buffer: The buffer the CRL is stored in
:return: The PKey object
"""
if isin... | def load_crl(type, buffer):
"""
Load Certificate Revocation List (CRL) data from a string *buffer*.
*buffer* encoded with the type *type*.
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
:param buffer: The buffer the CRL is stored in
:return: The PKey object
"""
if isin... | [
"Load",
"Certificate",
"Revocation",
"List",
"(",
"CRL",
")",
"data",
"from",
"a",
"string",
"*",
"buffer",
"*",
".",
"*",
"buffer",
"*",
"encoded",
"with",
"the",
"type",
"*",
"type",
"*",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2900-L2927 | [
"def",
"load_crl",
"(",
"type",
",",
"buffer",
")",
":",
"if",
"isinstance",
"(",
"buffer",
",",
"_text_type",
")",
":",
"buffer",
"=",
"buffer",
".",
"encode",
"(",
"\"ascii\"",
")",
"bio",
"=",
"_new_mem_buf",
"(",
"buffer",
")",
"if",
"type",
"==",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | load_pkcs7_data | Load pkcs7 data from the string *buffer* encoded with the type
*type*.
:param type: The file type (one of FILETYPE_PEM or FILETYPE_ASN1)
:param buffer: The buffer with the pkcs7 data.
:return: The PKCS7 object | src/OpenSSL/crypto.py | def load_pkcs7_data(type, buffer):
"""
Load pkcs7 data from the string *buffer* encoded with the type
*type*.
:param type: The file type (one of FILETYPE_PEM or FILETYPE_ASN1)
:param buffer: The buffer with the pkcs7 data.
:return: The PKCS7 object
"""
if isinstance(buffer, _text_type):... | def load_pkcs7_data(type, buffer):
"""
Load pkcs7 data from the string *buffer* encoded with the type
*type*.
:param type: The file type (one of FILETYPE_PEM or FILETYPE_ASN1)
:param buffer: The buffer with the pkcs7 data.
:return: The PKCS7 object
"""
if isinstance(buffer, _text_type):... | [
"Load",
"pkcs7",
"data",
"from",
"the",
"string",
"*",
"buffer",
"*",
"encoded",
"with",
"the",
"type",
"*",
"type",
"*",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2930-L2956 | [
"def",
"load_pkcs7_data",
"(",
"type",
",",
"buffer",
")",
":",
"if",
"isinstance",
"(",
"buffer",
",",
"_text_type",
")",
":",
"buffer",
"=",
"buffer",
".",
"encode",
"(",
"\"ascii\"",
")",
"bio",
"=",
"_new_mem_buf",
"(",
"buffer",
")",
"if",
"type",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | load_pkcs12 | Load pkcs12 data from the string *buffer*. If the pkcs12 structure is
encrypted, a *passphrase* must be included. The MAC is always
checked and thus required.
See also the man page for the C function :py:func:`PKCS12_parse`.
:param buffer: The buffer the certificate is stored in
:param passphrase... | src/OpenSSL/crypto.py | def load_pkcs12(buffer, passphrase=None):
"""
Load pkcs12 data from the string *buffer*. If the pkcs12 structure is
encrypted, a *passphrase* must be included. The MAC is always
checked and thus required.
See also the man page for the C function :py:func:`PKCS12_parse`.
:param buffer: The buf... | def load_pkcs12(buffer, passphrase=None):
"""
Load pkcs12 data from the string *buffer*. If the pkcs12 structure is
encrypted, a *passphrase* must be included. The MAC is always
checked and thus required.
See also the man page for the C function :py:func:`PKCS12_parse`.
:param buffer: The buf... | [
"Load",
"pkcs12",
"data",
"from",
"the",
"string",
"*",
"buffer",
"*",
".",
"If",
"the",
"pkcs12",
"structure",
"is",
"encrypted",
"a",
"*",
"passphrase",
"*",
"must",
"be",
"included",
".",
"The",
"MAC",
"is",
"always",
"checked",
"and",
"thus",
"requir... | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L2959-L3043 | [
"def",
"load_pkcs12",
"(",
"buffer",
",",
"passphrase",
"=",
"None",
")",
":",
"passphrase",
"=",
"_text_to_bytes_and_warn",
"(",
"\"passphrase\"",
",",
"passphrase",
")",
"if",
"isinstance",
"(",
"buffer",
",",
"_text_type",
")",
":",
"buffer",
"=",
"buffer",... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | PKey.to_cryptography_key | Export as a ``cryptography`` key.
:rtype: One of ``cryptography``'s `key interfaces`_.
.. _key interfaces: https://cryptography.io/en/latest/hazmat/\
primitives/asymmetric/rsa/#key-interfaces
.. versionadded:: 16.1.0 | src/OpenSSL/crypto.py | def to_cryptography_key(self):
"""
Export as a ``cryptography`` key.
:rtype: One of ``cryptography``'s `key interfaces`_.
.. _key interfaces: https://cryptography.io/en/latest/hazmat/\
primitives/asymmetric/rsa/#key-interfaces
.. versionadded:: 16.1.0
"""
... | def to_cryptography_key(self):
"""
Export as a ``cryptography`` key.
:rtype: One of ``cryptography``'s `key interfaces`_.
.. _key interfaces: https://cryptography.io/en/latest/hazmat/\
primitives/asymmetric/rsa/#key-interfaces
.. versionadded:: 16.1.0
"""
... | [
"Export",
"as",
"a",
"cryptography",
"key",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L230-L245 | [
"def",
"to_cryptography_key",
"(",
"self",
")",
":",
"backend",
"=",
"_get_backend",
"(",
")",
"if",
"self",
".",
"_only_public",
":",
"return",
"backend",
".",
"_evp_pkey_to_public_key",
"(",
"self",
".",
"_pkey",
")",
"else",
":",
"return",
"backend",
".",... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | PKey.from_cryptography_key | Construct based on a ``cryptography`` *crypto_key*.
:param crypto_key: A ``cryptography`` key.
:type crypto_key: One of ``cryptography``'s `key interfaces`_.
:rtype: PKey
.. versionadded:: 16.1.0 | src/OpenSSL/crypto.py | def from_cryptography_key(cls, crypto_key):
"""
Construct based on a ``cryptography`` *crypto_key*.
:param crypto_key: A ``cryptography`` key.
:type crypto_key: One of ``cryptography``'s `key interfaces`_.
:rtype: PKey
.. versionadded:: 16.1.0
"""
pkey ... | def from_cryptography_key(cls, crypto_key):
"""
Construct based on a ``cryptography`` *crypto_key*.
:param crypto_key: A ``cryptography`` key.
:type crypto_key: One of ``cryptography``'s `key interfaces`_.
:rtype: PKey
.. versionadded:: 16.1.0
"""
pkey ... | [
"Construct",
"based",
"on",
"a",
"cryptography",
"*",
"crypto_key",
"*",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L248-L268 | [
"def",
"from_cryptography_key",
"(",
"cls",
",",
"crypto_key",
")",
":",
"pkey",
"=",
"cls",
"(",
")",
"if",
"not",
"isinstance",
"(",
"crypto_key",
",",
"(",
"rsa",
".",
"RSAPublicKey",
",",
"rsa",
".",
"RSAPrivateKey",
",",
"dsa",
".",
"DSAPublicKey",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | PKey.generate_key | Generate a key pair of the given type, with the given number of bits.
This generates a key "into" the this object.
:param type: The key type.
:type type: :py:data:`TYPE_RSA` or :py:data:`TYPE_DSA`
:param bits: The number of bits.
:type bits: :py:data:`int` ``>= 0``
:rai... | src/OpenSSL/crypto.py | def generate_key(self, type, bits):
"""
Generate a key pair of the given type, with the given number of bits.
This generates a key "into" the this object.
:param type: The key type.
:type type: :py:data:`TYPE_RSA` or :py:data:`TYPE_DSA`
:param bits: The number of bits.
... | def generate_key(self, type, bits):
"""
Generate a key pair of the given type, with the given number of bits.
This generates a key "into" the this object.
:param type: The key type.
:type type: :py:data:`TYPE_RSA` or :py:data:`TYPE_DSA`
:param bits: The number of bits.
... | [
"Generate",
"a",
"key",
"pair",
"of",
"the",
"given",
"type",
"with",
"the",
"given",
"number",
"of",
"bits",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L270-L324 | [
"def",
"generate_key",
"(",
"self",
",",
"type",
",",
"bits",
")",
":",
"if",
"not",
"isinstance",
"(",
"type",
",",
"int",
")",
":",
"raise",
"TypeError",
"(",
"\"type must be an integer\"",
")",
"if",
"not",
"isinstance",
"(",
"bits",
",",
"int",
")",
... | 1fbe064c50fd030948141d7d630673761525b0d0 |
test | PKey.check | Check the consistency of an RSA private key.
This is the Python equivalent of OpenSSL's ``RSA_check_key``.
:return: ``True`` if key is consistent.
:raise OpenSSL.crypto.Error: if the key is inconsistent.
:raise TypeError: if the key is of a type which cannot be checked.
O... | src/OpenSSL/crypto.py | def check(self):
"""
Check the consistency of an RSA private key.
This is the Python equivalent of OpenSSL's ``RSA_check_key``.
:return: ``True`` if key is consistent.
:raise OpenSSL.crypto.Error: if the key is inconsistent.
:raise TypeError: if the key is of a type w... | def check(self):
"""
Check the consistency of an RSA private key.
This is the Python equivalent of OpenSSL's ``RSA_check_key``.
:return: ``True`` if key is consistent.
:raise OpenSSL.crypto.Error: if the key is inconsistent.
:raise TypeError: if the key is of a type w... | [
"Check",
"the",
"consistency",
"of",
"an",
"RSA",
"private",
"key",
"."
] | pyca/pyopenssl | python | https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L326-L350 | [
"def",
"check",
"(",
"self",
")",
":",
"if",
"self",
".",
"_only_public",
":",
"raise",
"TypeError",
"(",
"\"public key only\"",
")",
"if",
"_lib",
".",
"EVP_PKEY_type",
"(",
"self",
".",
"type",
"(",
")",
")",
"!=",
"_lib",
".",
"EVP_PKEY_RSA",
":",
"... | 1fbe064c50fd030948141d7d630673761525b0d0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.