ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- PK}S]debug.pynu[from __future__ import print_function import ssl import sys import OpenSSL.SSL import cffi import cryptography from . import version _env_info = u"""\ pyOpenSSL: {pyopenssl} cryptography: {cryptography} cffi: {cffi} cryptography's compiled against OpenSSL: {crypto_openssl_compile} cryptography's linked OpenSSL: {crypto_openssl_link} Pythons's OpenSSL: {python_openssl} Python executable: {python} Python version: {python_version} Platform: {platform} sys.path: {sys_path}""".format( pyopenssl=version.__version__, crypto_openssl_compile=OpenSSL._util.ffi.string( OpenSSL._util.lib.OPENSSL_VERSION_TEXT, ).decode("ascii"), crypto_openssl_link=OpenSSL.SSL.SSLeay_version( OpenSSL.SSL.SSLEAY_VERSION ).decode("ascii"), python_openssl=getattr(ssl, "OPENSSL_VERSION", "n/a"), cryptography=cryptography.__version__, cffi=cffi.__version__, python=sys.executable, python_version=sys.version, platform=sys.platform, sys_path=sys.path, ) if __name__ == "__main__": print(_env_info) PK}S]κy_y_'__pycache__/crypto.cpython-36.opt-1.pycnu[3 F\$@sddlZddlmZddlmZddlmZmZmZm Z m Z m Z ddl m ZmZmZddlmZddlmZmZddlmZdd lmZmZmZ m!Z"m#Z$m%Z&m'Z(m)Z*d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-g$Z+ej,Z-ej.Z/dnZ0ej1Z2ej3Z4ej5Z6ej7Z8Gd1dde9Z:ee e:Z;e*e:Zdod6d7Z?d8d9Z@d:d;ZAdd?d?eCZDGd@ddeCZEeeEeFdAeGZHGdBdCdCeCZIdDdZJdEdZKGdFddeCZLeeLeFdGeGZMGdHddeCZNeeNeFdIeGZOGdJddeCZPeePeFdKeGZQGdLddeCZReeReFdMeGZSGdNddeCZTGdOddeCZUeeUeFdPeGZVGdQdde9ZWGdRddeCZXdSdZYdTdZZdUdZ[dpdVdZ\GdWddeCZ]GdXd d eCZ^ee^eFdYeGZ_GdZd!d!eCZ`ee`eFd[eGZaGd\d"d"eCZbeebeFd]eGZcGd^d#d#eCZdeedeFd_eGZeGd`dadaeCZfdbd$Zgdqdcd%Zhddd&Zided'Zjdfd(Zkdgd)Zldhd*Zmdid+Zndjd,Zodrdkd-ZpejqejrejsdldS)sN) b16encode)partial)__eq____ne____lt____le____gt____ge__) integer_types text_typePY3)x509)dsarsa) deprecated)ffilibexception_from_error_queue byte_stringnative UNSPECIFIEDtext_to_bytes_and_warn make_assert FILETYPE_PEM FILETYPE_ASN1 FILETYPE_TEXTTYPE_RSATYPE_DSAErrorPKeyget_elliptic_curvesget_elliptic_curveX509Name X509ExtensionX509ReqX509X509StoreFlags X509StoreX509StoreContextErrorX509StoreContextload_certificatedump_certificatedump_publickeydump_privatekeyRevokedCRLPKCS7PKCS12 NetscapeSPKIload_publickeyload_privatekeydump_certificate_requestload_certificate_requestsignverifydump_crlload_crlload_pkcs7_data load_pkcs12c@seZdZdZdS)rz7 An error occurred in an `OpenSSL.crypto` API. N)__name__ __module__ __qualname____doc__rDrD/usr/lib/python3.6/crypto.pyrNscCsddlm}|S)ap Importing the backend from cryptography has the side effect of activating the osrandom engine. This mutates the global state of OpenSSL in the process and causes issues for various programs that use subinterpreters or embed Python. By putting the import in this function we can avoid triggering this side effect unless _get_backend is called. r)backend)Z,cryptography.hazmat.backends.openssl.backendrF)rFrDrDrE _get_backendXs rGcCstd|fdS)z An OpenSSL API failed somehow. Additionally, the failure which was encountered isn't one that's exercised by the test suite so future behavior of pyOpenSSL is now somewhat less predictable. zUnknown %s failureN) RuntimeError)whererDrDrE_untested_errordsrJcCsd|dkrtjtj}tj}n(tjd|}tj|t|}|fdd}t|tj ktj ||}|S)z 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. Nzchar[]cSs tj|S)N)_libBIO_free)biorefrDrDrEfree~sz_new_mem_buf..free) rKBIO_new BIO_s_memrL_ffinewZBIO_new_mem_buflen_openssl_assertNULLgc)bufferrMrOdatarDrDrE _new_mem_bufms    rZcCs.tjd}tj||}tj|d|ddS)zO Copy the contents of an OpenSSL BIO object into a Python byte string. zchar**rN)rRrSrKZBIO_get_mem_datarX)rM result_bufferZ buffer_lengthrDrDrE_bio_to_strings  r\cCs2t|tstdtj||}|dkr.tddS)a 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: If C{when} does not represent a time in the required format. @raise RuntimeError: If the time value cannot be set for some other (unspecified) reason. zwhen must be a byte stringrzInvalid stringN) isinstancebytes TypeErrorrKZASN1_TIME_set_string ValueError)boundarywhen set_resultrDrDrE_set_asn1_times   rdcCstjd|}tj|dkrdStj|tjkr>tjtj|Stjd}tj |||dtj krlt dn6tjd|d}tj|}tj|}tj |d|SdS)a] 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 contains no time value. z ASN1_STRING*rNzASN1_GENERALIZEDTIME**ASN1_TIME_to_generalizedtime) rRcastrKASN1_STRING_lengthZASN1_STRING_typeZV_ASN1_GENERALIZEDTIMEstringASN1_STRING_datarSrerVrJZASN1_GENERALIZEDTIME_free)Z timestampZstring_timestampZgeneralized_timestampZ string_data string_resultrDrDrE_get_asn1_times       rkc@s$eZdZddZddZddZdS)_X509NameInvalidatorcCs g|_dS)N)_names)selfrDrDrE__init__sz_X509NameInvalidator.__init__cCs|jj|dS)N)rmappend)rnnamerDrDrEaddsz_X509NameInvalidator.addcCsx|jD]}|`qWdS)N)rm_name)rnrqrDrDrEclears z_X509NameInvalidator.clearN)r@rArBrorrrtrDrDrDrErlsrlc@sTeZdZdZdZdZddZddZedd Z d d Z d d Z ddZ ddZ dS)rzD A class representing an DSA or RSA public key or key pair. FTcCs"tj}tj|tj|_d|_dS)NF)rKZ EVP_PKEY_newrRrW EVP_PKEY_free_pkey _initialized)rnpkeyrDrDrErosz PKey.__init__cCs(t}|jr|j|jS|j|jSdS)a 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 N)rG _only_publicZ_evp_pkey_to_public_keyrvZ_evp_pkey_to_private_key)rnrFrDrDrEto_cryptography_keys  zPKey.to_cryptography_keycCsR|}t|tjtjtjtjfs(td|j|_ t|tjtjfrHd|_ d|_ |S)z 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 zUnsupported key typeT) r]rZ RSAPublicKeyZ RSAPrivateKeyrZ DSAPublicKeyZ DSAPrivateKeyr_Z _evp_pkeyrvryrw)clsZ crypto_keyrxrDrDrEfrom_cryptography_keys  zPKey.from_cryptography_keycCs6t|tstdt|ts$td|tkr|dkr= 0`` :raises TypeError: If :py:data:`type` or :py:data:`bits` isn't of the appropriate type. :raises ValueError: If the number of bits isn't an integer of the appropriate size. :return: ``None`` ztype must be an integerzbits must be an integerrzInvalid number of bitsr?zNo such key typeTN)r]intr_rr`rKBN_newrRrWBN_freeZ BN_set_wordZRSA_F4ZRSA_newZRSA_generate_key_exrVrUZEVP_PKEY_assign_RSArvrZDSA_newZDSA_freeZDSA_generate_parameters_exZDSA_generate_keyZEVP_PKEY_set1_DSArrw)rntypebitsZexponentrresultrresrDrDrE generate_keys4     zPKey.generate_keycCs`|jrtdtj|jtjkr*tdtj|j}tj |tj }tj |}|rVdSt dS)ax 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. Only RSA keys can currently be checked. zpublic key onlyzkey type unsupportedTN) ryr_rKZ EVP_PKEY_typer EVP_PKEY_RSAEVP_PKEY_get1_RSArvrRrWRSA_freeZ RSA_check_key_raise_current_error)rnrrrDrDrEcheckGs   z PKey.checkcCs tj|jS)zT Returns the type of the key :return: The type of the key. )rK EVP_PKEY_idrv)rnrDrDrErasz PKey.typecCs tj|jS)zh Returns the number of bits of the key :return: The number of bits of the key. )rKZ EVP_PKEY_bitsrv)rnrDrDrErisz PKey.bitsN)r@rArBrCryrwrorz classmethodr|rrrrrDrDrDrErs 8z.PKeyType has been deprecated, use PKey insteadcsdeZdZdZdZer fddZeddZeddZ ed d Z d d Z d dZ ddZ ZS)_EllipticCurveaZ A representation of a supported elliptic curve. @cvar _curves: :py:obj:`None` until an attempt is made to load the curves. Thereafter, a :py:type:`set` containing :py:type:`_EllipticCurve` instances each of which represents one curve supported by the system. @type _curves: :py:type:`NoneType` or :py:type:`set` Ncst|trtt|j|StS)z Implement cooperation with the right-hand side argument of ``!=``. Python 3 seems to have dropped this cooperation in this very narrow circumstance. )r]rsuperrNotImplemented)rnother) __class__rDrErs z_EllipticCurve.__ne__cs>jtjd}tjd|}j||tfdd|DS)z Get the curves supported by OpenSSL. :param lib: The OpenSSL library binding object. :return: A :py:type:`set` of ``cls`` instances giving the names of the elliptic curves the underlying library supports. rzEC_builtin_curve[]c3s|]}j|jVqdS)N)from_nidnid).0c)r{rrDrE sz7_EllipticCurve._load_elliptic_curves..)ZEC_get_builtin_curvesrRrVrSset)r{rZ num_curvesZbuiltin_curvesrD)r{rrE_load_elliptic_curvess    z$_EllipticCurve._load_elliptic_curvescCs|jdkr|j||_|jS)a Get, cache, and return the curves supported by OpenSSL. :param lib: The OpenSSL library binding object. :return: A :py:type:`set` of ``cls`` instances giving the names of the elliptic curves the underlying library supports. N)_curvesr)r{rrDrDrE_get_elliptic_curvess  z#_EllipticCurve._get_elliptic_curvescCs|||tj|j|jdS)a Instantiate a new :py:class:`_EllipticCurve` associated with the given OpenSSL NID. :param lib: The OpenSSL library binding object. :param nid: The OpenSSL NID the resulting curve object will represent. This must be a curve NID (and not, for example, a hash NID) or subsequent operations will fail in unpredictable ways. :type nid: :py:class:`int` :return: The curve object. ascii)rRrh OBJ_nid2sndecode)r{rrrDrDrErsz_EllipticCurve.from_nidcCs||_||_||_dS)a :param _lib: The :py:mod:`cryptography` binding instance used to interface with OpenSSL. :param _nid: The OpenSSL NID identifying the curve this object represents. :type _nid: :py:class:`int` :param name: The OpenSSL short name identifying the curve this object represents. :type name: :py:class:`unicode` N)rK_nidrq)rnrrrqrDrDrEros z_EllipticCurve.__init__cCs d|jfS)Nz )rq)rnrDrDrE__repr__sz_EllipticCurve.__repr__cCs|jj|j}tj|tjS)z Create a new OpenSSL EC_KEY structure initialized to use this curve. The structure is automatically garbage collected when the Python object is garbage collected. )rKZEC_KEY_new_by_curve_namerrRrWZ EC_KEY_free)rnkeyrDrDrE _to_EC_KEYsz_EllipticCurve._to_EC_KEY)r@rArBrCr_PY3rrrrrrorr __classcell__rDrD)rrErys   rcCs tjtS)a Return a set of objects representing the elliptic curves supported in the OpenSSL build in use. The curve objects have a :py:class:`unicode` ``name`` attribute by which they identify themselves. The curve objects are useful as values for the argument accepted by :py:meth:`Context.set_tmp_ecdh` to specify which elliptical curve should be used for ECDHE key exchange. )rrrKrDrDrDrEr s cCs,xtD]}|j|kr|SqWtd|dS)aT 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` is raised. zunknown curve nameN)r rqr`)rqZcurverDrDrEr!s  cseZdZdZddZfddZfddZdd ZeeZee Z ee Z ee Z ee Z ee Z d d Zd d ZddZddZZS)r"a An X.509 Distinguished Name. :ivar countryName: The country of the entity. :ivar C: Alias for :py:attr:`countryName`. :ivar stateOrProvinceName: The state or province of the entity. :ivar ST: Alias for :py:attr:`stateOrProvinceName`. :ivar localityName: The locality of the entity. :ivar L: Alias for :py:attr:`localityName`. :ivar organizationName: The organization name of the entity. :ivar O: Alias for :py:attr:`organizationName`. :ivar organizationalUnitName: The organizational unit of the entity. :ivar OU: Alias for :py:attr:`organizationalUnitName` :ivar commonName: The common name of the entity. :ivar CN: Alias for :py:attr:`commonName`. :ivar emailAddress: The e-mail address of the entity. cCs tj|j}tj|tj|_dS)z Create a new X509Name, copying the given X509Name instance. :param name: The name to copy. :type name: :py:class:`X509Name` N)rK X509_NAME_duprsrRrWX509_NAME_free)rnrqrDrDrEros zX509Name.__init__c s|jdrtt|j||St|tk r.frD)rrrD)rrE_cmpss z X509Name._cmpcCsBtjdd}tj|j|t|}t|tjkdttj |fS)z6 String representation of an X509Name zchar[]iz) rRrSrKZX509_NAME_onelinersrTrUrV_nativerh)rnr[Z format_resultrDrDrErs  zX509Name.__repr__cCs tj|jS)a& Return an integer representation of the first four bytes of the MD5 digest of the DER representation of the name. This is the Python equivalent of OpenSSL's ``X509_NAME_hash``. :return: The (integer) hash of this name. :rtype: :py:class:`int` )rKZX509_NAME_hashrs)rnrDrDrEhashs z X509Name.hashcCsNtjd}tj|j|}t|dktj|d|dd}tj|d|S)z Return the DER encoding of this name. :return: The DER encoded form of this name. :rtype: :py:class:`bytes` zunsigned char**rN)rRrSrKZ i2d_X509_NAMErsrUrXr)rnr[Z encode_resultrjrDrDrEders   z X509Name.derc Csg}xttj|jD]n}tj|j|}tj|}tj|}tj|}tj|}t j tj |tj |dd}|j t j||fqW|S)z Returns the components of this name, as a sequence of 2-tuples. :return: The components of this name. :rtype: :py:class:`list` of ``name, value`` tuples. N)rrKrrsrrrrrrRrXrirgrprh) rnrrrZfnameZfvalrrqrrDrDrEget_componentss     zX509Name.get_components)r@rArBrCrorrrrrrrrr rrrrrrDrD)rrEr"s $ (  z6X509NameType has been deprecated, use X509Name insteadc@sdeZdZdZdddZeddZejdej dej d iZ d d Z d d Z ddZddZddZdS)r#z, An X.509 v3 certificate extension. NcCstjd}tj|tjtjtjtjdtj||dk rRt|tsJtd|j |_ |dk rtt|tsltd|j |_ |rd|}tj tj|||}|tjkrt tj|tj|_dS)a Initializes an X509 extension. :param type_name: The name of the type of extension_ to create. :type type_name: :py:data:`bytes` :param bool critical: A flag indicating whether this is a critical extension. :param value: The value of the extension. :type value: :py:data:`bytes` :param subject: Optional X509 certificate to use as subject. :type subject: :py:class:`X509` :param issuer: Optional X509 certificate to use as issuer. :type issuer: :py:class:`X509` .. _extension: https://www.openssl.org/docs/manmaster/man5/ x509v3_config.html#STANDARD-EXTENSIONS z X509V3_CTX*rNzissuer must be an X509 instancez subject must be an X509 instances critical,)rRrSrKZX509V3_set_ctxrVZX509V3_set_ctx_nodbr]r%r__x509 issuer_certZ subject_certZX509V3_EXT_nconfrrWX509_EXTENSION_free _extension)rnZ type_nameZcriticalrsubjectissuerZctx extensionrDrDrEros"     zX509Extension.__init__cCstjtj|jS)N)rKrX509_EXTENSION_get_objectr)rnrDrDrErszX509Extension._nidZemailZDNSZURIc Cstjdtj|j}tj|tj}g}xttj|D]}tj ||}y|j |j }Wn8t k rt }tj|||jtt|Yq6Xttj|jjj|jjjdd}|j|d|q6Wdj|S)NzGENERAL_NAMES*:z, )rRrfrKZX509V3_EXT_d2irrWZGENERAL_NAMES_freerZsk_GENERAL_NAME_numZsk_GENERAL_NAME_value _prefixesrKeyErrorrZZGENERAL_NAME_printrprr\rXdZia5rYlengthjoin)rnnamespartsrrqZlabelrMrrDrDrE_subjectAltNameStrings   "z#X509Extension._subjectAltNameStringcCsDtj|jkr|jSt}tj||jdd}t|dktt |S)zF :return: a nice text representation of the extension r) rKZNID_subject_alt_namerrrZX509V3_EXT_printrrUrr\)rnrM print_resultrDrDrE__str__/s   zX509Extension.__str__cCs tj|jS)zk Returns the critical field of this X.509 extension. :return: The critical field. )rKZX509_EXTENSION_get_criticalr)rnrDrDrE get_critical<szX509Extension.get_criticalcCs&tj|j}tj|}tjtj|S)z Returns the short type name of this X.509 extension. The result is a byte string such as :py:const:`b"basicConstraints"`. :return: The short type name. :rtype: :py:data:`bytes` .. versionadded:: 0.12 )rKrrrrRrhr)rnobjrrDrDrEget_short_nameDs  zX509Extension.get_short_namecCs@tj|j}tjd|}tj|}tj|}tj||ddS)z Returns the data of the X509 extension, encoded as ASN.1. :return: The ASN.1 encoded data of this X509 extension. :rtype: :py:data:`bytes` .. versionadded:: 0.12 z ASN1_STRING*N)rKX509_EXTENSION_get_datarrRrfrirgrX)rnZ octet_resultrjZ char_result result_lengthrDrDrEget_dataSs    zX509Extension.get_data)NN)r@rArBrCropropertyrrKZ GEN_EMAILZGEN_DNSZGEN_URIrrrrrrrDrDrDrEr#s =   z@X509ExtensionType has been deprecated, use X509Extension insteadc@steZdZdZddZddZeddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZddZdS)r$z0 An X.509 certificate signing requests. cCs&tj}tj|tj|_|jddS)Nr)rKZ X509_REQ_newrRrW X509_REQ_free_req set_version)rnreqrDrDrErooszX509Req.__init__cCsddlm}t}|||jS)z Export as a ``cryptography`` certificate signing request. :rtype: ``cryptography.x509.CertificateSigningRequest`` .. versionadded:: 17.1.0 r)_CertificateSigningRequest))cryptography.hazmat.backends.openssl.x509rrGr)rnrrFrDrDrEto_cryptographyus zX509Req.to_cryptographycCs&t|tjstd|}|j|_|S)a Construct based on a ``cryptography`` *crypto_req*. :param crypto_req: A ``cryptography`` X.509 certificate signing request :type crypto_req: ``cryptography.x509.CertificateSigningRequest`` :rtype: X509Req .. versionadded:: 17.1.0 z%Must be a certificate signing request)r]r ZCertificateSigningRequestr_Z _x509_reqr)r{Z crypto_reqrrDrDrEfrom_cryptographys zX509Req.from_cryptographycCs tj|j|j}t|dkdS)z Set the public key of the certificate signing request. :param pkey: The public key to use. :type pkey: :py:class:`PKey` :return: ``None`` r?N)rKZX509_REQ_set_pubkeyrrvrU)rnrxrcrDrDrE set_pubkeys zX509Req.set_pubkeycCsDtjt}tj|j|_t|jtjktj |jtj |_d|_ |S)z Get the public key of the certificate signing request. :return: The public key. :rtype: :py:class:`PKey` T) r__new__rKZX509_REQ_get_pubkeyrrvrUrRrVrWrury)rnrxrDrDrE get_pubkeys  zX509Req.get_pubkeycCstj|j|}t|dkdS)z Set the version subfield (RFC 2459, section 4.1.2.1) of the certificate request. :param int version: The version number. :return: ``None`` r?N)rKZX509_REQ_set_versionrrU)rnversionrcrDrDrErszX509Req.set_versioncCs tj|jS)z Get the version subfield (RFC 2459, section 4.1.2.1) of the certificate request. :return: The value of the version subfield. :rtype: :py:class:`int` )rKZX509_REQ_get_versionr)rnrDrDrE get_versionszX509Req.get_versioncCs2tjt}tj|j|_t|jtjk||_ |S)a Return the subject of this certificate signing request. This creates a new :class:`X509Name` that wraps the underlying subject name field on the certificate signing request. Modifying it will modify the underlying signing request, and will have the effect of modifying any other :class:`X509Name` that refers to this subject. :return: The subject of this certificate signing request. :rtype: :class:`X509Name` ) r"rrKZX509_REQ_get_subject_namerrsrUrRrV_owner)rnrqrDrDrE get_subjects zX509Req.get_subjectcCsptj}t|tjktj|tj}x,|D]$}t|ts@t dtj ||j q*Wtj |j |}t|dkdS)z Add extensions to the certificate signing request. :param extensions: The X.509 extensions to add. :type extensions: iterable of :py:class:`X509Extension` :return: ``None`` z+One of the elements is not an X509Extensionr?N)rKZsk_X509_EXTENSION_new_nullrUrRrVrWZsk_X509_EXTENSION_freer]r#r`Zsk_X509_EXTENSION_pushrZX509_REQ_add_extensionsr)rn extensionsstackextrrDrDrEadd_extensionss  zX509Req.add_extensionscCsNg}tj|j}x8ttj|D]&}tjt}tj|||_|j |q W|S)z Get X.509 extensions in the certificate signing request. :return: The X.509 extensions in this request. :rtype: :py:class:`list` of :py:class:`X509Extension` objects. .. versionadded:: 0.15 ) rKZX509_REQ_get_extensionsrrZsk_X509_EXTENSION_numr#rZsk_X509_EXTENSION_valuerrp)rnZextsZnative_exts_objrrrDrDrEget_extensionss   zX509Req.get_extensionscCs^|jrtd|jstdtjt|}|tjkrd?Z#d@dAZ$dBS)Cr%z An X.509 certificate. cCs:tj}t|tjktj|tj|_t|_ t|_ dS)N) rKZX509_newrUrRrVrW X509_freerrl_issuer_invalidator_subject_invalidator)rnr rDrDrEro<s z X509.__init__cCs.|j|}tj|tj|_t|_t|_|S)N) rrRrWrKrrrlrr)r{r certrDrDrE_from_raw_x509_ptrDs  zX509._from_raw_x509_ptrcCsddlm}t}|||jS)z Export as a ``cryptography`` certificate. :rtype: ``cryptography.x509.Certificate`` .. versionadded:: 17.1.0 r) _Certificate)rrrGr)rnrrFrDrDrErLs zX509.to_cryptographycCs&t|tjstd|}|j|_|S)z Construct based on a ``cryptography`` *crypto_cert*. :param crypto_key: A ``cryptography`` X.509 certificate. :type crypto_key: ``cryptography.x509.Certificate`` :rtype: X509 .. versionadded:: 17.1.0 zMust be a certificate)r]r Z Certificater_r)r{Z crypto_certrrDrDrErXs zX509.from_cryptographycCs$t|tstdtj|j|dS)a  Set the version number of the certificate. Note that the version value is zero-based, eg. a value of 0 is V1. :param version: The version number of the certificate. :type version: :py:class:`int` :return: ``None`` zversion must be an integerN)r]r}r_rKZX509_set_versionr)rnrrDrDrErks zX509.set_versioncCs tj|jS)z Return the version number of the certificate. :return: The version number of the certificate. :rtype: :py:class:`int` )rKZX509_get_versionr)rnrDrDrErzszX509.get_versioncCsFtjt}tj|j|_|jtjkr*ttj |jtj |_d|_ |S)z{ Get the public key of the certificate. :return: The public key. :rtype: :py:class:`PKey` T) rrrKX509_get_pubkeyrrvrRrVrrWrury)rnrxrDrDrErs  zX509.get_pubkeycCs2t|tstdtj|j|j}t|dkdS)z Set the public key of the certificate. :param pkey: The public key. :type pkey: :py:class:`PKey` :return: :py:data:`None` zpkey must be a PKey instancer?N)r]rr_rKZX509_set_pubkeyrrvrU)rnrxrcrDrDrErs zX509.set_pubkeycCspt|tstd|jr td|js.tdtjt|}|t j krNtdtj |j |j |}t|dkdS)a Sign the certificate with this key and digest type. :param pkey: The key to sign with. :type pkey: :py:class:`PKey` :param digest: The name of the message digest to use. :type digest: :py:class:`bytes` :return: :py:data:`None` zpkey must be a PKey instancezKey only has public partzKey is uninitializedzNo such digest methodrN)r]rr_ryr`rwrKrrrRrVZ X509_signrrvrU)rnrxrZevp_mdrrDrDrEr7s  z X509.signcCs:tj|j}tj|j}|tjkr*tdtjtj |S)z Return the signature algorithm used in the certificate. :return: The name of the algorithm. :rtype: :py:class:`bytes` :raises ValueError: If the signature algorithm is undefined. .. versionadded:: 0.13 zUndefined signature algorithm) rKZX509_get0_tbs_sigalgrr algorithmrr`rRrhZ OBJ_nid2ln)rnZalgorrrDrDrEget_signature_algorithms   zX509.get_signature_algorithmcCstjt|}|tjkr tdtjdtj}tjdd}t||d<tj |j |||}t |dkdj ddtj ||dDS) a7 Return the digest of the X509 object. :param digest_name: The name of the digest algorithm to use. :type digest_name: :py:class:`bytes` :return: The digest of the object, formatted as :py:const:`b":"`-delimited hex pairs. :rtype: :py:class:`bytes` zNo such digest methodzunsigned char[]zunsigned int[]r?r:cSsg|]}t|jqSrD)rupper)rZchrDrDrE szX509.digest..)rKrrrRrVr`rSZEVP_MAX_MD_SIZErTZ X509_digestrrUrrX)rnZ digest_namerr[rZ digest_resultrDrDrErs     z X509.digestcCs tj|jS)z Return the hash of the X509 subject. :return: The hash of the subject. :rtype: :py:class:`bytes` )rKZX509_subject_name_hashr)rnrDrDrEsubject_name_hashszX509.subject_name_hashcCst|tstdt|dd}t|ts6|jd}tjd}tj ||}|dtj krztj tj |j |}|rtnXtj|dtj }tj|d|tj krttj|tj}tj|j |}t|dkdS)z Set the serial number of the certificate. :param serial: The new serial number. :type serial: :py:class:`int` :return: :py:data`None` zserial must be an integerr=NrzBIGNUM**rr?)r]_integer_typesr_hexr^rrRrSrK BN_hex2bnrVZASN1_INTEGER_setX509_get_serialNumberrrBN_to_ASN1_INTEGERrrWASN1_INTEGER_freeZX509_set_serialNumberrU)rnserial hex_serial bignum_serialZ small_serialrc asn1_serialrDrDrEset_serial_numbers&      zX509.set_serial_numbercCs`tj|j}tj|tj}z4tj|}ztj|}t|d}|Stj |XWdtj |XdS)zx Return the serial number of this certificate. :return: The serial number. :rtype: int r>N) rKrrZASN1_INTEGER_to_BNrRrVZ BN_bn2hexrhr}rr)rnr r r Zhexstring_serialr rDrDrEget_serial_numbers    zX509.get_serial_numbercCs.t|tstdtj|j}tj||dS)z Adjust the time stamp on which the certificate stops being valid. :param int amount: The number of seconds by which to adjust the timestamp. :return: ``None`` zamount must be an integerN)r]r}r_rKX509_get_notAfterrX509_gmtime_adj)rnamountZnotAfterrDrDrEgmtime_adj_notAfter-s  zX509.gmtime_adj_notAftercCs.t|tstdtj|j}tj||dS)z Adjust the timestamp on which the certificate starts being valid. :param amount: The number of seconds by which to adjust the timestamp. :return: ``None`` zamount must be an integerN)r]r}r_rKX509_get_notBeforerr)rnrZ notBeforerDrDrEgmtime_adj_notBefore;s  zX509.gmtime_adj_notBeforecCs(t|j}tjj|d}|tjjkS)z Check whether the certificate has expired. :return: ``True`` if the certificate has expired, ``False`` otherwise. :rtype: bool z %Y%m%d%H%M%SZ)r get_notAfterdatetimeZstrptimeZutcnow)rnZ time_stringZ not_afterrDrDrE has_expiredHs zX509.has_expiredcCst||jS)N)rkr)rnwhichrDrDrE_get_boundary_timeTszX509._get_boundary_timecCs |jtjS)a  Get the timestamp at which the certificate starts being valid. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ :return: A timestamp string, or ``None`` if there is none. :rtype: bytes or NoneType )rrKr)rnrDrDrE get_notBeforeWs zX509.get_notBeforecCst||j|S)N)rdr)rnrrbrDrDrE_set_boundary_timedszX509._set_boundary_timecCs|jtj|S)z Set the timestamp at which the certificate starts being valid. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ :param bytes when: A timestamp string. :return: ``None`` )rrKr)rnrbrDrDrE set_notBeforegs zX509.set_notBeforecCs |jtjS)a  Get the timestamp at which the certificate stops being valid. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ :return: A timestamp string, or ``None`` if there is none. :rtype: bytes or NoneType )rrKr)rnrDrDrErts zX509.get_notAftercCs|jtj|S)z Set the timestamp at which the certificate stops being valid. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ :param bytes when: A timestamp string. :return: ``None`` )rrKr)rnrbrDrDrE set_notAfters zX509.set_notAftercCs0tjt}||j|_t|jtjk||_|S)N)r"rrrsrUrRrVr)rnrrqrDrDrE _get_names   zX509._get_namecCs0t|tstd||j|j}t|dkdS)Nzname must be an X509Namer?)r]r"r_rrsrU)rnrrqrcrDrDrE _set_names zX509._set_namecCs|jtj}|jj||S)a Return the issuer of this certificate. This creates a new :class:`X509Name` that wraps the underlying issuer name field on the certificate. Modifying it will modify the underlying certificate, and will have the effect of modifying any other :class:`X509Name` that refers to this issuer. :return: The issuer of this certificate. :rtype: :class:`X509Name` )rrKZX509_get_issuer_namerrr)rnrqrDrDrE get_issuers  zX509.get_issuercCs|jtj||jjdS)z Set the issuer of this certificate. :param issuer: The issuer. :type issuer: :py:class:`X509Name` :return: ``None`` N)r rKZX509_set_issuer_namerrt)rnrrDrDrE set_issuers zX509.set_issuercCs|jtj}|jj||S)a Return the subject of this certificate. This creates a new :class:`X509Name` that wraps the underlying subject name field on the certificate. Modifying it will modify the underlying certificate, and will have the effect of modifying any other :class:`X509Name` that refers to this subject. :return: The subject of this certificate. :rtype: :class:`X509Name` )rrKX509_get_subject_namerrr)rnrqrDrDrErs  zX509.get_subjectcCs|jtj||jjdS)z Set the subject of this certificate. :param subject: The subject. :type subject: :py:class:`X509Name` :return: ``None`` N)r rKZX509_set_subject_namerrt)rnrrDrDrE set_subjects zX509.set_subjectcCs tj|jS)z Get the number of extensions on this certificate. :return: The number of extensions. :rtype: :py:class:`int` .. versionadded:: 0.12 )rKZX509_get_ext_countr)rnrDrDrEget_extension_counts zX509.get_extension_countcCs@x:|D]2}t|tstdtj|j|jd}|stqWdS)z Add extensions to the certificate. :param extensions: The extensions to add. :type extensions: An iterable of :py:class:`X509Extension` objects. :return: ``None`` z+One of the elements is not an X509Extensionr?Nr)r]r#r`rKZ X509_add_extrrr)rnrrrrDrDrErs   zX509.add_extensionscCsNtjt}tj|j||_|jtjkr.tdtj |j}tj |tj |_|S)a Get a specific extension of the certificate by index. Extensions on a certificate are kept in order. The index parameter selects which extension will be returned. :param int index: The index of the extension to retrieve. :return: The extension at the specified index. :rtype: :py:class:`X509Extension` :raises IndexError: If the extension index was out of bounds. .. versionadded:: 0.12 zextension index out of bounds) r#rrKZ X509_get_extrrrRrV IndexErrorZX509_EXTENSION_duprWr)rnindexrrrDrDrE get_extensions   zX509.get_extensionN)%r@rArBrCrorrrrrrrrr7rrrrrrrrrrrrrrrr r!r"rr$r%rr(rDrDrDrEr%8sB    '          z.X509Type has been deprecated, use X509 insteadc@sReZdZdZejZejZej Z ej Z ej ZejZejZejZejZejZejZdS)r&a  Flags for X509 verification, used to change the behavior of :class:`X509Store`. See `OpenSSL Verification Flags`_ for details. .. _OpenSSL Verification Flags: https://www.openssl.org/docs/manmaster/man3/X509_VERIFY_PARAM_set_flags.html N)r@rArBrCrKZX509_V_FLAG_CRL_CHECKZ CRL_CHECKZX509_V_FLAG_CRL_CHECK_ALLZ CRL_CHECK_ALLZX509_V_FLAG_IGNORE_CRITICALZIGNORE_CRITICALZX509_V_FLAG_X509_STRICTZ X509_STRICTZX509_V_FLAG_ALLOW_PROXY_CERTSZALLOW_PROXY_CERTSZX509_V_FLAG_POLICY_CHECKZ POLICY_CHECKZX509_V_FLAG_EXPLICIT_POLICYZEXPLICIT_POLICYZX509_V_FLAG_INHIBIT_MAPZ INHIBIT_MAPZX509_V_FLAG_NOTIFY_POLICYZ NOTIFY_POLICYZX509_V_FLAG_CHECK_SS_SIGNATUREZCHECK_SS_SIGNATUREZX509_V_FLAG_CB_ISSUER_CHECKZCB_ISSUER_CHECKrDrDrDrEr&s c@s8eZdZdZddZddZddZdd Zd d Zd S) r'a An X.509 store. An X.509 store is used to describe a context in which to verify a certificate. A description of a context may include a set of certificates to trust, a set of certificate revocation lists, verification flags and more. An X.509 store, being only a description, cannot be used by itself to verify a certificate. To carry out the actual verification process, see :class:`X509StoreContext`. cCstj}tj|tj|_dS)N)rKZX509_STORE_newrRrWZX509_STORE_free_store)rnstorerDrDrEro6szX509Store.__init__cCsPt|tsttj|j|jdkrLtj}tj|}t |tj ktj dS)a Adds a trusted certificate to this store. Adding a certificate with this method adds this certificate as a *trusted* certificate. :param X509 cert: The certificate to add to this store. :raises TypeError: If the certificate is not an :class:`X509`. :raises OpenSSL.crypto.Error: If OpenSSL was unhappy with your certificate. :return: ``None`` if the certificate was added successfully. rN) r]r%r_rKZX509_STORE_add_certr)rZERR_peek_errorZERR_GET_REASONrUZ!X509_R_CERT_ALREADY_IN_HASH_TABLEZERR_clear_error)rnrcodeZ err_reasonrDrDrEadd_cert:s   zX509Store.add_certcCsttj|j|jdkdS)a Add a certificate revocation list to this store. The certificate revocation lists added to a store will only be used if the associated flags are configured to check certificate revocation lists. .. versionadded:: 16.1.0 :param CRL crl: The certificate revocation list to add to this store. :return: ``None`` if the certificate revocation list was added successfully. rN)rUrKZX509_STORE_add_crlr)_crl)rncrlrDrDrEadd_crlXszX509Store.add_crlcCsttj|j|dkdS)a Set verification flags to this store. Verification flags can be combined by oring them together. .. note:: Setting a verification flag sometimes requires clients to add additional information to the store, otherwise a suitable error will be raised. For example, in setting flags to enable CRL checking a suitable CRL must be added to the store otherwise an error will be raised. .. versionadded:: 16.1.0 :param int flags: The verification flags to set on this store. See :class:`X509StoreFlags` for available constants. :return: ``None`` if the verification flags were successfully set. rN)rUrKZX509_STORE_set_flagsr))rnflagsrDrDrE set_flagshszX509Store.set_flagscCsFtj}tj|tj}tj|t|jdttj |j |dkdS)a Set the time against which the certificates are verified. Normally the current time is used. .. note:: For example, you can determine if a certificate was valid at a given time. .. versionadded:: 17.0.0 :param datetime vfy_time: The verification time to set on this store. :return: ``None`` if the verification time was successfully set. z%srN) rKZX509_VERIFY_PARAM_newrRrWZX509_VERIFY_PARAM_freeZX509_VERIFY_PARAM_set_timer}ZstrftimerUZX509_STORE_set1_paramr))rnZvfy_timeZparamrDrDrEset_timeszX509Store.set_timeN) r@rArBrCror,r/r1r2rDrDrDrEr'(s  z8X509StoreType has been deprecated, use X509Store insteadcs eZdZdZfddZZS)r(z An exception raised when an error occurred while verifying a certificate using `OpenSSL.X509StoreContext.verify_certificate`. :ivar certificate: The certificate which caused verificate failure. :type certificate: :class:`X509` cstt|j|||_dS)N)rr(ro certificate)rnmessager3)rrDrEroszX509StoreContextError.__init__)r@rArBrCrorrDrD)rrEr(sc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)r)a An X.509 store context. An X.509 store context is used to carry out the actual verification process of a certificate in a described context. For describing such a context, see :class:`X509Store`. :ivar _store_ctx: The underlying X509_STORE_CTX structure used by this instance. It is dynamically allocated and automatically garbage collected. :ivar _store: See the ``store`` ``__init__`` parameter. :ivar _cert: See the ``certificate`` ``__init__`` parameter. :param X509Store store: The certificates which will be trusted for the purposes of any verifications. :param X509 certificate: The certificate to be verified. cCs0tj}tj|tj|_||_||_|jdS)N) rKZX509_STORE_CTX_newrRrWZX509_STORE_CTX_free _store_ctxr)_cert_init)rnr*r3Z store_ctxrDrDrEros zX509StoreContext.__init__cCs.tj|j|jj|jjtj}|dkr*tdS)z Set up the store context for a subsequent verification operation. Calling this method more than once without first calling :meth:`_cleanup` will leak memory. rN) rKZX509_STORE_CTX_initr5r)r6rrRrVr)rnretrDrDrEr7szX509StoreContext._initcCstj|jdS)z Internally cleans up the store context. The store context can then be reused with a new call to :meth:`_init`. N)rKZX509_STORE_CTX_cleanupr5)rnrDrDrE_cleanupszX509StoreContext._cleanupcCs\tj|jtj|jttjtjtj|jg}tj|j}tj |}t j |}t ||S)z Convert an OpenSSL native context error failure into a Python exception. When a call to native OpenSSL X509_verify_cert fails, additional information about the failure can be obtained from the store context. ) rKZX509_STORE_CTX_get_errorr5ZX509_STORE_CTX_get_error_depthrrRrhZX509_verify_cert_error_stringZX509_STORE_CTX_get_current_certZX509_dupr%rr()rnerrorsrr6pycertrDrDrE_exception_from_contexts      z(X509StoreContext._exception_from_contextcCs ||_dS)z Set the context's X.509 store. .. versionadded:: 0.15 :param X509Store store: The store description which will be used for the purposes of any *future* verifications. N)r))rnr*rDrDrE set_stores zX509StoreContext.set_storecCs8|j|jtj|j}|j|dkr4|jdS)a" Verify a certificate in a context. .. versionadded:: 0.15 :raises X509StoreContextError: If an error occurred when validating a certificate in the context. Sets ``certificate`` attribute to indicate which certificate caused the error. rN)r9r7rKZX509_verify_certr5r<)rnr8rDrDrEverify_certificates  z#X509StoreContext.verify_certificateN) r@rArBrCror7r9r<r=r>rDrDrDrEr)s   cCsvt|tr|jd}t|}|tkr.rr?)rNr]r^r_rQreplace _crl_reasonsr'rKZASN1_ENUMERATED_newrUrRrVrWZASN1_ENUMERATED_freeZASN1_ENUMERATED_setZX509_REVOKED_add1_ext_i2drGrM)rnreasonZ reason_codeZnew_reason_extrcrrDrDrE set_reasons    zRevoked.set_reasoncCsxttj|jD]l}tj|j|}tj|}tj|tjkrt}tj ||dd}|svtj |tj |}t |dkt |SqWdS)a  Get the reason of this revocation. :return: The reason, or ``None`` if there is none. :rtype: bytes or NoneType .. seealso:: :meth:`all_reasons`, which gives you a list of all supported reasons this method might return. rN)rrKrKrGrLrrrMrZrZM_ASN1_OCTET_STRING_printrrUr\)rnrrrrMrrDrDrE get_reasons   zRevoked.get_reasoncCs|jddS)a Return a list of all the supported reason strings. This list is a copy; modifying it does not change the supported reason strings. :return: A list of reason strings. :rtype: :class:`list` of :class:`bytes` N)rT)rnrDrDrE all_reasons)s zRevoked.all_reasonscCstj|j}t||S)z Set the revocation timestamp. :param bytes when: The timestamp of the revocation, as ASN.1 TIME. :return: ``None`` )rK X509_REVOKED_get0_revocationDaterGrd)rnrbdtrDrDrE set_rev_date5s zRevoked.set_rev_datecCstj|j}t|S)z Get the revocation timestamp. :return: The timestamp of the revocation, as ASN.1 TIME. :rtype: bytes )rKrYrGrk)rnrZrDrDrE get_rev_date@s zRevoked.get_rev_dateN)r@rArBrCrTrorIrJrNrVrWrXr[r\rDrDrDrEr.s" $  c@s|eZdZdZddZddZeddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZedefddZdS)r/z( A certificate revocation list. cCstj}tj|tj|_dS)N)rKZ X509_CRL_newrRrW X509_CRL_freer-)rnr.rDrDrEroPsz CRL.__init__cCsddlm}t}|||jS)z Export as a ``cryptography`` CRL. :rtype: ``cryptography.x509.CertificateRevocationList`` .. versionadded:: 17.1.0 r)_CertificateRevocationList)rr^rGr-)rnr^rFrDrDrErTs zCRL.to_cryptographycCs&t|tjstd|}|j|_|S)a Construct based on a ``cryptography`` *crypto_crl*. :param crypto_crl: A ``cryptography`` certificate revocation list :type crypto_crl: ``cryptography.x509.CertificateRevocationList`` :rtype: CRL .. versionadded:: 17.1.0 z%Must be a certificate revocation list)r]r ZCertificateRevocationListr_Z _x509_crlr-)r{Z crypto_crlr.rDrDrErbs zCRL.from_cryptographycCsrg}tj|j}xPttj|D]>}tj||}tj|}tjt}t j |tj |_ |j |q W|rnt|SdS)aA Return the revocations in this certificate revocation list. These revocations will be provided by value, not by reference. That means it's okay to mutate them: it won't affect this CRL. :return: The revocations in this CRL. :rtype: :class:`tuple` of :class:`Revocation` N)rKZX509_CRL_get_REVOKEDr-rZsk_X509_REVOKED_numZsk_X509_REVOKED_valueCryptography_X509_REVOKED_dupr.rrRrWrFrGrptuple)rnresultsZ revoked_stackrrHZ revoked_copyZpyrevrDrDrE get_revokedus     zCRL.get_revokedcCs8tj|j}t|tjktj|j|}t|dkdS)a9 Add a revoked (by value not reference) to the CRL structure This revocation will be added by value, not by reference. That means it's okay to mutate it after adding: it won't affect this CRL. :param Revoked revoked: The new revocation. :return: ``None`` rN)rKr_rGrUrRrVZX509_CRL_add0_revokedr-)rnrHcopyrrDrDrE add_revokeds zCRL.add_revokedcCsBtjtj|j}t|tjktj|tj}t j t }||_ |S)zc Get the CRL's issuer. .. versionadded:: 16.1.0 :rtype: X509Name ) rKrZX509_CRL_get_issuerr-rUrRrVrWrr"rrs)rnZ_issuerrrDrDrEr!s  zCRL.get_issuercCsttj|j|dkdS)z Set the CRL version. .. versionadded:: 16.1.0 :param int version: The version of the CRL. :return: ``None`` rN)rUrKZX509_CRL_set_versionr-)rnrrDrDrErs zCRL.set_versioncCst||j|S)N)rdr-)rnrrbrDrDrErszCRL._set_boundary_timecCs|jtj|S)z Set when the CRL was last updated. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ .. versionadded:: 16.1.0 :param bytes when: A timestamp string. :return: ``None`` )rrKZX509_CRL_get_lastUpdate)rnrbrDrDrEset_lastUpdates zCRL.set_lastUpdatecCs|jtj|S)z Set when the CRL will next be udpated. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ .. versionadded:: 16.1.0 :param bytes when: A timestamp string. :return: ``None`` )rrKZX509_CRL_get_nextUpdate)rnrbrDrDrEset_nextUpdates zCRL.set_nextUpdatecCs\tj|}t|tjktj|jtj|jtj |jtj |j|j |}t|dkdS)a; Sign the CRL. Signing a CRL enables clients to associate the CRL itself with an issuer. Before a CRL is meaningful to other OpenSSL functions, it must be signed by an issuer. This method implicitly sets the issuer's name based on the issuer certificate and private key used to sign the CRL. .. versionadded:: 16.1.0 :param X509 issuer_cert: The issuer's certificate. :param PKey issuer_key: The issuer's private key. :param bytes digest: The digest method to sign the CRL with. rN) rKrrUrRrVX509_CRL_set_issuer_namer-r#rZ X509_CRL_sort X509_CRL_signrv)rnrZ issuer_keyrrrrDrDrEr7s  zCRL.signdc Cst|tstdt|ts$tdt|ts6td|tkrFtdtj|}|tj krbt dtj tj }t |tj ktj}t |tj ktj|dtj|j|tj||dddtj|j|tj|jtj|jtj|j|j|} | stt||S) a Export the CRL as a string. :param X509 cert: The certificate used to sign the CRL. :param PKey key: The key used to sign the CRL. :param int type: The export format, either :data:`FILETYPE_PEM`, :data:`FILETYPE_ASN1`, or :data:`FILETYPE_TEXT`. :param int days: The number of days until the next update of this CRL. :param bytes digest: The name of the message digest to use (eg ``b"sha2566"``). :rtype: bytes zcert must be an X509 instancezkey must be a PKey instanceztype must be an integerzdigest must be providedzNo such digest methodr<)r]r%r_rr} _UNSPECIFIEDrKrrRrVr`rPrQrUZ ASN1_TIME_newrZX509_CRL_set_lastUpdater-ZX509_CRL_set_nextUpdatergr#rrhrvrr9) rnrrrZdaysrrrMZsometimerrDrDrEexports2      z CRL.exportN)r@rArBrCrorrrrbrdr!rrrerfr7rrlrmrDrDrDrEr/Ks  z,CRLType has been deprecated, use CRL insteadc@s4eZdZddZddZddZddZd d Zd S) r0cCsttj|jS)zm Check if this NID_pkcs7_signed object :return: True if the PKCS7 is of type signed )boolrKZPKCS7_type_is_signed_pkcs7)rnrDrDrEtype_is_signed- szPKCS7.type_is_signedcCsttj|jS)zt Check if this NID_pkcs7_enveloped object :returns: True if the PKCS7 is of type enveloped )rnrKZPKCS7_type_is_envelopedro)rnrDrDrEtype_is_enveloped5 szPKCS7.type_is_envelopedcCsttj|jS)z Check if this NID_pkcs7_signedAndEnveloped object :returns: True if the PKCS7 is of type signedAndEnveloped )rnrKZ PKCS7_type_is_signedAndEnvelopedro)rnrDrDrEtype_is_signedAndEnveloped= sz PKCS7.type_is_signedAndEnvelopedcCsttj|jS)zi Check if this NID_pkcs7_data object :return: True if the PKCS7 is of type data )rnrKZPKCS7_type_is_dataro)rnrDrDrE type_is_dataE szPKCS7.type_is_datacCs"tj|jj}tj|}tj|S)zk Returns the type name of the PKCS7 structure :return: A string with the typename )rKrrorrrRrh)rnrZ string_typerDrDrE get_type_nameM s zPKCS7.get_type_nameN)r@rArBrprqrrrsrtrDrDrDrEr0, s z0PKCS7Type has been deprecated, use PKCS7 insteadc@sbeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ dddZ dS)r1z A PKCS #12 archive. cCsd|_d|_d|_d|_dS)N)rvr6_cacerts _friendlyname)rnrDrDrErod szPKCS12.__init__cCs|jS)z Get the certificate in the PKCS #12 structure. :return: The certificate, or :py:const:`None` if there is none. :rtype: :py:class:`X509` or :py:const:`None` )r6)rnrDrDrEget_certificatej szPKCS12.get_certificatecCst|tstd||_dS)z Set the certificate in the PKCS #12 structure. :param cert: The new certificate, or :py:const:`None` to unset it. :type cert: :py:class:`X509` or :py:const:`None` :return: ``None`` zcert must be an X509 instanceN)r]r%r_r6)rnrrDrDrEset_certificates s zPKCS12.set_certificatecCs|jS)z Get the private key in the PKCS #12 structure. :return: The private key, or :py:const:`None` if there is none. :rtype: :py:class:`PKey` )rv)rnrDrDrEget_privatekey szPKCS12.get_privatekeycCst|tstd||_dS)z Set the certificate portion of the PKCS #12 structure. :param pkey: The new private key, or :py:const:`None` to unset it. :type pkey: :py:class:`PKey` or :py:const:`None` :return: ``None`` zpkey must be a PKey instanceN)r]rr_rv)rnrxrDrDrEset_privatekey s zPKCS12.set_privatekeycCs|jdk rt|jSdS)a Get the CA certificates in the PKCS #12 structure. :return: A tuple with the CA certificates in the chain, or :py:const:`None` if there are none. :rtype: :py:class:`tuple` of :py:class:`X509` or :py:const:`None` N)rur`)rnrDrDrEget_ca_certificates s zPKCS12.get_ca_certificatescCsB|dkrd|_n.t|}x|D]}t|tstdqW||_dS)a Replace or set the CA certificates within the PKCS12 object. :param cacerts: The new CA certificates, or :py:const:`None` to unset them. :type cacerts: An iterable of :py:class:`X509` or :py:const:`None` :return: ``None`` Nz)iterable must only contain X509 instances)rulistr]r%r_)rncacertsrrDrDrEset_ca_certificates s    zPKCS12.set_ca_certificatescCs2|dkrd|_nt|ts(td|f||_dS)z Set the friendly name in the PKCS #12 structure. :param name: The new friendly name, or :py:const:`None` to unset. :type name: :py:class:`bytes` or :py:const:`None` :return: ``None`` Nz+name must be a byte string or None (not %r))rvr]r^r_)rnrqrDrDrEset_friendlyname s   zPKCS12.set_friendlynamecCs|jS)z Get the friendly name in the PKCS# 12 structure. :returns: The friendly name, or :py:const:`None` if there is none. :rtype: :py:class:`bytes` or :py:const:`None` )rv)rnrDrDrEget_friendlyname szPKCS12.get_friendlynameNr?c Cstd|}|jdkrtj}n4tj}tj|tj}x|jD]}tj||j q:W|dkr^tj}|j }|dkrrtj}|j dkrtj}n|j j }|j dkrtj}n|j j }tj |||||tjtj||d }|tjkrttj|tj}t} tj| |t| S)a Dump a PKCS12 object as a string. For more information, see the :c:func:`PKCS12_create` man page. :param passphrase: The passphrase used to encrypt the structure. Unlike some other passphrase arguments, this *must* be a string, not a callback. :type passphrase: :py:data:`bytes` :param iter: Number of times to repeat the encryption step. :type iter: :py:data:`int` :param maciter: Number of times to repeat the MAC step. :type maciter: :py:data:`int` :return: The string representation of the PKCS #12 structure. :rtype: rDNr)_text_to_bytes_and_warnrurRrVrKZsk_X509_new_nullrW sk_X509_freeZ sk_X509_pushrrvrvr6Z PKCS12_createZ&NID_pbe_WithSHA1And3_Key_TripleDES_CBCr PKCS12_freerZZi2d_PKCS12_bior\) rnrDiterZmaciterr}r friendlynamerxpkcs12rMrDrDrErm s:         z PKCS12.export)Nrr?)r@rArBrCrorwrxryrzr{r~rrrmrDrDrDrEr1_ s      z2PKCS12Type has been deprecated, use PKCS12 insteadc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)r2z! A Netscape SPKI object. cCstj}tj|tj|_dS)N)rKZNETSCAPE_SPKI_newrRrWZNETSCAPE_SPKI_free_spki)rnZspkirDrDrEro szNetscapeSPKI.__init__cCs^|jrtd|jstdtjt|}|tjkrNetscapeSPKIType has been deprecated, use NetscapeSPKI insteadc@sBeZdZd ddZeddZeddZefdd Zd d Z d S)r@FcCs4|tkr|dk rtd||_||_||_g|_dS)Nz0only FILETYPE_PEM key format supports encryption)rr` _passphrase _more_args _truncate _problems)rnrrDZ more_argstruncaterDrDrErov sz_PassphraseHelper.__init__cCsF|jdkrtjSt|jtr"tjSt|jr:tjd|jStddS)NZpem_password_cbz2Last argument must be a byte string or a callable.) rrRrVr]r^callablerA_read_passphraser_)rnrDrDrErA s   z_PassphraseHelper.callbackcCs>|jdkrtjSt|jtr"|jSt|jr2tjStddS)Nz2Last argument must be a byte string or a callable.)rrRrVr]r^rr_)rnrDrDrErB s   z_PassphraseHelper.callback_argsc Cs8|jr4y t|Wn|k r&YnX|jjddS)Nr)r_exception_from_error_queuepop)rnZ exceptionTyperDrDrErC s  z"_PassphraseHelper.raise_if_problemcCsy|jr|j|||}n |j|}t|ts4tdt||kr\|jrT|d|}ntdx(tt|D]}|||d||<qjWt|Stk r}z|j j |dSd}~XnXdS)NzString expectedz+passphrase returned by callback is too longr?r) rrr]r^r`rTrr Exceptionrrp)rnZbufsizeZrwflagZuserdatarrerDrDrEr s"    z"_PassphraseHelper._read_passphraseN)FF) r@rArBrorrArBrrCrrDrDrDrEr@u s  r@cCst|tr|jd}t|}|tkrs$     (     ( jBHUoh ;+[,/ZG! $"$ `PK}S]jH/H/__pycache__/SSL.cpython-36.pycnu[3 F\[R@sddlZddlZddlmZddlmZmZddlmZm Z ddl m Z ddl m Z ddlmZddlmZmZmZmZdd lmZmZmZmZmZ m!Z"m#Z$m%Z&m'Z(dd l)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\gRZ0ye1Z2Wn&e3k rGd]d^d^e4Z2YnXej5Z5ej6Z6ej7Z7ej8Z8ej9Z9ej:Z:ej;Zd_Z?d`Z@daZAdbZBdcZCddZDejEZFejGZHejIZJejKZLejMZNejOZPejQZRejSZTejUZVejWZXejYZZej[Z\ej]Z^ej_Z`ejaZbejcZdejeZfejgZhejiZjejkZlejmZnejoZpejqZrejsZtejuZvejwZxejyZzej{Z|ej}Z~ejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejr$ejZejZejZejZe0jdedfdgdhgejZejZejZejZejZejZejZejZejZejZejZejZejZdidjdkdldmgZdngZdoZdpZGdqdSdSeZeeeZe eZGdrdTdTeZGdsdUdUeZGdtdVdVeZGdudWdWeZGdvdXdXeZGdwdxdxe4ZGdydzdzeZGd{d|d|eZGd}d~d~eZGdddeZGdddeZGdddeZddZddYZddZeejdZeejdZeejdZGddZdZe4ZGdd[d[e4ZeeedeσZGdd\d\e4ZeeedeσZejӃdS)N)platform)wrapspartial)countchain)WeakValueDictionary) errorcode) deprecated) binary_type integer_typesint2byte indexbytes) UNSPECIFIEDexception_from_error_queueffilib make_assertnative path_stringtext_to_bytes_and_warnno_zero_allocator) FILETYPE_PEM_PassphraseHelperPKeyX509NameX509 X509StoreOPENSSL_VERSION_NUMBERSSLEAY_VERSION SSLEAY_CFLAGSSSLEAY_PLATFORM SSLEAY_DIRSSLEAY_BUILT_ON SENT_SHUTDOWNRECEIVED_SHUTDOWN SSLv2_METHOD SSLv3_METHOD SSLv23_METHOD TLSv1_METHODTLSv1_1_METHODTLSv1_2_METHOD OP_NO_SSLv2 OP_NO_SSLv3 OP_NO_TLSv1 OP_NO_TLSv1_1 OP_NO_TLSv1_2MODE_RELEASE_BUFFERSOP_SINGLE_DH_USEOP_SINGLE_ECDH_USEOP_EPHEMERAL_RSAOP_MICROSOFT_SESS_ID_BUGOP_NETSCAPE_CHALLENGE_BUG#OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUGOP_SSLREF2_REUSE_CERT_TYPE_BUGOP_MICROSOFT_BIG_SSLV3_BUFFEROP_MSIE_SSLV2_RSA_PADDINGOP_SSLEAY_080_CLIENT_DH_BUG OP_TLS_D5_BUGOP_TLS_BLOCK_PADDING_BUGOP_DONT_INSERT_EMPTY_FRAGMENTSOP_CIPHER_SERVER_PREFERENCEOP_TLS_ROLLBACK_BUGOP_PKCS1_CHECK_1OP_PKCS1_CHECK_2OP_NETSCAPE_CA_DN_BUG"OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUGOP_NO_COMPRESSIONOP_NO_QUERY_MTUOP_COOKIE_EXCHANGE OP_NO_TICKETOP_ALL VERIFY_PEERVERIFY_FAIL_IF_NO_PEER_CERTVERIFY_CLIENT_ONCE VERIFY_NONESESS_CACHE_OFFSESS_CACHE_CLIENTSESS_CACHE_SERVERSESS_CACHE_BOTHSESS_CACHE_NO_AUTO_CLEARSESS_CACHE_NO_INTERNAL_LOOKUPSESS_CACHE_NO_INTERNAL_STORESESS_CACHE_NO_INTERNALSSL_ST_CONNECT SSL_ST_ACCEPT SSL_ST_MASK SSL_CB_LOOP SSL_CB_EXIT SSL_CB_READ SSL_CB_WRITE SSL_CB_ALERTSSL_CB_READ_ALERTSSL_CB_WRITE_ALERTSSL_CB_ACCEPT_LOOPSSL_CB_ACCEPT_EXITSSL_CB_CONNECT_LOOPSSL_CB_CONNECT_EXITSSL_CB_HANDSHAKE_STARTSSL_CB_HANDSHAKE_DONEError WantReadErrorWantWriteErrorWantX509LookupErrorZeroReturnError SysCallErrorSSLeay_versionSessionContext Connectionc@s eZdZdS)_bufferN)__name__ __module__ __qualname__rsrs/usr/lib/python3.6/SSL.pyrovsro SSL_ST_INIT SSL_ST_BEFORE SSL_ST_OKSSL_ST_RENEGOTIATEz"/etc/ssl/certs/ca-certificates.crtz /etc/pki/tls/certs/ca-bundle.crtz/etc/ssl/ca-bundle.pemz/etc/pki/tls/cacert.pemz1/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pemz/etc/ssl/certss$/opt/pyca/cryptography/openssl/certss'/opt/pyca/cryptography/openssl/cert.pemc@seZdZdZdS)rez4 An error occurred in an `OpenSSL.SSL` API. N)rprqrr__doc__rsrsrsrtresc@s eZdZdS)rfN)rprqrrrsrsrsrtrfsc@s eZdZdS)rgN)rprqrrrsrsrsrtrgsc@s eZdZdS)rhN)rprqrrrsrsrsrtrhsc@s eZdZdS)riN)rprqrrrsrsrsrtrisc@s eZdZdS)rjN)rprqrrrsrsrsrtrj sc@s eZdZdZddZddZdS)_CallbackExceptionHelpera A base class for wrapper classes that allow for intelligent exception handling in OpenSSL callbacks. :ivar list _problems: Any exceptions that occurred while executing in a context where they could not be raised in the normal way. Typically this is because OpenSSL has called into some Python code and requires a return value. The exceptions are saved to be raised later when it is possible to do so. cCs g|_dS)N) _problems)selfrsrsrt__init__sz!_CallbackExceptionHelper.__init__c Cs6|jr2y tWntk r$YnX|jjddS)z Raise an exception from the OpenSSL error queue or that was previously captured whe running a callback. rN)r_raise_current_errorrepop)rrsrsrtraise_if_problems  z)_CallbackExceptionHelper.raise_if_problemN)rprqrrrrrrsrsrsrtr s rc@seZdZdZddZdS) _VerifyHelperz^ Wrap a callback such that it can be used as a certificate verification callback. cs2tjtfdd}tjd|_dS)Nc stj|}tj|tj|}tj|}tj|}tj}tj||}t j |}y|||||} Wn,t k r} zj j | dSd} ~ XnX| rtj|tjdSdSdS)Nrru)_libZX509_STORE_CTX_get_current_cert X509_up_refr_from_raw_x509_ptrZX509_STORE_CTX_get_errorZX509_STORE_CTX_get_error_depthZ"SSL_get_ex_data_X509_STORE_CTX_idxZX509_STORE_CTX_get_ex_datarn_reverse_mapping ExceptionrappendZX509_STORE_CTX_set_errorZ X509_V_OK) okZ store_ctxZx509certZ error_numberZ error_depthindexsslZ connectionresulte)callbackrrsrtwrapper2s$        z'_VerifyHelper.__init__..wrapperzint (*)(int, X509_STORE_CTX *))rrr_ffir)rrrrs)rrrtr/s z_VerifyHelper.__init__N)rprqrrrrrsrsrsrtr)src@seZdZdZddZdS)_NpnAdvertiseHelperzT Wrap a callback such that it can be used as an NPN advertisement callback. cs2tjtfdd}tjd|_dS)Ncsyntj|}|}djtjdd|D}tjdt|tjd|g|_|jdd|d<|jd|d<dSt k r}zj j |dSd}~XnXdS) Ncss|]}tt||fVqdS)N)r len).0prsrsrt asz@_NpnAdvertiseHelper.__init__..wrapper..zunsigned int *zunsigned char[]rrurv) rnrjoinr from_iterablernewr_npn_advertise_callback_argsrrr)routoutlenargconnprotosprotostrr)rrrsrtrXs  z-_NpnAdvertiseHelper.__init__..wrapperz>int (*)(SSL *, const unsigned char **, unsigned int *, void *))rrrrr)rrrrs)rrrtrUs  z_NpnAdvertiseHelper.__init__N)rprqrrrrrsrsrsrtrPsrc@seZdZdZddZdS)_NpnSelectHelperzP Wrap a callback such that it can be used as an NPN selection callback. cs2tjtfdd}tjd|_dS)Nc sytj|}tj||dd}g}x<|r`t|d} |d| d} |j| || dd}q&W||} tjdt| tjd| g|_|jdd|d<|jd|d<dSt k r} zj j| dSd} ~ XnXdS)Nrruzunsigned char *zunsigned char[]rv) rnrrbufferr rrr_npn_select_callback_argsrr) rrrin_inlenrrinstr protolistlengthprotooutstrr)rrrsrtrs$     z*_NpnSelectHelper.__init__..wrapperz^int (*)(SSL *, unsigned char **, unsigned char *, const unsigned char *, unsigned int, void *))rrrrr)rrrrs)rrrtr~s  "z_NpnSelectHelper.__init__N)rprqrrrrrsrsrsrtrysrc@seZdZdZddZdS)_ALPNSelectHelperzQ Wrap a callback such that it can be used as an ALPN selection callback. cs2tjtfdd}tjd|_dS)Nc sytj|}tj||dd}g}x<|r`t|d} |d| d} |j| || dd}q&W||} t| ts~tdtj dt | tj d| g|_ |j dd|d<|j d|d<dSt k r} zj j| dSd} ~ XnXdS)Nrruz'ALPN callback must return a bytestring.zunsigned char *zunsigned char[]rv)rnrrrr r isinstance _binary_type TypeErrorrr_alpn_select_callback_argsrr) rrrrrrrrrZ encoded_lenrrr)rrrsrtrs(      z+_ALPNSelectHelper.__init__..wrapperz^int (*)(SSL *, unsigned char **, unsigned char *, const unsigned char *, unsigned int, void *))rrrrr)rrrrs)rrrtrs  $z_ALPNSelectHelper.__init__N)rprqrrrrrsrsrsrtrsrc@seZdZdZddZdS)_OCSPServerCallbackHelpera Wrap a callback such that it can be used as an OCSP callback for the server side. Annoyingly, OpenSSL defines one OCSP callback but uses it in two different ways. For servers, that callback is expected to retrieve some OCSP data and hand it to OpenSSL, and may return only SSL_TLSEXT_ERR_OK, SSL_TLSEXT_ERR_FATAL, and SSL_TLSEXT_ERR_NOACK. For clients, that callback is expected to check the OCSP data, and returns a negative value on error, 0 if the response is not acceptable, or positive if it is. These are mutually exclusive return code behaviours, and they mean that we need two helpers so that we always return an appropriate error code if the user's code throws an exception. Given that we have to have two helpers anyway, these helpers are a bit more helpery than most: specifically, they hide a few more of the OpenSSL functions so that the user has an easier time writing these callbacks. This helper implements the server side. cs2tjtfdd}tjd|_dS)Ncsytj|}|tjkr"tj|}nd}||}t|tsBtd|sJdSt|}t j |}|tj ||dd<t j |||dSt k r}zjj|dSd}~XnXdS)Nz'OCSP callback must return a bytestring.rwrrv)rnrrNULL from_handlerrrrrZOPENSSL_mallocrZSSL_set_tlsext_status_ocsp_resprrr)rcdatardata ocsp_dataZocsp_data_lengthZdata_ptrr)rrrsrtrs&        z3_OCSPServerCallbackHelper.__init__..wrapperzint (*)(SSL *, void *))rrrrr)rrrrs)rrrtrs 'z"_OCSPServerCallbackHelper.__init__N)rprqrrrrrsrsrsrtrsrc@seZdZdZddZdS)_OCSPClientCallbackHelpera Wrap a callback such that it can be used as an OCSP callback for the client side. Annoyingly, OpenSSL defines one OCSP callback but uses it in two different ways. For servers, that callback is expected to retrieve some OCSP data and hand it to OpenSSL, and may return only SSL_TLSEXT_ERR_OK, SSL_TLSEXT_ERR_FATAL, and SSL_TLSEXT_ERR_NOACK. For clients, that callback is expected to check the OCSP data, and returns a negative value on error, 0 if the response is not acceptable, or positive if it is. These are mutually exclusive return code behaviours, and they mean that we need two helpers so that we always return an appropriate error code if the user's code throws an exception. Given that we have to have two helpers anyway, these helpers are a bit more helpery than most: specifically, they hide a few more of the OpenSSL functions so that the user has an easier time writing these callbacks. This helper implements the client side. cs2tjtfdd}tjd|_dS)Nc syxtj|}|tjkr"tj|}nd}tjd}tj||}|dkrJd}ntj|d|dd}|||}t t |St k r}zj j |dSd}~XnXdS)Nzunsigned char **rrru)rnrrrrrrZSSL_get_tlsext_status_ocsp_resprintboolrrr) rrrrZocsp_ptrZocsp_lenrZvalidr)rrrsrtr9s        z3_OCSPClientCallbackHelper.__init__..wrapperzint (*)(SSL *, void *))rrrrr)rrrrs)rrrtr6s z"_OCSPClientCallbackHelper.__init__N)rprqrrrrrsrsrsrtr srcCsdd}t|ts(t|dd}|dk r(|}t|tr6|}t|tsJtdn|dkr`td|f|S)Nfilenoz3argument must be an int, or have a fileno() method.rz1file descriptor cannot be a negative integer (%i))rr getattrr ValueError)objfdmethrsrsrt_asFileDescriptor[s      rcCstjtj|S)z Return a string describing the version of OpenSSL in use. :param type: One of the :const:`SSLEAY_` constants defined in this module. )rstringrrk)typersrsrtrknscsfdd}|S)a 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``. :param error: The string to be used in the exception if the flag is false. cs$st|fdd}|S|SdS)Ncs tdS)N)NotImplementedError)argskwargs)errorrsrtexplodesz<_make_requires.._requires_decorator..explode)r)funcr)rflagrsrt_requires_decoratorsz+_make_requires.._requires_decoratorrs)rrrrs)rrrt_make_requiresws  rzNPN not availablezALPN not availablezSNI not availablec@seZdZdZdS)rlz A class representing an SSL session. A session defines certain connection parameters which may be re-used to speed up the setup of subsequent connections. .. versionadded:: 0.14 N)rprqrrrrsrsrsrtrlsc @seZdZdZededededede diZ e dd e j DZ d d Z ded dZddZdfddZddZddZddZddZefddZddZdd Zd!d"Zefd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Z d/d0Z!d1d2Z"d3d4Z#d5d6Z$d7d8Z%d9d:Z&d;d<Z'd=d>Z(d?d@Z)dAdBZ*dCdDZ+dEdFZ,dGdHZ-dIdJZ.dKdLZ/dMdNZ0dOdPZ1dQdRZ2e3dSdTZ4dUdVZ5e6dWdXZ7e6dYdZZ8e9d[d\Z:e9d]d^Z;d_d`Zd S)irmz :class:`OpenSSL.SSL.Context` instances define the parameters for setting up new SSL connections. :param method: One of SSLv2_METHOD, SSLv3_METHOD, SSLv23_METHOD, or TLSv1_METHOD. Z SSLv2_methodZ SSLv3_methodZ SSLv23_methodZ TLSv1_methodZTLSv1_1_methodZTLSv1_2_methodccs0|](\}}tt|ddk r|tt|fVqdS)N)rr)rZ identifiernamersrsrtrszContext.cCs&t|tstdy|j|}Wntk r<tdYnX|}t|tjkt j |}t|tjktj |t j }yt j |d}t|dkWntk rYnX||_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ |j!t j"dS)Nzmethod must be an integerzNo such protocolru)#rr r_methodsKeyErrorr_openssl_assertrrrZ SSL_CTX_newgcZ SSL_CTX_freeZSSL_CTX_set_ecdh_autoAttributeError_context_passphrase_helper_passphrase_callback_passphrase_userdata_verify_helper_verify_callback_info_callback_tlsext_servername_callback _app_data_npn_advertise_helper_npn_advertise_callback_npn_select_helper_npn_select_callback_alpn_select_helper_alpn_select_callback _ocsp_helper_ocsp_callback _ocsp_dataset_modeZSSL_MODE_ENABLE_PARTIAL_WRITE)rmethodZ method_funcZ method_objcontextresrsrsrtrsF   zContext.__init__NcCsN|dkrtj}nt|}|dkr(tj}nt|}tj|j||}|sJtdS)aU 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* may be :data:`None`. :param cafile: In which file we can find the certificates (``bytes`` or ``unicode``). :param capath: In which directory we can find the certificates (``bytes`` or ``unicode``). :return: None N)rr _path_stringrZSSL_CTX_load_verify_locationsrr)rcafilecapathZ load_resultrsrsrtload_verify_locationss zContext.load_verify_locationscs&tfdd}tt|dddS)Ncs||jS)N)r)sizeZverifyuserdata)rrrsrtr sz'Context._wrap_callback..wrapperT)Z more_argstruncate)rrr)rrrrs)rrrt_wrap_callback szContext._wrap_callbackcCs@t|std|j||_|jj|_tj|j|j||_ dS)a 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 the returned passphrase is longer than this, it will be truncated. Second, a boolean value which will be true if the user should be prompted for the passphrase twice and the callback should verify that the two values supplied are equal. Third, the value given as the *userdata* parameter to :meth:`set_passwd_cb`. The *callback* must return a byte string. If an error occurs, *callback* should return a false value (e.g. an empty string). :param userdata: (optional) A Python object which will be given as argument to the callback :return: None zcallback must be callableN) callablerrrrrrZSSL_CTX_set_default_passwd_cbrr)rrrrsrsrt set_passwd_cbs   zContext.set_passwd_cbcCstj|j}t|dktjtjjd}tjtjjd}|j ||stjtj }tjtj }|t kr|t kr|jttdS)a 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 the ``openssl@1.1`` `Homebrew `_ formula installed in the default location. * Windows will not work. * manylinux1 cryptography wheels will work on most common Linux distributions in pyOpenSSL 17.1.0 and above. pyOpenSSL detects the manylinux1 wheel and attempts to load roots via a fallback path. :return: None ruasciiN)rZ SSL_CTX_set_default_verify_pathsrrrrZX509_get_default_cert_dir_envdecodeZX509_get_default_cert_file_env_check_env_vars_setZX509_get_default_cert_dirZX509_get_default_cert_file_CRYPTOGRAPHY_MANYLINUX1_CA_DIR _CRYPTOGRAPHY_MANYLINUX1_CA_FILE_fallback_default_verify_paths_CERTIFICATE_FILE_LOCATIONS_CERTIFICATE_PATH_LOCATIONS)r set_result dir_env_var file_env_varZ default_dirZ default_filersrsrtset_default_verify_paths-s      z Context.set_default_verify_pathscCs tjj|dk ptjj|dk S)zp Check to see if the default cert dir/file environment vars are present. :return: bool N)osenvironget)rrrrsrsrtr^szContext._check_env_vars_setcCsRx$|D]}tjj|r|j|PqWx&|D]}tjj|r,|jd|Pq,WdS)aW 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: None N)rpathisfilerisdir)rZ file_pathZdir_pathrrrsrsrtris      z&Context._fallback_default_verify_pathscCs$t|}tj|j|}|s tdS)z 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 N)rrZ"SSL_CTX_use_certificate_chain_filerr)rcertfilerrsrsrtuse_certificate_chain_file}s  z"Context.use_certificate_chain_filecCs8t|}t|tstdtj|j||}|s4tdS)ah 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`. :return: None zfiletype must be an integerN)rrr rrZSSL_CTX_use_certificate_filerr)rr filetype use_resultrsrsrtuse_certificate_files   zContext.use_certificate_filecCs0t|tstdtj|j|j}|s,tdS)zs Load a certificate from a X509 object :param cert: The X509 object :return: None zcert must be an X509 instanceN)rrrrZSSL_CTX_use_certificater_x509r)rrr rsrsrtuse_certificates  zContext.use_certificatecCsDt|tstdtj|j}tj|j|}|s@tj|t dS)z Add certificate to chain :param certobj: The X509 certificate object to add to the chain :return: None z certobj must be an X509 instanceN) rrrrX509_duprZSSL_CTX_add_extra_chain_certrZ X509_freer)rZcertobjcopy add_resultrsrsrtadd_extra_chain_certs   zContext.add_extra_chain_certcCs |jdk r|jjttdS)N)rrrer)rrsrsrt_raise_passphrase_exceptions  z#Context._raise_passphrase_exceptioncCsHt|}|tkrt}nt|ts(tdtj|j||}|sD|j dS)aR 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 zfiletype must be an integerN) r _UNSPECIFIEDrrr rrZSSL_CTX_use_PrivateKey_filerr)rZkeyfiler r rsrsrtuse_privatekey_files   zContext.use_privatekey_filecCs2t|tstdtj|j|j}|s.|jdS)zs Load a private key from a PKey object :param pkey: The PKey object :return: None zpkey must be a PKey instanceN)rrrrZSSL_CTX_use_PrivateKeyrZ_pkeyr)rZpkeyr rsrsrtuse_privatekeys  zContext.use_privatekeycCstj|jstdS)z Check if the private key (loaded with :meth:`use_privatekey`) matches the certificate (loaded with :meth:`use_certificate`) :return: :data:`None` (raises :exc:`Error` if something's wrong) N)rZSSL_CTX_check_private_keyrr)rrsrsrtcheck_privatekeys zContext.check_privatekeycCs0tjtd|}t|tjktj|j|dS)a% 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 rN)rZSSL_load_client_CA_file_text_to_bytes_and_warnrrrSSL_CTX_set_client_CA_listr)rrZca_listrsrsrtload_client_cas  zContext.load_client_cacCs*td|}ttj|j|t|dkdS)aV 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: None bufruN)rrrZSSL_CTX_set_session_id_contextrr)rrrsrsrtset_session_ids zContext.set_session_idcCs t|tstdtj|j|S)a 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 previously set caching mode. .. versionadded:: 0.14 zmode must be an integer)rr rrZSSL_CTX_set_session_cache_moder)rmodersrsrtset_session_cache_modes zContext.set_session_cache_modecCs tj|jS)z Get the current session cache mode. :returns: The currently used cache mode. .. versionadded:: 0.14 )rZSSL_CTX_get_session_cache_moder)rrsrsrtget_session_cache_mode,szContext.get_session_cache_modecCsLt|tstdt|s"tdt||_|jj|_tj |j ||jdS)a 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:ed with :const:`VERIFY_FAIL_IF_NO_PEER_CERT` and :const:`VERIFY_CLIENT_ONCE` to further control the behaviour. :param callback: The Python callback to use. This should take five arguments: A Connection object, an X509 object, and three integer variables, which are in turn potential error number, error depth and return code. *callback* should return True if verification passes and False otherwise. :return: None See SSL_CTX_set_verify(3SSL) for further details. zmode must be an integerzcallback must be callableN) rr rrrrrrrZSSL_CTX_set_verifyr)rrrrsrsrt set_verify6s   zContext.set_verifycCs$t|tstdtj|j|dS)z 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 zdepth must be an integerN)rr rrZSSL_CTX_set_verify_depthr)rdepthrsrsrtset_verify_depthSs zContext.set_verify_depthcCs tj|jS)z Retrieve the Context object's verify mode, as set by :meth:`set_verify`. :return: The verify mode )rZSSL_CTX_get_verify_moder)rrsrsrtget_verify_mode`szContext.get_verify_modecCs tj|jS)z Retrieve the Context object's verify depth, as set by :meth:`set_verify_depth`. :return: The verify depth )rZSSL_CTX_get_verify_depthr)rrsrsrtget_verify_depthiszContext.get_verify_depthcCsht|}tj|d}|tjkr$ttj|tj}tj|tjtjtj}tj|tj }tj |j |dS)z Load parameters for Ephemeral Diffie-Hellman :param dhfile: The file to load EDH parameters from (``bytes`` or ``unicode``). :return: None rN) rrZ BIO_new_filerrrrZBIO_freeZPEM_read_bio_DHparamsZDH_freeZSSL_CTX_set_tmp_dhr)rZdhfilebioZdhrsrsrt load_tmp_dhrs   zContext.load_tmp_dhcCstj|j|jdS)a  Select a curve to use for ECDHE key exchange. :param curve: A curve object to use as returned by either :meth:`OpenSSL.crypto.get_elliptic_curve` or :meth:`OpenSSL.crypto.get_elliptic_curves`. :return: None N)rZSSL_CTX_set_tmp_ecdhrZ _to_EC_KEY)rZcurversrsrt set_tmp_ecdhs zContext.set_tmp_ecdhcCsVtd|}t|tstdttj|j|dkt|d}t|j dddgkdS)z 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_listz"cipher_list must be a byte string.ruNZTLS_AES_256_GCM_SHA384ZTLS_CHACHA20_POLY1305_SHA256ZTLS_AES_128_GCM_SHA256) rrbytesrrrZSSL_CTX_set_cipher_listrrnget_cipher_list)rr+Ztmpconnrsrsrtset_cipher_lists   zContext.set_cipher_listc Cstj}t|tjkyjxd|D]\}t|ts@tdt|j ftj |j }t|tjktj ||}|stj |tqWWn tk rtj|YnXtj|j|dS)a_ 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 .. versionadded:: 0.10 z3client CAs must be X509Name objects, not %s objectsN)rZsk_X509_NAME_new_nullrrrrrrrrp X509_NAME_dup_nameZsk_X509_NAME_pushX509_NAME_freerrZsk_X509_NAME_freerr)rZcertificate_authoritiesZ name_stackZca_namerZ push_resultrsrsrtset_client_ca_lists$       zContext.set_client_ca_listcCs2t|tstdtj|j|j}t|dkdS)ai 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 .. versionadded:: 0.10 z.certificate_authority must be an X509 instanceruN)rrrrZSSL_CTX_add_client_CArrr)rZcertificate_authorityrrsrsrt add_client_cas  zContext.add_client_cacCs t|tstdtj|j|S)aQ 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 ztimeout must be an integer)rr rrZSSL_CTX_set_timeoutr)rZtimeoutrsrsrt set_timeouts zContext.set_timeoutcCs tj|jS)z Retrieve session timeout, as set by :meth:`set_timeout`. The default is 300 seconds. :return: The session timeout )rZSSL_CTX_get_timeoutr)rrsrsrt get_timeoutszContext.get_timeoutcs6tfdd}tjd||_tj|j|jdS)a 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 handshake the function was called, and the other the return code from a (possibly failed) internal function call. :return: None cstj|||dS)N)rnr)rwhereZ return_code)rrsrtrsz*Context.set_info_callback..wrapperzvoid (*)(const SSL *, int, int)N)rrrrrZSSL_CTX_set_info_callbackr)rrrrs)rrtset_info_callbacks  zContext.set_info_callbackcCs|jS)zw Get the application data (supplied via :meth:`set_app_data()`) :return: The application data )r)rrsrsrt get_app_dataszContext.get_app_datacCs ||_dS)z Set the application data (will be returned from get_app_data()) :param data: Any Python object :return: None N)r)rrrsrsrt set_app_dataszContext.set_app_datacCs.tj|j}|tjkrdStjt}||_|S)z 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. N)rZSSL_CTX_get_cert_storerrrr__new__Z_store)rZstoreZpystorersrsrtget_cert_store&s    zContext.get_cert_storecCs t|tstdtj|j|S)z 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. zoptions must be an integer)rr rrZSSL_CTX_set_optionsr)rZoptionsrsrsrt set_options7s zContext.set_optionscCs t|tstdtj|j|S)z 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. zmode must be an integer)rr rrZSSL_CTX_set_moder)rrrsrsrtrDs zContext.set_modecs6tfdd}tjd||_tj|j|jdS)a 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 cstj|dS)Nr)rnr)rZalertr)rrsrtr\sz7Context.set_tlsext_servername_callback..wrapperzint (*)(SSL *, int *, void *)N)rrrrrZ&SSL_CTX_set_tlsext_servername_callbackr)rrrrs)rrtset_tlsext_servername_callbackQs  z&Context.set_tlsext_servername_callbackcCs,t|tstdttj|j|dkdS)z 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 zprofiles must be a byte string.rN)rr,rrrZSSL_CTX_set_tlsext_use_srtpr)rZprofilesrsrsrtset_tlsext_use_srtpfs zContext.set_tlsext_use_srtpcCs,t||_|jj|_tj|j|jtjdS)a Specify a callback function that will be called when offering `Next Protocol Negotiation `_ as a server. :param callback: The callback function. It will be invoked with one argument, the :class:`Connection` instance. It should return a list of bytestrings representing the advertised protocols, like ``[b'http/1.1', b'spdy/2']``. .. versionadded:: 0.15 N) rrrrrZ%SSL_CTX_set_next_protos_advertised_cbrrr)rrrsrsrtset_npn_advertise_callbackus  z"Context.set_npn_advertise_callbackcCs,t||_|jj|_tj|j|jtjdS)a 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']``. It should return one of those bytestrings, the chosen protocol. .. versionadded:: 0.15 N) rrrrrZ SSL_CTX_set_next_proto_select_cbrrr)rrrsrsrtset_npn_select_callbacks  zContext.set_npn_select_callbackcCs>djtjdd|D}tjd|}tj|j|t|dS)a 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 protocols to offer, e.g. ``[b'http/1.1', b'spdy/2']``. rcss|]}tt||fVqdS)N)r r)rrrsrsrtrsz*Context.set_alpn_protos..zunsigned char[]N) rrrrrrZSSL_CTX_set_alpn_protosrr)rrr input_strrsrsrtset_alpn_protoss  zContext.set_alpn_protoscCs,t||_|jj|_tj|j|jtjdS)a 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']``. It should return one of those bytestrings, the chosen protocol. N) rrrrrZSSL_CTX_set_alpn_select_cbrrr)rrrsrsrtset_alpn_select_callbacks  z Context.set_alpn_select_callbackcCsh||_|j|_|dkr tj|_n tj||_tj|j |j}t |dktj |j |j}t |dkdS)z This internal helper does the common work for ``set_ocsp_server_callback`` and ``set_ocsp_client_callback``, which is almost all of it. Nru) rrrrrrZ new_handlerZSSL_CTX_set_tlsext_status_cbrrZSSL_CTX_set_tlsext_status_arg)rhelperrrcrsrsrt_set_ocsp_callbacks    zContext._set_ocsp_callbackcCst|}|j||dS)a 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 contains the OCSP data to staple to the handshake. If no OCSP data is available for this connection, return the empty bytestring. :param data: Some opaque data that will be passed into the callback function when called. This can be used to avoid needing to do complex data lookups or to keep track of what context is being used. This parameter is optional. N)rrF)rrrrDrsrsrtset_ocsp_server_callbacksz Context.set_ocsp_server_callbackcCst|}|j||dS)a 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 provided. The callback must return a boolean that indicates the result of validating the OCSP data: ``True`` if the OCSP data is valid and the certificate can be trusted, or ``False`` if either the OCSP data is invalid or the certificate has been revoked. :param data: Some opaque data that will be passed into the callback function when called. This can be used to avoid needing to do complex data lookups or to keep track of what context is being used. This parameter is optional. N)rrF)rrrrDrsrsrtset_ocsp_client_callbacksz Context.set_ocsp_client_callback)N)N)N)N)?rprqrrrr%r&r'r(r)r*rdictitemsrrrrrrrr rrrrrrrrrrrr r!r"r$r%r&r)r*r.r2r3r4r5r7r8r9r;r<r _requires_snir=r> _requires_npnr?r@_requires_alpnrBrCrFrGrHrsrsrsrtrmsn.  1          %         z4ContextType has been deprecated, use Context insteadc@seZdZdZeZdxddZddZddZd d Z d d Z e d dZ e ddZ ddZdyddZeZdzddZd{ddZeZd|ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Z d4d5Z!d6d7Z"d8d9Z#d:d;Z$dd?Z&d@dAZ'dBdCZ(dDdEZ)dFdGZ*dHdIZ+d}dJdKZ,dLdMZ-dNdOZ.dPdQZ/dRdSZ0dTdUZ1dVdWZ2dXdYZ3dZd[Z4d\d]Z5d^d_Z6d`daZ7dbdcZ8dddeZ9dfdgZ:dhdiZ;djdkZe?dpdqZ@eAdrdsZBeAdtduZCdvdwZDdS)~rnz NcCst|tstdtj|j}tj|tj|_ tj |j tj ||_d|_ d|_ d|_d|_||j|j <|dkrd|_tjtj|_t|jtjktjtj|_t|jtjktj|j |j|jn2d|_d|_||_tj|j t|j}t|dkdS)z Create a new Connection object, using the given OpenSSL.SSL.Context instance and socket. :param context: An SSL Context to use for this connection :param socket: The socket to use for transport layer z"context must be a Context instanceNru)rrmrrZSSL_newrrrZSSL_free_sslZ SSL_set_modeZSSL_MODE_AUTO_RETRYrrrrr_socketZBIO_newZ BIO_s_mem _into_sslrr _from_sslZ SSL_set_bioZ SSL_set_fdr)rrsocketrrrsrsrtrs0   zConnection.__init__cCs0|jdkr td|jj|fn t|j|SdS)zy Look up attributes on the wrapped socket object if they are not found on the Connection object. Nz!'%s' object has no attribute '%s')rOr __class__rpr)rrrsrsrt __getattr__<s zConnection.__getattr__cCsT|jjdk r|jjj|jjdk r0|jjj|jjdk rH|jjj|jjdk r`|jjj|jjdk rx|jjjtj||}|tj krt n|tj krt n|tj krtn|tjkrtn|tjkr 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` zutf-8)rrrZSSL_get_versionrNr)rrrsrsrtget_protocol_version_namef s z$Connection.get_protocol_version_namecCstj|j}|S)a  Retrieve the SSL or TLS protocol version of the current connection. :returns: The TLS version of the current connection. For example, it will return ``0x769`` for connections made over TLS version 1. :rtype: :class:`int` )rZ SSL_versionrN)rrrsrsrtget_protocol_versionr s zConnection.get_protocol_versioncCs@tjd}tjd}tj|j||tj|d|dddS)z 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 zunsigned char **zunsigned int *rN)rrrZSSL_get0_next_proto_negotiatedrNr)rrdata_lenrsrsrtget_next_proto_negotiated} s  z$Connection.get_next_proto_negotiatedcCs>djtjdd|D}tjd|}tj|j|t|dS)ah 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'http/1.1', b'spdy/2']``. rcss|]}tt||fVqdS)N)r r)rrrsrsrtr sz-Connection.set_alpn_protos..zunsigned char[]N) rrrrrrZSSL_set_alpn_protosrNr)rrrrArsrsrtrB s  zConnection.set_alpn_protoscCsHtjd}tjd}tj|j|||s,dStj|d|dddS)z 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. zunsigned char **zunsigned int *rrN)rrrZSSL_get0_alpn_selectedrNr)rrrrsrsrtget_alpn_proto_negotiated s   z$Connection.get_alpn_proto_negotiatedcCs tj|jtj}t|dkdS)a 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`. ruN)rZSSL_set_tlsext_status_typerNZTLSEXT_STATUSTYPE_ocspr)rrErsrsrt request_ocsp s zConnection.request_ocsp)N)r)r)N)NN)N)ErprqrrrrrrrTrVrWrXrKrYr[r\rbwriterdrjreadrlrnrorprrrsrqrtrvrxrzr|r}r-rrr8r9rrrrrrrrrrrrrr{ryrrrrrrrrrrrLrrMrBrrrsrsrsrtrns| 6 )    $  %                   "      z:ConnectionType has been deprecated, use Connection instead)rrRsysr functoolsrr itertoolsrrweakrefrrUrZcryptography.utilsr Zsixr rr r r Z OpenSSL._utilrrrZ_exception_from_error_queuerrrrrZ _make_assertrr~rrrrrreZOpenSSL.cryptorrrrrr__all__rro NameErrorobjectrrrr r!r"ZSSL_SENT_SHUTDOWNr#ZSSL_RECEIVED_SHUTDOWNr$r%r&r'r(r)r*ZSSL_OP_NO_SSLv2r+ZSSL_OP_NO_SSLv3r,ZSSL_OP_NO_TLSv1r-ZSSL_OP_NO_TLSv1_1r.ZSSL_OP_NO_TLSv1_2r/ZSSL_MODE_RELEASE_BUFFERSr0ZSSL_OP_SINGLE_DH_USEr1ZSSL_OP_SINGLE_ECDH_USEr2ZSSL_OP_EPHEMERAL_RSAr3ZSSL_OP_MICROSOFT_SESS_ID_BUGr4ZSSL_OP_NETSCAPE_CHALLENGE_BUGr5Z'SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUGr6Z"SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUGr7Z!SSL_OP_MICROSOFT_BIG_SSLV3_BUFFERr8ZSSL_OP_MSIE_SSLV2_RSA_PADDINGr9ZSSL_OP_SSLEAY_080_CLIENT_DH_BUGr:ZSSL_OP_TLS_D5_BUGr;ZSSL_OP_TLS_BLOCK_PADDING_BUGr<Z"SSL_OP_DONT_INSERT_EMPTY_FRAGMENTSr=ZSSL_OP_CIPHER_SERVER_PREFERENCEr>ZSSL_OP_TLS_ROLLBACK_BUGr?ZSSL_OP_PKCS1_CHECK_1r@ZSSL_OP_PKCS1_CHECK_2rAZSSL_OP_NETSCAPE_CA_DN_BUGrBZ&SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUGrCZSSL_OP_NO_COMPRESSIONrDZSSL_OP_NO_QUERY_MTUrEZSSL_OP_COOKIE_EXCHANGErFZSSL_OP_NO_TICKETrGZ SSL_OP_ALLrHZSSL_VERIFY_PEERrIZSSL_VERIFY_FAIL_IF_NO_PEER_CERTrJZSSL_VERIFY_CLIENT_ONCErKZSSL_VERIFY_NONErLZSSL_SESS_CACHE_OFFrMZSSL_SESS_CACHE_CLIENTrNZSSL_SESS_CACHE_SERVERrOZSSL_SESS_CACHE_BOTHrPZSSL_SESS_CACHE_NO_AUTO_CLEARrQZ!SSL_SESS_CACHE_NO_INTERNAL_LOOKUPrRZ SSL_SESS_CACHE_NO_INTERNAL_STORErSZSSL_SESS_CACHE_NO_INTERNALrTrUrVrWZCryptography_HAS_SSL_STr{r|r}r~extendrXrYrZr[r\r]r^r_r`rarbrcrdrrrrrrerrrfrgrhrirjrrrrrrrrrkrZCryptography_HAS_NEXTPROTONEGrLZCryptography_HAS_ALPNrMZ Cryptography_HAS_TLSEXT_HOSTNAMErKrlrmrpDeprecationWarningZ ContextTypernZConnectionTypeZSSL_library_initrsrsrsrts    ,  ')13C;     ZIPK}S] 4__pycache__/rand.cpython-36.pycnu[3 F\@s$dZddlmZddZddZdS)z* PRNG management routines, thin wrappers. )libcCs:t|tstdt|ts$tdtj|t||dS)a Mix bytes from *string* into the PRNG state. The *entropy* argument is (the lower bound of) an estimate of how much randomness is contained in *string*, measured in bytes. For more information, see e.g. :rfc:`1750`. This function is only relevant if you are forking Python processes and need to reseed the CSPRNG after fork. :param buffer: Buffer with random data. :param entropy: The entropy (in bytes) measurement of the buffer. :return: :obj:`None` zbuffer must be a byte stringzentropy must be an integerN) isinstancebytes TypeErrorint_libZRAND_addlen)bufferZentropyr /usr/lib/python3.6/rand.pyadds   r cCstjS)z} Check whether the PRNG has been seeded with enough data. :return: 1 if the PRNG is seeded enough, 0 otherwise. )rZ RAND_statusr r r r status"sr N)__doc__Z OpenSSL._utilrrr r r r r r s PK}S],7&__pycache__/tsafe.cpython-36.opt-1.pycnu[3 F\N@sBddlZddlmZddlmZejdeddGdddZ dS) N)RLock)SSLz/OpenSSL.tsafe is deprecated and will be removed) stacklevelc!@s2eZdZddZxd&D]Zed$eefqWd%S)' ConnectioncGstj||_t|_dS)N)_sslrZ _ssl_conn_RLock_lock)selfargsr /usr/lib/python3.6/tsafe.py__init__s zConnection.__init__ get_contextpendingsendwriterecvread renegotiatebindlistenconnectaccept setblockingfilenoshutdowncloseget_cipher_list getpeername getsockname getsockopt setsockoptmakefile get_app_data set_app_data state_string sock_shutdownget_peer_certificateget_peer_cert_chain want_read want_writeset_connect_stateset_accept_state connect_exsendallzdef %s(self, *args): self._lock.acquire() try: return self._ssl_conn.%s(*args) finally: self._lock.release() N)!rrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/)__name__ __module__ __qualname__rfexecr r r r r sr) warningsZ threadingrrZOpenSSLrrwarnDeprecationWarningrr r r r s    PK}S]33 __pycache__/_util.cpython-36.pycnu[3 F\N@sddlZddlZddlmZmZmZddlmZeZej ej Z ej Z e j ddZ ddZdd Zd d Zd d ZddZerddZnddZeZejdZddZdS)N)PY3 binary_type text_type)BindingF)Zshould_clear_after_alloccCs|sdSttj|S)z Get a native string type representing of the given CFFI ``char*`` object. :param charp: A C-style string represented using CFFI. :return: :class:`str` )nativeffistring)Zcharpr /usr/lib/python3.6/_util.pytextsr cCsVg}xDtj}|dkrP|jttj|ttj|ttj|fqW||dS)ac Convert an OpenSSL library failure into a Python exception. When a call to the native OpenSSL library fails, this is usually signalled by the return value, and an error code is stored in an error queue associated with the current thread. The err library provides functions to obtain these error codes and textual error messages. rN)libZ ERR_get_errorappendr ZERR_lib_error_stringZERR_func_error_stringZERR_reason_error_string)Zexception_typeerrorserrorr r r exception_from_error_queue"s   rcsfdd}|S)z~ Create an assert function that uses :func:`exception_from_error_queue` to raise an exception wrapped by *error*. cs|dk rtdS)zT If *ok* is not True, retrieve the error from OpenSSL and raise it. TN)r)ok)rr r openssl_assert>sz#make_assert..openssl_assertr )rrr )rr make_assert9s rcCsLt|ttfstd|tr4t|trH|jdSnt|trH|jdS|S)a6 Convert :py:class:`bytes` or :py:class:`unicode` to the native :py:class:`str` type, using UTF-8 encoding if conversion is necessary. :raise UnicodeError: The input string is not UTF-8 decodeable. :raise TypeError: The input is neither :py:class:`bytes` nor :py:class:`unicode`. z%r is neither bytes nor unicodezutf-8) isinstancerr TypeErrorrdecodeencode)sr r r rHs      rcCs2t|tr|St|tr&|jtjStddS)a Convert a Python string to a :py:class:`bytes` string identifying the same path and which can be passed into an OpenSSL API accepting a filename. :param s: An instance of :py:class:`bytes` or :py:class:`unicode`. :return: An instance of :py:class:`bytes`. z3Path must be represented as bytes or unicode stringN)rrrrsysgetfilesystemencodingr)rr r r path_string]s  rcCs |jdS)Ncharmap)r)rr r r byte_stringosrcCs|S)Nr )rr r r rrsz) for {0} is no longer accepted, use bytescCs.t|tr*tjtj|tdd|jdS|S)a If ``obj`` is text, emit a warning that it should be bytes instead and try to convert it to bytes automatically. :param str label: The name of the parameter from which ``obj`` was taken (so a developer can easily find the source of the problem and correct it). :return: If ``obj`` is the text string type, a ``bytes`` object giving the UTF-8 encoding of that text is returned. Otherwise, ``obj`` itself is returned. )category stacklevelzutf-8)rrwarningswarn _TEXT_WARNINGformatDeprecationWarningr)Zlabelobjr r r text_to_bytes_and_warns  r()rr"ZsixrrrZ,cryptography.hazmat.bindings.openssl.bindingrZbindingZinit_static_locksrr Z new_allocatorZno_zero_allocatorr rrrrrobjectZ UNSPECIFIED__name__r$r(r r r r s&     PK}S]Xӎ#__pycache__/__init__.cpython-36.pycnu[3 F\ @sXdZddlmZmZddlmZmZmZmZm Z m Z m Z m Z dddddd d d d d g Z dS)z9 pyOpenSSL - A simple wrapper around the OpenSSL library )cryptoSSL) __author__ __copyright__ __email__ __license__ __summary__ __title____uri__ __version__rrrrrrrr r r N)__doc__ZOpenSSLrrZOpenSSL.versionrrrrrr r r __all__rr/usr/lib/python3.6/__init__.pys ( PK}S]%J//$__pycache__/SSL.cpython-36.opt-1.pycnu[3 F\[R@sddlZddlZddlmZddlmZmZddlmZm Z ddl m Z ddl m Z ddlmZddlmZmZmZmZdd lmZmZmZmZmZ m!Z"m#Z$m%Z&m'Z(dd l)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\gRZ0ye1Z2Wn&e3k rGd]d^d^e4Z2YnXej5Z5ej6Z6ej7Z7ej8Z8ej9Z9ej:Z:ej;Zd_Z?d`Z@daZAdbZBdcZCddZDejEZFejGZHejIZJejKZLejMZNejOZPejQZRejSZTejUZVejWZXejYZZej[Z\ej]Z^ej_Z`ejaZbejcZdejeZfejgZhejiZjejkZlejmZnejoZpejqZrejsZtejuZvejwZxejyZzej{Z|ej}Z~ejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejr$ejZejZejZejZe0jdedfdgdhgejZejZejZejZejZejZejZejZejZejZejZejZejZdidjdkdldmgZdngZdoZdpZGdqdSdSeZeeeZe eZGdrdTdTeZGdsdUdUeZGdtdVdVeZGdudWdWeZGdvdXdXeZGdwdxdxe4ZGdydzdzeZGd{d|d|eZGd}d~d~eZGdddeZGdddeZGdddeZddZddYZddZeejdZeejdZeejdZGddZdZe4ZGdd[d[e4ZeeedeσZGdd\d\e4ZeeedeσZejӃdS)N)platform)wrapspartial)countchain)WeakValueDictionary) errorcode) deprecated) binary_type integer_typesint2byte indexbytes) UNSPECIFIEDexception_from_error_queueffilib make_assertnative path_stringtext_to_bytes_and_warnno_zero_allocator) FILETYPE_PEM_PassphraseHelperPKeyX509NameX509 X509StoreOPENSSL_VERSION_NUMBERSSLEAY_VERSION SSLEAY_CFLAGSSSLEAY_PLATFORM SSLEAY_DIRSSLEAY_BUILT_ON SENT_SHUTDOWNRECEIVED_SHUTDOWN SSLv2_METHOD SSLv3_METHOD SSLv23_METHOD TLSv1_METHODTLSv1_1_METHODTLSv1_2_METHOD OP_NO_SSLv2 OP_NO_SSLv3 OP_NO_TLSv1 OP_NO_TLSv1_1 OP_NO_TLSv1_2MODE_RELEASE_BUFFERSOP_SINGLE_DH_USEOP_SINGLE_ECDH_USEOP_EPHEMERAL_RSAOP_MICROSOFT_SESS_ID_BUGOP_NETSCAPE_CHALLENGE_BUG#OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUGOP_SSLREF2_REUSE_CERT_TYPE_BUGOP_MICROSOFT_BIG_SSLV3_BUFFEROP_MSIE_SSLV2_RSA_PADDINGOP_SSLEAY_080_CLIENT_DH_BUG OP_TLS_D5_BUGOP_TLS_BLOCK_PADDING_BUGOP_DONT_INSERT_EMPTY_FRAGMENTSOP_CIPHER_SERVER_PREFERENCEOP_TLS_ROLLBACK_BUGOP_PKCS1_CHECK_1OP_PKCS1_CHECK_2OP_NETSCAPE_CA_DN_BUG"OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUGOP_NO_COMPRESSIONOP_NO_QUERY_MTUOP_COOKIE_EXCHANGE OP_NO_TICKETOP_ALL VERIFY_PEERVERIFY_FAIL_IF_NO_PEER_CERTVERIFY_CLIENT_ONCE VERIFY_NONESESS_CACHE_OFFSESS_CACHE_CLIENTSESS_CACHE_SERVERSESS_CACHE_BOTHSESS_CACHE_NO_AUTO_CLEARSESS_CACHE_NO_INTERNAL_LOOKUPSESS_CACHE_NO_INTERNAL_STORESESS_CACHE_NO_INTERNALSSL_ST_CONNECT SSL_ST_ACCEPT SSL_ST_MASK SSL_CB_LOOP SSL_CB_EXIT SSL_CB_READ SSL_CB_WRITE SSL_CB_ALERTSSL_CB_READ_ALERTSSL_CB_WRITE_ALERTSSL_CB_ACCEPT_LOOPSSL_CB_ACCEPT_EXITSSL_CB_CONNECT_LOOPSSL_CB_CONNECT_EXITSSL_CB_HANDSHAKE_STARTSSL_CB_HANDSHAKE_DONEError WantReadErrorWantWriteErrorWantX509LookupErrorZeroReturnError SysCallErrorSSLeay_versionSessionContext Connectionc@s eZdZdS)_bufferN)__name__ __module__ __qualname__rsrs/usr/lib/python3.6/SSL.pyrovsro SSL_ST_INIT SSL_ST_BEFORE SSL_ST_OKSSL_ST_RENEGOTIATEz"/etc/ssl/certs/ca-certificates.crtz /etc/pki/tls/certs/ca-bundle.crtz/etc/ssl/ca-bundle.pemz/etc/pki/tls/cacert.pemz1/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pemz/etc/ssl/certss$/opt/pyca/cryptography/openssl/certss'/opt/pyca/cryptography/openssl/cert.pemc@seZdZdZdS)rez4 An error occurred in an `OpenSSL.SSL` API. N)rprqrr__doc__rsrsrsrtresc@s eZdZdS)rfN)rprqrrrsrsrsrtrfsc@s eZdZdS)rgN)rprqrrrsrsrsrtrgsc@s eZdZdS)rhN)rprqrrrsrsrsrtrhsc@s eZdZdS)riN)rprqrrrsrsrsrtrisc@s eZdZdS)rjN)rprqrrrsrsrsrtrj sc@s eZdZdZddZddZdS)_CallbackExceptionHelpera A base class for wrapper classes that allow for intelligent exception handling in OpenSSL callbacks. :ivar list _problems: Any exceptions that occurred while executing in a context where they could not be raised in the normal way. Typically this is because OpenSSL has called into some Python code and requires a return value. The exceptions are saved to be raised later when it is possible to do so. cCs g|_dS)N) _problems)selfrsrsrt__init__sz!_CallbackExceptionHelper.__init__c Cs6|jr2y tWntk r$YnX|jjddS)z Raise an exception from the OpenSSL error queue or that was previously captured whe running a callback. rN)r_raise_current_errorrepop)rrsrsrtraise_if_problems  z)_CallbackExceptionHelper.raise_if_problemN)rprqrrrrrrsrsrsrtr s rc@seZdZdZddZdS) _VerifyHelperz^ Wrap a callback such that it can be used as a certificate verification callback. cs2tjtfdd}tjd|_dS)Nc stj|}tj|tj|}tj|}tj|}tj}tj||}t j |}y|||||} Wn,t k r} zj j | dSd} ~ XnX| rtj|tjdSdSdS)Nrru)_libZX509_STORE_CTX_get_current_cert X509_up_refr_from_raw_x509_ptrZX509_STORE_CTX_get_errorZX509_STORE_CTX_get_error_depthZ"SSL_get_ex_data_X509_STORE_CTX_idxZX509_STORE_CTX_get_ex_datarn_reverse_mapping ExceptionrappendZX509_STORE_CTX_set_errorZ X509_V_OK) okZ store_ctxZx509certZ error_numberZ error_depthindexsslZ connectionresulte)callbackrrsrtwrapper2s$        z'_VerifyHelper.__init__..wrapperzint (*)(int, X509_STORE_CTX *))rrr_ffir)rrrrs)rrrtr/s z_VerifyHelper.__init__N)rprqrrrrrsrsrsrtr)src@seZdZdZddZdS)_NpnAdvertiseHelperzT Wrap a callback such that it can be used as an NPN advertisement callback. cs2tjtfdd}tjd|_dS)Ncsyntj|}|}djtjdd|D}tjdt|tjd|g|_|jdd|d<|jd|d<dSt k r}zj j |dSd}~XnXdS) Ncss|]}tt||fVqdS)N)r len).0prsrsrt asz@_NpnAdvertiseHelper.__init__..wrapper..zunsigned int *zunsigned char[]rrurv) rnrjoinr from_iterablernewr_npn_advertise_callback_argsrrr)routoutlenargconnprotosprotostrr)rrrsrtrXs  z-_NpnAdvertiseHelper.__init__..wrapperz>int (*)(SSL *, const unsigned char **, unsigned int *, void *))rrrrr)rrrrs)rrrtrUs  z_NpnAdvertiseHelper.__init__N)rprqrrrrrsrsrsrtrPsrc@seZdZdZddZdS)_NpnSelectHelperzP Wrap a callback such that it can be used as an NPN selection callback. cs2tjtfdd}tjd|_dS)Nc sytj|}tj||dd}g}x<|r`t|d} |d| d} |j| || dd}q&W||} tjdt| tjd| g|_|jdd|d<|jd|d<dSt k r} zj j| dSd} ~ XnXdS)Nrruzunsigned char *zunsigned char[]rv) rnrrbufferr rrr_npn_select_callback_argsrr) rrrin_inlenrrinstr protolistlengthprotooutstrr)rrrsrtrs$     z*_NpnSelectHelper.__init__..wrapperz^int (*)(SSL *, unsigned char **, unsigned char *, const unsigned char *, unsigned int, void *))rrrrr)rrrrs)rrrtr~s  "z_NpnSelectHelper.__init__N)rprqrrrrrsrsrsrtrysrc@seZdZdZddZdS)_ALPNSelectHelperzQ Wrap a callback such that it can be used as an ALPN selection callback. cs2tjtfdd}tjd|_dS)Nc sytj|}tj||dd}g}x<|r`t|d} |d| d} |j| || dd}q&W||} t| ts~tdtj dt | tj d| g|_ |j dd|d<|j d|d<dSt k r} zj j| dSd} ~ XnXdS)Nrruz'ALPN callback must return a bytestring.zunsigned char *zunsigned char[]rv)rnrrrr r isinstance _binary_type TypeErrorrr_alpn_select_callback_argsrr) rrrrrrrrrZ encoded_lenrrr)rrrsrtrs(      z+_ALPNSelectHelper.__init__..wrapperz^int (*)(SSL *, unsigned char **, unsigned char *, const unsigned char *, unsigned int, void *))rrrrr)rrrrs)rrrtrs  $z_ALPNSelectHelper.__init__N)rprqrrrrrsrsrsrtrsrc@seZdZdZddZdS)_OCSPServerCallbackHelpera Wrap a callback such that it can be used as an OCSP callback for the server side. Annoyingly, OpenSSL defines one OCSP callback but uses it in two different ways. For servers, that callback is expected to retrieve some OCSP data and hand it to OpenSSL, and may return only SSL_TLSEXT_ERR_OK, SSL_TLSEXT_ERR_FATAL, and SSL_TLSEXT_ERR_NOACK. For clients, that callback is expected to check the OCSP data, and returns a negative value on error, 0 if the response is not acceptable, or positive if it is. These are mutually exclusive return code behaviours, and they mean that we need two helpers so that we always return an appropriate error code if the user's code throws an exception. Given that we have to have two helpers anyway, these helpers are a bit more helpery than most: specifically, they hide a few more of the OpenSSL functions so that the user has an easier time writing these callbacks. This helper implements the server side. cs2tjtfdd}tjd|_dS)Ncsytj|}|tjkr"tj|}nd}||}t|tsBtd|sJdSt|}t j |}|tj ||dd<t j |||dSt k r}zjj|dSd}~XnXdS)Nz'OCSP callback must return a bytestring.rwrrv)rnrrNULL from_handlerrrrrZOPENSSL_mallocrZSSL_set_tlsext_status_ocsp_resprrr)rcdatardata ocsp_dataZocsp_data_lengthZdata_ptrr)rrrsrtrs&        z3_OCSPServerCallbackHelper.__init__..wrapperzint (*)(SSL *, void *))rrrrr)rrrrs)rrrtrs 'z"_OCSPServerCallbackHelper.__init__N)rprqrrrrrsrsrsrtrsrc@seZdZdZddZdS)_OCSPClientCallbackHelpera Wrap a callback such that it can be used as an OCSP callback for the client side. Annoyingly, OpenSSL defines one OCSP callback but uses it in two different ways. For servers, that callback is expected to retrieve some OCSP data and hand it to OpenSSL, and may return only SSL_TLSEXT_ERR_OK, SSL_TLSEXT_ERR_FATAL, and SSL_TLSEXT_ERR_NOACK. For clients, that callback is expected to check the OCSP data, and returns a negative value on error, 0 if the response is not acceptable, or positive if it is. These are mutually exclusive return code behaviours, and they mean that we need two helpers so that we always return an appropriate error code if the user's code throws an exception. Given that we have to have two helpers anyway, these helpers are a bit more helpery than most: specifically, they hide a few more of the OpenSSL functions so that the user has an easier time writing these callbacks. This helper implements the client side. cs2tjtfdd}tjd|_dS)Nc syxtj|}|tjkr"tj|}nd}tjd}tj||}|dkrJd}ntj|d|dd}|||}t t |St k r}zj j |dSd}~XnXdS)Nzunsigned char **rrru)rnrrrrrrZSSL_get_tlsext_status_ocsp_resprintboolrrr) rrrrZocsp_ptrZocsp_lenrZvalidr)rrrsrtr9s        z3_OCSPClientCallbackHelper.__init__..wrapperzint (*)(SSL *, void *))rrrrr)rrrrs)rrrtr6s z"_OCSPClientCallbackHelper.__init__N)rprqrrrrrsrsrsrtr srcCsdd}t|ts(t|dd}|dk r(|}t|tr6|}t|tsJtdn|dkr`td|f|S)Nfilenoz3argument must be an int, or have a fileno() method.rz1file descriptor cannot be a negative integer (%i))rr getattrr ValueError)objfdmethrsrsrt_asFileDescriptor[s      rcCstjtj|S)z Return a string describing the version of OpenSSL in use. :param type: One of the :const:`SSLEAY_` constants defined in this module. )rstringrrk)typersrsrtrknscsfdd}|S)a 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``. :param error: The string to be used in the exception if the flag is false. cs$st|fdd}|S|SdS)Ncs tdS)N)NotImplementedError)argskwargs)errorrsrtexplodesz<_make_requires.._requires_decorator..explode)r)funcr)rflagrsrt_requires_decoratorsz+_make_requires.._requires_decoratorrs)rrrrs)rrrt_make_requiresws  rzNPN not availablezALPN not availablezSNI not availablec@seZdZdZdS)rlz A class representing an SSL session. A session defines certain connection parameters which may be re-used to speed up the setup of subsequent connections. .. versionadded:: 0.14 N)rprqrrrrsrsrsrtrlsc @seZdZdZededededede diZ e dd e j DZ d d Z ded dZddZdfddZddZddZddZddZefddZddZdd Zd!d"Zefd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Z d/d0Z!d1d2Z"d3d4Z#d5d6Z$d7d8Z%d9d:Z&d;d<Z'd=d>Z(d?d@Z)dAdBZ*dCdDZ+dEdFZ,dGdHZ-dIdJZ.dKdLZ/dMdNZ0dOdPZ1dQdRZ2e3dSdTZ4dUdVZ5e6dWdXZ7e6dYdZZ8e9d[d\Z:e9d]d^Z;d_d`Zd S)irmz :class:`OpenSSL.SSL.Context` instances define the parameters for setting up new SSL connections. :param method: One of SSLv2_METHOD, SSLv3_METHOD, SSLv23_METHOD, or TLSv1_METHOD. Z SSLv2_methodZ SSLv3_methodZ SSLv23_methodZ TLSv1_methodZTLSv1_1_methodZTLSv1_2_methodccs0|](\}}tt|ddk r|tt|fVqdS)N)rr)rZ identifiernamersrsrtrszContext.cCs&t|tstdy|j|}Wntk r<tdYnX|}t|tjkt j |}t|tjktj |t j }yt j |d}t|dkWntk rYnX||_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ |j!t j"dS)Nzmethod must be an integerzNo such protocolru)#rr r_methodsKeyErrorr_openssl_assertrrrZ SSL_CTX_newgcZ SSL_CTX_freeZSSL_CTX_set_ecdh_autoAttributeError_context_passphrase_helper_passphrase_callback_passphrase_userdata_verify_helper_verify_callback_info_callback_tlsext_servername_callback _app_data_npn_advertise_helper_npn_advertise_callback_npn_select_helper_npn_select_callback_alpn_select_helper_alpn_select_callback _ocsp_helper_ocsp_callback _ocsp_dataset_modeZSSL_MODE_ENABLE_PARTIAL_WRITE)rmethodZ method_funcZ method_objcontextresrsrsrtrsF   zContext.__init__NcCsN|dkrtj}nt|}|dkr(tj}nt|}tj|j||}|sJtdS)aU 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* may be :data:`None`. :param cafile: In which file we can find the certificates (``bytes`` or ``unicode``). :param capath: In which directory we can find the certificates (``bytes`` or ``unicode``). :return: None N)rr _path_stringrZSSL_CTX_load_verify_locationsrr)rcafilecapathZ load_resultrsrsrtload_verify_locationss zContext.load_verify_locationscs&tfdd}tt|dddS)Ncs||jS)N)r)sizeZverifyuserdata)rrrsrtr sz'Context._wrap_callback..wrapperT)Z more_argstruncate)rrr)rrrrs)rrrt_wrap_callback szContext._wrap_callbackcCs@t|std|j||_|jj|_tj|j|j||_ dS)a 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 the returned passphrase is longer than this, it will be truncated. Second, a boolean value which will be true if the user should be prompted for the passphrase twice and the callback should verify that the two values supplied are equal. Third, the value given as the *userdata* parameter to :meth:`set_passwd_cb`. The *callback* must return a byte string. If an error occurs, *callback* should return a false value (e.g. an empty string). :param userdata: (optional) A Python object which will be given as argument to the callback :return: None zcallback must be callableN) callablerrrrrrZSSL_CTX_set_default_passwd_cbrr)rrrrsrsrt set_passwd_cbs   zContext.set_passwd_cbcCstj|j}t|dktjtjjd}tjtjjd}|j ||stjtj }tjtj }|t kr|t kr|jttdS)a 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 the ``openssl@1.1`` `Homebrew `_ formula installed in the default location. * Windows will not work. * manylinux1 cryptography wheels will work on most common Linux distributions in pyOpenSSL 17.1.0 and above. pyOpenSSL detects the manylinux1 wheel and attempts to load roots via a fallback path. :return: None ruasciiN)rZ SSL_CTX_set_default_verify_pathsrrrrZX509_get_default_cert_dir_envdecodeZX509_get_default_cert_file_env_check_env_vars_setZX509_get_default_cert_dirZX509_get_default_cert_file_CRYPTOGRAPHY_MANYLINUX1_CA_DIR _CRYPTOGRAPHY_MANYLINUX1_CA_FILE_fallback_default_verify_paths_CERTIFICATE_FILE_LOCATIONS_CERTIFICATE_PATH_LOCATIONS)r set_result dir_env_var file_env_varZ default_dirZ default_filersrsrtset_default_verify_paths-s      z Context.set_default_verify_pathscCs tjj|dk ptjj|dk S)zp Check to see if the default cert dir/file environment vars are present. :return: bool N)osenvironget)rrrrsrsrtr^szContext._check_env_vars_setcCsRx$|D]}tjj|r|j|PqWx&|D]}tjj|r,|jd|Pq,WdS)aW 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: None N)rpathisfilerisdir)rZ file_pathZdir_pathrrrsrsrtris      z&Context._fallback_default_verify_pathscCs$t|}tj|j|}|s tdS)z 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 N)rrZ"SSL_CTX_use_certificate_chain_filerr)rcertfilerrsrsrtuse_certificate_chain_file}s  z"Context.use_certificate_chain_filecCs8t|}t|tstdtj|j||}|s4tdS)ah 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`. :return: None zfiletype must be an integerN)rrr rrZSSL_CTX_use_certificate_filerr)rr filetype use_resultrsrsrtuse_certificate_files   zContext.use_certificate_filecCs0t|tstdtj|j|j}|s,tdS)zs Load a certificate from a X509 object :param cert: The X509 object :return: None zcert must be an X509 instanceN)rrrrZSSL_CTX_use_certificater_x509r)rrr rsrsrtuse_certificates  zContext.use_certificatecCsDt|tstdtj|j}tj|j|}|s@tj|t dS)z Add certificate to chain :param certobj: The X509 certificate object to add to the chain :return: None z certobj must be an X509 instanceN) rrrrX509_duprZSSL_CTX_add_extra_chain_certrZ X509_freer)rZcertobjcopy add_resultrsrsrtadd_extra_chain_certs   zContext.add_extra_chain_certcCs |jdk r|jjttdS)N)rrrer)rrsrsrt_raise_passphrase_exceptions  z#Context._raise_passphrase_exceptioncCsHt|}|tkrt}nt|ts(tdtj|j||}|sD|j dS)aR 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 zfiletype must be an integerN) r _UNSPECIFIEDrrr rrZSSL_CTX_use_PrivateKey_filerr)rZkeyfiler r rsrsrtuse_privatekey_files   zContext.use_privatekey_filecCs2t|tstdtj|j|j}|s.|jdS)zs Load a private key from a PKey object :param pkey: The PKey object :return: None zpkey must be a PKey instanceN)rrrrZSSL_CTX_use_PrivateKeyrZ_pkeyr)rZpkeyr rsrsrtuse_privatekeys  zContext.use_privatekeycCstj|jstdS)z Check if the private key (loaded with :meth:`use_privatekey`) matches the certificate (loaded with :meth:`use_certificate`) :return: :data:`None` (raises :exc:`Error` if something's wrong) N)rZSSL_CTX_check_private_keyrr)rrsrsrtcheck_privatekeys zContext.check_privatekeycCs0tjtd|}t|tjktj|j|dS)a% 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 rN)rZSSL_load_client_CA_file_text_to_bytes_and_warnrrrSSL_CTX_set_client_CA_listr)rrZca_listrsrsrtload_client_cas  zContext.load_client_cacCs*td|}ttj|j|t|dkdS)aV 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: None bufruN)rrrZSSL_CTX_set_session_id_contextrr)rrrsrsrtset_session_ids zContext.set_session_idcCs t|tstdtj|j|S)a 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 previously set caching mode. .. versionadded:: 0.14 zmode must be an integer)rr rrZSSL_CTX_set_session_cache_moder)rmodersrsrtset_session_cache_modes zContext.set_session_cache_modecCs tj|jS)z Get the current session cache mode. :returns: The currently used cache mode. .. versionadded:: 0.14 )rZSSL_CTX_get_session_cache_moder)rrsrsrtget_session_cache_mode,szContext.get_session_cache_modecCsLt|tstdt|s"tdt||_|jj|_tj |j ||jdS)a 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:ed with :const:`VERIFY_FAIL_IF_NO_PEER_CERT` and :const:`VERIFY_CLIENT_ONCE` to further control the behaviour. :param callback: The Python callback to use. This should take five arguments: A Connection object, an X509 object, and three integer variables, which are in turn potential error number, error depth and return code. *callback* should return True if verification passes and False otherwise. :return: None See SSL_CTX_set_verify(3SSL) for further details. zmode must be an integerzcallback must be callableN) rr rrrrrrrZSSL_CTX_set_verifyr)rrrrsrsrt set_verify6s   zContext.set_verifycCs$t|tstdtj|j|dS)z 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 zdepth must be an integerN)rr rrZSSL_CTX_set_verify_depthr)rdepthrsrsrtset_verify_depthSs zContext.set_verify_depthcCs tj|jS)z Retrieve the Context object's verify mode, as set by :meth:`set_verify`. :return: The verify mode )rZSSL_CTX_get_verify_moder)rrsrsrtget_verify_mode`szContext.get_verify_modecCs tj|jS)z Retrieve the Context object's verify depth, as set by :meth:`set_verify_depth`. :return: The verify depth )rZSSL_CTX_get_verify_depthr)rrsrsrtget_verify_depthiszContext.get_verify_depthcCsht|}tj|d}|tjkr$ttj|tj}tj|tjtjtj}tj|tj }tj |j |dS)z Load parameters for Ephemeral Diffie-Hellman :param dhfile: The file to load EDH parameters from (``bytes`` or ``unicode``). :return: None rN) rrZ BIO_new_filerrrrZBIO_freeZPEM_read_bio_DHparamsZDH_freeZSSL_CTX_set_tmp_dhr)rZdhfilebioZdhrsrsrt load_tmp_dhrs   zContext.load_tmp_dhcCstj|j|jdS)a  Select a curve to use for ECDHE key exchange. :param curve: A curve object to use as returned by either :meth:`OpenSSL.crypto.get_elliptic_curve` or :meth:`OpenSSL.crypto.get_elliptic_curves`. :return: None N)rZSSL_CTX_set_tmp_ecdhrZ _to_EC_KEY)rZcurversrsrt set_tmp_ecdhs zContext.set_tmp_ecdhcCsVtd|}t|tstdttj|j|dkt|d}t|j dddgkdS)z 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_listz"cipher_list must be a byte string.ruNZTLS_AES_256_GCM_SHA384ZTLS_CHACHA20_POLY1305_SHA256ZTLS_AES_128_GCM_SHA256) rrbytesrrrZSSL_CTX_set_cipher_listrrnget_cipher_list)rr+Ztmpconnrsrsrtset_cipher_lists   zContext.set_cipher_listc Cstj}t|tjkyjxd|D]\}t|ts@tdt|j ftj |j }t|tjktj ||}|stj |tqWWn tk rtj|YnXtj|j|dS)a_ 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 .. versionadded:: 0.10 z3client CAs must be X509Name objects, not %s objectsN)rZsk_X509_NAME_new_nullrrrrrrrrp X509_NAME_dup_nameZsk_X509_NAME_pushX509_NAME_freerrZsk_X509_NAME_freerr)rZcertificate_authoritiesZ name_stackZca_namerZ push_resultrsrsrtset_client_ca_lists$       zContext.set_client_ca_listcCs2t|tstdtj|j|j}t|dkdS)ai 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 .. versionadded:: 0.10 z.certificate_authority must be an X509 instanceruN)rrrrZSSL_CTX_add_client_CArrr)rZcertificate_authorityrrsrsrt add_client_cas  zContext.add_client_cacCs t|tstdtj|j|S)aQ 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 ztimeout must be an integer)rr rrZSSL_CTX_set_timeoutr)rZtimeoutrsrsrt set_timeouts zContext.set_timeoutcCs tj|jS)z Retrieve session timeout, as set by :meth:`set_timeout`. The default is 300 seconds. :return: The session timeout )rZSSL_CTX_get_timeoutr)rrsrsrt get_timeoutszContext.get_timeoutcs6tfdd}tjd||_tj|j|jdS)a 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 handshake the function was called, and the other the return code from a (possibly failed) internal function call. :return: None cstj|||dS)N)rnr)rwhereZ return_code)rrsrtrsz*Context.set_info_callback..wrapperzvoid (*)(const SSL *, int, int)N)rrrrrZSSL_CTX_set_info_callbackr)rrrrs)rrtset_info_callbacks  zContext.set_info_callbackcCs|jS)zw Get the application data (supplied via :meth:`set_app_data()`) :return: The application data )r)rrsrsrt get_app_dataszContext.get_app_datacCs ||_dS)z Set the application data (will be returned from get_app_data()) :param data: Any Python object :return: None N)r)rrrsrsrt set_app_dataszContext.set_app_datacCs.tj|j}|tjkrdStjt}||_|S)z 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. N)rZSSL_CTX_get_cert_storerrrr__new__Z_store)rZstoreZpystorersrsrtget_cert_store&s    zContext.get_cert_storecCs t|tstdtj|j|S)z 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. zoptions must be an integer)rr rrZSSL_CTX_set_optionsr)rZoptionsrsrsrt set_options7s zContext.set_optionscCs t|tstdtj|j|S)z 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. zmode must be an integer)rr rrZSSL_CTX_set_moder)rrrsrsrtrDs zContext.set_modecs6tfdd}tjd||_tj|j|jdS)a 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 cstj|dS)Nr)rnr)rZalertr)rrsrtr\sz7Context.set_tlsext_servername_callback..wrapperzint (*)(SSL *, int *, void *)N)rrrrrZ&SSL_CTX_set_tlsext_servername_callbackr)rrrrs)rrtset_tlsext_servername_callbackQs  z&Context.set_tlsext_servername_callbackcCs,t|tstdttj|j|dkdS)z 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 zprofiles must be a byte string.rN)rr,rrrZSSL_CTX_set_tlsext_use_srtpr)rZprofilesrsrsrtset_tlsext_use_srtpfs zContext.set_tlsext_use_srtpcCs,t||_|jj|_tj|j|jtjdS)a Specify a callback function that will be called when offering `Next Protocol Negotiation `_ as a server. :param callback: The callback function. It will be invoked with one argument, the :class:`Connection` instance. It should return a list of bytestrings representing the advertised protocols, like ``[b'http/1.1', b'spdy/2']``. .. versionadded:: 0.15 N) rrrrrZ%SSL_CTX_set_next_protos_advertised_cbrrr)rrrsrsrtset_npn_advertise_callbackus  z"Context.set_npn_advertise_callbackcCs,t||_|jj|_tj|j|jtjdS)a 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']``. It should return one of those bytestrings, the chosen protocol. .. versionadded:: 0.15 N) rrrrrZ SSL_CTX_set_next_proto_select_cbrrr)rrrsrsrtset_npn_select_callbacks  zContext.set_npn_select_callbackcCs>djtjdd|D}tjd|}tj|j|t|dS)a 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 protocols to offer, e.g. ``[b'http/1.1', b'spdy/2']``. rcss|]}tt||fVqdS)N)r r)rrrsrsrtrsz*Context.set_alpn_protos..zunsigned char[]N) rrrrrrZSSL_CTX_set_alpn_protosrr)rrr input_strrsrsrtset_alpn_protoss  zContext.set_alpn_protoscCs,t||_|jj|_tj|j|jtjdS)a 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']``. It should return one of those bytestrings, the chosen protocol. N) rrrrrZSSL_CTX_set_alpn_select_cbrrr)rrrsrsrtset_alpn_select_callbacks  z Context.set_alpn_select_callbackcCsh||_|j|_|dkr tj|_n tj||_tj|j |j}t |dktj |j |j}t |dkdS)z This internal helper does the common work for ``set_ocsp_server_callback`` and ``set_ocsp_client_callback``, which is almost all of it. Nru) rrrrrrZ new_handlerZSSL_CTX_set_tlsext_status_cbrrZSSL_CTX_set_tlsext_status_arg)rhelperrrcrsrsrt_set_ocsp_callbacks    zContext._set_ocsp_callbackcCst|}|j||dS)a 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 contains the OCSP data to staple to the handshake. If no OCSP data is available for this connection, return the empty bytestring. :param data: Some opaque data that will be passed into the callback function when called. This can be used to avoid needing to do complex data lookups or to keep track of what context is being used. This parameter is optional. N)rrF)rrrrDrsrsrtset_ocsp_server_callbacksz Context.set_ocsp_server_callbackcCst|}|j||dS)a 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 provided. The callback must return a boolean that indicates the result of validating the OCSP data: ``True`` if the OCSP data is valid and the certificate can be trusted, or ``False`` if either the OCSP data is invalid or the certificate has been revoked. :param data: Some opaque data that will be passed into the callback function when called. This can be used to avoid needing to do complex data lookups or to keep track of what context is being used. This parameter is optional. N)rrF)rrrrDrsrsrtset_ocsp_client_callbacksz Context.set_ocsp_client_callback)N)N)N)N)?rprqrrrr%r&r'r(r)r*rdictitemsrrrrrrrr rrrrrrrrrrrr r!r"r$r%r&r)r*r.r2r3r4r5r7r8r9r;r<r _requires_snir=r> _requires_npnr?r@_requires_alpnrBrCrFrGrHrsrsrsrtrmsn.  1          %         z4ContextType has been deprecated, use Context insteadc@seZdZdZeZdxddZddZddZd d Z d d Z e d dZ e ddZ ddZdyddZeZdzddZd{ddZeZd|ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Z d4d5Z!d6d7Z"d8d9Z#d:d;Z$dd?Z&d@dAZ'dBdCZ(dDdEZ)dFdGZ*dHdIZ+d}dJdKZ,dLdMZ-dNdOZ.dPdQZ/dRdSZ0dTdUZ1dVdWZ2dXdYZ3dZd[Z4d\d]Z5d^d_Z6d`daZ7dbdcZ8dddeZ9dfdgZ:dhdiZ;djdkZe?dpdqZ@eAdrdsZBeAdtduZCdvdwZDdS)~rnz NcCst|tstdtj|j}tj|tj|_ tj |j tj ||_d|_ d|_ d|_d|_||j|j <|dkrd|_tjtj|_t|jtjktjtj|_t|jtjktj|j |j|jn2d|_d|_||_tj|j t|j}t|dkdS)z Create a new Connection object, using the given OpenSSL.SSL.Context instance and socket. :param context: An SSL Context to use for this connection :param socket: The socket to use for transport layer z"context must be a Context instanceNru)rrmrrZSSL_newrrrZSSL_free_sslZ SSL_set_modeZSSL_MODE_AUTO_RETRYrrrrr_socketZBIO_newZ BIO_s_mem _into_sslrr _from_sslZ SSL_set_bioZ SSL_set_fdr)rrsocketrrrsrsrtrs0   zConnection.__init__cCs0|jdkr td|jj|fn t|j|SdS)zy Look up attributes on the wrapped socket object if they are not found on the Connection object. Nz!'%s' object has no attribute '%s')rOr __class__rpr)rrrsrsrt __getattr__<s zConnection.__getattr__cCsT|jjdk r|jjj|jjdk r0|jjj|jjdk rH|jjj|jjdk r`|jjj|jjdk rx|jjjtj||}|tj krt n|tj krt n|tj krtn|tjkrtn|tjkr 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` zutf-8)rrrZSSL_get_versionrNr)rrrsrsrtget_protocol_version_namef s z$Connection.get_protocol_version_namecCstj|j}|S)a  Retrieve the SSL or TLS protocol version of the current connection. :returns: The TLS version of the current connection. For example, it will return ``0x769`` for connections made over TLS version 1. :rtype: :class:`int` )rZ SSL_versionrN)rrrsrsrtget_protocol_versionr s zConnection.get_protocol_versioncCs@tjd}tjd}tj|j||tj|d|dddS)z 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 zunsigned char **zunsigned int *rN)rrrZSSL_get0_next_proto_negotiatedrNr)rrdata_lenrsrsrtget_next_proto_negotiated} s  z$Connection.get_next_proto_negotiatedcCs>djtjdd|D}tjd|}tj|j|t|dS)ah 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'http/1.1', b'spdy/2']``. rcss|]}tt||fVqdS)N)r r)rrrsrsrtr sz-Connection.set_alpn_protos..zunsigned char[]N) rrrrrrZSSL_set_alpn_protosrNr)rrrrArsrsrtrB s  zConnection.set_alpn_protoscCsHtjd}tjd}tj|j|||s,dStj|d|dddS)z 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. zunsigned char **zunsigned int *rrN)rrrZSSL_get0_alpn_selectedrNr)rrrrsrsrtget_alpn_proto_negotiated s   z$Connection.get_alpn_proto_negotiatedcCs tj|jtj}t|dkdS)a 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`. ruN)rZSSL_set_tlsext_status_typerNZTLSEXT_STATUSTYPE_ocspr)rrErsrsrt request_ocsp s zConnection.request_ocsp)N)r)r)N)NN)N)ErprqrrrrrrrTrVrWrXrKrYr[r\rbwriterdrjreadrlrnrorprrrsrqrtrvrxrzr|r}r-rrr8r9rrrrrrrrrrrrrr{ryrrrrrrrrrrrLrrMrBrrrsrsrsrtrns| 6 )    $  %                   "      z:ConnectionType has been deprecated, use Connection instead)rrRsysr functoolsrr itertoolsrrweakrefrrUrZcryptography.utilsr Zsixr rr r r Z OpenSSL._utilrrrZ_exception_from_error_queuerrrrrZ _make_assertrr~rrrrrreZOpenSSL.cryptorrrrrr__all__rro NameErrorobjectrrrr r!r"ZSSL_SENT_SHUTDOWNr#ZSSL_RECEIVED_SHUTDOWNr$r%r&r'r(r)r*ZSSL_OP_NO_SSLv2r+ZSSL_OP_NO_SSLv3r,ZSSL_OP_NO_TLSv1r-ZSSL_OP_NO_TLSv1_1r.ZSSL_OP_NO_TLSv1_2r/ZSSL_MODE_RELEASE_BUFFERSr0ZSSL_OP_SINGLE_DH_USEr1ZSSL_OP_SINGLE_ECDH_USEr2ZSSL_OP_EPHEMERAL_RSAr3ZSSL_OP_MICROSOFT_SESS_ID_BUGr4ZSSL_OP_NETSCAPE_CHALLENGE_BUGr5Z'SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUGr6Z"SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUGr7Z!SSL_OP_MICROSOFT_BIG_SSLV3_BUFFERr8ZSSL_OP_MSIE_SSLV2_RSA_PADDINGr9ZSSL_OP_SSLEAY_080_CLIENT_DH_BUGr:ZSSL_OP_TLS_D5_BUGr;ZSSL_OP_TLS_BLOCK_PADDING_BUGr<Z"SSL_OP_DONT_INSERT_EMPTY_FRAGMENTSr=ZSSL_OP_CIPHER_SERVER_PREFERENCEr>ZSSL_OP_TLS_ROLLBACK_BUGr?ZSSL_OP_PKCS1_CHECK_1r@ZSSL_OP_PKCS1_CHECK_2rAZSSL_OP_NETSCAPE_CA_DN_BUGrBZ&SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUGrCZSSL_OP_NO_COMPRESSIONrDZSSL_OP_NO_QUERY_MTUrEZSSL_OP_COOKIE_EXCHANGErFZSSL_OP_NO_TICKETrGZ SSL_OP_ALLrHZSSL_VERIFY_PEERrIZSSL_VERIFY_FAIL_IF_NO_PEER_CERTrJZSSL_VERIFY_CLIENT_ONCErKZSSL_VERIFY_NONErLZSSL_SESS_CACHE_OFFrMZSSL_SESS_CACHE_CLIENTrNZSSL_SESS_CACHE_SERVERrOZSSL_SESS_CACHE_BOTHrPZSSL_SESS_CACHE_NO_AUTO_CLEARrQZ!SSL_SESS_CACHE_NO_INTERNAL_LOOKUPrRZ SSL_SESS_CACHE_NO_INTERNAL_STORErSZSSL_SESS_CACHE_NO_INTERNALrTrUrVrWZCryptography_HAS_SSL_STr{r|r}r~extendrXrYrZr[r\r]r^r_r`rarbrcrdrrrrrrerrrfrgrhrirjrrrrrrrrrkrZCryptography_HAS_NEXTPROTONEGrLZCryptography_HAS_ALPNrMZ Cryptography_HAS_TLSEXT_HOSTNAMErKrlrmrpDeprecationWarningZ ContextTypernZConnectionTypeZSSL_library_initrsrsrsrts    ,  ')13C;     ZIPK}S] 4%__pycache__/rand.cpython-36.opt-1.pycnu[3 F\@s$dZddlmZddZddZdS)z* PRNG management routines, thin wrappers. )libcCs:t|tstdt|ts$tdtj|t||dS)a Mix bytes from *string* into the PRNG state. The *entropy* argument is (the lower bound of) an estimate of how much randomness is contained in *string*, measured in bytes. For more information, see e.g. :rfc:`1750`. This function is only relevant if you are forking Python processes and need to reseed the CSPRNG after fork. :param buffer: Buffer with random data. :param entropy: The entropy (in bytes) measurement of the buffer. :return: :obj:`None` zbuffer must be a byte stringzentropy must be an integerN) isinstancebytes TypeErrorint_libZRAND_addlen)bufferZentropyr /usr/lib/python3.6/rand.pyadds   r cCstjS)z} Check whether the PRNG has been seeded with enough data. :return: 1 if the PRNG is seeded enough, 0 otherwise. )rZ RAND_statusr r r r status"sr N)__doc__Z OpenSSL._utilrrr r r r r r s PK}S]Mgg"__pycache__/version.cpython-36.pycnu[3 F\r@sBdZddddddddgZd Zd Zd Zd Zd ZdZdZdj eZ dS)z9 pyOpenSSL - A simple wrapper around the OpenSSL library __author__ __copyright__ __email__ __license__ __summary__ __title____uri__ __version__z19.0.0Z pyOpenSSLzhttps://pyopenssl.org/z0Python wrapper module around the OpenSSL libraryzThe pyOpenSSL developerszcryptography-dev@python.orgzApache License, Version 2.0zCopyright 2001-2017 {0}N) __doc____all__rrrrrrrformatrr r /usr/lib/python3.6/version.pys  PK}S]#cSS&__pycache__/debug.cpython-36.opt-1.pycnu[3 F\ @sddlmZddlZddlZddlZddlZddlZddlm Z dj e j ej j jej jjjdejjejjjdeeddej ej ejej ejejd Zed kreedS) )print_functionN)versionaBpyOpenSSL: {pyopenssl} cryptography: {cryptography} cffi: {cffi} cryptography's compiled against OpenSSL: {crypto_openssl_compile} cryptography's linked OpenSSL: {crypto_openssl_link} Pythons's OpenSSL: {python_openssl} Python executable: {python} Python version: {python_version} Platform: {platform} sys.path: {sys_path}asciiZOPENSSL_VERSIONzn/a) Z pyopensslZcrypto_openssl_compileZcrypto_openssl_linkZpython_openssl cryptographycffipythonZpython_versionplatformZsys_path__main__)Z __future__rZsslsysZ OpenSSL.SSLZOpenSSLrrrformat __version__Z_utilZffistringlibZOPENSSL_VERSION_TEXTdecodeZSSLZSSLeay_versionZSSLEAY_VERSIONgetattr executabler pathZ _env_info__name__printrr/usr/lib/python3.6/debug.pys.      PK}S]Xӎ)__pycache__/__init__.cpython-36.opt-1.pycnu[3 F\ @sXdZddlmZmZddlmZmZmZmZm Z m Z m Z m Z dddddd d d d d g Z dS)z9 pyOpenSSL - A simple wrapper around the OpenSSL library )cryptoSSL) __author__ __copyright__ __email__ __license__ __summary__ __title____uri__ __version__rrrrrrrr r r N)__doc__ZOpenSSLrrZOpenSSL.versionrrrrrr r r __all__rr/usr/lib/python3.6/__init__.pys ( PK}S]C__!__pycache__/crypto.cpython-36.pycnu[3 F\$@sddlZddlmZddlmZddlmZmZmZm Z m Z m Z ddl m ZmZmZddlmZddlmZmZddlmZdd lmZmZmZ m!Z"m#Z$m%Z&m'Z(m)Z*d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-g$Z+ej,Z-ej.Z/dnZ0ej1Z2ej3Z4ej5Z6ej7Z8Gd1dde9Z:ee e:Z;e*e:Zdod6d7Z?d8d9Z@d:d;ZAdd?d?eCZDGd@ddeCZEeeEeFdAeGZHGdBdCdCeCZIdDdZJdEdZKGdFddeCZLeeLeFdGeGZMGdHddeCZNeeNeFdIeGZOGdJddeCZPeePeFdKeGZQGdLddeCZReeReFdMeGZSGdNddeCZTGdOddeCZUeeUeFdPeGZVGdQdde9ZWGdRddeCZXdSdZYdTdZZdUdZ[dpdVdZ\GdWddeCZ]GdXd d eCZ^ee^eFdYeGZ_GdZd!d!eCZ`ee`eFd[eGZaGd\d"d"eCZbeebeFd]eGZcGd^d#d#eCZdeedeFd_eGZeGd`dadaeCZfdbd$Zgdqdcd%Zhddd&Zided'Zjdfd(Zkdgd)Zldhd*Zmdid+Zndjd,Zodrdkd-ZpejqejrejsdldS)sN) b16encode)partial)__eq____ne____lt____le____gt____ge__) integer_types text_typePY3)x509)dsarsa) deprecated)ffilibexception_from_error_queue byte_stringnative UNSPECIFIEDtext_to_bytes_and_warn make_assert FILETYPE_PEM FILETYPE_ASN1 FILETYPE_TEXTTYPE_RSATYPE_DSAErrorPKeyget_elliptic_curvesget_elliptic_curveX509Name X509ExtensionX509ReqX509X509StoreFlags X509StoreX509StoreContextErrorX509StoreContextload_certificatedump_certificatedump_publickeydump_privatekeyRevokedCRLPKCS7PKCS12 NetscapeSPKIload_publickeyload_privatekeydump_certificate_requestload_certificate_requestsignverifydump_crlload_crlload_pkcs7_data load_pkcs12c@seZdZdZdS)rz7 An error occurred in an `OpenSSL.crypto` API. N)__name__ __module__ __qualname____doc__rDrD/usr/lib/python3.6/crypto.pyrNscCsddlm}|S)ap Importing the backend from cryptography has the side effect of activating the osrandom engine. This mutates the global state of OpenSSL in the process and causes issues for various programs that use subinterpreters or embed Python. By putting the import in this function we can avoid triggering this side effect unless _get_backend is called. r)backend)Z,cryptography.hazmat.backends.openssl.backendrF)rFrDrDrE _get_backendXs rGcCstd|fdS)z An OpenSSL API failed somehow. Additionally, the failure which was encountered isn't one that's exercised by the test suite so future behavior of pyOpenSSL is now somewhat less predictable. zUnknown %s failureN) RuntimeError)whererDrDrE_untested_errordsrJcCsd|dkrtjtj}tj}n(tjd|}tj|t|}|fdd}t|tj ktj ||}|S)z 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. Nzchar[]cSs tj|S)N)_libBIO_free)biorefrDrDrEfree~sz_new_mem_buf..free) rKBIO_new BIO_s_memrL_ffinewZBIO_new_mem_buflen_openssl_assertNULLgc)bufferrMrOdatarDrDrE _new_mem_bufms    rZcCs.tjd}tj||}tj|d|ddS)zO Copy the contents of an OpenSSL BIO object into a Python byte string. zchar**rN)rRrSrKZBIO_get_mem_datarX)rM result_bufferZ buffer_lengthrDrDrE_bio_to_strings  r\cCs2t|tstdtj||}|dkr.tddS)a 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: If C{when} does not represent a time in the required format. @raise RuntimeError: If the time value cannot be set for some other (unspecified) reason. zwhen must be a byte stringrzInvalid stringN) isinstancebytes TypeErrorrKZASN1_TIME_set_string ValueError)boundarywhen set_resultrDrDrE_set_asn1_times   rdcCstjd|}tj|dkrdStj|tjkr>tjtj|Stjd}tj |||dtj krlt dn6tjd|d}tj|}tj|}tj |d|SdS)a] 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 contains no time value. z ASN1_STRING*rNzASN1_GENERALIZEDTIME**ASN1_TIME_to_generalizedtime) rRcastrKASN1_STRING_lengthZASN1_STRING_typeZV_ASN1_GENERALIZEDTIMEstringASN1_STRING_datarSrerVrJZASN1_GENERALIZEDTIME_free)Z timestampZstring_timestampZgeneralized_timestampZ string_data string_resultrDrDrE_get_asn1_times       rkc@s$eZdZddZddZddZdS)_X509NameInvalidatorcCs g|_dS)N)_names)selfrDrDrE__init__sz_X509NameInvalidator.__init__cCs|jj|dS)N)rmappend)rnnamerDrDrEaddsz_X509NameInvalidator.addcCsx|jD]}|`qWdS)N)rm_name)rnrqrDrDrEclears z_X509NameInvalidator.clearN)r@rArBrorrrtrDrDrDrErlsrlc@sTeZdZdZdZdZddZddZedd Z d d Z d d Z ddZ ddZ dS)rzD A class representing an DSA or RSA public key or key pair. FTcCs"tj}tj|tj|_d|_dS)NF)rKZ EVP_PKEY_newrRrW EVP_PKEY_free_pkey _initialized)rnpkeyrDrDrErosz PKey.__init__cCs(t}|jr|j|jS|j|jSdS)a 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 N)rG _only_publicZ_evp_pkey_to_public_keyrvZ_evp_pkey_to_private_key)rnrFrDrDrEto_cryptography_keys  zPKey.to_cryptography_keycCsR|}t|tjtjtjtjfs(td|j|_ t|tjtjfrHd|_ d|_ |S)z 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 zUnsupported key typeT) r]rZ RSAPublicKeyZ RSAPrivateKeyrZ DSAPublicKeyZ DSAPrivateKeyr_Z _evp_pkeyrvryrw)clsZ crypto_keyrxrDrDrEfrom_cryptography_keys  zPKey.from_cryptography_keycCs6t|tstdt|ts$td|tkr|dkr= 0`` :raises TypeError: If :py:data:`type` or :py:data:`bits` isn't of the appropriate type. :raises ValueError: If the number of bits isn't an integer of the appropriate size. :return: ``None`` ztype must be an integerzbits must be an integerrzInvalid number of bitsr?zNo such key typeTN)r]intr_rr`rKBN_newrRrWBN_freeZ BN_set_wordZRSA_F4ZRSA_newZRSA_generate_key_exrVrUZEVP_PKEY_assign_RSArvrZDSA_newZDSA_freeZDSA_generate_parameters_exZDSA_generate_keyZEVP_PKEY_set1_DSArrw)rntypebitsZexponentrresultrresrDrDrE generate_keys4     zPKey.generate_keycCs`|jrtdtj|jtjkr*tdtj|j}tj |tj }tj |}|rVdSt dS)ax 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. Only RSA keys can currently be checked. zpublic key onlyzkey type unsupportedTN) ryr_rKZ EVP_PKEY_typer EVP_PKEY_RSAEVP_PKEY_get1_RSArvrRrWRSA_freeZ RSA_check_key_raise_current_error)rnrrrDrDrEcheckGs   z PKey.checkcCs tj|jS)zT Returns the type of the key :return: The type of the key. )rK EVP_PKEY_idrv)rnrDrDrErasz PKey.typecCs tj|jS)zh Returns the number of bits of the key :return: The number of bits of the key. )rKZ EVP_PKEY_bitsrv)rnrDrDrErisz PKey.bitsN)r@rArBrCryrwrorz classmethodr|rrrrrDrDrDrErs 8z.PKeyType has been deprecated, use PKey insteadcsdeZdZdZdZer fddZeddZeddZ ed d Z d d Z d dZ ddZ ZS)_EllipticCurveaZ A representation of a supported elliptic curve. @cvar _curves: :py:obj:`None` until an attempt is made to load the curves. Thereafter, a :py:type:`set` containing :py:type:`_EllipticCurve` instances each of which represents one curve supported by the system. @type _curves: :py:type:`NoneType` or :py:type:`set` Ncst|trtt|j|StS)z Implement cooperation with the right-hand side argument of ``!=``. Python 3 seems to have dropped this cooperation in this very narrow circumstance. )r]rsuperrNotImplemented)rnother) __class__rDrErs z_EllipticCurve.__ne__cs>jtjd}tjd|}j||tfdd|DS)z Get the curves supported by OpenSSL. :param lib: The OpenSSL library binding object. :return: A :py:type:`set` of ``cls`` instances giving the names of the elliptic curves the underlying library supports. rzEC_builtin_curve[]c3s|]}j|jVqdS)N)from_nidnid).0c)r{rrDrE sz7_EllipticCurve._load_elliptic_curves..)ZEC_get_builtin_curvesrRrVrSset)r{rZ num_curvesZbuiltin_curvesrD)r{rrE_load_elliptic_curvess    z$_EllipticCurve._load_elliptic_curvescCs|jdkr|j||_|jS)a Get, cache, and return the curves supported by OpenSSL. :param lib: The OpenSSL library binding object. :return: A :py:type:`set` of ``cls`` instances giving the names of the elliptic curves the underlying library supports. N)_curvesr)r{rrDrDrE_get_elliptic_curvess  z#_EllipticCurve._get_elliptic_curvescCs|||tj|j|jdS)a Instantiate a new :py:class:`_EllipticCurve` associated with the given OpenSSL NID. :param lib: The OpenSSL library binding object. :param nid: The OpenSSL NID the resulting curve object will represent. This must be a curve NID (and not, for example, a hash NID) or subsequent operations will fail in unpredictable ways. :type nid: :py:class:`int` :return: The curve object. ascii)rRrh OBJ_nid2sndecode)r{rrrDrDrErsz_EllipticCurve.from_nidcCs||_||_||_dS)a :param _lib: The :py:mod:`cryptography` binding instance used to interface with OpenSSL. :param _nid: The OpenSSL NID identifying the curve this object represents. :type _nid: :py:class:`int` :param name: The OpenSSL short name identifying the curve this object represents. :type name: :py:class:`unicode` N)rK_nidrq)rnrrrqrDrDrEros z_EllipticCurve.__init__cCs d|jfS)Nz )rq)rnrDrDrE__repr__sz_EllipticCurve.__repr__cCs|jj|j}tj|tjS)z Create a new OpenSSL EC_KEY structure initialized to use this curve. The structure is automatically garbage collected when the Python object is garbage collected. )rKZEC_KEY_new_by_curve_namerrRrWZ EC_KEY_free)rnkeyrDrDrE _to_EC_KEYsz_EllipticCurve._to_EC_KEY)r@rArBrCr_PY3rrrrrrorr __classcell__rDrD)rrErys   rcCs tjtS)a Return a set of objects representing the elliptic curves supported in the OpenSSL build in use. The curve objects have a :py:class:`unicode` ``name`` attribute by which they identify themselves. The curve objects are useful as values for the argument accepted by :py:meth:`Context.set_tmp_ecdh` to specify which elliptical curve should be used for ECDHE key exchange. )rrrKrDrDrDrEr s cCs,xtD]}|j|kr|SqWtd|dS)aT 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` is raised. zunknown curve nameN)r rqr`)rqZcurverDrDrEr!s  cseZdZdZddZfddZfddZdd ZeeZee Z ee Z ee Z ee Z ee Z d d Zd d ZddZddZZS)r"a An X.509 Distinguished Name. :ivar countryName: The country of the entity. :ivar C: Alias for :py:attr:`countryName`. :ivar stateOrProvinceName: The state or province of the entity. :ivar ST: Alias for :py:attr:`stateOrProvinceName`. :ivar localityName: The locality of the entity. :ivar L: Alias for :py:attr:`localityName`. :ivar organizationName: The organization name of the entity. :ivar O: Alias for :py:attr:`organizationName`. :ivar organizationalUnitName: The organizational unit of the entity. :ivar OU: Alias for :py:attr:`organizationalUnitName` :ivar commonName: The common name of the entity. :ivar CN: Alias for :py:attr:`commonName`. :ivar emailAddress: The e-mail address of the entity. cCs tj|j}tj|tj|_dS)z Create a new X509Name, copying the given X509Name instance. :param name: The name to copy. :type name: :py:class:`X509Name` N)rK X509_NAME_duprsrRrWX509_NAME_free)rnrqrDrDrEros zX509Name.__init__c s|jdrtt|j||St|tk r.frD)rrrD)rrE_cmpss z X509Name._cmpcCsBtjdd}tj|j|t|}t|tjkdttj |fS)z6 String representation of an X509Name zchar[]iz) rRrSrKZX509_NAME_onelinersrTrUrV_nativerh)rnr[Z format_resultrDrDrErs  zX509Name.__repr__cCs tj|jS)a& Return an integer representation of the first four bytes of the MD5 digest of the DER representation of the name. This is the Python equivalent of OpenSSL's ``X509_NAME_hash``. :return: The (integer) hash of this name. :rtype: :py:class:`int` )rKZX509_NAME_hashrs)rnrDrDrEhashs z X509Name.hashcCsNtjd}tj|j|}t|dktj|d|dd}tj|d|S)z Return the DER encoding of this name. :return: The DER encoded form of this name. :rtype: :py:class:`bytes` zunsigned char**rN)rRrSrKZ i2d_X509_NAMErsrUrXr)rnr[Z encode_resultrjrDrDrEders   z X509Name.derc Csg}xttj|jD]n}tj|j|}tj|}tj|}tj|}tj|}t j tj |tj |dd}|j t j||fqW|S)z Returns the components of this name, as a sequence of 2-tuples. :return: The components of this name. :rtype: :py:class:`list` of ``name, value`` tuples. N)rrKrrsrrrrrrRrXrirgrprh) rnrrrZfnameZfvalrrqrrDrDrEget_componentss     zX509Name.get_components)r@rArBrCrorrrrrrrrr rrrrrrDrD)rrEr"s $ (  z6X509NameType has been deprecated, use X509Name insteadc@sdeZdZdZdddZeddZejdej dej d iZ d d Z d d Z ddZddZddZdS)r#z, An X.509 v3 certificate extension. NcCstjd}tj|tjtjtjtjdtj||dk rRt|tsJtd|j |_ |dk rtt|tsltd|j |_ |rd|}tj tj|||}|tjkrt tj|tj|_dS)a Initializes an X509 extension. :param type_name: The name of the type of extension_ to create. :type type_name: :py:data:`bytes` :param bool critical: A flag indicating whether this is a critical extension. :param value: The value of the extension. :type value: :py:data:`bytes` :param subject: Optional X509 certificate to use as subject. :type subject: :py:class:`X509` :param issuer: Optional X509 certificate to use as issuer. :type issuer: :py:class:`X509` .. _extension: https://www.openssl.org/docs/manmaster/man5/ x509v3_config.html#STANDARD-EXTENSIONS z X509V3_CTX*rNzissuer must be an X509 instancez subject must be an X509 instances critical,)rRrSrKZX509V3_set_ctxrVZX509V3_set_ctx_nodbr]r%r__x509 issuer_certZ subject_certZX509V3_EXT_nconfrrWX509_EXTENSION_free _extension)rnZ type_nameZcriticalrsubjectissuerZctx extensionrDrDrEros"     zX509Extension.__init__cCstjtj|jS)N)rKrX509_EXTENSION_get_objectr)rnrDrDrErszX509Extension._nidZemailZDNSZURIc Cstjdtj|j}tj|tj}g}xttj|D]}tj ||}y|j |j }Wn8t k rt }tj|||jtt|Yq6Xttj|jjj|jjjdd}|j|d|q6Wdj|S)NzGENERAL_NAMES*:z, )rRrfrKZX509V3_EXT_d2irrWZGENERAL_NAMES_freerZsk_GENERAL_NAME_numZsk_GENERAL_NAME_value _prefixesrKeyErrorrZZGENERAL_NAME_printrprr\rXdZia5rYlengthjoin)rnnamespartsrrqZlabelrMrrDrDrE_subjectAltNameStrings   "z#X509Extension._subjectAltNameStringcCsDtj|jkr|jSt}tj||jdd}t|dktt |S)zF :return: a nice text representation of the extension r) rKZNID_subject_alt_namerrrZX509V3_EXT_printrrUrr\)rnrM print_resultrDrDrE__str__/s   zX509Extension.__str__cCs tj|jS)zk Returns the critical field of this X.509 extension. :return: The critical field. )rKZX509_EXTENSION_get_criticalr)rnrDrDrE get_critical<szX509Extension.get_criticalcCs&tj|j}tj|}tjtj|S)z Returns the short type name of this X.509 extension. The result is a byte string such as :py:const:`b"basicConstraints"`. :return: The short type name. :rtype: :py:data:`bytes` .. versionadded:: 0.12 )rKrrrrRrhr)rnobjrrDrDrEget_short_nameDs  zX509Extension.get_short_namecCs@tj|j}tjd|}tj|}tj|}tj||ddS)z Returns the data of the X509 extension, encoded as ASN.1. :return: The ASN.1 encoded data of this X509 extension. :rtype: :py:data:`bytes` .. versionadded:: 0.12 z ASN1_STRING*N)rKX509_EXTENSION_get_datarrRrfrirgrX)rnZ octet_resultrjZ char_result result_lengthrDrDrEget_dataSs    zX509Extension.get_data)NN)r@rArBrCropropertyrrKZ GEN_EMAILZGEN_DNSZGEN_URIrrrrrrrDrDrDrEr#s =   z@X509ExtensionType has been deprecated, use X509Extension insteadc@steZdZdZddZddZeddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZddZdS)r$z0 An X.509 certificate signing requests. cCs&tj}tj|tj|_|jddS)Nr)rKZ X509_REQ_newrRrW X509_REQ_free_req set_version)rnreqrDrDrErooszX509Req.__init__cCsddlm}t}|||jS)z Export as a ``cryptography`` certificate signing request. :rtype: ``cryptography.x509.CertificateSigningRequest`` .. versionadded:: 17.1.0 r)_CertificateSigningRequest))cryptography.hazmat.backends.openssl.x509rrGr)rnrrFrDrDrEto_cryptographyus zX509Req.to_cryptographycCs&t|tjstd|}|j|_|S)a Construct based on a ``cryptography`` *crypto_req*. :param crypto_req: A ``cryptography`` X.509 certificate signing request :type crypto_req: ``cryptography.x509.CertificateSigningRequest`` :rtype: X509Req .. versionadded:: 17.1.0 z%Must be a certificate signing request)r]r ZCertificateSigningRequestr_Z _x509_reqr)r{Z crypto_reqrrDrDrEfrom_cryptographys zX509Req.from_cryptographycCs tj|j|j}t|dkdS)z Set the public key of the certificate signing request. :param pkey: The public key to use. :type pkey: :py:class:`PKey` :return: ``None`` r?N)rKZX509_REQ_set_pubkeyrrvrU)rnrxrcrDrDrE set_pubkeys zX509Req.set_pubkeycCsDtjt}tj|j|_t|jtjktj |jtj |_d|_ |S)z Get the public key of the certificate signing request. :return: The public key. :rtype: :py:class:`PKey` T) r__new__rKZX509_REQ_get_pubkeyrrvrUrRrVrWrury)rnrxrDrDrE get_pubkeys  zX509Req.get_pubkeycCstj|j|}t|dkdS)z Set the version subfield (RFC 2459, section 4.1.2.1) of the certificate request. :param int version: The version number. :return: ``None`` r?N)rKZX509_REQ_set_versionrrU)rnversionrcrDrDrErszX509Req.set_versioncCs tj|jS)z Get the version subfield (RFC 2459, section 4.1.2.1) of the certificate request. :return: The value of the version subfield. :rtype: :py:class:`int` )rKZX509_REQ_get_versionr)rnrDrDrE get_versionszX509Req.get_versioncCs2tjt}tj|j|_t|jtjk||_ |S)a Return the subject of this certificate signing request. This creates a new :class:`X509Name` that wraps the underlying subject name field on the certificate signing request. Modifying it will modify the underlying signing request, and will have the effect of modifying any other :class:`X509Name` that refers to this subject. :return: The subject of this certificate signing request. :rtype: :class:`X509Name` ) r"rrKZX509_REQ_get_subject_namerrsrUrRrV_owner)rnrqrDrDrE get_subjects zX509Req.get_subjectcCsptj}t|tjktj|tj}x,|D]$}t|ts@t dtj ||j q*Wtj |j |}t|dkdS)z Add extensions to the certificate signing request. :param extensions: The X.509 extensions to add. :type extensions: iterable of :py:class:`X509Extension` :return: ``None`` z+One of the elements is not an X509Extensionr?N)rKZsk_X509_EXTENSION_new_nullrUrRrVrWZsk_X509_EXTENSION_freer]r#r`Zsk_X509_EXTENSION_pushrZX509_REQ_add_extensionsr)rn extensionsstackextrrDrDrEadd_extensionss  zX509Req.add_extensionscCsNg}tj|j}x8ttj|D]&}tjt}tj|||_|j |q W|S)z Get X.509 extensions in the certificate signing request. :return: The X.509 extensions in this request. :rtype: :py:class:`list` of :py:class:`X509Extension` objects. .. versionadded:: 0.15 ) rKZX509_REQ_get_extensionsrrZsk_X509_EXTENSION_numr#rZsk_X509_EXTENSION_valuerrp)rnZextsZnative_exts_objrrrDrDrEget_extensionss   zX509Req.get_extensionscCs^|jrtd|jstdtjt|}|tjkrd?Z#d@dAZ$dBS)Cr%z An X.509 certificate. cCs:tj}t|tjktj|tj|_t|_ t|_ dS)N) rKZX509_newrUrRrVrW X509_freerrl_issuer_invalidator_subject_invalidator)rnr rDrDrEro<s z X509.__init__cCs.|j|}tj|tj|_t|_t|_|S)N) rrRrWrKrrrlrr)r{r certrDrDrE_from_raw_x509_ptrDs  zX509._from_raw_x509_ptrcCsddlm}t}|||jS)z Export as a ``cryptography`` certificate. :rtype: ``cryptography.x509.Certificate`` .. versionadded:: 17.1.0 r) _Certificate)rrrGr)rnrrFrDrDrErLs zX509.to_cryptographycCs&t|tjstd|}|j|_|S)z Construct based on a ``cryptography`` *crypto_cert*. :param crypto_key: A ``cryptography`` X.509 certificate. :type crypto_key: ``cryptography.x509.Certificate`` :rtype: X509 .. versionadded:: 17.1.0 zMust be a certificate)r]r Z Certificater_r)r{Z crypto_certrrDrDrErXs zX509.from_cryptographycCs$t|tstdtj|j|dS)a  Set the version number of the certificate. Note that the version value is zero-based, eg. a value of 0 is V1. :param version: The version number of the certificate. :type version: :py:class:`int` :return: ``None`` zversion must be an integerN)r]r}r_rKZX509_set_versionr)rnrrDrDrErks zX509.set_versioncCs tj|jS)z Return the version number of the certificate. :return: The version number of the certificate. :rtype: :py:class:`int` )rKZX509_get_versionr)rnrDrDrErzszX509.get_versioncCsFtjt}tj|j|_|jtjkr*ttj |jtj |_d|_ |S)z{ Get the public key of the certificate. :return: The public key. :rtype: :py:class:`PKey` T) rrrKX509_get_pubkeyrrvrRrVrrWrury)rnrxrDrDrErs  zX509.get_pubkeycCs2t|tstdtj|j|j}t|dkdS)z Set the public key of the certificate. :param pkey: The public key. :type pkey: :py:class:`PKey` :return: :py:data:`None` zpkey must be a PKey instancer?N)r]rr_rKZX509_set_pubkeyrrvrU)rnrxrcrDrDrErs zX509.set_pubkeycCspt|tstd|jr td|js.tdtjt|}|t j krNtdtj |j |j |}t|dkdS)a Sign the certificate with this key and digest type. :param pkey: The key to sign with. :type pkey: :py:class:`PKey` :param digest: The name of the message digest to use. :type digest: :py:class:`bytes` :return: :py:data:`None` zpkey must be a PKey instancezKey only has public partzKey is uninitializedzNo such digest methodrN)r]rr_ryr`rwrKrrrRrVZ X509_signrrvrU)rnrxrZevp_mdrrDrDrEr7s  z X509.signcCs:tj|j}tj|j}|tjkr*tdtjtj |S)z Return the signature algorithm used in the certificate. :return: The name of the algorithm. :rtype: :py:class:`bytes` :raises ValueError: If the signature algorithm is undefined. .. versionadded:: 0.13 zUndefined signature algorithm) rKZX509_get0_tbs_sigalgrr algorithmrr`rRrhZ OBJ_nid2ln)rnZalgorrrDrDrEget_signature_algorithms   zX509.get_signature_algorithmcCstjt|}|tjkr tdtjdtj}tjdd}t||d<tj |j |||}t |dkdj ddtj ||dDS) a7 Return the digest of the X509 object. :param digest_name: The name of the digest algorithm to use. :type digest_name: :py:class:`bytes` :return: The digest of the object, formatted as :py:const:`b":"`-delimited hex pairs. :rtype: :py:class:`bytes` zNo such digest methodzunsigned char[]zunsigned int[]r?r:cSsg|]}t|jqSrD)rupper)rZchrDrDrE szX509.digest..)rKrrrRrVr`rSZEVP_MAX_MD_SIZErTZ X509_digestrrUrrX)rnZ digest_namerr[rZ digest_resultrDrDrErs     z X509.digestcCs tj|jS)z Return the hash of the X509 subject. :return: The hash of the subject. :rtype: :py:class:`bytes` )rKZX509_subject_name_hashr)rnrDrDrEsubject_name_hashszX509.subject_name_hashcCst|tstdt|dd}t|ts6|jd}tjd}tj ||}|dtj krztj tj |j |}|rtnXtj|dtj }tj|d|tj krttj|tj}tj|j |}t|dkdS)z Set the serial number of the certificate. :param serial: The new serial number. :type serial: :py:class:`int` :return: :py:data`None` zserial must be an integerr=NrzBIGNUM**rr?)r]_integer_typesr_hexr^rrRrSrK BN_hex2bnrVZASN1_INTEGER_setX509_get_serialNumberrrBN_to_ASN1_INTEGERrrWASN1_INTEGER_freeZX509_set_serialNumberrU)rnserial hex_serial bignum_serialZ small_serialrc asn1_serialrDrDrEset_serial_numbers&      zX509.set_serial_numbercCs`tj|j}tj|tj}z4tj|}ztj|}t|d}|Stj |XWdtj |XdS)zx Return the serial number of this certificate. :return: The serial number. :rtype: int r>N) rKrrZASN1_INTEGER_to_BNrRrVZ BN_bn2hexrhr}rr)rnr r r Zhexstring_serialr rDrDrEget_serial_numbers    zX509.get_serial_numbercCs.t|tstdtj|j}tj||dS)z Adjust the time stamp on which the certificate stops being valid. :param int amount: The number of seconds by which to adjust the timestamp. :return: ``None`` zamount must be an integerN)r]r}r_rKX509_get_notAfterrX509_gmtime_adj)rnamountZnotAfterrDrDrEgmtime_adj_notAfter-s  zX509.gmtime_adj_notAftercCs.t|tstdtj|j}tj||dS)z Adjust the timestamp on which the certificate starts being valid. :param amount: The number of seconds by which to adjust the timestamp. :return: ``None`` zamount must be an integerN)r]r}r_rKX509_get_notBeforerr)rnrZ notBeforerDrDrEgmtime_adj_notBefore;s  zX509.gmtime_adj_notBeforecCs(t|j}tjj|d}|tjjkS)z Check whether the certificate has expired. :return: ``True`` if the certificate has expired, ``False`` otherwise. :rtype: bool z %Y%m%d%H%M%SZ)r get_notAfterdatetimeZstrptimeZutcnow)rnZ time_stringZ not_afterrDrDrE has_expiredHs zX509.has_expiredcCst||jS)N)rkr)rnwhichrDrDrE_get_boundary_timeTszX509._get_boundary_timecCs |jtjS)a  Get the timestamp at which the certificate starts being valid. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ :return: A timestamp string, or ``None`` if there is none. :rtype: bytes or NoneType )rrKr)rnrDrDrE get_notBeforeWs zX509.get_notBeforecCst||j|S)N)rdr)rnrrbrDrDrE_set_boundary_timedszX509._set_boundary_timecCs|jtj|S)z Set the timestamp at which the certificate starts being valid. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ :param bytes when: A timestamp string. :return: ``None`` )rrKr)rnrbrDrDrE set_notBeforegs zX509.set_notBeforecCs |jtjS)a  Get the timestamp at which the certificate stops being valid. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ :return: A timestamp string, or ``None`` if there is none. :rtype: bytes or NoneType )rrKr)rnrDrDrErts zX509.get_notAftercCs|jtj|S)z Set the timestamp at which the certificate stops being valid. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ :param bytes when: A timestamp string. :return: ``None`` )rrKr)rnrbrDrDrE set_notAfters zX509.set_notAftercCs0tjt}||j|_t|jtjk||_|S)N)r"rrrsrUrRrVr)rnrrqrDrDrE _get_names   zX509._get_namecCs0t|tstd||j|j}t|dkdS)Nzname must be an X509Namer?)r]r"r_rrsrU)rnrrqrcrDrDrE _set_names zX509._set_namecCs|jtj}|jj||S)a Return the issuer of this certificate. This creates a new :class:`X509Name` that wraps the underlying issuer name field on the certificate. Modifying it will modify the underlying certificate, and will have the effect of modifying any other :class:`X509Name` that refers to this issuer. :return: The issuer of this certificate. :rtype: :class:`X509Name` )rrKZX509_get_issuer_namerrr)rnrqrDrDrE get_issuers  zX509.get_issuercCs|jtj||jjdS)z Set the issuer of this certificate. :param issuer: The issuer. :type issuer: :py:class:`X509Name` :return: ``None`` N)r rKZX509_set_issuer_namerrt)rnrrDrDrE set_issuers zX509.set_issuercCs|jtj}|jj||S)a Return the subject of this certificate. This creates a new :class:`X509Name` that wraps the underlying subject name field on the certificate. Modifying it will modify the underlying certificate, and will have the effect of modifying any other :class:`X509Name` that refers to this subject. :return: The subject of this certificate. :rtype: :class:`X509Name` )rrKX509_get_subject_namerrr)rnrqrDrDrErs  zX509.get_subjectcCs|jtj||jjdS)z Set the subject of this certificate. :param subject: The subject. :type subject: :py:class:`X509Name` :return: ``None`` N)r rKZX509_set_subject_namerrt)rnrrDrDrE set_subjects zX509.set_subjectcCs tj|jS)z Get the number of extensions on this certificate. :return: The number of extensions. :rtype: :py:class:`int` .. versionadded:: 0.12 )rKZX509_get_ext_countr)rnrDrDrEget_extension_counts zX509.get_extension_countcCs@x:|D]2}t|tstdtj|j|jd}|stqWdS)z Add extensions to the certificate. :param extensions: The extensions to add. :type extensions: An iterable of :py:class:`X509Extension` objects. :return: ``None`` z+One of the elements is not an X509Extensionr?Nr)r]r#r`rKZ X509_add_extrrr)rnrrrrDrDrErs   zX509.add_extensionscCsNtjt}tj|j||_|jtjkr.tdtj |j}tj |tj |_|S)a Get a specific extension of the certificate by index. Extensions on a certificate are kept in order. The index parameter selects which extension will be returned. :param int index: The index of the extension to retrieve. :return: The extension at the specified index. :rtype: :py:class:`X509Extension` :raises IndexError: If the extension index was out of bounds. .. versionadded:: 0.12 zextension index out of bounds) r#rrKZ X509_get_extrrrRrV IndexErrorZX509_EXTENSION_duprWr)rnindexrrrDrDrE get_extensions   zX509.get_extensionN)%r@rArBrCrorrrrrrrrr7rrrrrrrrrrrrrrrr r!r"rr$r%rr(rDrDrDrEr%8sB    '          z.X509Type has been deprecated, use X509 insteadc@sReZdZdZejZejZej Z ej Z ej ZejZejZejZejZejZejZdS)r&a  Flags for X509 verification, used to change the behavior of :class:`X509Store`. See `OpenSSL Verification Flags`_ for details. .. _OpenSSL Verification Flags: https://www.openssl.org/docs/manmaster/man3/X509_VERIFY_PARAM_set_flags.html N)r@rArBrCrKZX509_V_FLAG_CRL_CHECKZ CRL_CHECKZX509_V_FLAG_CRL_CHECK_ALLZ CRL_CHECK_ALLZX509_V_FLAG_IGNORE_CRITICALZIGNORE_CRITICALZX509_V_FLAG_X509_STRICTZ X509_STRICTZX509_V_FLAG_ALLOW_PROXY_CERTSZALLOW_PROXY_CERTSZX509_V_FLAG_POLICY_CHECKZ POLICY_CHECKZX509_V_FLAG_EXPLICIT_POLICYZEXPLICIT_POLICYZX509_V_FLAG_INHIBIT_MAPZ INHIBIT_MAPZX509_V_FLAG_NOTIFY_POLICYZ NOTIFY_POLICYZX509_V_FLAG_CHECK_SS_SIGNATUREZCHECK_SS_SIGNATUREZX509_V_FLAG_CB_ISSUER_CHECKZCB_ISSUER_CHECKrDrDrDrEr&s c@s8eZdZdZddZddZddZdd Zd d Zd S) r'a An X.509 store. An X.509 store is used to describe a context in which to verify a certificate. A description of a context may include a set of certificates to trust, a set of certificate revocation lists, verification flags and more. An X.509 store, being only a description, cannot be used by itself to verify a certificate. To carry out the actual verification process, see :class:`X509StoreContext`. cCstj}tj|tj|_dS)N)rKZX509_STORE_newrRrWZX509_STORE_free_store)rnstorerDrDrEro6szX509Store.__init__cCsPt|tsttj|j|jdkrLtj}tj|}t |tj ktj dS)a Adds a trusted certificate to this store. Adding a certificate with this method adds this certificate as a *trusted* certificate. :param X509 cert: The certificate to add to this store. :raises TypeError: If the certificate is not an :class:`X509`. :raises OpenSSL.crypto.Error: If OpenSSL was unhappy with your certificate. :return: ``None`` if the certificate was added successfully. rN) r]r%r_rKZX509_STORE_add_certr)rZERR_peek_errorZERR_GET_REASONrUZ!X509_R_CERT_ALREADY_IN_HASH_TABLEZERR_clear_error)rnrcodeZ err_reasonrDrDrEadd_cert:s   zX509Store.add_certcCsttj|j|jdkdS)a Add a certificate revocation list to this store. The certificate revocation lists added to a store will only be used if the associated flags are configured to check certificate revocation lists. .. versionadded:: 16.1.0 :param CRL crl: The certificate revocation list to add to this store. :return: ``None`` if the certificate revocation list was added successfully. rN)rUrKZX509_STORE_add_crlr)_crl)rncrlrDrDrEadd_crlXszX509Store.add_crlcCsttj|j|dkdS)a Set verification flags to this store. Verification flags can be combined by oring them together. .. note:: Setting a verification flag sometimes requires clients to add additional information to the store, otherwise a suitable error will be raised. For example, in setting flags to enable CRL checking a suitable CRL must be added to the store otherwise an error will be raised. .. versionadded:: 16.1.0 :param int flags: The verification flags to set on this store. See :class:`X509StoreFlags` for available constants. :return: ``None`` if the verification flags were successfully set. rN)rUrKZX509_STORE_set_flagsr))rnflagsrDrDrE set_flagshszX509Store.set_flagscCsFtj}tj|tj}tj|t|jdttj |j |dkdS)a Set the time against which the certificates are verified. Normally the current time is used. .. note:: For example, you can determine if a certificate was valid at a given time. .. versionadded:: 17.0.0 :param datetime vfy_time: The verification time to set on this store. :return: ``None`` if the verification time was successfully set. z%srN) rKZX509_VERIFY_PARAM_newrRrWZX509_VERIFY_PARAM_freeZX509_VERIFY_PARAM_set_timer}ZstrftimerUZX509_STORE_set1_paramr))rnZvfy_timeZparamrDrDrEset_timeszX509Store.set_timeN) r@rArBrCror,r/r1r2rDrDrDrEr'(s  z8X509StoreType has been deprecated, use X509Store insteadcs eZdZdZfddZZS)r(z An exception raised when an error occurred while verifying a certificate using `OpenSSL.X509StoreContext.verify_certificate`. :ivar certificate: The certificate which caused verificate failure. :type certificate: :class:`X509` cstt|j|||_dS)N)rr(ro certificate)rnmessager3)rrDrEroszX509StoreContextError.__init__)r@rArBrCrorrDrD)rrEr(sc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)r)a An X.509 store context. An X.509 store context is used to carry out the actual verification process of a certificate in a described context. For describing such a context, see :class:`X509Store`. :ivar _store_ctx: The underlying X509_STORE_CTX structure used by this instance. It is dynamically allocated and automatically garbage collected. :ivar _store: See the ``store`` ``__init__`` parameter. :ivar _cert: See the ``certificate`` ``__init__`` parameter. :param X509Store store: The certificates which will be trusted for the purposes of any verifications. :param X509 certificate: The certificate to be verified. cCs0tj}tj|tj|_||_||_|jdS)N) rKZX509_STORE_CTX_newrRrWZX509_STORE_CTX_free _store_ctxr)_cert_init)rnr*r3Z store_ctxrDrDrEros zX509StoreContext.__init__cCs.tj|j|jj|jjtj}|dkr*tdS)z Set up the store context for a subsequent verification operation. Calling this method more than once without first calling :meth:`_cleanup` will leak memory. rN) rKZX509_STORE_CTX_initr5r)r6rrRrVr)rnretrDrDrEr7szX509StoreContext._initcCstj|jdS)z Internally cleans up the store context. The store context can then be reused with a new call to :meth:`_init`. N)rKZX509_STORE_CTX_cleanupr5)rnrDrDrE_cleanupszX509StoreContext._cleanupcCs\tj|jtj|jttjtjtj|jg}tj|j}tj |}t j |}t ||S)z Convert an OpenSSL native context error failure into a Python exception. When a call to native OpenSSL X509_verify_cert fails, additional information about the failure can be obtained from the store context. ) rKZX509_STORE_CTX_get_errorr5ZX509_STORE_CTX_get_error_depthrrRrhZX509_verify_cert_error_stringZX509_STORE_CTX_get_current_certZX509_dupr%rr()rnerrorsrr6pycertrDrDrE_exception_from_contexts      z(X509StoreContext._exception_from_contextcCs ||_dS)z Set the context's X.509 store. .. versionadded:: 0.15 :param X509Store store: The store description which will be used for the purposes of any *future* verifications. N)r))rnr*rDrDrE set_stores zX509StoreContext.set_storecCs8|j|jtj|j}|j|dkr4|jdS)a" Verify a certificate in a context. .. versionadded:: 0.15 :raises X509StoreContextError: If an error occurred when validating a certificate in the context. Sets ``certificate`` attribute to indicate which certificate caused the error. rN)r9r7rKZX509_verify_certr5r<)rnr8rDrDrEverify_certificates  z#X509StoreContext.verify_certificateN) r@rArBrCror7r9r<r=r>rDrDrDrEr)s   cCsvt|tr|jd}t|}|tkr.rr?)rOr]r^r_rRreplace _crl_reasonsr'rKZASN1_ENUMERATED_newrUrRrVrWZASN1_ENUMERATED_freeZASN1_ENUMERATED_setZX509_REVOKED_add1_ext_i2drHrN)rnreasonZ reason_codeZnew_reason_extrcrrDrDrE set_reasons    zRevoked.set_reasoncCsxttj|jD]l}tj|j|}tj|}tj|tjkrt}tj ||dd}|svtj |tj |}t |dkt |SqWdS)a  Get the reason of this revocation. :return: The reason, or ``None`` if there is none. :rtype: bytes or NoneType .. seealso:: :meth:`all_reasons`, which gives you a list of all supported reasons this method might return. rN)rrKrLrHrMrrrNrZrZM_ASN1_OCTET_STRING_printrrUr\)rnrrrrMrrDrDrE get_reasons   zRevoked.get_reasoncCs|jddS)a Return a list of all the supported reason strings. This list is a copy; modifying it does not change the supported reason strings. :return: A list of reason strings. :rtype: :class:`list` of :class:`bytes` N)rU)rnrDrDrE all_reasons)s zRevoked.all_reasonscCstj|j}t||S)z Set the revocation timestamp. :param bytes when: The timestamp of the revocation, as ASN.1 TIME. :return: ``None`` )rK X509_REVOKED_get0_revocationDaterHrd)rnrbdtrDrDrE set_rev_date5s zRevoked.set_rev_datecCstj|j}t|S)z Get the revocation timestamp. :return: The timestamp of the revocation, as ASN.1 TIME. :rtype: bytes )rKrZrHrk)rnr[rDrDrE get_rev_date@s zRevoked.get_rev_dateN)r@rArBrCrUrorJrKrOrWrXrYr\r]rDrDrDrEr.s" $  c@s|eZdZdZddZddZeddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZedefddZdS)r/z( A certificate revocation list. cCstj}tj|tj|_dS)N)rKZ X509_CRL_newrRrW X509_CRL_freer-)rnr.rDrDrEroPsz CRL.__init__cCsddlm}t}|||jS)z Export as a ``cryptography`` CRL. :rtype: ``cryptography.x509.CertificateRevocationList`` .. versionadded:: 17.1.0 r)_CertificateRevocationList)rr_rGr-)rnr_rFrDrDrErTs zCRL.to_cryptographycCs&t|tjstd|}|j|_|S)a Construct based on a ``cryptography`` *crypto_crl*. :param crypto_crl: A ``cryptography`` certificate revocation list :type crypto_crl: ``cryptography.x509.CertificateRevocationList`` :rtype: CRL .. versionadded:: 17.1.0 z%Must be a certificate revocation list)r]r ZCertificateRevocationListr_Z _x509_crlr-)r{Z crypto_crlr.rDrDrErbs zCRL.from_cryptographycCsrg}tj|j}xPttj|D]>}tj||}tj|}tjt}t j |tj |_ |j |q W|rnt|SdS)aA Return the revocations in this certificate revocation list. These revocations will be provided by value, not by reference. That means it's okay to mutate them: it won't affect this CRL. :return: The revocations in this CRL. :rtype: :class:`tuple` of :class:`Revocation` N)rKZX509_CRL_get_REVOKEDr-rZsk_X509_REVOKED_numZsk_X509_REVOKED_valueCryptography_X509_REVOKED_dupr.rrRrWrGrHrptuple)rnresultsZ revoked_stackrrIZ revoked_copyZpyrevrDrDrE get_revokedus     zCRL.get_revokedcCs8tj|j}t|tjktj|j|}t|dkdS)a9 Add a revoked (by value not reference) to the CRL structure This revocation will be added by value, not by reference. That means it's okay to mutate it after adding: it won't affect this CRL. :param Revoked revoked: The new revocation. :return: ``None`` rN)rKr`rHrUrRrVZX509_CRL_add0_revokedr-)rnrIcopyrrDrDrE add_revokeds zCRL.add_revokedcCsBtjtj|j}t|tjktj|tj}t j t }||_ |S)zc Get the CRL's issuer. .. versionadded:: 16.1.0 :rtype: X509Name ) rKrZX509_CRL_get_issuerr-rUrRrVrWrr"rrs)rnZ_issuerrrDrDrEr!s  zCRL.get_issuercCsttj|j|dkdS)z Set the CRL version. .. versionadded:: 16.1.0 :param int version: The version of the CRL. :return: ``None`` rN)rUrKZX509_CRL_set_versionr-)rnrrDrDrErs zCRL.set_versioncCst||j|S)N)rdr-)rnrrbrDrDrErszCRL._set_boundary_timecCs|jtj|S)z Set when the CRL was last updated. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ .. versionadded:: 16.1.0 :param bytes when: A timestamp string. :return: ``None`` )rrKZX509_CRL_get_lastUpdate)rnrbrDrDrEset_lastUpdates zCRL.set_lastUpdatecCs|jtj|S)z Set when the CRL will next be udpated. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ .. versionadded:: 16.1.0 :param bytes when: A timestamp string. :return: ``None`` )rrKZX509_CRL_get_nextUpdate)rnrbrDrDrEset_nextUpdates zCRL.set_nextUpdatecCs\tj|}t|tjktj|jtj|jtj |jtj |j|j |}t|dkdS)a; Sign the CRL. Signing a CRL enables clients to associate the CRL itself with an issuer. Before a CRL is meaningful to other OpenSSL functions, it must be signed by an issuer. This method implicitly sets the issuer's name based on the issuer certificate and private key used to sign the CRL. .. versionadded:: 16.1.0 :param X509 issuer_cert: The issuer's certificate. :param PKey issuer_key: The issuer's private key. :param bytes digest: The digest method to sign the CRL with. rN) rKrrUrRrVX509_CRL_set_issuer_namer-r#rZ X509_CRL_sort X509_CRL_signrv)rnrZ issuer_keyrrrrDrDrEr7s  zCRL.signdc Cst|tstdt|ts$tdt|ts6td|tkrFtdtj|}|tj krbt dtj tj }t |tj ktj}t |tj ktj|dtj|j|tj||dddtj|j|tj|jtj|jtj|j|j|} | stt||S) a Export the CRL as a string. :param X509 cert: The certificate used to sign the CRL. :param PKey key: The key used to sign the CRL. :param int type: The export format, either :data:`FILETYPE_PEM`, :data:`FILETYPE_ASN1`, or :data:`FILETYPE_TEXT`. :param int days: The number of days until the next update of this CRL. :param bytes digest: The name of the message digest to use (eg ``b"sha2566"``). :rtype: bytes zcert must be an X509 instancezkey must be a PKey instanceztype must be an integerzdigest must be providedzNo such digest methodr<)r]r%r_rr} _UNSPECIFIEDrKrrRrVr`rPrQrUZ ASN1_TIME_newrZX509_CRL_set_lastUpdater-ZX509_CRL_set_nextUpdaterhr#rrirvrr9) rnrrrZdaysrrrMZsometimerrDrDrEexports2      z CRL.exportN)r@rArBrCrorrrrcrer!rrrfrgr7rrmrnrDrDrDrEr/Ks  z,CRLType has been deprecated, use CRL insteadc@s4eZdZddZddZddZddZd d Zd S) r0cCsttj|jS)zm Check if this NID_pkcs7_signed object :return: True if the PKCS7 is of type signed )boolrKZPKCS7_type_is_signed_pkcs7)rnrDrDrEtype_is_signed- szPKCS7.type_is_signedcCsttj|jS)zt Check if this NID_pkcs7_enveloped object :returns: True if the PKCS7 is of type enveloped )rorKZPKCS7_type_is_envelopedrp)rnrDrDrEtype_is_enveloped5 szPKCS7.type_is_envelopedcCsttj|jS)z Check if this NID_pkcs7_signedAndEnveloped object :returns: True if the PKCS7 is of type signedAndEnveloped )rorKZ PKCS7_type_is_signedAndEnvelopedrp)rnrDrDrEtype_is_signedAndEnveloped= sz PKCS7.type_is_signedAndEnvelopedcCsttj|jS)zi Check if this NID_pkcs7_data object :return: True if the PKCS7 is of type data )rorKZPKCS7_type_is_datarp)rnrDrDrE type_is_dataE szPKCS7.type_is_datacCs"tj|jj}tj|}tj|S)zk Returns the type name of the PKCS7 structure :return: A string with the typename )rKrrprrrRrh)rnrZ string_typerDrDrE get_type_nameM s zPKCS7.get_type_nameN)r@rArBrqrrrsrtrurDrDrDrEr0, s z0PKCS7Type has been deprecated, use PKCS7 insteadc@sbeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ dddZ dS)r1z A PKCS #12 archive. cCsd|_d|_d|_d|_dS)N)rvr6_cacerts _friendlyname)rnrDrDrErod szPKCS12.__init__cCs|jS)z Get the certificate in the PKCS #12 structure. :return: The certificate, or :py:const:`None` if there is none. :rtype: :py:class:`X509` or :py:const:`None` )r6)rnrDrDrEget_certificatej szPKCS12.get_certificatecCst|tstd||_dS)z Set the certificate in the PKCS #12 structure. :param cert: The new certificate, or :py:const:`None` to unset it. :type cert: :py:class:`X509` or :py:const:`None` :return: ``None`` zcert must be an X509 instanceN)r]r%r_r6)rnrrDrDrEset_certificates s zPKCS12.set_certificatecCs|jS)z Get the private key in the PKCS #12 structure. :return: The private key, or :py:const:`None` if there is none. :rtype: :py:class:`PKey` )rv)rnrDrDrEget_privatekey szPKCS12.get_privatekeycCst|tstd||_dS)z Set the certificate portion of the PKCS #12 structure. :param pkey: The new private key, or :py:const:`None` to unset it. :type pkey: :py:class:`PKey` or :py:const:`None` :return: ``None`` zpkey must be a PKey instanceN)r]rr_rv)rnrxrDrDrEset_privatekey s zPKCS12.set_privatekeycCs|jdk rt|jSdS)a Get the CA certificates in the PKCS #12 structure. :return: A tuple with the CA certificates in the chain, or :py:const:`None` if there are none. :rtype: :py:class:`tuple` of :py:class:`X509` or :py:const:`None` N)rvra)rnrDrDrEget_ca_certificates s zPKCS12.get_ca_certificatescCsB|dkrd|_n.t|}x|D]}t|tstdqW||_dS)a Replace or set the CA certificates within the PKCS12 object. :param cacerts: The new CA certificates, or :py:const:`None` to unset them. :type cacerts: An iterable of :py:class:`X509` or :py:const:`None` :return: ``None`` Nz)iterable must only contain X509 instances)rvlistr]r%r_)rncacertsrrDrDrEset_ca_certificates s    zPKCS12.set_ca_certificatescCs2|dkrd|_nt|ts(td|f||_dS)z Set the friendly name in the PKCS #12 structure. :param name: The new friendly name, or :py:const:`None` to unset. :type name: :py:class:`bytes` or :py:const:`None` :return: ``None`` Nz+name must be a byte string or None (not %r))rwr]r^r_)rnrqrDrDrEset_friendlyname s   zPKCS12.set_friendlynamecCs|jS)z Get the friendly name in the PKCS# 12 structure. :returns: The friendly name, or :py:const:`None` if there is none. :rtype: :py:class:`bytes` or :py:const:`None` )rw)rnrDrDrEget_friendlyname szPKCS12.get_friendlynameNr?c Cstd|}|jdkrtj}n4tj}tj|tj}x|jD]}tj||j q:W|dkr^tj}|j }|dkrrtj}|j dkrtj}n|j j }|j dkrtj}n|j j }tj |||||tjtj||d }|tjkrttj|tj}t} tj| |t| S)a Dump a PKCS12 object as a string. For more information, see the :c:func:`PKCS12_create` man page. :param passphrase: The passphrase used to encrypt the structure. Unlike some other passphrase arguments, this *must* be a string, not a callback. :type passphrase: :py:data:`bytes` :param iter: Number of times to repeat the encryption step. :type iter: :py:data:`int` :param maciter: Number of times to repeat the MAC step. :type maciter: :py:data:`int` :return: The string representation of the PKCS #12 structure. :rtype: rENr)_text_to_bytes_and_warnrvrRrVrKZsk_X509_new_nullrW sk_X509_freeZ sk_X509_pushrrwrvr6Z PKCS12_createZ&NID_pbe_WithSHA1And3_Key_TripleDES_CBCr PKCS12_freerZZi2d_PKCS12_bior\) rnrEiterZmaciterr~r friendlynamerxpkcs12rMrDrDrErn s:         z PKCS12.export)Nrr?)r@rArBrCrorxryrzr{r|rrrrnrDrDrDrEr1_ s      z2PKCS12Type has been deprecated, use PKCS12 insteadc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)r2z! A Netscape SPKI object. cCstj}tj|tj|_dS)N)rKZNETSCAPE_SPKI_newrRrWZNETSCAPE_SPKI_free_spki)rnZspkirDrDrEro szNetscapeSPKI.__init__cCs^|jrtd|jstdtjt|}|tjkrNetscapeSPKIType has been deprecated, use NetscapeSPKI insteadc@sBeZdZd ddZeddZeddZefdd Zd d Z d S)rAFcCs4|tkr|dk rtd||_||_||_g|_dS)Nz0only FILETYPE_PEM key format supports encryption)rr` _passphrase _more_args _truncate _problems)rnrrEZ more_argstruncaterDrDrErov sz_PassphraseHelper.__init__cCsF|jdkrtjSt|jtr"tjSt|jr:tjd|jStddS)NZpem_password_cbz2Last argument must be a byte string or a callable.) rrRrVr]r^callablerB_read_passphraser_)rnrDrDrErB s   z_PassphraseHelper.callbackcCs>|jdkrtjSt|jtr"|jSt|jr2tjStddS)Nz2Last argument must be a byte string or a callable.)rrRrVr]r^rr_)rnrDrDrErC s   z_PassphraseHelper.callback_argsc Cs8|jr4y t|Wn|k r&YnX|jjddS)Nr)r_exception_from_error_queuepop)rnZ exceptionTyperDrDrErD s  z"_PassphraseHelper.raise_if_problemcCsy|jr|j|||}n |j|}t|ts4tdt||kr\|jrT|d|}ntdx(tt|D]}|||d||<qjWt|Stk r}z|j j |dSd}~XnXdS)NzString expectedz+passphrase returned by callback is too longr?r) rrr]r^r`rTrr Exceptionrrp)rnZbufsizeZrwflagZuserdatarrerDrDrEr s"    z"_PassphraseHelper._read_passphraseN)FF) r@rArBrorrBrCrrDrrDrDrDrErAu s  rAcCst|tr|jd}t|}|tkrs$     (     ( jBHUoh ;+[,/ZG! $"$ `PK}S]33&__pycache__/_util.cpython-36.opt-1.pycnu[3 F\N@sddlZddlZddlmZmZmZddlmZeZej ej Z ej Z e j ddZ ddZdd Zd d Zd d ZddZerddZnddZeZejdZddZdS)N)PY3 binary_type text_type)BindingF)Zshould_clear_after_alloccCs|sdSttj|S)z Get a native string type representing of the given CFFI ``char*`` object. :param charp: A C-style string represented using CFFI. :return: :class:`str` )nativeffistring)Zcharpr /usr/lib/python3.6/_util.pytextsr cCsVg}xDtj}|dkrP|jttj|ttj|ttj|fqW||dS)ac Convert an OpenSSL library failure into a Python exception. When a call to the native OpenSSL library fails, this is usually signalled by the return value, and an error code is stored in an error queue associated with the current thread. The err library provides functions to obtain these error codes and textual error messages. rN)libZ ERR_get_errorappendr ZERR_lib_error_stringZERR_func_error_stringZERR_reason_error_string)Zexception_typeerrorserrorr r r exception_from_error_queue"s   rcsfdd}|S)z~ Create an assert function that uses :func:`exception_from_error_queue` to raise an exception wrapped by *error*. cs|dk rtdS)zT If *ok* is not True, retrieve the error from OpenSSL and raise it. TN)r)ok)rr r openssl_assert>sz#make_assert..openssl_assertr )rrr )rr make_assert9s rcCsLt|ttfstd|tr4t|trH|jdSnt|trH|jdS|S)a6 Convert :py:class:`bytes` or :py:class:`unicode` to the native :py:class:`str` type, using UTF-8 encoding if conversion is necessary. :raise UnicodeError: The input string is not UTF-8 decodeable. :raise TypeError: The input is neither :py:class:`bytes` nor :py:class:`unicode`. z%r is neither bytes nor unicodezutf-8) isinstancerr TypeErrorrdecodeencode)sr r r rHs      rcCs2t|tr|St|tr&|jtjStddS)a Convert a Python string to a :py:class:`bytes` string identifying the same path and which can be passed into an OpenSSL API accepting a filename. :param s: An instance of :py:class:`bytes` or :py:class:`unicode`. :return: An instance of :py:class:`bytes`. z3Path must be represented as bytes or unicode stringN)rrrrsysgetfilesystemencodingr)rr r r path_string]s  rcCs |jdS)Ncharmap)r)rr r r byte_stringosrcCs|S)Nr )rr r r rrsz) for {0} is no longer accepted, use bytescCs.t|tr*tjtj|tdd|jdS|S)a If ``obj`` is text, emit a warning that it should be bytes instead and try to convert it to bytes automatically. :param str label: The name of the parameter from which ``obj`` was taken (so a developer can easily find the source of the problem and correct it). :return: If ``obj`` is the text string type, a ``bytes`` object giving the UTF-8 encoding of that text is returned. Otherwise, ``obj`` itself is returned. )category stacklevelzutf-8)rrwarningswarn _TEXT_WARNINGformatDeprecationWarningr)Zlabelobjr r r text_to_bytes_and_warns  r()rr"ZsixrrrZ,cryptography.hazmat.bindings.openssl.bindingrZbindingZinit_static_locksrr Z new_allocatorZno_zero_allocatorr rrrrrobjectZ UNSPECIFIED__name__r$r(r r r r s&     PK}S]#cSS __pycache__/debug.cpython-36.pycnu[3 F\ @sddlmZddlZddlZddlZddlZddlZddlm Z dj e j ej j jej jjjdejjejjjdeeddej ej ejej ejejd Zed kreedS) )print_functionN)versionaBpyOpenSSL: {pyopenssl} cryptography: {cryptography} cffi: {cffi} cryptography's compiled against OpenSSL: {crypto_openssl_compile} cryptography's linked OpenSSL: {crypto_openssl_link} Pythons's OpenSSL: {python_openssl} Python executable: {python} Python version: {python_version} Platform: {platform} sys.path: {sys_path}asciiZOPENSSL_VERSIONzn/a) Z pyopensslZcrypto_openssl_compileZcrypto_openssl_linkZpython_openssl cryptographycffipythonZpython_versionplatformZsys_path__main__)Z __future__rZsslsysZ OpenSSL.SSLZOpenSSLrrrformat __version__Z_utilZffistringlibZOPENSSL_VERSION_TEXTdecodeZSSLZSSLeay_versionZSSLEAY_VERSIONgetattr executabler pathZ _env_info__name__printrr/usr/lib/python3.6/debug.pys.      PK}S]Mgg(__pycache__/version.cpython-36.opt-1.pycnu[3 F\r@sBdZddddddddgZd Zd Zd Zd Zd ZdZdZdj eZ dS)z9 pyOpenSSL - A simple wrapper around the OpenSSL library __author__ __copyright__ __email__ __license__ __summary__ __title____uri__ __version__z19.0.0Z pyOpenSSLzhttps://pyopenssl.org/z0Python wrapper module around the OpenSSL libraryzThe pyOpenSSL developerszcryptography-dev@python.orgzApache License, Version 2.0zCopyright 2001-2017 {0}N) __doc____all__rrrrrrrformatrr r /usr/lib/python3.6/version.pys  PK}S],7 __pycache__/tsafe.cpython-36.pycnu[3 F\N@sBddlZddlmZddlmZejdeddGdddZ dS) N)RLock)SSLz/OpenSSL.tsafe is deprecated and will be removed) stacklevelc!@s2eZdZddZxd&D]Zed$eefqWd%S)' ConnectioncGstj||_t|_dS)N)_sslrZ _ssl_conn_RLock_lock)selfargsr /usr/lib/python3.6/tsafe.py__init__s zConnection.__init__ get_contextpendingsendwriterecvread renegotiatebindlistenconnectaccept setblockingfilenoshutdowncloseget_cipher_list getpeername getsockname getsockopt setsockoptmakefile get_app_data set_app_data state_string sock_shutdownget_peer_certificateget_peer_cert_chain want_read want_writeset_connect_stateset_accept_state connect_exsendallzdef %s(self, *args): self._lock.acquire() try: return self._ssl_conn.%s(*args) finally: self._lock.release() N)!rrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/)__name__ __module__ __qualname__rfexecr r r r r sr) warningsZ threadingrrZOpenSSLrrwarnDeprecationWarningrr r r r s    PK}S]*mNNtsafe.pynu[import warnings from threading import RLock as _RLock from OpenSSL import SSL as _ssl warnings.warn( "OpenSSL.tsafe is deprecated and will be removed", DeprecationWarning, stacklevel=3 ) class Connection: def __init__(self, *args): self._ssl_conn = _ssl.Connection(*args) self._lock = _RLock() for f in ('get_context', 'pending', 'send', 'write', 'recv', 'read', 'renegotiate', 'bind', 'listen', 'connect', 'accept', 'setblocking', 'fileno', 'shutdown', 'close', 'get_cipher_list', 'getpeername', 'getsockname', 'getsockopt', 'setsockopt', 'makefile', 'get_app_data', 'set_app_data', 'state_string', 'sock_shutdown', 'get_peer_certificate', 'get_peer_cert_chain', 'want_read', 'want_write', 'set_connect_state', 'set_accept_state', 'connect_ex', 'sendall'): exec("""def %s(self, *args): self._lock.acquire() try: return self._ssl_conn.%s(*args) finally: self._lock.release()\n""" % (f, f)) PK}S]{M crypto.pynu[import datetime from base64 import b16encode from functools import partial from operator import __eq__, __ne__, __lt__, __le__, __gt__, __ge__ from six import ( integer_types as _integer_types, text_type as _text_type, PY3 as _PY3) from cryptography import x509 from cryptography.hazmat.primitives.asymmetric import dsa, rsa from cryptography.utils import deprecated from OpenSSL._util import ( ffi as _ffi, lib as _lib, exception_from_error_queue as _exception_from_error_queue, byte_string as _byte_string, native as _native, UNSPECIFIED as _UNSPECIFIED, text_to_bytes_and_warn as _text_to_bytes_and_warn, make_assert as _make_assert, ) __all__ = [ 'FILETYPE_PEM', 'FILETYPE_ASN1', 'FILETYPE_TEXT', 'TYPE_RSA', 'TYPE_DSA', 'Error', 'PKey', 'get_elliptic_curves', 'get_elliptic_curve', 'X509Name', 'X509Extension', 'X509Req', 'X509', 'X509StoreFlags', 'X509Store', 'X509StoreContextError', 'X509StoreContext', 'load_certificate', 'dump_certificate', 'dump_publickey', 'dump_privatekey', 'Revoked', 'CRL', 'PKCS7', 'PKCS12', 'NetscapeSPKI', 'load_publickey', 'load_privatekey', 'dump_certificate_request', 'load_certificate_request', 'sign', 'verify', 'dump_crl', 'load_crl', 'load_pkcs7_data', 'load_pkcs12' ] FILETYPE_PEM = _lib.SSL_FILETYPE_PEM FILETYPE_ASN1 = _lib.SSL_FILETYPE_ASN1 # TODO This was an API mistake. OpenSSL has no such constant. FILETYPE_TEXT = 2 ** 16 - 1 TYPE_RSA = _lib.EVP_PKEY_RSA TYPE_DSA = _lib.EVP_PKEY_DSA TYPE_DH = _lib.EVP_PKEY_DH TYPE_EC = _lib.EVP_PKEY_EC class Error(Exception): """ An error occurred in an `OpenSSL.crypto` API. """ _raise_current_error = partial(_exception_from_error_queue, Error) _openssl_assert = _make_assert(Error) def _get_backend(): """ Importing the backend from cryptography has the side effect of activating the osrandom engine. This mutates the global state of OpenSSL in the process and causes issues for various programs that use subinterpreters or embed Python. By putting the import in this function we can avoid triggering this side effect unless _get_backend is called. """ from cryptography.hazmat.backends.openssl.backend import backend return backend def _untested_error(where): """ An OpenSSL API failed somehow. Additionally, the failure which was encountered isn't one that's exercised by the test suite so future behavior of pyOpenSSL is now somewhat less predictable. """ raise RuntimeError("Unknown %s failure" % (where,)) 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_mem()) free = _lib.BIO_free else: data = _ffi.new("char[]", buffer) bio = _lib.BIO_new_mem_buf(data, len(buffer)) # Keep the memory alive as long as the bio is alive! def free(bio, ref=data): return _lib.BIO_free(bio) _openssl_assert(bio != _ffi.NULL) bio = _ffi.gc(bio, free) return bio 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 _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} is not a L{bytes} string. @raise ValueError: If C{when} does not represent a time in the required format. @raise RuntimeError: If the time value cannot be set for some other (unspecified) reason. """ if not isinstance(when, bytes): raise TypeError("when must be a byte string") set_result = _lib.ASN1_TIME_set_string(boundary, when) if set_result == 0: raise ValueError("Invalid string") 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 format. Or C{None} if the object contains no time value. """ string_timestamp = _ffi.cast('ASN1_STRING*', timestamp) if _lib.ASN1_STRING_length(string_timestamp) == 0: return None elif ( _lib.ASN1_STRING_type(string_timestamp) == _lib.V_ASN1_GENERALIZEDTIME ): return _ffi.string(_lib.ASN1_STRING_data(string_timestamp)) else: generalized_timestamp = _ffi.new("ASN1_GENERALIZEDTIME**") _lib.ASN1_TIME_to_generalizedtime(timestamp, generalized_timestamp) if generalized_timestamp[0] == _ffi.NULL: # This may happen: # - if timestamp was not an ASN1_TIME # - if allocating memory for the ASN1_GENERALIZEDTIME failed # - if a copy of the time data from timestamp cannot be made for # the newly allocated ASN1_GENERALIZEDTIME # # These are difficult to test. cffi enforces the ASN1_TIME type. # Memory allocation failures are a pain to trigger # deterministically. _untested_error("ASN1_TIME_to_generalizedtime") else: string_timestamp = _ffi.cast( "ASN1_STRING*", generalized_timestamp[0]) string_data = _lib.ASN1_STRING_data(string_timestamp) string_result = _ffi.string(string_data) _lib.ASN1_GENERALIZEDTIME_free(generalized_timestamp[0]) return string_result class _X509NameInvalidator(object): def __init__(self): self._names = [] def add(self, name): self._names.append(name) def clear(self): for name in self._names: # Breaks the object, but also prevents UAF! del name._name class PKey(object): """ A class representing an DSA or RSA public key or key pair. """ _only_public = False _initialized = True def __init__(self): pkey = _lib.EVP_PKEY_new() self._pkey = _ffi.gc(pkey, _lib.EVP_PKEY_free) self._initialized = False 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 """ backend = _get_backend() if self._only_public: return backend._evp_pkey_to_public_key(self._pkey) else: return backend._evp_pkey_to_private_key(self._pkey) @classmethod 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 = cls() if not isinstance(crypto_key, (rsa.RSAPublicKey, rsa.RSAPrivateKey, dsa.DSAPublicKey, dsa.DSAPrivateKey)): raise TypeError("Unsupported key type") pkey._pkey = crypto_key._evp_pkey if isinstance(crypto_key, (rsa.RSAPublicKey, dsa.DSAPublicKey)): pkey._only_public = True pkey._initialized = True return pkey 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. :type bits: :py:data:`int` ``>= 0`` :raises TypeError: If :py:data:`type` or :py:data:`bits` isn't of the appropriate type. :raises ValueError: If the number of bits isn't an integer of the appropriate size. :return: ``None`` """ if not isinstance(type, int): raise TypeError("type must be an integer") if not isinstance(bits, int): raise TypeError("bits must be an integer") if type == TYPE_RSA: if bits <= 0: raise ValueError("Invalid number of bits") # TODO Check error return exponent = _lib.BN_new() exponent = _ffi.gc(exponent, _lib.BN_free) _lib.BN_set_word(exponent, _lib.RSA_F4) rsa = _lib.RSA_new() result = _lib.RSA_generate_key_ex(rsa, bits, exponent, _ffi.NULL) _openssl_assert(result == 1) result = _lib.EVP_PKEY_assign_RSA(self._pkey, rsa) _openssl_assert(result == 1) elif type == TYPE_DSA: dsa = _lib.DSA_new() _openssl_assert(dsa != _ffi.NULL) dsa = _ffi.gc(dsa, _lib.DSA_free) res = _lib.DSA_generate_parameters_ex( dsa, bits, _ffi.NULL, 0, _ffi.NULL, _ffi.NULL, _ffi.NULL ) _openssl_assert(res == 1) _openssl_assert(_lib.DSA_generate_key(dsa) == 1) _openssl_assert(_lib.EVP_PKEY_set1_DSA(self._pkey, dsa) == 1) else: raise Error("No such key type") self._initialized = True 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 which cannot be checked. Only RSA keys can currently be checked. """ if self._only_public: raise TypeError("public key only") if _lib.EVP_PKEY_type(self.type()) != _lib.EVP_PKEY_RSA: raise TypeError("key type unsupported") rsa = _lib.EVP_PKEY_get1_RSA(self._pkey) rsa = _ffi.gc(rsa, _lib.RSA_free) result = _lib.RSA_check_key(rsa) if result: return True _raise_current_error() def type(self): """ Returns the type of the key :return: The type of the key. """ return _lib.EVP_PKEY_id(self._pkey) def bits(self): """ Returns the number of bits of the key :return: The number of bits of the key. """ return _lib.EVP_PKEY_bits(self._pkey) PKeyType = deprecated( PKey, __name__, "PKeyType has been deprecated, use PKey instead", DeprecationWarning ) class _EllipticCurve(object): """ A representation of a supported elliptic curve. @cvar _curves: :py:obj:`None` until an attempt is made to load the curves. Thereafter, a :py:type:`set` containing :py:type:`_EllipticCurve` instances each of which represents one curve supported by the system. @type _curves: :py:type:`NoneType` or :py:type:`set` """ _curves = None if _PY3: # This only necessary on Python 3. Morever, it is broken on Python 2. def __ne__(self, other): """ Implement cooperation with the right-hand side argument of ``!=``. Python 3 seems to have dropped this cooperation in this very narrow circumstance. """ if isinstance(other, _EllipticCurve): return super(_EllipticCurve, self).__ne__(other) return NotImplemented @classmethod def _load_elliptic_curves(cls, lib): """ Get the curves supported by OpenSSL. :param lib: The OpenSSL library binding object. :return: A :py:type:`set` of ``cls`` instances giving the names of the elliptic curves the underlying library supports. """ num_curves = lib.EC_get_builtin_curves(_ffi.NULL, 0) builtin_curves = _ffi.new('EC_builtin_curve[]', num_curves) # The return value on this call should be num_curves again. We # could check it to make sure but if it *isn't* then.. what could # we do? Abort the whole process, I suppose...? -exarkun lib.EC_get_builtin_curves(builtin_curves, num_curves) return set( cls.from_nid(lib, c.nid) for c in builtin_curves) @classmethod def _get_elliptic_curves(cls, lib): """ Get, cache, and return the curves supported by OpenSSL. :param lib: The OpenSSL library binding object. :return: A :py:type:`set` of ``cls`` instances giving the names of the elliptic curves the underlying library supports. """ if cls._curves is None: cls._curves = cls._load_elliptic_curves(lib) return cls._curves @classmethod def from_nid(cls, lib, nid): """ Instantiate a new :py:class:`_EllipticCurve` associated with the given OpenSSL NID. :param lib: The OpenSSL library binding object. :param nid: The OpenSSL NID the resulting curve object will represent. This must be a curve NID (and not, for example, a hash NID) or subsequent operations will fail in unpredictable ways. :type nid: :py:class:`int` :return: The curve object. """ return cls(lib, nid, _ffi.string(lib.OBJ_nid2sn(nid)).decode("ascii")) def __init__(self, lib, nid, name): """ :param _lib: The :py:mod:`cryptography` binding instance used to interface with OpenSSL. :param _nid: The OpenSSL NID identifying the curve this object represents. :type _nid: :py:class:`int` :param name: The OpenSSL short name identifying the curve this object represents. :type name: :py:class:`unicode` """ self._lib = lib self._nid = nid self.name = name def __repr__(self): return "" % (self.name,) def _to_EC_KEY(self): """ Create a new OpenSSL EC_KEY structure initialized to use this curve. The structure is automatically garbage collected when the Python object is garbage collected. """ key = self._lib.EC_KEY_new_by_curve_name(self._nid) return _ffi.gc(key, _lib.EC_KEY_free) def get_elliptic_curves(): """ Return a set of objects representing the elliptic curves supported in the OpenSSL build in use. The curve objects have a :py:class:`unicode` ``name`` attribute by which they identify themselves. The curve objects are useful as values for the argument accepted by :py:meth:`Context.set_tmp_ecdh` to specify which elliptical curve should be used for ECDHE key exchange. """ return _EllipticCurve._get_elliptic_curves(_lib) 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 not supported then :py:class:`ValueError` is raised. """ for curve in get_elliptic_curves(): if curve.name == name: return curve raise ValueError("unknown curve name", name) class X509Name(object): """ An X.509 Distinguished Name. :ivar countryName: The country of the entity. :ivar C: Alias for :py:attr:`countryName`. :ivar stateOrProvinceName: The state or province of the entity. :ivar ST: Alias for :py:attr:`stateOrProvinceName`. :ivar localityName: The locality of the entity. :ivar L: Alias for :py:attr:`localityName`. :ivar organizationName: The organization name of the entity. :ivar O: Alias for :py:attr:`organizationName`. :ivar organizationalUnitName: The organizational unit of the entity. :ivar OU: Alias for :py:attr:`organizationalUnitName` :ivar commonName: The common name of the entity. :ivar CN: Alias for :py:attr:`commonName`. :ivar emailAddress: The e-mail address of the entity. """ def __init__(self, name): """ Create a new X509Name, copying the given X509Name instance. :param name: The name to copy. :type name: :py:class:`X509Name` """ name = _lib.X509_NAME_dup(name._name) self._name = _ffi.gc(name, _lib.X509_NAME_free) def __setattr__(self, name, value): if name.startswith('_'): return super(X509Name, self).__setattr__(name, value) # Note: we really do not want str subclasses here, so we do not use # isinstance. if type(name) is not str: raise TypeError("attribute name must be string, not '%.200s'" % ( type(value).__name__,)) nid = _lib.OBJ_txt2nid(_byte_string(name)) if nid == _lib.NID_undef: try: _raise_current_error() except Error: pass raise AttributeError("No such attribute") # If there's an old entry for this NID, remove it for i in range(_lib.X509_NAME_entry_count(self._name)): ent = _lib.X509_NAME_get_entry(self._name, i) ent_obj = _lib.X509_NAME_ENTRY_get_object(ent) ent_nid = _lib.OBJ_obj2nid(ent_obj) if nid == ent_nid: ent = _lib.X509_NAME_delete_entry(self._name, i) _lib.X509_NAME_ENTRY_free(ent) break if isinstance(value, _text_type): value = value.encode('utf-8') add_result = _lib.X509_NAME_add_entry_by_NID( self._name, nid, _lib.MBSTRING_UTF8, value, -1, -1, 0) if not add_result: _raise_current_error() def __getattr__(self, name): """ Find attribute. An X509Name object has the following attributes: countryName (alias C), stateOrProvince (alias ST), locality (alias L), organization (alias O), organizationalUnit (alias OU), commonName (alias CN) and more... """ nid = _lib.OBJ_txt2nid(_byte_string(name)) if nid == _lib.NID_undef: # This is a bit weird. OBJ_txt2nid indicated failure, but it seems # a lower level function, a2d_ASN1_OBJECT, also feels the need to # push something onto the error queue. If we don't clean that up # now, someone else will bump into it later and be quite confused. # See lp#314814. try: _raise_current_error() except Error: pass return super(X509Name, self).__getattr__(name) entry_index = _lib.X509_NAME_get_index_by_NID(self._name, nid, -1) if entry_index == -1: return None entry = _lib.X509_NAME_get_entry(self._name, entry_index) data = _lib.X509_NAME_ENTRY_get_data(entry) result_buffer = _ffi.new("unsigned char**") data_length = _lib.ASN1_STRING_to_UTF8(result_buffer, data) _openssl_assert(data_length >= 0) try: result = _ffi.buffer( result_buffer[0], data_length )[:].decode('utf-8') finally: # XXX untested _lib.OPENSSL_free(result_buffer[0]) return result def _cmp(op): def f(self, other): if not isinstance(other, X509Name): return NotImplemented result = _lib.X509_NAME_cmp(self._name, other._name) return op(result, 0) return f __eq__ = _cmp(__eq__) __ne__ = _cmp(__ne__) __lt__ = _cmp(__lt__) __le__ = _cmp(__le__) __gt__ = _cmp(__gt__) __ge__ = _cmp(__ge__) def __repr__(self): """ String representation of an X509Name """ result_buffer = _ffi.new("char[]", 512) format_result = _lib.X509_NAME_oneline( self._name, result_buffer, len(result_buffer)) _openssl_assert(format_result != _ffi.NULL) return "" % ( _native(_ffi.string(result_buffer)),) def hash(self): """ Return an integer representation of the first four bytes of the MD5 digest of the DER representation of the name. This is the Python equivalent of OpenSSL's ``X509_NAME_hash``. :return: The (integer) hash of this name. :rtype: :py:class:`int` """ return _lib.X509_NAME_hash(self._name) def der(self): """ Return the DER encoding of this name. :return: The DER encoded form of this name. :rtype: :py:class:`bytes` """ result_buffer = _ffi.new('unsigned char**') encode_result = _lib.i2d_X509_NAME(self._name, result_buffer) _openssl_assert(encode_result >= 0) string_result = _ffi.buffer(result_buffer[0], encode_result)[:] _lib.OPENSSL_free(result_buffer[0]) return string_result def get_components(self): """ Returns the components of this name, as a sequence of 2-tuples. :return: The components of this name. :rtype: :py:class:`list` of ``name, value`` tuples. """ result = [] for i in range(_lib.X509_NAME_entry_count(self._name)): ent = _lib.X509_NAME_get_entry(self._name, i) fname = _lib.X509_NAME_ENTRY_get_object(ent) fval = _lib.X509_NAME_ENTRY_get_data(ent) nid = _lib.OBJ_obj2nid(fname) name = _lib.OBJ_nid2sn(nid) # ffi.string does not handle strings containing NULL bytes # (which may have been generated by old, broken software) value = _ffi.buffer(_lib.ASN1_STRING_data(fval), _lib.ASN1_STRING_length(fval))[:] result.append((_ffi.string(name), value)) return result X509NameType = deprecated( X509Name, __name__, "X509NameType has been deprecated, use X509Name instead", DeprecationWarning ) class X509Extension(object): """ An X.509 v3 certificate extension. """ def __init__(self, type_name, critical, value, subject=None, issuer=None): """ Initializes an X509 extension. :param type_name: The name of the type of extension_ to create. :type type_name: :py:data:`bytes` :param bool critical: A flag indicating whether this is a critical extension. :param value: The value of the extension. :type value: :py:data:`bytes` :param subject: Optional X509 certificate to use as subject. :type subject: :py:class:`X509` :param issuer: Optional X509 certificate to use as issuer. :type issuer: :py:class:`X509` .. _extension: https://www.openssl.org/docs/manmaster/man5/ x509v3_config.html#STANDARD-EXTENSIONS """ ctx = _ffi.new("X509V3_CTX*") # A context is necessary for any extension which uses the r2i # conversion method. That is, X509V3_EXT_nconf may segfault if passed # a NULL ctx. Start off by initializing most of the fields to NULL. _lib.X509V3_set_ctx(ctx, _ffi.NULL, _ffi.NULL, _ffi.NULL, _ffi.NULL, 0) # We have no configuration database - but perhaps we should (some # extensions may require it). _lib.X509V3_set_ctx_nodb(ctx) # Initialize the subject and issuer, if appropriate. ctx is a local, # and as far as I can tell none of the X509V3_* APIs invoked here steal # any references, so no need to mess with reference counts or # duplicates. if issuer is not None: if not isinstance(issuer, X509): raise TypeError("issuer must be an X509 instance") ctx.issuer_cert = issuer._x509 if subject is not None: if not isinstance(subject, X509): raise TypeError("subject must be an X509 instance") ctx.subject_cert = subject._x509 if critical: # There are other OpenSSL APIs which would let us pass in critical # separately, but they're harder to use, and since value is already # a pile of crappy junk smuggling a ton of utterly important # structured data, what's the point of trying to avoid nasty stuff # with strings? (However, X509V3_EXT_i2d in particular seems like # it would be a better API to invoke. I do not know where to get # the ext_struc it desires for its last parameter, though.) value = b"critical," + value extension = _lib.X509V3_EXT_nconf(_ffi.NULL, ctx, type_name, value) if extension == _ffi.NULL: _raise_current_error() self._extension = _ffi.gc(extension, _lib.X509_EXTENSION_free) @property def _nid(self): return _lib.OBJ_obj2nid( _lib.X509_EXTENSION_get_object(self._extension) ) _prefixes = { _lib.GEN_EMAIL: "email", _lib.GEN_DNS: "DNS", _lib.GEN_URI: "URI", } def _subjectAltNameString(self): names = _ffi.cast( "GENERAL_NAMES*", _lib.X509V3_EXT_d2i(self._extension) ) names = _ffi.gc(names, _lib.GENERAL_NAMES_free) parts = [] for i in range(_lib.sk_GENERAL_NAME_num(names)): name = _lib.sk_GENERAL_NAME_value(names, i) try: label = self._prefixes[name.type] except KeyError: bio = _new_mem_buf() _lib.GENERAL_NAME_print(bio, name) parts.append(_native(_bio_to_string(bio))) else: value = _native( _ffi.buffer(name.d.ia5.data, name.d.ia5.length)[:]) parts.append(label + ":" + value) return ", ".join(parts) def __str__(self): """ :return: a nice text representation of the extension """ if _lib.NID_subject_alt_name == self._nid: return self._subjectAltNameString() bio = _new_mem_buf() print_result = _lib.X509V3_EXT_print(bio, self._extension, 0, 0) _openssl_assert(print_result != 0) return _native(_bio_to_string(bio)) def get_critical(self): """ Returns the critical field of this X.509 extension. :return: The critical field. """ return _lib.X509_EXTENSION_get_critical(self._extension) def get_short_name(self): """ Returns the short type name of this X.509 extension. The result is a byte string such as :py:const:`b"basicConstraints"`. :return: The short type name. :rtype: :py:data:`bytes` .. versionadded:: 0.12 """ obj = _lib.X509_EXTENSION_get_object(self._extension) nid = _lib.OBJ_obj2nid(obj) return _ffi.string(_lib.OBJ_nid2sn(nid)) def get_data(self): """ Returns the data of the X509 extension, encoded as ASN.1. :return: The ASN.1 encoded data of this X509 extension. :rtype: :py:data:`bytes` .. versionadded:: 0.12 """ octet_result = _lib.X509_EXTENSION_get_data(self._extension) string_result = _ffi.cast('ASN1_STRING*', octet_result) char_result = _lib.ASN1_STRING_data(string_result) result_length = _lib.ASN1_STRING_length(string_result) return _ffi.buffer(char_result, result_length)[:] X509ExtensionType = deprecated( X509Extension, __name__, "X509ExtensionType has been deprecated, use X509Extension instead", DeprecationWarning ) class X509Req(object): """ An X.509 certificate signing requests. """ def __init__(self): req = _lib.X509_REQ_new() self._req = _ffi.gc(req, _lib.X509_REQ_free) # Default to version 0. self.set_version(0) def to_cryptography(self): """ Export as a ``cryptography`` certificate signing request. :rtype: ``cryptography.x509.CertificateSigningRequest`` .. versionadded:: 17.1.0 """ from cryptography.hazmat.backends.openssl.x509 import ( _CertificateSigningRequest ) backend = _get_backend() return _CertificateSigningRequest(backend, self._req) @classmethod def from_cryptography(cls, crypto_req): """ Construct based on a ``cryptography`` *crypto_req*. :param crypto_req: A ``cryptography`` X.509 certificate signing request :type crypto_req: ``cryptography.x509.CertificateSigningRequest`` :rtype: X509Req .. versionadded:: 17.1.0 """ if not isinstance(crypto_req, x509.CertificateSigningRequest): raise TypeError("Must be a certificate signing request") req = cls() req._req = crypto_req._x509_req return req def set_pubkey(self, pkey): """ Set the public key of the certificate signing request. :param pkey: The public key to use. :type pkey: :py:class:`PKey` :return: ``None`` """ set_result = _lib.X509_REQ_set_pubkey(self._req, pkey._pkey) _openssl_assert(set_result == 1) def get_pubkey(self): """ Get the public key of the certificate signing request. :return: The public key. :rtype: :py:class:`PKey` """ pkey = PKey.__new__(PKey) pkey._pkey = _lib.X509_REQ_get_pubkey(self._req) _openssl_assert(pkey._pkey != _ffi.NULL) pkey._pkey = _ffi.gc(pkey._pkey, _lib.EVP_PKEY_free) pkey._only_public = True return pkey def set_version(self, version): """ Set the version subfield (RFC 2459, section 4.1.2.1) of the certificate request. :param int version: The version number. :return: ``None`` """ set_result = _lib.X509_REQ_set_version(self._req, version) _openssl_assert(set_result == 1) def get_version(self): """ Get the version subfield (RFC 2459, section 4.1.2.1) of the certificate request. :return: The value of the version subfield. :rtype: :py:class:`int` """ return _lib.X509_REQ_get_version(self._req) def get_subject(self): """ Return the subject of this certificate signing request. This creates a new :class:`X509Name` that wraps the underlying subject name field on the certificate signing request. Modifying it will modify the underlying signing request, and will have the effect of modifying any other :class:`X509Name` that refers to this subject. :return: The subject of this certificate signing request. :rtype: :class:`X509Name` """ name = X509Name.__new__(X509Name) name._name = _lib.X509_REQ_get_subject_name(self._req) _openssl_assert(name._name != _ffi.NULL) # The name is owned by the X509Req structure. As long as the X509Name # Python object is alive, keep the X509Req Python object alive. name._owner = self return name def add_extensions(self, extensions): """ Add extensions to the certificate signing request. :param extensions: The X.509 extensions to add. :type extensions: iterable of :py:class:`X509Extension` :return: ``None`` """ stack = _lib.sk_X509_EXTENSION_new_null() _openssl_assert(stack != _ffi.NULL) stack = _ffi.gc(stack, _lib.sk_X509_EXTENSION_free) for ext in extensions: if not isinstance(ext, X509Extension): raise ValueError("One of the elements is not an X509Extension") # TODO push can fail (here and elsewhere) _lib.sk_X509_EXTENSION_push(stack, ext._extension) add_result = _lib.X509_REQ_add_extensions(self._req, stack) _openssl_assert(add_result == 1) def get_extensions(self): """ Get X.509 extensions in the certificate signing request. :return: The X.509 extensions in this request. :rtype: :py:class:`list` of :py:class:`X509Extension` objects. .. versionadded:: 0.15 """ exts = [] native_exts_obj = _lib.X509_REQ_get_extensions(self._req) for i in range(_lib.sk_X509_EXTENSION_num(native_exts_obj)): ext = X509Extension.__new__(X509Extension) ext._extension = _lib.sk_X509_EXTENSION_value(native_exts_obj, i) exts.append(ext) return exts def sign(self, pkey, digest): """ Sign the certificate signing request with this key and digest type. :param pkey: The key pair to sign with. :type pkey: :py:class:`PKey` :param digest: The name of the message digest to use for the signature, e.g. :py:data:`b"sha256"`. :type digest: :py:class:`bytes` :return: ``None`` """ if pkey._only_public: raise ValueError("Key has only public part") if not pkey._initialized: raise ValueError("Key is uninitialized") digest_obj = _lib.EVP_get_digestbyname(_byte_string(digest)) if digest_obj == _ffi.NULL: raise ValueError("No such digest method") sign_result = _lib.X509_REQ_sign(self._req, pkey._pkey, digest_obj) _openssl_assert(sign_result > 0) def verify(self, pkey): """ Verifies the signature on this certificate signing request. :param PKey key: A public key. :return: ``True`` if the signature is correct. :rtype: bool :raises OpenSSL.crypto.Error: If the signature is invalid or there is a problem verifying the signature. """ if not isinstance(pkey, PKey): raise TypeError("pkey must be a PKey instance") result = _lib.X509_REQ_verify(self._req, pkey._pkey) if result <= 0: _raise_current_error() return result X509ReqType = deprecated( X509Req, __name__, "X509ReqType has been deprecated, use X509Req instead", DeprecationWarning ) class X509(object): """ An X.509 certificate. """ def __init__(self): x509 = _lib.X509_new() _openssl_assert(x509 != _ffi.NULL) self._x509 = _ffi.gc(x509, _lib.X509_free) self._issuer_invalidator = _X509NameInvalidator() self._subject_invalidator = _X509NameInvalidator() @classmethod def _from_raw_x509_ptr(cls, x509): cert = cls.__new__(cls) cert._x509 = _ffi.gc(x509, _lib.X509_free) cert._issuer_invalidator = _X509NameInvalidator() cert._subject_invalidator = _X509NameInvalidator() return cert def to_cryptography(self): """ Export as a ``cryptography`` certificate. :rtype: ``cryptography.x509.Certificate`` .. versionadded:: 17.1.0 """ from cryptography.hazmat.backends.openssl.x509 import _Certificate backend = _get_backend() return _Certificate(backend, self._x509) @classmethod def from_cryptography(cls, crypto_cert): """ Construct based on a ``cryptography`` *crypto_cert*. :param crypto_key: A ``cryptography`` X.509 certificate. :type crypto_key: ``cryptography.x509.Certificate`` :rtype: X509 .. versionadded:: 17.1.0 """ if not isinstance(crypto_cert, x509.Certificate): raise TypeError("Must be a certificate") cert = cls() cert._x509 = crypto_cert._x509 return cert def set_version(self, version): """ Set the version number of the certificate. Note that the version value is zero-based, eg. a value of 0 is V1. :param version: The version number of the certificate. :type version: :py:class:`int` :return: ``None`` """ if not isinstance(version, int): raise TypeError("version must be an integer") _lib.X509_set_version(self._x509, version) def get_version(self): """ Return the version number of the certificate. :return: The version number of the certificate. :rtype: :py:class:`int` """ return _lib.X509_get_version(self._x509) def get_pubkey(self): """ Get the public key of the certificate. :return: The public key. :rtype: :py:class:`PKey` """ pkey = PKey.__new__(PKey) pkey._pkey = _lib.X509_get_pubkey(self._x509) if pkey._pkey == _ffi.NULL: _raise_current_error() pkey._pkey = _ffi.gc(pkey._pkey, _lib.EVP_PKEY_free) pkey._only_public = True return pkey def set_pubkey(self, pkey): """ Set the public key of the certificate. :param pkey: The public key. :type pkey: :py:class:`PKey` :return: :py:data:`None` """ if not isinstance(pkey, PKey): raise TypeError("pkey must be a PKey instance") set_result = _lib.X509_set_pubkey(self._x509, pkey._pkey) _openssl_assert(set_result == 1) def sign(self, pkey, digest): """ Sign the certificate with this key and digest type. :param pkey: The key to sign with. :type pkey: :py:class:`PKey` :param digest: The name of the message digest to use. :type digest: :py:class:`bytes` :return: :py:data:`None` """ if not isinstance(pkey, PKey): raise TypeError("pkey must be a PKey instance") if pkey._only_public: raise ValueError("Key only has public part") if not pkey._initialized: raise ValueError("Key is uninitialized") evp_md = _lib.EVP_get_digestbyname(_byte_string(digest)) if evp_md == _ffi.NULL: raise ValueError("No such digest method") sign_result = _lib.X509_sign(self._x509, pkey._pkey, evp_md) _openssl_assert(sign_result > 0) def get_signature_algorithm(self): """ Return the signature algorithm used in the certificate. :return: The name of the algorithm. :rtype: :py:class:`bytes` :raises ValueError: If the signature algorithm is undefined. .. versionadded:: 0.13 """ algor = _lib.X509_get0_tbs_sigalg(self._x509) nid = _lib.OBJ_obj2nid(algor.algorithm) if nid == _lib.NID_undef: raise ValueError("Undefined signature algorithm") return _ffi.string(_lib.OBJ_nid2ln(nid)) def digest(self, digest_name): """ Return the digest of the X509 object. :param digest_name: The name of the digest algorithm to use. :type digest_name: :py:class:`bytes` :return: The digest of the object, formatted as :py:const:`b":"`-delimited hex pairs. :rtype: :py:class:`bytes` """ digest = _lib.EVP_get_digestbyname(_byte_string(digest_name)) if digest == _ffi.NULL: raise ValueError("No such digest method") result_buffer = _ffi.new("unsigned char[]", _lib.EVP_MAX_MD_SIZE) result_length = _ffi.new("unsigned int[]", 1) result_length[0] = len(result_buffer) digest_result = _lib.X509_digest( self._x509, digest, result_buffer, result_length) _openssl_assert(digest_result == 1) return b":".join([ b16encode(ch).upper() for ch in _ffi.buffer(result_buffer, result_length[0])]) def subject_name_hash(self): """ Return the hash of the X509 subject. :return: The hash of the subject. :rtype: :py:class:`bytes` """ return _lib.X509_subject_name_hash(self._x509) def set_serial_number(self, serial): """ Set the serial number of the certificate. :param serial: The new serial number. :type serial: :py:class:`int` :return: :py:data`None` """ if not isinstance(serial, _integer_types): raise TypeError("serial must be an integer") hex_serial = hex(serial)[2:] if not isinstance(hex_serial, bytes): hex_serial = hex_serial.encode('ascii') bignum_serial = _ffi.new("BIGNUM**") # BN_hex2bn stores the result in &bignum. Unless it doesn't feel like # it. If bignum is still NULL after this call, then the return value # is actually the result. I hope. -exarkun small_serial = _lib.BN_hex2bn(bignum_serial, hex_serial) if bignum_serial[0] == _ffi.NULL: set_result = _lib.ASN1_INTEGER_set( _lib.X509_get_serialNumber(self._x509), small_serial) if set_result: # TODO Not tested _raise_current_error() else: asn1_serial = _lib.BN_to_ASN1_INTEGER(bignum_serial[0], _ffi.NULL) _lib.BN_free(bignum_serial[0]) if asn1_serial == _ffi.NULL: # TODO Not tested _raise_current_error() asn1_serial = _ffi.gc(asn1_serial, _lib.ASN1_INTEGER_free) set_result = _lib.X509_set_serialNumber(self._x509, asn1_serial) _openssl_assert(set_result == 1) def get_serial_number(self): """ Return the serial number of this certificate. :return: The serial number. :rtype: int """ asn1_serial = _lib.X509_get_serialNumber(self._x509) bignum_serial = _lib.ASN1_INTEGER_to_BN(asn1_serial, _ffi.NULL) try: hex_serial = _lib.BN_bn2hex(bignum_serial) try: hexstring_serial = _ffi.string(hex_serial) serial = int(hexstring_serial, 16) return serial finally: _lib.OPENSSL_free(hex_serial) finally: _lib.BN_free(bignum_serial) def gmtime_adj_notAfter(self, amount): """ Adjust the time stamp on which the certificate stops being valid. :param int amount: The number of seconds by which to adjust the timestamp. :return: ``None`` """ if not isinstance(amount, int): raise TypeError("amount must be an integer") notAfter = _lib.X509_get_notAfter(self._x509) _lib.X509_gmtime_adj(notAfter, amount) def gmtime_adj_notBefore(self, amount): """ Adjust the timestamp on which the certificate starts being valid. :param amount: The number of seconds by which to adjust the timestamp. :return: ``None`` """ if not isinstance(amount, int): raise TypeError("amount must be an integer") notBefore = _lib.X509_get_notBefore(self._x509) _lib.X509_gmtime_adj(notBefore, amount) def has_expired(self): """ Check whether the certificate has expired. :return: ``True`` if the certificate has expired, ``False`` otherwise. :rtype: bool """ time_string = _native(self.get_notAfter()) not_after = datetime.datetime.strptime(time_string, "%Y%m%d%H%M%SZ") return not_after < datetime.datetime.utcnow() def _get_boundary_time(self, which): return _get_asn1_time(which(self._x509)) def get_notBefore(self): """ Get the timestamp at which the certificate starts being valid. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ :return: A timestamp string, or ``None`` if there is none. :rtype: bytes or NoneType """ return self._get_boundary_time(_lib.X509_get_notBefore) def _set_boundary_time(self, which, when): return _set_asn1_time(which(self._x509), when) def set_notBefore(self, when): """ Set the timestamp at which the certificate starts being valid. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ :param bytes when: A timestamp string. :return: ``None`` """ return self._set_boundary_time(_lib.X509_get_notBefore, when) def get_notAfter(self): """ Get the timestamp at which the certificate stops being valid. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ :return: A timestamp string, or ``None`` if there is none. :rtype: bytes or NoneType """ return self._get_boundary_time(_lib.X509_get_notAfter) def set_notAfter(self, when): """ Set the timestamp at which the certificate stops being valid. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ :param bytes when: A timestamp string. :return: ``None`` """ return self._set_boundary_time(_lib.X509_get_notAfter, when) def _get_name(self, which): name = X509Name.__new__(X509Name) name._name = which(self._x509) _openssl_assert(name._name != _ffi.NULL) # The name is owned by the X509 structure. As long as the X509Name # Python object is alive, keep the X509 Python object alive. name._owner = self return name def _set_name(self, which, name): if not isinstance(name, X509Name): raise TypeError("name must be an X509Name") set_result = which(self._x509, name._name) _openssl_assert(set_result == 1) def get_issuer(self): """ Return the issuer of this certificate. This creates a new :class:`X509Name` that wraps the underlying issuer name field on the certificate. Modifying it will modify the underlying certificate, and will have the effect of modifying any other :class:`X509Name` that refers to this issuer. :return: The issuer of this certificate. :rtype: :class:`X509Name` """ name = self._get_name(_lib.X509_get_issuer_name) self._issuer_invalidator.add(name) return name def set_issuer(self, issuer): """ Set the issuer of this certificate. :param issuer: The issuer. :type issuer: :py:class:`X509Name` :return: ``None`` """ self._set_name(_lib.X509_set_issuer_name, issuer) self._issuer_invalidator.clear() def get_subject(self): """ Return the subject of this certificate. This creates a new :class:`X509Name` that wraps the underlying subject name field on the certificate. Modifying it will modify the underlying certificate, and will have the effect of modifying any other :class:`X509Name` that refers to this subject. :return: The subject of this certificate. :rtype: :class:`X509Name` """ name = self._get_name(_lib.X509_get_subject_name) self._subject_invalidator.add(name) return name def set_subject(self, subject): """ Set the subject of this certificate. :param subject: The subject. :type subject: :py:class:`X509Name` :return: ``None`` """ self._set_name(_lib.X509_set_subject_name, subject) self._subject_invalidator.clear() def get_extension_count(self): """ Get the number of extensions on this certificate. :return: The number of extensions. :rtype: :py:class:`int` .. versionadded:: 0.12 """ return _lib.X509_get_ext_count(self._x509) def add_extensions(self, extensions): """ Add extensions to the certificate. :param extensions: The extensions to add. :type extensions: An iterable of :py:class:`X509Extension` objects. :return: ``None`` """ for ext in extensions: if not isinstance(ext, X509Extension): raise ValueError("One of the elements is not an X509Extension") add_result = _lib.X509_add_ext(self._x509, ext._extension, -1) if not add_result: _raise_current_error() def get_extension(self, index): """ Get a specific extension of the certificate by index. Extensions on a certificate are kept in order. The index parameter selects which extension will be returned. :param int index: The index of the extension to retrieve. :return: The extension at the specified index. :rtype: :py:class:`X509Extension` :raises IndexError: If the extension index was out of bounds. .. versionadded:: 0.12 """ ext = X509Extension.__new__(X509Extension) ext._extension = _lib.X509_get_ext(self._x509, index) if ext._extension == _ffi.NULL: raise IndexError("extension index out of bounds") extension = _lib.X509_EXTENSION_dup(ext._extension) ext._extension = _ffi.gc(extension, _lib.X509_EXTENSION_free) return ext X509Type = deprecated( X509, __name__, "X509Type has been deprecated, use X509 instead", DeprecationWarning ) class X509StoreFlags(object): """ Flags for X509 verification, used to change the behavior of :class:`X509Store`. See `OpenSSL Verification Flags`_ for details. .. _OpenSSL Verification Flags: https://www.openssl.org/docs/manmaster/man3/X509_VERIFY_PARAM_set_flags.html """ CRL_CHECK = _lib.X509_V_FLAG_CRL_CHECK CRL_CHECK_ALL = _lib.X509_V_FLAG_CRL_CHECK_ALL IGNORE_CRITICAL = _lib.X509_V_FLAG_IGNORE_CRITICAL X509_STRICT = _lib.X509_V_FLAG_X509_STRICT ALLOW_PROXY_CERTS = _lib.X509_V_FLAG_ALLOW_PROXY_CERTS POLICY_CHECK = _lib.X509_V_FLAG_POLICY_CHECK EXPLICIT_POLICY = _lib.X509_V_FLAG_EXPLICIT_POLICY INHIBIT_MAP = _lib.X509_V_FLAG_INHIBIT_MAP NOTIFY_POLICY = _lib.X509_V_FLAG_NOTIFY_POLICY CHECK_SS_SIGNATURE = _lib.X509_V_FLAG_CHECK_SS_SIGNATURE CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK class X509Store(object): """ An X.509 store. An X.509 store is used to describe a context in which to verify a certificate. A description of a context may include a set of certificates to trust, a set of certificate revocation lists, verification flags and more. An X.509 store, being only a description, cannot be used by itself to verify a certificate. To carry out the actual verification process, see :class:`X509StoreContext`. """ def __init__(self): store = _lib.X509_STORE_new() self._store = _ffi.gc(store, _lib.X509_STORE_free) def add_cert(self, cert): """ Adds a trusted certificate to this store. Adding a certificate with this method adds this certificate as a *trusted* certificate. :param X509 cert: The certificate to add to this store. :raises TypeError: If the certificate is not an :class:`X509`. :raises OpenSSL.crypto.Error: If OpenSSL was unhappy with your certificate. :return: ``None`` if the certificate was added successfully. """ if not isinstance(cert, X509): raise TypeError() # As of OpenSSL 1.1.0i adding the same cert to the store more than # once doesn't cause an error. Accordingly, this code now silences # the error for OpenSSL < 1.1.0i as well. if _lib.X509_STORE_add_cert(self._store, cert._x509) == 0: code = _lib.ERR_peek_error() err_reason = _lib.ERR_GET_REASON(code) _openssl_assert( err_reason == _lib.X509_R_CERT_ALREADY_IN_HASH_TABLE ) _lib.ERR_clear_error() def add_crl(self, crl): """ Add a certificate revocation list to this store. The certificate revocation lists added to a store will only be used if the associated flags are configured to check certificate revocation lists. .. versionadded:: 16.1.0 :param CRL crl: The certificate revocation list to add to this store. :return: ``None`` if the certificate revocation list was added successfully. """ _openssl_assert(_lib.X509_STORE_add_crl(self._store, crl._crl) != 0) def set_flags(self, flags): """ Set verification flags to this store. Verification flags can be combined by oring them together. .. note:: Setting a verification flag sometimes requires clients to add additional information to the store, otherwise a suitable error will be raised. For example, in setting flags to enable CRL checking a suitable CRL must be added to the store otherwise an error will be raised. .. versionadded:: 16.1.0 :param int flags: The verification flags to set on this store. See :class:`X509StoreFlags` for available constants. :return: ``None`` if the verification flags were successfully set. """ _openssl_assert(_lib.X509_STORE_set_flags(self._store, flags) != 0) def set_time(self, vfy_time): """ Set the time against which the certificates are verified. Normally the current time is used. .. note:: For example, you can determine if a certificate was valid at a given time. .. versionadded:: 17.0.0 :param datetime vfy_time: The verification time to set on this store. :return: ``None`` if the verification time was successfully set. """ param = _lib.X509_VERIFY_PARAM_new() param = _ffi.gc(param, _lib.X509_VERIFY_PARAM_free) _lib.X509_VERIFY_PARAM_set_time(param, int(vfy_time.strftime('%s'))) _openssl_assert(_lib.X509_STORE_set1_param(self._store, param) != 0) X509StoreType = deprecated( X509Store, __name__, "X509StoreType has been deprecated, use X509Store instead", DeprecationWarning ) class X509StoreContextError(Exception): """ An exception raised when an error occurred while verifying a certificate using `OpenSSL.X509StoreContext.verify_certificate`. :ivar certificate: The certificate which caused verificate failure. :type certificate: :class:`X509` """ def __init__(self, message, certificate): super(X509StoreContextError, self).__init__(message) self.certificate = certificate class X509StoreContext(object): """ An X.509 store context. An X.509 store context is used to carry out the actual verification process of a certificate in a described context. For describing such a context, see :class:`X509Store`. :ivar _store_ctx: The underlying X509_STORE_CTX structure used by this instance. It is dynamically allocated and automatically garbage collected. :ivar _store: See the ``store`` ``__init__`` parameter. :ivar _cert: See the ``certificate`` ``__init__`` parameter. :param X509Store store: The certificates which will be trusted for the purposes of any verifications. :param X509 certificate: The certificate to be verified. """ def __init__(self, store, certificate): store_ctx = _lib.X509_STORE_CTX_new() self._store_ctx = _ffi.gc(store_ctx, _lib.X509_STORE_CTX_free) self._store = store self._cert = certificate # Make the store context available for use after instantiating this # class by initializing it now. Per testing, subsequent calls to # :meth:`_init` have no adverse affect. self._init() def _init(self): """ Set up the store context for a subsequent verification operation. Calling this method more than once without first calling :meth:`_cleanup` will leak memory. """ ret = _lib.X509_STORE_CTX_init( self._store_ctx, self._store._store, self._cert._x509, _ffi.NULL ) if ret <= 0: _raise_current_error() def _cleanup(self): """ Internally cleans up the store context. The store context can then be reused with a new call to :meth:`_init`. """ _lib.X509_STORE_CTX_cleanup(self._store_ctx) def _exception_from_context(self): """ Convert an OpenSSL native context error failure into a Python exception. When a call to native OpenSSL X509_verify_cert fails, additional information about the failure can be obtained from the store context. """ errors = [ _lib.X509_STORE_CTX_get_error(self._store_ctx), _lib.X509_STORE_CTX_get_error_depth(self._store_ctx), _native(_ffi.string(_lib.X509_verify_cert_error_string( _lib.X509_STORE_CTX_get_error(self._store_ctx)))), ] # A context error should always be associated with a certificate, so we # expect this call to never return :class:`None`. _x509 = _lib.X509_STORE_CTX_get_current_cert(self._store_ctx) _cert = _lib.X509_dup(_x509) pycert = X509._from_raw_x509_ptr(_cert) return X509StoreContextError(errors, pycert) def set_store(self, store): """ Set the context's X.509 store. .. versionadded:: 0.15 :param X509Store store: The store description which will be used for the purposes of any *future* verifications. """ self._store = store def verify_certificate(self): """ Verify a certificate in a context. .. versionadded:: 0.15 :raises X509StoreContextError: If an error occurred when validating a certificate in the context. Sets ``certificate`` attribute to indicate which certificate caused the error. """ # Always re-initialize the store context in case # :meth:`verify_certificate` is called multiple times. # # :meth:`_init` is called in :meth:`__init__` so _cleanup is called # before _init to ensure memory is not leaked. self._cleanup() self._init() ret = _lib.X509_verify_cert(self._store_ctx) self._cleanup() if ret <= 0: raise self._exception_from_context() 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 isinstance(buffer, _text_type): buffer = buffer.encode("ascii") bio = _new_mem_buf(buffer) if type == FILETYPE_PEM: x509 = _lib.PEM_read_bio_X509(bio, _ffi.NULL, _ffi.NULL, _ffi.NULL) elif type == FILETYPE_ASN1: x509 = _lib.d2i_X509_bio(bio, _ffi.NULL) else: raise ValueError( "type argument must be FILETYPE_PEM or FILETYPE_ASN1") if x509 == _ffi.NULL: _raise_current_error() return X509._from_raw_x509_ptr(x509) 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 """ bio = _new_mem_buf() if type == FILETYPE_PEM: result_code = _lib.PEM_write_bio_X509(bio, cert._x509) elif type == FILETYPE_ASN1: result_code = _lib.i2d_X509_bio(bio, cert._x509) elif type == FILETYPE_TEXT: result_code = _lib.X509_print_ex(bio, cert._x509, 0, 0) else: raise ValueError( "type argument must be FILETYPE_PEM, FILETYPE_ASN1, or " "FILETYPE_TEXT") assert result_code == 1 return _bio_to_string(bio) 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() if type == FILETYPE_PEM: write_bio = _lib.PEM_write_bio_PUBKEY elif type == FILETYPE_ASN1: write_bio = _lib.i2d_PUBKEY_bio else: raise ValueError("type argument must be FILETYPE_PEM or FILETYPE_ASN1") result_code = write_bio(bio, pkey._pkey) if result_code != 1: # pragma: no cover _raise_current_error() return _bio_to_string(bio) 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`, :const:`FILETYPE_ASN1`, or :const:`FILETYPE_TEXT`) :param PKey pkey: The PKey to dump :param cipher: (optional) if encrypted PEM format, the cipher to use :param passphrase: (optional) if encrypted PEM format, this can be either the passphrase to use, or a callback for providing the passphrase. :return: The buffer with the dumped key in :rtype: bytes """ bio = _new_mem_buf() if not isinstance(pkey, PKey): raise TypeError("pkey must be a PKey") if cipher is not None: if passphrase is None: raise TypeError( "if a value is given for cipher " "one must also be given for passphrase") cipher_obj = _lib.EVP_get_cipherbyname(_byte_string(cipher)) if cipher_obj == _ffi.NULL: raise ValueError("Invalid cipher name") else: cipher_obj = _ffi.NULL helper = _PassphraseHelper(type, passphrase) if type == FILETYPE_PEM: result_code = _lib.PEM_write_bio_PrivateKey( bio, pkey._pkey, cipher_obj, _ffi.NULL, 0, helper.callback, helper.callback_args) helper.raise_if_problem() elif type == FILETYPE_ASN1: result_code = _lib.i2d_PrivateKey_bio(bio, pkey._pkey) elif type == FILETYPE_TEXT: if _lib.EVP_PKEY_id(pkey._pkey) != _lib.EVP_PKEY_RSA: raise TypeError("Only RSA keys are supported for FILETYPE_TEXT") rsa = _ffi.gc( _lib.EVP_PKEY_get1_RSA(pkey._pkey), _lib.RSA_free ) result_code = _lib.RSA_print(bio, rsa, 0) else: raise ValueError( "type argument must be FILETYPE_PEM, FILETYPE_ASN1, or " "FILETYPE_TEXT") _openssl_assert(result_code != 0) return _bio_to_string(bio) class Revoked(object): """ A certificate revocation. """ # https://www.openssl.org/docs/manmaster/man5/x509v3_config.html#CRL-distribution-points # which differs from crl_reasons of crypto/x509v3/v3_enum.c that matches # OCSP_crl_reason_str. We use the latter, just like the command line # program. _crl_reasons = [ b"unspecified", b"keyCompromise", b"CACompromise", b"affiliationChanged", b"superseded", b"cessationOfOperation", b"certificateHold", # b"removeFromCRL", ] def __init__(self): revoked = _lib.X509_REVOKED_new() self._revoked = _ffi.gc(revoked, _lib.X509_REVOKED_free) def set_serial(self, hex_str): """ Set the serial number. The serial number is formatted as a hexadecimal number encoded in ASCII. :param bytes hex_str: The new serial number. :return: ``None`` """ bignum_serial = _ffi.gc(_lib.BN_new(), _lib.BN_free) bignum_ptr = _ffi.new("BIGNUM**") bignum_ptr[0] = bignum_serial bn_result = _lib.BN_hex2bn(bignum_ptr, hex_str) if not bn_result: raise ValueError("bad hex string") asn1_serial = _ffi.gc( _lib.BN_to_ASN1_INTEGER(bignum_serial, _ffi.NULL), _lib.ASN1_INTEGER_free) _lib.X509_REVOKED_set_serialNumber(self._revoked, asn1_serial) def get_serial(self): """ Get the serial number. The serial number is formatted as a hexadecimal number encoded in ASCII. :return: The serial number. :rtype: bytes """ bio = _new_mem_buf() asn1_int = _lib.X509_REVOKED_get0_serialNumber(self._revoked) _openssl_assert(asn1_int != _ffi.NULL) result = _lib.i2a_ASN1_INTEGER(bio, asn1_int) _openssl_assert(result >= 0) return _bio_to_string(bio) def _delete_reason(self): for i in range(_lib.X509_REVOKED_get_ext_count(self._revoked)): ext = _lib.X509_REVOKED_get_ext(self._revoked, i) obj = _lib.X509_EXTENSION_get_object(ext) if _lib.OBJ_obj2nid(obj) == _lib.NID_crl_reason: _lib.X509_EXTENSION_free(ext) _lib.X509_REVOKED_delete_ext(self._revoked, i) break def set_reason(self, reason): """ Set the reason of this revocation. If :data:`reason` is ``None``, delete the reason instead. :param reason: The reason string. :type reason: :class:`bytes` or :class:`NoneType` :return: ``None`` .. seealso:: :meth:`all_reasons`, which gives you a list of all supported reasons which you might pass to this method. """ if reason is None: self._delete_reason() elif not isinstance(reason, bytes): raise TypeError("reason must be None or a byte string") else: reason = reason.lower().replace(b' ', b'') reason_code = [r.lower() for r in self._crl_reasons].index(reason) new_reason_ext = _lib.ASN1_ENUMERATED_new() _openssl_assert(new_reason_ext != _ffi.NULL) new_reason_ext = _ffi.gc(new_reason_ext, _lib.ASN1_ENUMERATED_free) set_result = _lib.ASN1_ENUMERATED_set(new_reason_ext, reason_code) _openssl_assert(set_result != _ffi.NULL) self._delete_reason() add_result = _lib.X509_REVOKED_add1_ext_i2d( self._revoked, _lib.NID_crl_reason, new_reason_ext, 0, 0) _openssl_assert(add_result == 1) def get_reason(self): """ Get the reason of this revocation. :return: The reason, or ``None`` if there is none. :rtype: bytes or NoneType .. seealso:: :meth:`all_reasons`, which gives you a list of all supported reasons this method might return. """ for i in range(_lib.X509_REVOKED_get_ext_count(self._revoked)): ext = _lib.X509_REVOKED_get_ext(self._revoked, i) obj = _lib.X509_EXTENSION_get_object(ext) if _lib.OBJ_obj2nid(obj) == _lib.NID_crl_reason: bio = _new_mem_buf() print_result = _lib.X509V3_EXT_print(bio, ext, 0, 0) if not print_result: print_result = _lib.M_ASN1_OCTET_STRING_print( bio, _lib.X509_EXTENSION_get_data(ext) ) _openssl_assert(print_result != 0) return _bio_to_string(bio) def all_reasons(self): """ Return a list of all the supported reason strings. This list is a copy; modifying it does not change the supported reason strings. :return: A list of reason strings. :rtype: :class:`list` of :class:`bytes` """ return self._crl_reasons[:] def set_rev_date(self, when): """ Set the revocation timestamp. :param bytes when: The timestamp of the revocation, as ASN.1 TIME. :return: ``None`` """ dt = _lib.X509_REVOKED_get0_revocationDate(self._revoked) return _set_asn1_time(dt, when) def get_rev_date(self): """ Get the revocation timestamp. :return: The timestamp of the revocation, as ASN.1 TIME. :rtype: bytes """ dt = _lib.X509_REVOKED_get0_revocationDate(self._revoked) return _get_asn1_time(dt) class CRL(object): """ A certificate revocation list. """ def __init__(self): crl = _lib.X509_CRL_new() self._crl = _ffi.gc(crl, _lib.X509_CRL_free) def to_cryptography(self): """ Export as a ``cryptography`` CRL. :rtype: ``cryptography.x509.CertificateRevocationList`` .. versionadded:: 17.1.0 """ from cryptography.hazmat.backends.openssl.x509 import ( _CertificateRevocationList ) backend = _get_backend() return _CertificateRevocationList(backend, self._crl) @classmethod def from_cryptography(cls, crypto_crl): """ Construct based on a ``cryptography`` *crypto_crl*. :param crypto_crl: A ``cryptography`` certificate revocation list :type crypto_crl: ``cryptography.x509.CertificateRevocationList`` :rtype: CRL .. versionadded:: 17.1.0 """ if not isinstance(crypto_crl, x509.CertificateRevocationList): raise TypeError("Must be a certificate revocation list") crl = cls() crl._crl = crypto_crl._x509_crl return crl def get_revoked(self): """ Return the revocations in this certificate revocation list. These revocations will be provided by value, not by reference. That means it's okay to mutate them: it won't affect this CRL. :return: The revocations in this CRL. :rtype: :class:`tuple` of :class:`Revocation` """ results = [] revoked_stack = _lib.X509_CRL_get_REVOKED(self._crl) for i in range(_lib.sk_X509_REVOKED_num(revoked_stack)): revoked = _lib.sk_X509_REVOKED_value(revoked_stack, i) revoked_copy = _lib.Cryptography_X509_REVOKED_dup(revoked) pyrev = Revoked.__new__(Revoked) pyrev._revoked = _ffi.gc(revoked_copy, _lib.X509_REVOKED_free) results.append(pyrev) if results: return tuple(results) def add_revoked(self, revoked): """ Add a revoked (by value not reference) to the CRL structure This revocation will be added by value, not by reference. That means it's okay to mutate it after adding: it won't affect this CRL. :param Revoked revoked: The new revocation. :return: ``None`` """ copy = _lib.Cryptography_X509_REVOKED_dup(revoked._revoked) _openssl_assert(copy != _ffi.NULL) add_result = _lib.X509_CRL_add0_revoked(self._crl, copy) _openssl_assert(add_result != 0) def get_issuer(self): """ Get the CRL's issuer. .. versionadded:: 16.1.0 :rtype: X509Name """ _issuer = _lib.X509_NAME_dup(_lib.X509_CRL_get_issuer(self._crl)) _openssl_assert(_issuer != _ffi.NULL) _issuer = _ffi.gc(_issuer, _lib.X509_NAME_free) issuer = X509Name.__new__(X509Name) issuer._name = _issuer return issuer def set_version(self, version): """ Set the CRL version. .. versionadded:: 16.1.0 :param int version: The version of the CRL. :return: ``None`` """ _openssl_assert(_lib.X509_CRL_set_version(self._crl, version) != 0) def _set_boundary_time(self, which, when): return _set_asn1_time(which(self._crl), when) def set_lastUpdate(self, when): """ Set when the CRL was last updated. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ .. versionadded:: 16.1.0 :param bytes when: A timestamp string. :return: ``None`` """ return self._set_boundary_time(_lib.X509_CRL_get_lastUpdate, when) def set_nextUpdate(self, when): """ Set when the CRL will next be udpated. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ .. versionadded:: 16.1.0 :param bytes when: A timestamp string. :return: ``None`` """ return self._set_boundary_time(_lib.X509_CRL_get_nextUpdate, when) def sign(self, issuer_cert, issuer_key, digest): """ Sign the CRL. Signing a CRL enables clients to associate the CRL itself with an issuer. Before a CRL is meaningful to other OpenSSL functions, it must be signed by an issuer. This method implicitly sets the issuer's name based on the issuer certificate and private key used to sign the CRL. .. versionadded:: 16.1.0 :param X509 issuer_cert: The issuer's certificate. :param PKey issuer_key: The issuer's private key. :param bytes digest: The digest method to sign the CRL with. """ digest_obj = _lib.EVP_get_digestbyname(digest) _openssl_assert(digest_obj != _ffi.NULL) _lib.X509_CRL_set_issuer_name( self._crl, _lib.X509_get_subject_name(issuer_cert._x509)) _lib.X509_CRL_sort(self._crl) result = _lib.X509_CRL_sign(self._crl, issuer_key._pkey, digest_obj) _openssl_assert(result != 0) def export(self, cert, key, type=FILETYPE_PEM, days=100, digest=_UNSPECIFIED): """ Export the CRL as a string. :param X509 cert: The certificate used to sign the CRL. :param PKey key: The key used to sign the CRL. :param int type: The export format, either :data:`FILETYPE_PEM`, :data:`FILETYPE_ASN1`, or :data:`FILETYPE_TEXT`. :param int days: The number of days until the next update of this CRL. :param bytes digest: The name of the message digest to use (eg ``b"sha2566"``). :rtype: bytes """ if not isinstance(cert, X509): raise TypeError("cert must be an X509 instance") if not isinstance(key, PKey): raise TypeError("key must be a PKey instance") if not isinstance(type, int): raise TypeError("type must be an integer") if digest is _UNSPECIFIED: raise TypeError("digest must be provided") digest_obj = _lib.EVP_get_digestbyname(digest) if digest_obj == _ffi.NULL: raise ValueError("No such digest method") bio = _lib.BIO_new(_lib.BIO_s_mem()) _openssl_assert(bio != _ffi.NULL) # A scratch time object to give different values to different CRL # fields sometime = _lib.ASN1_TIME_new() _openssl_assert(sometime != _ffi.NULL) _lib.X509_gmtime_adj(sometime, 0) _lib.X509_CRL_set_lastUpdate(self._crl, sometime) _lib.X509_gmtime_adj(sometime, days * 24 * 60 * 60) _lib.X509_CRL_set_nextUpdate(self._crl, sometime) _lib.X509_CRL_set_issuer_name( self._crl, _lib.X509_get_subject_name(cert._x509) ) sign_result = _lib.X509_CRL_sign(self._crl, key._pkey, digest_obj) if not sign_result: _raise_current_error() return dump_crl(type, self) CRLType = deprecated( CRL, __name__, "CRLType has been deprecated, use CRL instead", DeprecationWarning ) class PKCS7(object): def type_is_signed(self): """ Check if this NID_pkcs7_signed object :return: True if the PKCS7 is of type signed """ return bool(_lib.PKCS7_type_is_signed(self._pkcs7)) def type_is_enveloped(self): """ Check if this NID_pkcs7_enveloped object :returns: True if the PKCS7 is of type enveloped """ return bool(_lib.PKCS7_type_is_enveloped(self._pkcs7)) def type_is_signedAndEnveloped(self): """ Check if this NID_pkcs7_signedAndEnveloped object :returns: True if the PKCS7 is of type signedAndEnveloped """ return bool(_lib.PKCS7_type_is_signedAndEnveloped(self._pkcs7)) def type_is_data(self): """ Check if this NID_pkcs7_data object :return: True if the PKCS7 is of type data """ return bool(_lib.PKCS7_type_is_data(self._pkcs7)) def get_type_name(self): """ Returns the type name of the PKCS7 structure :return: A string with the typename """ nid = _lib.OBJ_obj2nid(self._pkcs7.type) string_type = _lib.OBJ_nid2sn(nid) return _ffi.string(string_type) PKCS7Type = deprecated( PKCS7, __name__, "PKCS7Type has been deprecated, use PKCS7 instead", DeprecationWarning ) class PKCS12(object): """ A PKCS #12 archive. """ def __init__(self): self._pkey = None self._cert = None self._cacerts = None self._friendlyname = None def get_certificate(self): """ Get the certificate in the PKCS #12 structure. :return: The certificate, or :py:const:`None` if there is none. :rtype: :py:class:`X509` or :py:const:`None` """ return self._cert def set_certificate(self, cert): """ Set the certificate in the PKCS #12 structure. :param cert: The new certificate, or :py:const:`None` to unset it. :type cert: :py:class:`X509` or :py:const:`None` :return: ``None`` """ if not isinstance(cert, X509): raise TypeError("cert must be an X509 instance") self._cert = cert def get_privatekey(self): """ Get the private key in the PKCS #12 structure. :return: The private key, or :py:const:`None` if there is none. :rtype: :py:class:`PKey` """ return self._pkey def set_privatekey(self, pkey): """ Set the certificate portion of the PKCS #12 structure. :param pkey: The new private key, or :py:const:`None` to unset it. :type pkey: :py:class:`PKey` or :py:const:`None` :return: ``None`` """ if not isinstance(pkey, PKey): raise TypeError("pkey must be a PKey instance") self._pkey = pkey def get_ca_certificates(self): """ Get the CA certificates in the PKCS #12 structure. :return: A tuple with the CA certificates in the chain, or :py:const:`None` if there are none. :rtype: :py:class:`tuple` of :py:class:`X509` or :py:const:`None` """ if self._cacerts is not None: return tuple(self._cacerts) def set_ca_certificates(self, cacerts): """ Replace or set the CA certificates within the PKCS12 object. :param cacerts: The new CA certificates, or :py:const:`None` to unset them. :type cacerts: An iterable of :py:class:`X509` or :py:const:`None` :return: ``None`` """ if cacerts is None: self._cacerts = None else: cacerts = list(cacerts) for cert in cacerts: if not isinstance(cert, X509): raise TypeError( "iterable must only contain X509 instances" ) self._cacerts = cacerts def set_friendlyname(self, name): """ Set the friendly name in the PKCS #12 structure. :param name: The new friendly name, or :py:const:`None` to unset. :type name: :py:class:`bytes` or :py:const:`None` :return: ``None`` """ if name is None: self._friendlyname = None elif not isinstance(name, bytes): raise TypeError( "name must be a byte string or None (not %r)" % (name,) ) self._friendlyname = name def get_friendlyname(self): """ Get the friendly name in the PKCS# 12 structure. :returns: The friendly name, or :py:const:`None` if there is none. :rtype: :py:class:`bytes` or :py:const:`None` """ return self._friendlyname def export(self, passphrase=None, iter=2048, maciter=1): """ Dump a PKCS12 object as a string. For more information, see the :c:func:`PKCS12_create` man page. :param passphrase: The passphrase used to encrypt the structure. Unlike some other passphrase arguments, this *must* be a string, not a callback. :type passphrase: :py:data:`bytes` :param iter: Number of times to repeat the encryption step. :type iter: :py:data:`int` :param maciter: Number of times to repeat the MAC step. :type maciter: :py:data:`int` :return: The string representation of the PKCS #12 structure. :rtype: """ passphrase = _text_to_bytes_and_warn("passphrase", passphrase) if self._cacerts is None: cacerts = _ffi.NULL else: cacerts = _lib.sk_X509_new_null() cacerts = _ffi.gc(cacerts, _lib.sk_X509_free) for cert in self._cacerts: _lib.sk_X509_push(cacerts, cert._x509) if passphrase is None: passphrase = _ffi.NULL friendlyname = self._friendlyname if friendlyname is None: friendlyname = _ffi.NULL if self._pkey is None: pkey = _ffi.NULL else: pkey = self._pkey._pkey if self._cert is None: cert = _ffi.NULL else: cert = self._cert._x509 pkcs12 = _lib.PKCS12_create( passphrase, friendlyname, pkey, cert, cacerts, _lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC, _lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC, iter, maciter, 0) if pkcs12 == _ffi.NULL: _raise_current_error() pkcs12 = _ffi.gc(pkcs12, _lib.PKCS12_free) bio = _new_mem_buf() _lib.i2d_PKCS12_bio(bio, pkcs12) return _bio_to_string(bio) PKCS12Type = deprecated( PKCS12, __name__, "PKCS12Type has been deprecated, use PKCS12 instead", DeprecationWarning ) class NetscapeSPKI(object): """ A Netscape SPKI object. """ def __init__(self): spki = _lib.NETSCAPE_SPKI_new() self._spki = _ffi.gc(spki, _lib.NETSCAPE_SPKI_free) def sign(self, pkey, digest): """ Sign the certificate request with this key and digest type. :param pkey: The private key to sign with. :type pkey: :py:class:`PKey` :param digest: The message digest to use. :type digest: :py:class:`bytes` :return: ``None`` """ if pkey._only_public: raise ValueError("Key has only public part") if not pkey._initialized: raise ValueError("Key is uninitialized") digest_obj = _lib.EVP_get_digestbyname(_byte_string(digest)) if digest_obj == _ffi.NULL: raise ValueError("No such digest method") sign_result = _lib.NETSCAPE_SPKI_sign( self._spki, pkey._pkey, digest_obj ) _openssl_assert(sign_result > 0) def verify(self, key): """ Verifies a signature on a certificate request. :param PKey key: The public key that signature is supposedly from. :return: ``True`` if the signature is correct. :rtype: bool :raises OpenSSL.crypto.Error: If the signature is invalid, or there was a problem verifying the signature. """ answer = _lib.NETSCAPE_SPKI_verify(self._spki, key._pkey) if answer <= 0: _raise_current_error() return True def b64_encode(self): """ Generate a base64 encoded representation of this SPKI object. :return: The base64 encoded string. :rtype: :py:class:`bytes` """ encoded = _lib.NETSCAPE_SPKI_b64_encode(self._spki) result = _ffi.string(encoded) _lib.OPENSSL_free(encoded) return result def get_pubkey(self): """ Get the public key of this certificate. :return: The public key. :rtype: :py:class:`PKey` """ pkey = PKey.__new__(PKey) pkey._pkey = _lib.NETSCAPE_SPKI_get_pubkey(self._spki) _openssl_assert(pkey._pkey != _ffi.NULL) pkey._pkey = _ffi.gc(pkey._pkey, _lib.EVP_PKEY_free) pkey._only_public = True return pkey def set_pubkey(self, pkey): """ Set the public key of the certificate :param pkey: The public key :return: ``None`` """ set_result = _lib.NETSCAPE_SPKI_set_pubkey(self._spki, pkey._pkey) _openssl_assert(set_result == 1) NetscapeSPKIType = deprecated( NetscapeSPKI, __name__, "NetscapeSPKIType has been deprecated, use NetscapeSPKI instead", DeprecationWarning ) class _PassphraseHelper(object): def __init__(self, type, passphrase, more_args=False, truncate=False): if type != FILETYPE_PEM and passphrase is not None: raise ValueError( "only FILETYPE_PEM key format supports encryption" ) self._passphrase = passphrase self._more_args = more_args self._truncate = truncate self._problems = [] @property def callback(self): if self._passphrase is None: return _ffi.NULL elif isinstance(self._passphrase, bytes): return _ffi.NULL elif callable(self._passphrase): return _ffi.callback("pem_password_cb", self._read_passphrase) else: raise TypeError( "Last argument must be a byte string or a callable." ) @property def callback_args(self): if self._passphrase is None: return _ffi.NULL elif isinstance(self._passphrase, bytes): return self._passphrase elif callable(self._passphrase): return _ffi.NULL else: raise TypeError( "Last argument must be a byte string or a callable." ) def raise_if_problem(self, exceptionType=Error): if self._problems: # Flush the OpenSSL error queue try: _exception_from_error_queue(exceptionType) except exceptionType: pass raise self._problems.pop(0) def _read_passphrase(self, buf, size, rwflag, userdata): try: if self._more_args: result = self._passphrase(size, rwflag, userdata) else: result = self._passphrase(rwflag) if not isinstance(result, bytes): raise ValueError("String expected") if len(result) > size: if self._truncate: result = result[:size] else: raise ValueError( "passphrase returned by callback is too long" ) for i in range(len(result)): buf[i] = result[i:i + 1] return len(result) except Exception as e: self._problems.append(e) return 0 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 object. :rtype: :class:`PKey` """ if isinstance(buffer, _text_type): buffer = buffer.encode("ascii") bio = _new_mem_buf(buffer) if type == FILETYPE_PEM: evp_pkey = _lib.PEM_read_bio_PUBKEY( bio, _ffi.NULL, _ffi.NULL, _ffi.NULL) elif type == FILETYPE_ASN1: evp_pkey = _lib.d2i_PUBKEY_bio(bio, _ffi.NULL) else: raise ValueError("type argument must be FILETYPE_PEM or FILETYPE_ASN1") if evp_pkey == _ffi.NULL: _raise_current_error() pkey = PKey.__new__(PKey) pkey._pkey = _ffi.gc(evp_pkey, _lib.EVP_PKEY_free) pkey._only_public = True return pkey 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 format, this can be either the passphrase to use, or a callback for providing the passphrase. :return: The PKey object """ if isinstance(buffer, _text_type): buffer = buffer.encode("ascii") bio = _new_mem_buf(buffer) helper = _PassphraseHelper(type, passphrase) if type == FILETYPE_PEM: evp_pkey = _lib.PEM_read_bio_PrivateKey( bio, _ffi.NULL, helper.callback, helper.callback_args) helper.raise_if_problem() elif type == FILETYPE_ASN1: evp_pkey = _lib.d2i_PrivateKey_bio(bio, _ffi.NULL) else: raise ValueError("type argument must be FILETYPE_PEM or FILETYPE_ASN1") if evp_pkey == _ffi.NULL: _raise_current_error() pkey = PKey.__new__(PKey) pkey._pkey = _ffi.gc(evp_pkey, _lib.EVP_PKEY_free) return pkey 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 in """ bio = _new_mem_buf() if type == FILETYPE_PEM: result_code = _lib.PEM_write_bio_X509_REQ(bio, req._req) elif type == FILETYPE_ASN1: result_code = _lib.i2d_X509_REQ_bio(bio, req._req) elif type == FILETYPE_TEXT: result_code = _lib.X509_REQ_print_ex(bio, req._req, 0, 0) else: raise ValueError( "type argument must be FILETYPE_PEM, FILETYPE_ASN1, or " "FILETYPE_TEXT" ) _openssl_assert(result_code != 0) return _bio_to_string(bio) 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 """ if isinstance(buffer, _text_type): buffer = buffer.encode("ascii") bio = _new_mem_buf(buffer) if type == FILETYPE_PEM: req = _lib.PEM_read_bio_X509_REQ(bio, _ffi.NULL, _ffi.NULL, _ffi.NULL) elif type == FILETYPE_ASN1: req = _lib.d2i_X509_REQ_bio(bio, _ffi.NULL) else: raise ValueError("type argument must be FILETYPE_PEM or FILETYPE_ASN1") _openssl_assert(req != _ffi.NULL) x509req = X509Req.__new__(X509Req) x509req._req = _ffi.gc(req, _lib.X509_REQ_free) return x509req 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) digest_obj = _lib.EVP_get_digestbyname(_byte_string(digest)) if digest_obj == _ffi.NULL: raise ValueError("No such digest method") md_ctx = _lib.Cryptography_EVP_MD_CTX_new() md_ctx = _ffi.gc(md_ctx, _lib.Cryptography_EVP_MD_CTX_free) _lib.EVP_SignInit(md_ctx, digest_obj) _lib.EVP_SignUpdate(md_ctx, data, len(data)) length = _lib.EVP_PKEY_size(pkey._pkey) _openssl_assert(length > 0) signature_buffer = _ffi.new("unsigned char[]", length) signature_length = _ffi.new("unsigned int *") final_result = _lib.EVP_SignFinal( md_ctx, signature_buffer, signature_length, pkey._pkey) _openssl_assert(final_result == 1) return _ffi.buffer(signature_buffer, signature_length[0])[:] 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 :param digest: message digest to use :return: ``None`` if the signature is correct, raise exception otherwise. .. versionadded:: 0.11 """ data = _text_to_bytes_and_warn("data", data) digest_obj = _lib.EVP_get_digestbyname(_byte_string(digest)) if digest_obj == _ffi.NULL: raise ValueError("No such digest method") pkey = _lib.X509_get_pubkey(cert._x509) _openssl_assert(pkey != _ffi.NULL) pkey = _ffi.gc(pkey, _lib.EVP_PKEY_free) md_ctx = _lib.Cryptography_EVP_MD_CTX_new() md_ctx = _ffi.gc(md_ctx, _lib.Cryptography_EVP_MD_CTX_free) _lib.EVP_VerifyInit(md_ctx, digest_obj) _lib.EVP_VerifyUpdate(md_ctx, data, len(data)) verify_result = _lib.EVP_VerifyFinal( md_ctx, signature, len(signature), pkey ) if verify_result != 1: _raise_current_error() 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() if type == FILETYPE_PEM: ret = _lib.PEM_write_bio_X509_CRL(bio, crl._crl) elif type == FILETYPE_ASN1: ret = _lib.i2d_X509_CRL_bio(bio, crl._crl) elif type == FILETYPE_TEXT: ret = _lib.X509_CRL_print(bio, crl._crl) else: raise ValueError( "type argument must be FILETYPE_PEM, FILETYPE_ASN1, or " "FILETYPE_TEXT") assert ret == 1 return _bio_to_string(bio) 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 isinstance(buffer, _text_type): buffer = buffer.encode("ascii") bio = _new_mem_buf(buffer) if type == FILETYPE_PEM: crl = _lib.PEM_read_bio_X509_CRL(bio, _ffi.NULL, _ffi.NULL, _ffi.NULL) elif type == FILETYPE_ASN1: crl = _lib.d2i_X509_CRL_bio(bio, _ffi.NULL) else: raise ValueError("type argument must be FILETYPE_PEM or FILETYPE_ASN1") if crl == _ffi.NULL: _raise_current_error() result = CRL.__new__(CRL) result._crl = _ffi.gc(crl, _lib.X509_CRL_free) return result 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): buffer = buffer.encode("ascii") bio = _new_mem_buf(buffer) if type == FILETYPE_PEM: pkcs7 = _lib.PEM_read_bio_PKCS7(bio, _ffi.NULL, _ffi.NULL, _ffi.NULL) elif type == FILETYPE_ASN1: pkcs7 = _lib.d2i_PKCS7_bio(bio, _ffi.NULL) else: raise ValueError("type argument must be FILETYPE_PEM or FILETYPE_ASN1") if pkcs7 == _ffi.NULL: _raise_current_error() pypkcs7 = PKCS7.__new__(PKCS7) pypkcs7._pkcs7 = _ffi.gc(pkcs7, _lib.PKCS7_free) return pypkcs7 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 buffer the certificate is stored in :param passphrase: (Optional) The password to decrypt the PKCS12 lump :returns: The PKCS12 object """ passphrase = _text_to_bytes_and_warn("passphrase", passphrase) if isinstance(buffer, _text_type): buffer = buffer.encode("ascii") bio = _new_mem_buf(buffer) # Use null passphrase if passphrase is None or empty string. With PKCS#12 # password based encryption no password and a zero length password are two # different things, but OpenSSL implementation will try both to figure out # which one works. if not passphrase: passphrase = _ffi.NULL p12 = _lib.d2i_PKCS12_bio(bio, _ffi.NULL) if p12 == _ffi.NULL: _raise_current_error() p12 = _ffi.gc(p12, _lib.PKCS12_free) pkey = _ffi.new("EVP_PKEY**") cert = _ffi.new("X509**") cacerts = _ffi.new("Cryptography_STACK_OF_X509**") parse_result = _lib.PKCS12_parse(p12, passphrase, pkey, cert, cacerts) if not parse_result: _raise_current_error() cacerts = _ffi.gc(cacerts[0], _lib.sk_X509_free) # openssl 1.0.0 sometimes leaves an X509_check_private_key error in the # queue for no particular reason. This error isn't interesting to anyone # outside this function. It's not even interesting to us. Get rid of it. try: _raise_current_error() except Error: pass if pkey[0] == _ffi.NULL: pykey = None else: pykey = PKey.__new__(PKey) pykey._pkey = _ffi.gc(pkey[0], _lib.EVP_PKEY_free) if cert[0] == _ffi.NULL: pycert = None friendlyname = None else: pycert = X509._from_raw_x509_ptr(cert[0]) friendlyname_length = _ffi.new("int*") friendlyname_buffer = _lib.X509_alias_get0( cert[0], friendlyname_length ) friendlyname = _ffi.buffer( friendlyname_buffer, friendlyname_length[0] )[:] if friendlyname_buffer == _ffi.NULL: friendlyname = None pycacerts = [] for i in range(_lib.sk_X509_num(cacerts)): x509 = _lib.sk_X509_value(cacerts, i) pycacert = X509._from_raw_x509_ptr(x509) pycacerts.append(pycacert) if not pycacerts: pycacerts = None pkcs12 = PKCS12.__new__(PKCS12) pkcs12._pkey = pykey pkcs12._cert = pycert pkcs12._cacerts = pycacerts pkcs12._friendlyname = friendlyname return pkcs12 # There are no direct unit tests for this initialization. It is tested # indirectly since it is necessary for functions like dump_privatekey when # using encryption. # # Thus OpenSSL.test.test_crypto.FunctionTests.test_dump_privatekey_passphrase # and some other similar tests may fail without this (though they may not if # the Python runtime has already done some initialization of the underlying # OpenSSL library (and is linked against the same one that cryptography is # using)). _lib.OpenSSL_add_all_algorithms() # This is similar but exercised mainly by exception_from_error_queue. It calls # both ERR_load_crypto_strings() and ERR_load_SSL_strings(). _lib.SSL_load_error_strings() # Set the default string mask to match OpenSSL upstream (since 2005) and # RFC5280 recommendations. _lib.ASN1_STRING_set_default_mask_asc(b'utf8only') PK}S]rkrand.pynu[""" PRNG management routines, thin wrappers. """ from OpenSSL._util import lib as _lib def add(buffer, entropy): """ Mix bytes from *string* into the PRNG state. The *entropy* argument is (the lower bound of) an estimate of how much randomness is contained in *string*, measured in bytes. For more information, see e.g. :rfc:`1750`. This function is only relevant if you are forking Python processes and need to reseed the CSPRNG after fork. :param buffer: Buffer with random data. :param entropy: The entropy (in bytes) measurement of the buffer. :return: :obj:`None` """ if not isinstance(buffer, bytes): raise TypeError("buffer must be a byte string") if not isinstance(entropy, int): raise TypeError("entropy must be an integer") _lib.RAND_add(buffer, len(buffer), entropy) def status(): """ Check whether the PRNG has been seeded with enough data. :return: 1 if the PRNG is seeded enough, 0 otherwise. """ return _lib.RAND_status() PK}S]<0-[[SSL.pynu[import os import socket from sys import platform from functools import wraps, partial from itertools import count, chain from weakref import WeakValueDictionary from errno import errorcode from cryptography.utils import deprecated from six import ( binary_type as _binary_type, integer_types as integer_types, int2byte, indexbytes) from OpenSSL._util import ( UNSPECIFIED as _UNSPECIFIED, exception_from_error_queue as _exception_from_error_queue, ffi as _ffi, lib as _lib, make_assert as _make_assert, native as _native, path_string as _path_string, text_to_bytes_and_warn as _text_to_bytes_and_warn, no_zero_allocator as _no_zero_allocator, ) from OpenSSL.crypto import ( FILETYPE_PEM, _PassphraseHelper, PKey, X509Name, X509, X509Store) __all__ = [ 'OPENSSL_VERSION_NUMBER', 'SSLEAY_VERSION', 'SSLEAY_CFLAGS', 'SSLEAY_PLATFORM', 'SSLEAY_DIR', 'SSLEAY_BUILT_ON', 'SENT_SHUTDOWN', 'RECEIVED_SHUTDOWN', 'SSLv2_METHOD', 'SSLv3_METHOD', 'SSLv23_METHOD', 'TLSv1_METHOD', 'TLSv1_1_METHOD', 'TLSv1_2_METHOD', 'OP_NO_SSLv2', 'OP_NO_SSLv3', 'OP_NO_TLSv1', 'OP_NO_TLSv1_1', 'OP_NO_TLSv1_2', 'MODE_RELEASE_BUFFERS', 'OP_SINGLE_DH_USE', 'OP_SINGLE_ECDH_USE', 'OP_EPHEMERAL_RSA', 'OP_MICROSOFT_SESS_ID_BUG', 'OP_NETSCAPE_CHALLENGE_BUG', 'OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG', 'OP_SSLREF2_REUSE_CERT_TYPE_BUG', 'OP_MICROSOFT_BIG_SSLV3_BUFFER', 'OP_MSIE_SSLV2_RSA_PADDING', 'OP_SSLEAY_080_CLIENT_DH_BUG', 'OP_TLS_D5_BUG', 'OP_TLS_BLOCK_PADDING_BUG', 'OP_DONT_INSERT_EMPTY_FRAGMENTS', 'OP_CIPHER_SERVER_PREFERENCE', 'OP_TLS_ROLLBACK_BUG', 'OP_PKCS1_CHECK_1', 'OP_PKCS1_CHECK_2', 'OP_NETSCAPE_CA_DN_BUG', 'OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG', 'OP_NO_COMPRESSION', 'OP_NO_QUERY_MTU', 'OP_COOKIE_EXCHANGE', 'OP_NO_TICKET', 'OP_ALL', 'VERIFY_PEER', 'VERIFY_FAIL_IF_NO_PEER_CERT', 'VERIFY_CLIENT_ONCE', 'VERIFY_NONE', 'SESS_CACHE_OFF', 'SESS_CACHE_CLIENT', 'SESS_CACHE_SERVER', 'SESS_CACHE_BOTH', 'SESS_CACHE_NO_AUTO_CLEAR', 'SESS_CACHE_NO_INTERNAL_LOOKUP', 'SESS_CACHE_NO_INTERNAL_STORE', 'SESS_CACHE_NO_INTERNAL', 'SSL_ST_CONNECT', 'SSL_ST_ACCEPT', 'SSL_ST_MASK', 'SSL_CB_LOOP', 'SSL_CB_EXIT', 'SSL_CB_READ', 'SSL_CB_WRITE', 'SSL_CB_ALERT', 'SSL_CB_READ_ALERT', 'SSL_CB_WRITE_ALERT', 'SSL_CB_ACCEPT_LOOP', 'SSL_CB_ACCEPT_EXIT', 'SSL_CB_CONNECT_LOOP', 'SSL_CB_CONNECT_EXIT', 'SSL_CB_HANDSHAKE_START', 'SSL_CB_HANDSHAKE_DONE', 'Error', 'WantReadError', 'WantWriteError', 'WantX509LookupError', 'ZeroReturnError', 'SysCallError', 'SSLeay_version', 'Session', 'Context', 'Connection' ] try: _buffer = buffer except NameError: class _buffer(object): pass OPENSSL_VERSION_NUMBER = _lib.OPENSSL_VERSION_NUMBER SSLEAY_VERSION = _lib.SSLEAY_VERSION SSLEAY_CFLAGS = _lib.SSLEAY_CFLAGS SSLEAY_PLATFORM = _lib.SSLEAY_PLATFORM SSLEAY_DIR = _lib.SSLEAY_DIR SSLEAY_BUILT_ON = _lib.SSLEAY_BUILT_ON SENT_SHUTDOWN = _lib.SSL_SENT_SHUTDOWN RECEIVED_SHUTDOWN = _lib.SSL_RECEIVED_SHUTDOWN SSLv2_METHOD = 1 SSLv3_METHOD = 2 SSLv23_METHOD = 3 TLSv1_METHOD = 4 TLSv1_1_METHOD = 5 TLSv1_2_METHOD = 6 OP_NO_SSLv2 = _lib.SSL_OP_NO_SSLv2 OP_NO_SSLv3 = _lib.SSL_OP_NO_SSLv3 OP_NO_TLSv1 = _lib.SSL_OP_NO_TLSv1 OP_NO_TLSv1_1 = _lib.SSL_OP_NO_TLSv1_1 OP_NO_TLSv1_2 = _lib.SSL_OP_NO_TLSv1_2 MODE_RELEASE_BUFFERS = _lib.SSL_MODE_RELEASE_BUFFERS OP_SINGLE_DH_USE = _lib.SSL_OP_SINGLE_DH_USE OP_SINGLE_ECDH_USE = _lib.SSL_OP_SINGLE_ECDH_USE OP_EPHEMERAL_RSA = _lib.SSL_OP_EPHEMERAL_RSA OP_MICROSOFT_SESS_ID_BUG = _lib.SSL_OP_MICROSOFT_SESS_ID_BUG OP_NETSCAPE_CHALLENGE_BUG = _lib.SSL_OP_NETSCAPE_CHALLENGE_BUG OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG = ( _lib.SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG ) OP_SSLREF2_REUSE_CERT_TYPE_BUG = _lib.SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG OP_MICROSOFT_BIG_SSLV3_BUFFER = _lib.SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER OP_MSIE_SSLV2_RSA_PADDING = _lib.SSL_OP_MSIE_SSLV2_RSA_PADDING OP_SSLEAY_080_CLIENT_DH_BUG = _lib.SSL_OP_SSLEAY_080_CLIENT_DH_BUG OP_TLS_D5_BUG = _lib.SSL_OP_TLS_D5_BUG OP_TLS_BLOCK_PADDING_BUG = _lib.SSL_OP_TLS_BLOCK_PADDING_BUG OP_DONT_INSERT_EMPTY_FRAGMENTS = _lib.SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS OP_CIPHER_SERVER_PREFERENCE = _lib.SSL_OP_CIPHER_SERVER_PREFERENCE OP_TLS_ROLLBACK_BUG = _lib.SSL_OP_TLS_ROLLBACK_BUG OP_PKCS1_CHECK_1 = _lib.SSL_OP_PKCS1_CHECK_1 OP_PKCS1_CHECK_2 = _lib.SSL_OP_PKCS1_CHECK_2 OP_NETSCAPE_CA_DN_BUG = _lib.SSL_OP_NETSCAPE_CA_DN_BUG OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG = ( _lib.SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG ) OP_NO_COMPRESSION = _lib.SSL_OP_NO_COMPRESSION OP_NO_QUERY_MTU = _lib.SSL_OP_NO_QUERY_MTU OP_COOKIE_EXCHANGE = _lib.SSL_OP_COOKIE_EXCHANGE OP_NO_TICKET = _lib.SSL_OP_NO_TICKET OP_ALL = _lib.SSL_OP_ALL VERIFY_PEER = _lib.SSL_VERIFY_PEER VERIFY_FAIL_IF_NO_PEER_CERT = _lib.SSL_VERIFY_FAIL_IF_NO_PEER_CERT VERIFY_CLIENT_ONCE = _lib.SSL_VERIFY_CLIENT_ONCE VERIFY_NONE = _lib.SSL_VERIFY_NONE SESS_CACHE_OFF = _lib.SSL_SESS_CACHE_OFF SESS_CACHE_CLIENT = _lib.SSL_SESS_CACHE_CLIENT SESS_CACHE_SERVER = _lib.SSL_SESS_CACHE_SERVER SESS_CACHE_BOTH = _lib.SSL_SESS_CACHE_BOTH SESS_CACHE_NO_AUTO_CLEAR = _lib.SSL_SESS_CACHE_NO_AUTO_CLEAR SESS_CACHE_NO_INTERNAL_LOOKUP = _lib.SSL_SESS_CACHE_NO_INTERNAL_LOOKUP SESS_CACHE_NO_INTERNAL_STORE = _lib.SSL_SESS_CACHE_NO_INTERNAL_STORE SESS_CACHE_NO_INTERNAL = _lib.SSL_SESS_CACHE_NO_INTERNAL SSL_ST_CONNECT = _lib.SSL_ST_CONNECT SSL_ST_ACCEPT = _lib.SSL_ST_ACCEPT SSL_ST_MASK = _lib.SSL_ST_MASK if _lib.Cryptography_HAS_SSL_ST: SSL_ST_INIT = _lib.SSL_ST_INIT SSL_ST_BEFORE = _lib.SSL_ST_BEFORE SSL_ST_OK = _lib.SSL_ST_OK SSL_ST_RENEGOTIATE = _lib.SSL_ST_RENEGOTIATE __all__.extend([ 'SSL_ST_INIT', 'SSL_ST_BEFORE', 'SSL_ST_OK', 'SSL_ST_RENEGOTIATE', ]) SSL_CB_LOOP = _lib.SSL_CB_LOOP SSL_CB_EXIT = _lib.SSL_CB_EXIT SSL_CB_READ = _lib.SSL_CB_READ SSL_CB_WRITE = _lib.SSL_CB_WRITE SSL_CB_ALERT = _lib.SSL_CB_ALERT SSL_CB_READ_ALERT = _lib.SSL_CB_READ_ALERT SSL_CB_WRITE_ALERT = _lib.SSL_CB_WRITE_ALERT SSL_CB_ACCEPT_LOOP = _lib.SSL_CB_ACCEPT_LOOP SSL_CB_ACCEPT_EXIT = _lib.SSL_CB_ACCEPT_EXIT SSL_CB_CONNECT_LOOP = _lib.SSL_CB_CONNECT_LOOP SSL_CB_CONNECT_EXIT = _lib.SSL_CB_CONNECT_EXIT SSL_CB_HANDSHAKE_START = _lib.SSL_CB_HANDSHAKE_START SSL_CB_HANDSHAKE_DONE = _lib.SSL_CB_HANDSHAKE_DONE # Taken from https://golang.org/src/crypto/x509/root_linux.go _CERTIFICATE_FILE_LOCATIONS = [ "/etc/ssl/certs/ca-certificates.crt", # Debian/Ubuntu/Gentoo etc. "/etc/pki/tls/certs/ca-bundle.crt", # Fedora/RHEL 6 "/etc/ssl/ca-bundle.pem", # OpenSUSE "/etc/pki/tls/cacert.pem", # OpenELEC "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem", # CentOS/RHEL 7 ] _CERTIFICATE_PATH_LOCATIONS = [ "/etc/ssl/certs", # SLES10/SLES11 ] # These values are compared to output from cffi's ffi.string so they must be # byte strings. _CRYPTOGRAPHY_MANYLINUX1_CA_DIR = b"/opt/pyca/cryptography/openssl/certs" _CRYPTOGRAPHY_MANYLINUX1_CA_FILE = b"/opt/pyca/cryptography/openssl/cert.pem" class Error(Exception): """ An error occurred in an `OpenSSL.SSL` API. """ _raise_current_error = partial(_exception_from_error_queue, Error) _openssl_assert = _make_assert(Error) class WantReadError(Error): pass class WantWriteError(Error): pass class WantX509LookupError(Error): pass class ZeroReturnError(Error): pass class SysCallError(Error): pass class _CallbackExceptionHelper(object): """ A base class for wrapper classes that allow for intelligent exception handling in OpenSSL callbacks. :ivar list _problems: Any exceptions that occurred while executing in a context where they could not be raised in the normal way. Typically this is because OpenSSL has called into some Python code and requires a return value. The exceptions are saved to be raised later when it is possible to do so. """ def __init__(self): self._problems = [] def raise_if_problem(self): """ Raise an exception from the OpenSSL error queue or that was previously captured whe running a callback. """ if self._problems: try: _raise_current_error() except Error: pass raise self._problems.pop(0) class _VerifyHelper(_CallbackExceptionHelper): """ Wrap a callback such that it can be used as a certificate verification callback. """ def __init__(self, callback): _CallbackExceptionHelper.__init__(self) @wraps(callback) def wrapper(ok, store_ctx): x509 = _lib.X509_STORE_CTX_get_current_cert(store_ctx) _lib.X509_up_ref(x509) cert = X509._from_raw_x509_ptr(x509) error_number = _lib.X509_STORE_CTX_get_error(store_ctx) error_depth = _lib.X509_STORE_CTX_get_error_depth(store_ctx) index = _lib.SSL_get_ex_data_X509_STORE_CTX_idx() ssl = _lib.X509_STORE_CTX_get_ex_data(store_ctx, index) connection = Connection._reverse_mapping[ssl] try: result = callback( connection, cert, error_number, error_depth, ok ) except Exception as e: self._problems.append(e) return 0 else: if result: _lib.X509_STORE_CTX_set_error(store_ctx, _lib.X509_V_OK) return 1 else: return 0 self.callback = _ffi.callback( "int (*)(int, X509_STORE_CTX *)", wrapper) class _NpnAdvertiseHelper(_CallbackExceptionHelper): """ Wrap a callback such that it can be used as an NPN advertisement callback. """ def __init__(self, callback): _CallbackExceptionHelper.__init__(self) @wraps(callback) def wrapper(ssl, out, outlen, arg): try: conn = Connection._reverse_mapping[ssl] protos = callback(conn) # Join the protocols into a Python bytestring, length-prefixing # each element. protostr = b''.join( chain.from_iterable((int2byte(len(p)), p) for p in protos) ) # Save our callback arguments on the connection object. This is # done to make sure that they don't get freed before OpenSSL # uses them. Then, return them appropriately in the output # parameters. conn._npn_advertise_callback_args = [ _ffi.new("unsigned int *", len(protostr)), _ffi.new("unsigned char[]", protostr), ] outlen[0] = conn._npn_advertise_callback_args[0][0] out[0] = conn._npn_advertise_callback_args[1] return 0 except Exception as e: self._problems.append(e) return 2 # SSL_TLSEXT_ERR_ALERT_FATAL self.callback = _ffi.callback( "int (*)(SSL *, const unsigned char **, unsigned int *, void *)", wrapper ) class _NpnSelectHelper(_CallbackExceptionHelper): """ Wrap a callback such that it can be used as an NPN selection callback. """ def __init__(self, callback): _CallbackExceptionHelper.__init__(self) @wraps(callback) def wrapper(ssl, out, outlen, in_, inlen, arg): try: conn = Connection._reverse_mapping[ssl] # The string passed to us is actually made up of multiple # length-prefixed bytestrings. We need to split that into a # list. instr = _ffi.buffer(in_, inlen)[:] protolist = [] while instr: length = indexbytes(instr, 0) proto = instr[1:length + 1] protolist.append(proto) instr = instr[length + 1:] # Call the callback outstr = callback(conn, protolist) # Save our callback arguments on the connection object. This is # done to make sure that they don't get freed before OpenSSL # uses them. Then, return them appropriately in the output # parameters. conn._npn_select_callback_args = [ _ffi.new("unsigned char *", len(outstr)), _ffi.new("unsigned char[]", outstr), ] outlen[0] = conn._npn_select_callback_args[0][0] out[0] = conn._npn_select_callback_args[1] return 0 except Exception as e: self._problems.append(e) return 2 # SSL_TLSEXT_ERR_ALERT_FATAL self.callback = _ffi.callback( ("int (*)(SSL *, unsigned char **, unsigned char *, " "const unsigned char *, unsigned int, void *)"), wrapper ) class _ALPNSelectHelper(_CallbackExceptionHelper): """ Wrap a callback such that it can be used as an ALPN selection callback. """ def __init__(self, callback): _CallbackExceptionHelper.__init__(self) @wraps(callback) def wrapper(ssl, out, outlen, in_, inlen, arg): try: conn = Connection._reverse_mapping[ssl] # The string passed to us is made up of multiple # length-prefixed bytestrings. We need to split that into a # list. instr = _ffi.buffer(in_, inlen)[:] protolist = [] while instr: encoded_len = indexbytes(instr, 0) proto = instr[1:encoded_len + 1] protolist.append(proto) instr = instr[encoded_len + 1:] # Call the callback outstr = callback(conn, protolist) if not isinstance(outstr, _binary_type): raise TypeError("ALPN callback must return a bytestring.") # Save our callback arguments on the connection object to make # sure that they don't get freed before OpenSSL can use them. # Then, return them in the appropriate output parameters. conn._alpn_select_callback_args = [ _ffi.new("unsigned char *", len(outstr)), _ffi.new("unsigned char[]", outstr), ] outlen[0] = conn._alpn_select_callback_args[0][0] out[0] = conn._alpn_select_callback_args[1] return 0 except Exception as e: self._problems.append(e) return 2 # SSL_TLSEXT_ERR_ALERT_FATAL self.callback = _ffi.callback( ("int (*)(SSL *, unsigned char **, unsigned char *, " "const unsigned char *, unsigned int, void *)"), wrapper ) class _OCSPServerCallbackHelper(_CallbackExceptionHelper): """ Wrap a callback such that it can be used as an OCSP callback for the server side. Annoyingly, OpenSSL defines one OCSP callback but uses it in two different ways. For servers, that callback is expected to retrieve some OCSP data and hand it to OpenSSL, and may return only SSL_TLSEXT_ERR_OK, SSL_TLSEXT_ERR_FATAL, and SSL_TLSEXT_ERR_NOACK. For clients, that callback is expected to check the OCSP data, and returns a negative value on error, 0 if the response is not acceptable, or positive if it is. These are mutually exclusive return code behaviours, and they mean that we need two helpers so that we always return an appropriate error code if the user's code throws an exception. Given that we have to have two helpers anyway, these helpers are a bit more helpery than most: specifically, they hide a few more of the OpenSSL functions so that the user has an easier time writing these callbacks. This helper implements the server side. """ def __init__(self, callback): _CallbackExceptionHelper.__init__(self) @wraps(callback) def wrapper(ssl, cdata): try: conn = Connection._reverse_mapping[ssl] # Extract the data if any was provided. if cdata != _ffi.NULL: data = _ffi.from_handle(cdata) else: data = None # Call the callback. ocsp_data = callback(conn, data) if not isinstance(ocsp_data, _binary_type): raise TypeError("OCSP callback must return a bytestring.") # If the OCSP data was provided, we will pass it to OpenSSL. # However, we have an early exit here: if no OCSP data was # provided we will just exit out and tell OpenSSL that there # is nothing to do. if not ocsp_data: return 3 # SSL_TLSEXT_ERR_NOACK # OpenSSL takes ownership of this data and expects it to have # been allocated by OPENSSL_malloc. ocsp_data_length = len(ocsp_data) data_ptr = _lib.OPENSSL_malloc(ocsp_data_length) _ffi.buffer(data_ptr, ocsp_data_length)[:] = ocsp_data _lib.SSL_set_tlsext_status_ocsp_resp( ssl, data_ptr, ocsp_data_length ) return 0 except Exception as e: self._problems.append(e) return 2 # SSL_TLSEXT_ERR_ALERT_FATAL self.callback = _ffi.callback("int (*)(SSL *, void *)", wrapper) class _OCSPClientCallbackHelper(_CallbackExceptionHelper): """ Wrap a callback such that it can be used as an OCSP callback for the client side. Annoyingly, OpenSSL defines one OCSP callback but uses it in two different ways. For servers, that callback is expected to retrieve some OCSP data and hand it to OpenSSL, and may return only SSL_TLSEXT_ERR_OK, SSL_TLSEXT_ERR_FATAL, and SSL_TLSEXT_ERR_NOACK. For clients, that callback is expected to check the OCSP data, and returns a negative value on error, 0 if the response is not acceptable, or positive if it is. These are mutually exclusive return code behaviours, and they mean that we need two helpers so that we always return an appropriate error code if the user's code throws an exception. Given that we have to have two helpers anyway, these helpers are a bit more helpery than most: specifically, they hide a few more of the OpenSSL functions so that the user has an easier time writing these callbacks. This helper implements the client side. """ def __init__(self, callback): _CallbackExceptionHelper.__init__(self) @wraps(callback) def wrapper(ssl, cdata): try: conn = Connection._reverse_mapping[ssl] # Extract the data if any was provided. if cdata != _ffi.NULL: data = _ffi.from_handle(cdata) else: data = None # Get the OCSP data. ocsp_ptr = _ffi.new("unsigned char **") ocsp_len = _lib.SSL_get_tlsext_status_ocsp_resp(ssl, ocsp_ptr) if ocsp_len < 0: # No OCSP data. ocsp_data = b'' else: # Copy the OCSP data, then pass it to the callback. ocsp_data = _ffi.buffer(ocsp_ptr[0], ocsp_len)[:] valid = callback(conn, ocsp_data, data) # Return 1 on success or 0 on error. return int(bool(valid)) except Exception as e: self._problems.append(e) # Return negative value if an exception is hit. return -1 self.callback = _ffi.callback("int (*)(SSL *, void *)", wrapper) def _asFileDescriptor(obj): fd = None if not isinstance(obj, integer_types): meth = getattr(obj, "fileno", None) if meth is not None: obj = meth() if isinstance(obj, integer_types): fd = obj if not isinstance(fd, integer_types): raise TypeError("argument must be an int, or have a fileno() method.") elif fd < 0: raise ValueError( "file descriptor cannot be a negative integer (%i)" % (fd,)) return fd def SSLeay_version(type): """ Return a string describing the version of OpenSSL in use. :param type: One of the :const:`SSLEAY_` constants defined in this module. """ return _ffi.string(_lib.SSLeay_version(type)) 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. ``Cryptography_HAS_NEXTPROTONEG``. :param error: The string to be used in the exception if the flag is false. """ def _requires_decorator(func): if not flag: @wraps(func) def explode(*args, **kwargs): raise NotImplementedError(error) return explode else: return func return _requires_decorator _requires_npn = _make_requires( _lib.Cryptography_HAS_NEXTPROTONEG, "NPN not available" ) _requires_alpn = _make_requires( _lib.Cryptography_HAS_ALPN, "ALPN not available" ) _requires_sni = _make_requires( _lib.Cryptography_HAS_TLSEXT_HOSTNAME, "SNI not available" ) class Session(object): """ A class representing an SSL session. A session defines certain connection parameters which may be re-used to speed up the setup of subsequent connections. .. versionadded:: 0.14 """ pass class Context(object): """ :class:`OpenSSL.SSL.Context` instances define the parameters for setting up new SSL connections. :param method: One of SSLv2_METHOD, SSLv3_METHOD, SSLv23_METHOD, or TLSv1_METHOD. """ _methods = { SSLv2_METHOD: "SSLv2_method", SSLv3_METHOD: "SSLv3_method", SSLv23_METHOD: "SSLv23_method", TLSv1_METHOD: "TLSv1_method", TLSv1_1_METHOD: "TLSv1_1_method", TLSv1_2_METHOD: "TLSv1_2_method", } _methods = dict( (identifier, getattr(_lib, name)) for (identifier, name) in _methods.items() if getattr(_lib, name, None) is not None) def __init__(self, method): if not isinstance(method, integer_types): raise TypeError("method must be an integer") try: method_func = self._methods[method] except KeyError: raise ValueError("No such protocol") method_obj = method_func() _openssl_assert(method_obj != _ffi.NULL) context = _lib.SSL_CTX_new(method_obj) _openssl_assert(context != _ffi.NULL) context = _ffi.gc(context, _lib.SSL_CTX_free) # If SSL_CTX_set_ecdh_auto is available then set it so the ECDH curve # will be auto-selected. This function was added in 1.0.2 and made a # noop in 1.1.0+ (where it is set automatically). try: res = _lib.SSL_CTX_set_ecdh_auto(context, 1) _openssl_assert(res == 1) except AttributeError: pass self._context = context self._passphrase_helper = None self._passphrase_callback = None self._passphrase_userdata = None self._verify_helper = None self._verify_callback = None self._info_callback = None self._tlsext_servername_callback = None self._app_data = None self._npn_advertise_helper = None self._npn_advertise_callback = None self._npn_select_helper = None self._npn_select_callback = None self._alpn_select_helper = None self._alpn_select_callback = None self._ocsp_helper = None self._ocsp_callback = None self._ocsp_data = None self.set_mode(_lib.SSL_MODE_ENABLE_PARTIAL_WRITE) 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 included with OpenSSL. Either, but not both, of *pemfile* or *capath* may be :data:`None`. :param cafile: In which file we can find the certificates (``bytes`` or ``unicode``). :param capath: In which directory we can find the certificates (``bytes`` or ``unicode``). :return: None """ if cafile is None: cafile = _ffi.NULL else: cafile = _path_string(cafile) if capath is None: capath = _ffi.NULL else: capath = _path_string(capath) load_result = _lib.SSL_CTX_load_verify_locations( self._context, cafile, capath ) if not load_result: _raise_current_error() def _wrap_callback(self, callback): @wraps(callback) def wrapper(size, verify, userdata): return callback(size, verify, self._passphrase_userdata) return _PassphraseHelper( FILETYPE_PEM, wrapper, more_args=True, truncate=True) 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 giving the maximum length of the passphrase it may return. If the returned passphrase is longer than this, it will be truncated. Second, a boolean value which will be true if the user should be prompted for the passphrase twice and the callback should verify that the two values supplied are equal. Third, the value given as the *userdata* parameter to :meth:`set_passwd_cb`. The *callback* must return a byte string. If an error occurs, *callback* should return a false value (e.g. an empty string). :param userdata: (optional) A Python object which will be given as argument to the callback :return: None """ if not callable(callback): raise TypeError("callback must be callable") self._passphrase_helper = self._wrap_callback(callback) self._passphrase_callback = self._passphrase_helper.callback _lib.SSL_CTX_set_default_passwd_cb( self._context, self._passphrase_callback) self._passphrase_userdata = userdata 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 certificates using this method if the user has the ``openssl@1.1`` `Homebrew `_ formula installed in the default location. * Windows will not work. * manylinux1 cryptography wheels will work on most common Linux distributions in pyOpenSSL 17.1.0 and above. pyOpenSSL detects the manylinux1 wheel and attempts to load roots via a fallback path. :return: None """ # 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_result = _lib.SSL_CTX_set_default_verify_paths(self._context) _openssl_assert(set_result == 1) # After attempting to set default_verify_paths we need to know whether # to go down the fallback path. # First we'll check to see if any env vars have been set. If so, # we won't try to do anything else because the user has set the path # themselves. dir_env_var = _ffi.string( _lib.X509_get_default_cert_dir_env() ).decode("ascii") file_env_var = _ffi.string( _lib.X509_get_default_cert_file_env() ).decode("ascii") if not self._check_env_vars_set(dir_env_var, file_env_var): default_dir = _ffi.string(_lib.X509_get_default_cert_dir()) default_file = _ffi.string(_lib.X509_get_default_cert_file()) # Now we check to see if the default_dir and default_file are set # to the exact values we use in our manylinux1 builds. If they are # then we know to load the fallbacks if ( default_dir == _CRYPTOGRAPHY_MANYLINUX1_CA_DIR and default_file == _CRYPTOGRAPHY_MANYLINUX1_CA_FILE ): # This is manylinux1, let's load our fallback paths self._fallback_default_verify_paths( _CERTIFICATE_FILE_LOCATIONS, _CERTIFICATE_PATH_LOCATIONS ) 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 _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 predefined set of paths and attempt to load roots from there. :return: None """ for cafile in file_path: if os.path.isfile(cafile): self.load_verify_locations(cafile) break for capath in dir_path: if os.path.isdir(capath): self.load_verify_locations(None, capath) break 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) result = _lib.SSL_CTX_use_certificate_chain_file( self._context, certfile ) if not result: _raise_current_error() 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:`FILETYPE_PEM` or :const:`FILETYPE_ASN1`. The default is :const:`FILETYPE_PEM`. :return: None """ certfile = _path_string(certfile) if not isinstance(filetype, integer_types): raise TypeError("filetype must be an integer") use_result = _lib.SSL_CTX_use_certificate_file( self._context, certfile, filetype ) if not use_result: _raise_current_error() 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._context, cert._x509) if not use_result: _raise_current_error() 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.X509_dup(certobj._x509) add_result = _lib.SSL_CTX_add_extra_chain_cert(self._context, copy) if not add_result: # TODO: This is untested. _lib.X509_free(copy) _raise_current_error() def _raise_passphrase_exception(self): if self._passphrase_helper is not None: self._passphrase_helper.raise_if_problem(Error) _raise_current_error() 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:`FILETYPE_ASN1`. The default is :const:`FILETYPE_PEM`. :return: None """ keyfile = _path_string(keyfile) if filetype is _UNSPECIFIED: filetype = FILETYPE_PEM elif not isinstance(filetype, integer_types): raise TypeError("filetype must be an integer") use_result = _lib.SSL_CTX_use_PrivateKey_file( self._context, keyfile, filetype) if not use_result: self._raise_passphrase_exception() 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._context, pkey._pkey) if not use_result: self._raise_passphrase_exception() def check_privatekey(self): """ Check if the private key (loaded with :meth:`use_privatekey`) matches the certificate (loaded with :meth:`use_certificate`) :return: :data:`None` (raises :exc:`Error` if something's wrong) """ if not _lib.SSL_CTX_check_private_key(self._context): _raise_current_error() 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. :return: None """ ca_list = _lib.SSL_load_client_CA_file( _text_to_bytes_and_warn("cafile", cafile) ) _openssl_assert(ca_list != _ffi.NULL) _lib.SSL_CTX_set_client_CA_list(self._context, ca_list) 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. :param bytes buf: The session id. :returns: None """ buf = _text_to_bytes_and_warn("buf", buf) _openssl_assert( _lib.SSL_CTX_set_session_id_context( self._context, buf, len(buf), ) == 1 ) 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 (combine using bitwise or) :returns: The previously set caching mode. .. versionadded:: 0.14 """ if not isinstance(mode, integer_types): raise TypeError("mode must be an integer") return _lib.SSL_CTX_set_session_cache_mode(self._context, mode) def get_session_cache_mode(self): """ Get the current session cache mode. :returns: The currently used cache mode. .. versionadded:: 0.14 """ return _lib.SSL_CTX_get_session_cache_mode(self._context) 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 :const:`VERIFY_PEER` is used, *mode* can be OR:ed with :const:`VERIFY_FAIL_IF_NO_PEER_CERT` and :const:`VERIFY_CLIENT_ONCE` to further control the behaviour. :param callback: The Python callback to use. This should take five arguments: A Connection object, an X509 object, and three integer variables, which are in turn potential error number, error depth and return code. *callback* should return True if verification passes and False otherwise. :return: None See SSL_CTX_set_verify(3SSL) for further details. """ if not isinstance(mode, integer_types): raise TypeError("mode must be an integer") if not callable(callback): raise TypeError("callback must be callable") self._verify_helper = _VerifyHelper(callback) self._verify_callback = self._verify_helper.callback _lib.SSL_CTX_set_verify(self._context, mode, self._verify_callback) 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): raise TypeError("depth must be an integer") _lib.SSL_CTX_set_verify_depth(self._context, depth) def get_verify_mode(self): """ Retrieve the Context object's verify mode, as set by :meth:`set_verify`. :return: The verify mode """ return _lib.SSL_CTX_get_verify_mode(self._context) def get_verify_depth(self): """ Retrieve the Context object's verify depth, as set by :meth:`set_verify_depth`. :return: The verify depth """ return _lib.SSL_CTX_get_verify_depth(self._context) 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") if bio == _ffi.NULL: _raise_current_error() bio = _ffi.gc(bio, _lib.BIO_free) dh = _lib.PEM_read_bio_DHparams(bio, _ffi.NULL, _ffi.NULL, _ffi.NULL) dh = _ffi.gc(dh, _lib.DH_free) _lib.SSL_CTX_set_tmp_dh(self._context, dh) def set_tmp_ecdh(self, curve): """ Select a curve to use for ECDHE key exchange. :param curve: A curve object to use as returned by either :meth:`OpenSSL.crypto.get_elliptic_curve` or :meth:`OpenSSL.crypto.get_elliptic_curves`. :return: None """ _lib.SSL_CTX_set_tmp_ecdh(self._context, curve._to_EC_KEY()) 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 = _text_to_bytes_and_warn("cipher_list", cipher_list) if not isinstance(cipher_list, bytes): raise TypeError("cipher_list must be a byte string.") _openssl_assert( _lib.SSL_CTX_set_cipher_list(self._context, cipher_list) == 1 ) # In OpenSSL 1.1.1 setting the cipher list will always return TLS 1.3 # ciphers even if you pass an invalid cipher. Applications (like # Twisted) have tests that depend on an error being raised if an # invalid cipher string is passed, but without the following check # for the TLS 1.3 specific cipher suites it would never error. tmpconn = Connection(self, None) _openssl_assert( tmpconn.get_cipher_list() != [ 'TLS_AES_256_GCM_SHA384', 'TLS_CHACHA20_POLY1305_SHA256', 'TLS_AES_128_GCM_SHA256' ] ) 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_authorities: a sequence of X509Names. :return: None .. versionadded:: 0.10 """ name_stack = _lib.sk_X509_NAME_new_null() _openssl_assert(name_stack != _ffi.NULL) try: for ca_name in certificate_authorities: if not isinstance(ca_name, X509Name): raise TypeError( "client CAs must be X509Name objects, not %s " "objects" % ( type(ca_name).__name__, ) ) copy = _lib.X509_NAME_dup(ca_name._name) _openssl_assert(copy != _ffi.NULL) push_result = _lib.sk_X509_NAME_push(name_stack, copy) if not push_result: _lib.X509_NAME_free(copy) _raise_current_error() except Exception: _lib.sk_X509_NAME_free(name_stack) raise _lib.SSL_CTX_set_client_CA_list(self._context, name_stack) 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: certificate authority's X509 certificate. :return: None .. versionadded:: 0.10 """ if not isinstance(certificate_authority, X509): raise TypeError("certificate_authority must be an X509 instance") add_result = _lib.SSL_CTX_add_client_CA( self._context, certificate_authority._x509) _openssl_assert(add_result == 1) 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) seconds :return: The previous session timeout """ if not isinstance(timeout, integer_types): raise TypeError("timeout must be an integer") return _lib.SSL_CTX_set_timeout(self._context, timeout) def get_timeout(self): """ Retrieve session timeout, as set by :meth:`set_timeout`. The default is 300 seconds. :return: The session timeout """ return _lib.SSL_CTX_get_timeout(self._context) 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. The first integer specifies where in the SSL handshake the function was called, and the other the return code from a (possibly failed) internal function call. :return: None """ @wraps(callback) def wrapper(ssl, where, return_code): callback(Connection._reverse_mapping[ssl], where, return_code) self._info_callback = _ffi.callback( "void (*)(const SSL *, int, int)", wrapper) _lib.SSL_CTX_set_info_callback(self._context, self._info_callback) def get_app_data(self): """ Get the application data (supplied via :meth:`set_app_data()`) :return: The application data """ return self._app_data def set_app_data(self, data): """ Set the application data (will be returned from get_app_data()) :param data: Any Python object :return: None """ self._app_data = data 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_cert_store(self._context) if store == _ffi.NULL: # TODO: This is untested. return None pystore = X509Store.__new__(X509Store) pystore._store = store return pystore 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): raise TypeError("options must be an integer") return _lib.SSL_CTX_set_options(self._context, options) 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): raise TypeError("mode must be an integer") return _lib.SSL_CTX_set_mode(self._context, mode) @_requires_sni 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 """ @wraps(callback) def wrapper(ssl, alert, arg): callback(Connection._reverse_mapping[ssl]) return 0 self._tlsext_servername_callback = _ffi.callback( "int (*)(SSL *, int *, void *)", wrapper) _lib.SSL_CTX_set_tlsext_servername_callback( self._context, self._tlsext_servername_callback) 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 isinstance(profiles, bytes): raise TypeError("profiles must be a byte string.") _openssl_assert( _lib.SSL_CTX_set_tlsext_use_srtp(self._context, profiles) == 0 ) @_requires_npn def set_npn_advertise_callback(self, callback): """ Specify a callback function that will be called when offering `Next Protocol Negotiation `_ as a server. :param callback: The callback function. It will be invoked with one argument, the :class:`Connection` instance. It should return a list of bytestrings representing the advertised protocols, like ``[b'http/1.1', b'spdy/2']``. .. versionadded:: 0.15 """ self._npn_advertise_helper = _NpnAdvertiseHelper(callback) self._npn_advertise_callback = self._npn_advertise_helper.callback _lib.SSL_CTX_set_next_protos_advertised_cb( self._context, self._npn_advertise_callback, _ffi.NULL) @_requires_npn 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 protocols as bytestrings, e.g. ``[b'http/1.1', b'spdy/2']``. It should return one of those bytestrings, the chosen protocol. .. versionadded:: 0.15 """ self._npn_select_helper = _NpnSelectHelper(callback) self._npn_select_callback = self._npn_select_helper.callback _lib.SSL_CTX_set_next_proto_select_cb( self._context, self._npn_select_callback, _ffi.NULL) @_requires_alpn 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 should be a Python list of bytestrings representing the protocols to offer, e.g. ``[b'http/1.1', b'spdy/2']``. """ # Take the list of protocols and join them together, prefixing them # with their lengths. protostr = b''.join( chain.from_iterable((int2byte(len(p)), p) for p in protos) ) # Build a C string from the list. We don't need to save this off # because OpenSSL immediately copies the data out. input_str = _ffi.new("unsigned char[]", protostr) _lib.SSL_CTX_set_alpn_protos(self._context, input_str, len(protostr)) @_requires_alpn 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 protocols as bytestrings, e.g ``[b'http/1.1', b'spdy/2']``. It should return one of those bytestrings, the chosen protocol. """ self._alpn_select_helper = _ALPNSelectHelper(callback) self._alpn_select_callback = self._alpn_select_helper.callback _lib.SSL_CTX_set_alpn_select_cb( self._context, self._alpn_select_callback, _ffi.NULL) 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 data is None: self._ocsp_data = _ffi.NULL else: self._ocsp_data = _ffi.new_handle(data) rc = _lib.SSL_CTX_set_tlsext_status_cb( self._context, self._ocsp_callback ) _openssl_assert(rc == 1) rc = _lib.SSL_CTX_set_tlsext_status_arg(self._context, self._ocsp_data) _openssl_assert(rc == 1) 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 data you have provided. The callback must return a bytestring that contains the OCSP data to staple to the handshake. If no OCSP data is available for this connection, return the empty bytestring. :param data: Some opaque data that will be passed into the callback function when called. This can be used to avoid needing to do complex data lookups or to keep track of what context is being used. This parameter is optional. """ helper = _OCSPServerCallbackHelper(callback) self._set_ocsp_callback(helper, data) 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 stapled OCSP assertion, and the optional arbitrary data you have provided. The callback must return a boolean that indicates the result of validating the OCSP data: ``True`` if the OCSP data is valid and the certificate can be trusted, or ``False`` if either the OCSP data is invalid or the certificate has been revoked. :param data: Some opaque data that will be passed into the callback function when called. This can be used to avoid needing to do complex data lookups or to keep track of what context is being used. This parameter is optional. """ helper = _OCSPClientCallbackHelper(callback) self._set_ocsp_callback(helper, data) ContextType = deprecated( Context, __name__, "ContextType has been deprecated, use Context instead", DeprecationWarning ) class Connection(object): """ """ _reverse_mapping = WeakValueDictionary() def __init__(self, context, socket=None): """ Create a new Connection object, using the given OpenSSL.SSL.Context instance and socket. :param context: An SSL Context to use for this connection :param socket: The socket to use for transport layer """ if not isinstance(context, Context): raise TypeError("context must be a Context instance") ssl = _lib.SSL_new(context._context) self._ssl = _ffi.gc(ssl, _lib.SSL_free) # We set SSL_MODE_AUTO_RETRY to handle situations where OpenSSL returns # an SSL_ERROR_WANT_READ when processing a non-application data packet # even though there is still data on the underlying transport. # See https://github.com/openssl/openssl/issues/6234 for more details. _lib.SSL_set_mode(self._ssl, _lib.SSL_MODE_AUTO_RETRY) self._context = context self._app_data = None # References to strings used for Next Protocol Negotiation. OpenSSL's # header files suggest that these might get copied at some point, but # doesn't specify when, so we store them here to make sure they don't # get freed before OpenSSL uses them. self._npn_advertise_callback_args = None self._npn_select_callback_args = None # References to strings used for Application Layer Protocol # Negotiation. These strings get copied at some point but it's well # after the callback returns, so we have to hang them somewhere to # avoid them getting freed. self._alpn_select_callback_args = None self._reverse_mapping[self._ssl] = self if socket is None: self._socket = None # Don't set up any gc for these, SSL_free will take care of them. self._into_ssl = _lib.BIO_new(_lib.BIO_s_mem()) _openssl_assert(self._into_ssl != _ffi.NULL) self._from_ssl = _lib.BIO_new(_lib.BIO_s_mem()) _openssl_assert(self._from_ssl != _ffi.NULL) _lib.SSL_set_bio(self._ssl, self._into_ssl, self._from_ssl) else: self._into_ssl = None self._from_ssl = None self._socket = socket set_result = _lib.SSL_set_fd( self._ssl, _asFileDescriptor(self._socket)) _openssl_assert(set_result == 1) def __getattr__(self, name): """ Look up attributes on the wrapped socket object if they are not found on the Connection object. """ if self._socket is None: raise AttributeError("'%s' object has no attribute '%s'" % ( self.__class__.__name__, name )) else: return getattr(self._socket, name) def _raise_ssl_error(self, ssl, result): if self._context._verify_helper is not None: self._context._verify_helper.raise_if_problem() if self._context._npn_advertise_helper is not None: self._context._npn_advertise_helper.raise_if_problem() if self._context._npn_select_helper is not None: self._context._npn_select_helper.raise_if_problem() if self._context._alpn_select_helper is not None: self._context._alpn_select_helper.raise_if_problem() if self._context._ocsp_helper is not None: self._context._ocsp_helper.raise_if_problem() error = _lib.SSL_get_error(ssl, result) if error == _lib.SSL_ERROR_WANT_READ: raise WantReadError() elif error == _lib.SSL_ERROR_WANT_WRITE: raise WantWriteError() elif error == _lib.SSL_ERROR_ZERO_RETURN: raise ZeroReturnError() elif error == _lib.SSL_ERROR_WANT_X509_LOOKUP: # TODO: This is untested. raise WantX509LookupError() elif error == _lib.SSL_ERROR_SYSCALL: if _lib.ERR_peek_error() == 0: if result < 0: if platform == "win32": errno = _ffi.getwinerror()[0] else: errno = _ffi.errno if errno != 0: raise SysCallError(errno, errorcode.get(errno)) raise SysCallError(-1, "Unexpected EOF") else: # TODO: This is untested. _raise_current_error() elif error == _lib.SSL_ERROR_NONE: pass else: _raise_current_error() def get_context(self): """ Retrieve the :class:`Context` object associated with this :class:`Connection`. """ return self._context 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 instance") _lib.SSL_set_SSL_CTX(self._ssl, context._context) self._context = context @_requires_sni 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( self._ssl, _lib.TLSEXT_NAMETYPE_host_name ) if name == _ffi.NULL: return None return _ffi.string(name) @_requires_sni 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 string") elif b"\0" in name: raise TypeError("name must not contain NUL byte") # XXX I guess this can fail sometimes? _lib.SSL_set_tlsext_host_name(self._ssl, name) def pending(self): """ Get the number of bytes that can be safely read from the SSL buffer (**not** the underlying transport buffer). :return: The number of bytes available in the receive buffer. """ return _lib.SSL_pending(self._ssl) 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: (optional) Included for compatibility with the socket API, the value is ignored :return: The number of bytes written """ # Backward compatibility buf = _text_to_bytes_and_warn("buf", buf) if isinstance(buf, memoryview): buf = buf.tobytes() if isinstance(buf, _buffer): buf = str(buf) if not isinstance(buf, bytes): raise TypeError("data must be a memoryview, buffer or byte string") if len(buf) > 2147483647: raise ValueError("Cannot send more than 2**31-1 bytes at once.") result = _lib.SSL_write(self._ssl, buf, len(buf)) self._raise_ssl_error(self._ssl, result) return result write = send 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: (optional) Included for compatibility with the socket API, the value is ignored :return: The number of bytes written """ buf = _text_to_bytes_and_warn("buf", buf) if isinstance(buf, memoryview): buf = buf.tobytes() if isinstance(buf, _buffer): buf = str(buf) if not isinstance(buf, bytes): raise TypeError("buf must be a memoryview, buffer or byte string") left_to_send = len(buf) total_sent = 0 data = _ffi.new("char[]", buf) while left_to_send: # SSL_write's num arg is an int, # so we cannot send more than 2**31-1 bytes at once. result = _lib.SSL_write( self._ssl, data + total_sent, min(left_to_send, 2147483647) ) self._raise_ssl_error(self._ssl, result) total_sent += result left_to_send -= result 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 """ buf = _no_zero_allocator("char[]", bufsiz) if flags is not None and flags & socket.MSG_PEEK: result = _lib.SSL_peek(self._ssl, buf, bufsiz) else: result = _lib.SSL_read(self._ssl, buf, bufsiz) self._raise_ssl_error(self._ssl, result) return _ffi.buffer(buf, result)[:] read = recv 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 the buffer. If not present, defaults to the size of the buffer. If larger than the size of the buffer, is reduced to the size of the buffer. :param flags: (optional) The only supported flag is ``MSG_PEEK``, all other flags are ignored. :return: The number of bytes read into the buffer. """ if nbytes is None: nbytes = len(buffer) else: nbytes = min(nbytes, len(buffer)) # We need to create a temporary buffer. This is annoying, it would be # better if we could pass memoryviews straight into the SSL_read call, # but right now we can't. Revisit this if CFFI gets that ability. buf = _no_zero_allocator("char[]", nbytes) if flags is not None and flags & socket.MSG_PEEK: result = _lib.SSL_peek(self._ssl, buf, nbytes) else: result = _lib.SSL_read(self._ssl, buf, nbytes) self._raise_ssl_error(self._ssl, result) # This strange line is all to avoid a memory copy. The buffer protocol # should allow us to assign a CFFI buffer to the LHS of this line, but # on CPython 3.3+ that segfaults. As a workaround, we can temporarily # wrap it in a memoryview. buffer[:result] = memoryview(_ffi.buffer(buf, result)) return result def _handle_bio_errors(self, bio, result): if _lib.BIO_should_retry(bio): if _lib.BIO_should_read(bio): raise WantReadError() elif _lib.BIO_should_write(bio): # TODO: This is untested. raise WantWriteError() elif _lib.BIO_should_io_special(bio): # TODO: This is untested. I think io_special means the socket # BIO has a not-yet connected socket. raise ValueError("BIO_should_io_special") else: # TODO: This is untested. raise ValueError("unknown bio failure") else: # TODO: This is untested. _raise_current_error() 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 Connection will be able to take no further actions. :param bufsiz: The maximum number of bytes to read :return: The string read. """ if self._from_ssl is None: raise TypeError("Connection sock was not None") if not isinstance(bufsiz, integer_types): raise TypeError("bufsiz must be an integer") buf = _no_zero_allocator("char[]", bufsiz) result = _lib.BIO_read(self._from_ssl, buf, bufsiz) if result <= 0: self._handle_bio_errors(self._from_ssl, result) return _ffi.buffer(buf, result)[:] 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 put into the memory BIO. :return: The number of bytes written """ buf = _text_to_bytes_and_warn("buf", buf) if self._into_ssl is None: raise TypeError("Connection sock was not None") result = _lib.BIO_write(self._into_ssl, buf, len(buf)) if result <= 0: self._handle_bio_errors(self._into_ssl, result) return result 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 return False 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.SSL_do_handshake(self._ssl) self._raise_ssl_error(self._ssl, result) def renegotiate_pending(self): """ Check if there's a renegotiation in progress, it will return False once a renegotiation is finished. :return: Whether there's a renegotiation in progress :rtype: bool """ return _lib.SSL_renegotiate_pending(self._ssl) == 1 def total_renegotiations(self): """ Find out the total number of renegotiations. :return: The number of renegotiations. :rtype: int """ return _lib.SSL_total_renegotiations(self._ssl) 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 method returns """ _lib.SSL_set_connect_state(self._ssl) return self._socket.connect(addr) 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 be initialized. :param addr: A remove address :return: What the socket's connect_ex method returns """ connect_ex = self._socket.connect_ex self.set_connect_state() return connect_ex(addr) 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:`Connection` object created, and *address* is as returned by the socket's :meth:`accept`. """ client, addr = self._socket.accept() conn = Connection(self._context, client) conn.set_accept_state() return (conn, addr) def bio_shutdown(self): """ If the Connection was created with a memory BIO, this method can be used to indicate that *end of file* has been reached on the read end of that memory BIO. :return: None """ if self._from_ssl is None: raise TypeError("Connection sock was not None") _lib.BIO_set_mem_eof_return(self._into_ssl, 0) 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 becomes readable/writeable). """ result = _lib.SSL_shutdown(self._ssl) if result < 0: self._raise_ssl_error(self._ssl, result) elif result > 0: return True else: return False 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: break ciphers.append(_native(_ffi.string(result))) return ciphers 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`'s :class:`Context`. If this is a client connection, the list will be empty until the connection with the server is established. .. versionadded:: 0.10 """ ca_names = _lib.SSL_get_client_CA_list(self._ssl) if ca_names == _ffi.NULL: # TODO: This is untested. return [] result = [] for i in range(_lib.sk_X509_NAME_num(ca_names)): name = _lib.sk_X509_NAME_value(ca_names, i) copy = _lib.X509_NAME_dup(name) _openssl_assert(copy != _ffi.NULL) pyname = X509Name.__new__(X509Name) pyname._name = _ffi.gc(copy, _lib.X509_NAME_free) result.append(pyname) return result def makefile(self, *args, **kwargs): """ The makefile() method is not implemented, since there is no dup semantics for SSL connections :raise: NotImplementedError """ raise NotImplementedError( "Cannot make file object of OpenSSL.SSL.Connection") def get_app_data(self): """ Retrieve application data as set by :meth:`set_app_data`. :return: The application data """ return self._app_data def set_app_data(self, data): """ Set application data :param data: The application data :return: None """ self._app_data = data def get_shutdown(self): """ Get the shutdown state of the Connection. :return: The shutdown state, a bitvector of SENT_SHUTDOWN, RECEIVED_SHUTDOWN. """ return _lib.SSL_get_shutdown(self._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_shutdown(self._ssl, state) def get_state_string(self): """ Retrieve a verbose string detailing the state of the Connection. :return: A string representing the state :rtype: bytes """ return _ffi.string(_lib.SSL_state_string_long(self._ssl)) 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(self._ssl, _ffi.NULL, 0) assert length > 0 outp = _no_zero_allocator("unsigned char[]", length) _lib.SSL_get_server_random(self._ssl, outp, length) return _ffi.buffer(outp, length)[:] 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(self._ssl, _ffi.NULL, 0) assert length > 0 outp = _no_zero_allocator("unsigned char[]", length) _lib.SSL_get_client_random(self._ssl, outp, length) return _ffi.buffer(outp, length)[:] 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(session, _ffi.NULL, 0) assert length > 0 outp = _no_zero_allocator("unsigned char[]", length) _lib.SSL_SESSION_get_master_key(session, outp, length) return _ffi.buffer(outp, length)[:] 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 context value :return: the exported key material bytes or None """ outp = _no_zero_allocator("unsigned char[]", olen) context_buf = _ffi.NULL context_len = 0 use_context = 0 if context is not None: context_buf = context context_len = len(context) use_context = 1 success = _lib.SSL_export_keying_material(self._ssl, outp, olen, label, len(label), context_buf, context_len, use_context) _openssl_assert(success == 1) return _ffi.buffer(outp, olen)[:] def sock_shutdown(self, *args, **kwargs): """ Call the :meth:`shutdown` method of the underlying socket. See :manpage:`shutdown(2)`. :return: What the socket's shutdown() method returns """ return self._socket.shutdown(*args, **kwargs) 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 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 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_stack == _ffi.NULL: return None result = [] for i in range(_lib.sk_X509_num(cert_stack)): # TODO could incref instead of dup here cert = _lib.X509_dup(_lib.sk_X509_value(cert_stack, i)) pycert = X509._from_raw_x509_ptr(cert) result.append(pycert) return result def want_read(self): """ Checks if more data has to be read from the transport layer to complete an operation. :return: True iff more data has to be read """ return _lib.SSL_want_read(self._ssl) def want_write(self): """ Checks if there is data to write to the transport layer to complete an operation. :return: True iff there is data to write """ return _lib.SSL_want_write(self._ssl) def set_accept_state(self): """ Set the connection to work in server mode. The handshake will be handled automatically by read/write. :return: None """ _lib.SSL_set_accept_state(self._ssl) def set_connect_state(self): """ Set the connection to work in client mode. The handshake will be handled automatically by read/write. :return: None """ _lib.SSL_set_connect_state(self._ssl) 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: return None pysession = Session.__new__(Session) pysession._session = _ffi.gc(session, _lib.SSL_SESSION_free) return pysession 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): raise TypeError("session must be a Session instance") result = _lib.SSL_set_session(self._ssl, session._session) if not result: _raise_current_error() 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 received, otherwise the contents of the message. :rtype: :class:`bytes` or :class:`NoneType` """ # 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 # implementation reveals that it calls memcpy() unconditionally. # Section 7.1.4, paragraph 1 of the C standard suggests that # memcpy(NULL, source, 0) is not guaranteed to produce defined (let # alone desirable) behavior (though it probably does on just about # every implementation...) # # Allocate a tiny buffer to pass in (instead of just passing NULL as # one might expect) for the initial call so as to be safe against this # potentially undefined behavior. empty = _ffi.new("char[]", 0) size = function(self._ssl, empty, 0) if size == 0: # No Finished message so far. return None buf = _no_zero_allocator("char[]", size) function(self._ssl, buf, size) return _ffi.buffer(buf, size)[:] def get_finished(self): """ Obtain the latest TLS Finished message that we sent. :return: The contents of the message or :obj:`None` if the TLS handshake has not yet completed. :rtype: :class:`bytes` or :class:`NoneType` .. versionadded:: 0.15 """ return self._get_finished_message(_lib.SSL_get_finished) def get_peer_finished(self): """ Obtain the latest TLS Finished message that we received from the peer. :return: The contents of the message or :obj:`None` if the TLS handshake has not yet completed. :rtype: :class:`bytes` or :class:`NoneType` .. versionadded:: 0.15 """ return self._get_finished_message(_lib.SSL_get_peer_finished) 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 """ cipher = _lib.SSL_get_current_cipher(self._ssl) if cipher == _ffi.NULL: return None else: name = _ffi.string(_lib.SSL_CIPHER_get_name(cipher)) return name.decode("utf-8") 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` .. versionadded:: 0.15 """ cipher = _lib.SSL_get_current_cipher(self._ssl) if cipher == _ffi.NULL: return None else: return _lib.SSL_CIPHER_get_bits(cipher, _ffi.NULL) 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:: 0.15 """ cipher = _lib.SSL_get_current_cipher(self._ssl) if cipher == _ffi.NULL: return None else: version = _ffi.string(_lib.SSL_CIPHER_get_version(cipher)) return version.decode("utf-8") 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 established. :rtype: :class:`unicode` """ version = _ffi.string(_lib.SSL_get_version(self._ssl)) return version.decode("utf-8") def get_protocol_version(self): """ Retrieve the SSL or TLS protocol version of the current connection. :returns: The TLS version of the current connection. For example, it will return ``0x769`` for connections made over TLS version 1. :rtype: :class:`int` """ version = _lib.SSL_version(self._ssl) return version @_requires_npn 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 """ data = _ffi.new("unsigned char **") data_len = _ffi.new("unsigned int *") _lib.SSL_get0_next_proto_negotiated(self._ssl, data, data_len) return _ffi.buffer(data[0], data_len[0])[:] @_requires_alpn 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 representing the protocols to offer, e.g. ``[b'http/1.1', b'spdy/2']``. """ # Take the list of protocols and join them together, prefixing them # with their lengths. protostr = b''.join( chain.from_iterable((int2byte(len(p)), p) for p in protos) ) # Build a C string from the list. We don't need to save this off # because OpenSSL immediately copies the data out. input_str = _ffi.new("unsigned char[]", protostr) _lib.SSL_set_alpn_protos(self._ssl, input_str, len(protostr)) @_requires_alpn 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("unsigned int *") _lib.SSL_get0_alpn_selected(self._ssl, data, data_len) if not data_len: return b'' return _ffi.buffer(data[0], data_len[0])[:] 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`. """ rc = _lib.SSL_set_tlsext_status_type( self._ssl, _lib.TLSEXT_STATUSTYPE_ocsp ) _openssl_assert(rc == 1) ConnectionType = deprecated( Connection, __name__, "ConnectionType has been deprecated, use Connection instead", DeprecationWarning ) # This is similar to the initialization calls at the end of OpenSSL/crypto.py # but is exercised mostly by the Context initializer. _lib.SSL_library_init() PK}S]}Srr version.pynu[# Copyright (C) AB Strakt # Copyright (C) Jean-Paul Calderone # See LICENSE for details. """ pyOpenSSL - A simple wrapper around the OpenSSL library """ __all__ = [ "__author__", "__copyright__", "__email__", "__license__", "__summary__", "__title__", "__uri__", "__version__", ] __version__ = "19.0.0" __title__ = "pyOpenSSL" __uri__ = "https://pyopenssl.org/" __summary__ = "Python wrapper module around the OpenSSL library" __author__ = "The pyOpenSSL developers" __email__ = "cryptography-dev@python.org" __license__ = "Apache License, Version 2.0" __copyright__ = "Copyright 2001-2017 {0}".format(__author__) PK}S]F[NN_util.pynu[import sys import warnings from six import PY3, binary_type, text_type from cryptography.hazmat.bindings.openssl.binding import Binding binding = Binding() binding.init_static_locks() ffi = binding.ffi lib = binding.lib # This is a special CFFI allocator that does not bother to zero its memory # after allocation. This has vastly better performance on large allocations and # so should be used whenever we don't need the memory zeroed out. no_zero_allocator = ffi.new_allocator(should_clear_after_alloc=False) def text(charp): """ Get a native string type representing of the given CFFI ``char*`` object. :param charp: A C-style string represented using CFFI. :return: :class:`str` """ if not charp: return "" return native(ffi.string(charp)) def exception_from_error_queue(exception_type): """ Convert an OpenSSL library failure into a Python exception. When a call to the native OpenSSL library fails, this is usually signalled by the return value, and an error code is stored in an error queue associated with the current thread. The err library provides functions to obtain these error codes and textual error messages. """ errors = [] while True: error = lib.ERR_get_error() if error == 0: break errors.append(( text(lib.ERR_lib_error_string(error)), text(lib.ERR_func_error_string(error)), text(lib.ERR_reason_error_string(error)))) raise exception_type(errors) def make_assert(error): """ Create an assert function that uses :func:`exception_from_error_queue` to raise an exception wrapped by *error*. """ def openssl_assert(ok): """ If *ok* is not True, retrieve the error from OpenSSL and raise it. """ if ok is not True: exception_from_error_queue(error) return openssl_assert def native(s): """ Convert :py:class:`bytes` or :py:class:`unicode` to the native :py:class:`str` type, using UTF-8 encoding if conversion is necessary. :raise UnicodeError: The input string is not UTF-8 decodeable. :raise TypeError: The input is neither :py:class:`bytes` nor :py:class:`unicode`. """ if not isinstance(s, (binary_type, text_type)): raise TypeError("%r is neither bytes nor unicode" % s) if PY3: if isinstance(s, binary_type): return s.decode("utf-8") else: if isinstance(s, text_type): return s.encode("utf-8") return s def path_string(s): """ Convert a Python string to a :py:class:`bytes` string identifying the same path and which can be passed into an OpenSSL API accepting a filename. :param s: An instance of :py:class:`bytes` or :py:class:`unicode`. :return: An instance of :py:class:`bytes`. """ if isinstance(s, binary_type): return s elif isinstance(s, text_type): return s.encode(sys.getfilesystemencoding()) else: raise TypeError("Path must be represented as bytes or unicode string") if PY3: def byte_string(s): return s.encode("charmap") else: def byte_string(s): return s # A marker object to observe whether some optional arguments are passed any # value or not. UNSPECIFIED = object() _TEXT_WARNING = ( text_type.__name__ + " for {0} is no longer accepted, use bytes" ) def text_to_bytes_and_warn(label, obj): """ If ``obj`` is text, emit a warning that it should be bytes instead and try to convert it to bytes automatically. :param str label: The name of the parameter from which ``obj`` was taken (so a developer can easily find the source of the problem and correct it). :return: If ``obj`` is the text string type, a ``bytes`` object giving the UTF-8 encoding of that text is returned. Otherwise, ``obj`` itself is returned. """ if isinstance(obj, text_type): warnings.warn( _TEXT_WARNING.format(label), category=DeprecationWarning, stacklevel=3 ) return obj.encode('utf-8') return obj PK}S]+\ __init__.pynu[# Copyright (C) AB Strakt # See LICENSE for details. """ pyOpenSSL - A simple wrapper around the OpenSSL library """ from OpenSSL import crypto, SSL from OpenSSL.version import ( __author__, __copyright__, __email__, __license__, __summary__, __title__, __uri__, __version__, ) __all__ = [ "SSL", "crypto", "__author__", "__copyright__", "__email__", "__license__", "__summary__", "__title__", "__uri__", "__version__", ] PKI ]mu11KDF/KDFError/cdesc-KDFError.rinu[U:RDoc::NormalClass[iI" KDFError:ETI"OpenSSL::KDF::KDFError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"NGeneric exception class raised if an error occurs in OpenSSL::KDF module.;T: @fileI"ext/openssl/ossl_kdf.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_kdf.c;TI"OpenSSL::KDF;TcRDoc::NormalModulePKI ] $fff KDF/hkdf-c.rinu[U:RDoc::AnyMethod[iI" hkdf:ETI"OpenSSL::KDF::hkdf;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"RHMAC-based Extract-and-Expand Key Derivation Function (HKDF) as specified in ;TI"5{RFC 5869}[https://tools.ietf.org/html/rfc5869].;To:RDoc::Markup::BlankLineo; ; [I"New in OpenSSL 1.1.0.;T@S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: NOTE: @items[ o:RDoc::Markup::ListItem: @label[I" _ikm_;T; [o; ; [I"The input keying material.;To;;[I" _salt_;T; [o; ; [I"The salt.;To;;[I" _info_;T; [o; ; [I"6The context and application specific information.;To;;[I" _length_;T; [o; ; [I"KThe output length in octets. Must be <= 255 * HashLen, where ;TI"AHashLen is the length of the hash function output in octets.;To;;[I" _hash_;T; [o; ; [I"The hash function.;T@S; ; i;I" Example;To:RDoc::Markup::Verbatim; [ I"R# The values from https://datatracker.ietf.org/doc/html/rfc5869#appendix-A.1 ;TI"Gikm = ["0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"].pack("H*") ;TI"6salt = ["000102030405060708090a0b0c"].pack("H*") ;TI"0info = ["f0f1f2f3f4f5f6f7f8f9"].pack("H*") ;TI"`p OpenSSL::KDF.hkdf(ikm, salt: salt, info: info, length: 42, hash: "SHA256").unpack1("H*") ;TI"`# => "3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865";T: @format0: @fileI"ext/openssl/ossl_kdf.c;T:0@omit_headings_from_table_of_contents_below0I";KDF.hkdf(ikm, salt:, info:, length:, hash:) -> String ;T0[I"(p1, p2 = {});T@EFI"KDF;TcRDoc::NormalModule00PKI ] ::KDF/scrypt-c.rinu[U:RDoc::AnyMethod[iI" scrypt:ETI"OpenSSL::KDF::scrypt;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"FDerives a key from _pass_ using given parameters with the scrypt ;TI"Qpassword-based key derivation function. The result can be used for password ;TI" storage.;To:RDoc::Markup::BlankLineo; ; [I"Nscrypt is designed to be memory-hard and more secure against brute-force ;TI"Lattacks using custom hardwares than alternative KDFs such as PBKDF2 or ;TI" bcrypt.;T@o; ; [I"QThe keyword arguments _N_, _r_ and _p_ can be used to tune scrypt. RFC 7914 ;TI"R(published on 2016-08, https://tools.ietf.org/html/rfc7914#section-2) states ;TI"Athat using values r=8 and p=1 appears to yield good results.;T@o; ; [I"MSee RFC 7914 (https://tools.ietf.org/html/rfc7914) for more information.;T@S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: NOTE: @items[ o:RDoc::Markup::ListItem: @label[I" pass ;T; [o; ; [I"Passphrase.;To;;[I" salt ;T; [o; ; [I" Salt.;To;;[I" N ;T; [o; ; [I":CPU/memory cost parameter. This must be a power of 2.;To;;[I" r ;T; [o; ; [I"Block size parameter.;To;;[I" p ;T; [o; ; [I"Parallelization parameter.;To;;[I" length ;T; [o; ; [I")Length in octets of the derived key.;T@S; ; i;I" Example;To:RDoc::Markup::Verbatim; [ I"pass = "password" ;TI"*salt = SecureRandom.random_bytes(16) ;TI"Rdk = OpenSSL::KDF.scrypt(pass, salt: salt, N: 2**14, r: 8, p: 1, length: 32) ;TI",p dk #=> "\xDA\xE4\xE2...\x7F\xA1\x01T";T: @format0: @fileI"ext/openssl/ossl_kdf.c;T:0@omit_headings_from_table_of_contents_below0I"=KDF.scrypt(pass, salt:, N:, r:, p:, length:) -> aString ;T0[I"(p1, p2 = {});T@TFI"KDF;TcRDoc::NormalModule00PKI ]8 KDF/cdesc-KDF.rinu[U:RDoc::NormalModule[iI"KDF:ETI"OpenSSL::KDF;T0o:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"FProvides functionality of various KDFs (key derivation function).;To:RDoc::Markup::BlankLineo; ;[ I"LKDF is typically used for securely deriving arbitrary length symmetric ;TI"Nkeys to be used with an OpenSSL::Cipher from passwords. Another use case ;TI"Iis for storing passwords: Due to the ability to tweak the effort of ;TI"Ncomputation by increasing the iteration count, computation can be slowed ;TI"Fdown artificially in order to render possible attacks infeasible.;T@o; ;[I"LCurrently, OpenSSL::KDF provides implementations for the following KDF:;T@o:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0;[o; ;[I"BPKCS #5 PBKDF2 (Password-Based Key Derivation Function 2) in ;TI"combination with HMAC;To;;0;[o; ;[I" scrypt;To;;0;[o; ;[I" HKDF;T@S:RDoc::Markup::Heading: leveli: textI" Examples;TS;;i;I"5Generating a 128 bit key for a Cipher (e.g. AES);To:RDoc::Markup::Verbatim;[ I"pass = "secret" ;TI"-salt = OpenSSL::Random.random_bytes(16) ;TI"iter = 20_000 ;TI"key_len = 16 ;TI"Hkey = OpenSSL::KDF.pbkdf2_hmac(pass, salt: salt, iterations: iter, ;TI"C length: key_len, hash: "sha1") ;T: @format0S;;i;I"Storing Passwords;To;;[I"pass = "secret" ;TI"+# store this with the generated value ;TI"-salt = OpenSSL::Random.random_bytes(16) ;TI"iter = 20_000 ;TI"*hash = OpenSSL::Digest.new('SHA256') ;TI"len = hash.digest_length ;TI"$# the final value to be stored ;TI"Jvalue = OpenSSL::KDF.pbkdf2_hmac(pass, salt: salt, iterations: iter, ;TI"? length: len, hash: hash) ;T;0S;;i;I")Important Note on Checking Passwords;To; ;[ I"JWhen comparing passwords provided by the user with previously stored ;TI"Kvalues, a common mistake made is comparing the two values using "==". ;TI"DTypically, "==" short-circuits on evaluation, and is therefore ;TI"Jvulnerable to timing attacks. The proper way is to use a method that ;TI"Jalways takes the same amount of time when comparing two values, thus ;TI"Inot leaking any information to potential attackers. To do this, use ;TI"++OpenSSL.fixed_length_secure_compare+.;T: @fileI"ext/openssl/ossl_kdf.c;T:0@omit_headings_from_table_of_contents_below0;0;0[[[[[I" class;T[[: public[[:protected[[: private[[I" hkdf;TI"ext/openssl/ossl_kdf.c;T[I"pbkdf2_hmac;T@a[I" scrypt;T@a[I" instance;T[[;[[;[[;[[[U:RDoc::Context::Section[i0o;;[;0;0[I"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]~KDF/pbkdf2_hmac-c.rinu[U:RDoc::AnyMethod[iI"pbkdf2_hmac:ETI"OpenSSL::KDF::pbkdf2_hmac;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"NPKCS #5 PBKDF2 (Password-Based Key Derivation Function 2) in combination ;TI"Nwith HMAC. Takes _pass_, _salt_ and _iterations_, and then derives a key ;TI"of _length_ bytes.;To:RDoc::Markup::BlankLineo; ; [I"AFor more information about PBKDF2, see RFC 2898 Section 5.2 ;TI"7(https://tools.ietf.org/html/rfc2898#section-5.2).;T@S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: NOTE: @items[ o:RDoc::Markup::ListItem: @label[I"pass ;T; [o; ; [I"The passphrase.;To;;[I"salt ;T; [o; ; [ I"EThe salt. Salts prevent attacks based on dictionaries of common ;TI"Cpasswords and attacks based on rainbow tables. It is a public ;TI"Cvalue that can be safely stored along with the password (e.g. ;TI"8if the derived value is used for password storage).;To;;[I"iterations ;T; [o; ; [I"@The iteration count. This provides the ability to tune the ;TI"Calgorithm. It is better to use the highest count possible for ;TI"3the maximum resistance to brute-force attacks.;To;;[I"length ;T; [o; ; [I"5The desired length of the derived key in octets.;To;;[I"hash ;T; [o; ; [I"DThe hash algorithm used with HMAC for the PRF. May be a String ;TI"8representing the algorithm name, or an instance of ;TI"OpenSSL::Digest.;T: @fileI"ext/openssl/ossl_kdf.c;T:0@omit_headings_from_table_of_contents_below0I"JKDF.pbkdf2_hmac(pass, salt:, iterations:, length:, hash:) -> aString ;T0[I"(p1, p2 = {});T@CFI"KDF;TcRDoc::NormalModule00PKI ];y)   debug-c.rinu[U:RDoc::AnyMethod[iI" debug:ETI"OpenSSL::debug;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl.c;T:0@omit_headings_from_table_of_contents_below0I""OpenSSL.debug -> true | false;T0[I"();T@ FI" OpenSSL;TcRDoc::NormalModule00PKI ]չ**Buffering/eof-i.rinu[U:RDoc::AnyMethod[iI"eof:ETI"OpenSSL::Buffering#eof;TF: privateo:RDoc::Markup::Document: @parts[: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"Buffering;TcRDoc::NormalModule0[I"OpenSSL::Buffering;TFI" eof?;TPKI ] @qBuffering/read_nonblock-i.rinu[U:RDoc::AnyMethod[iI"read_nonblock:ETI"%OpenSSL::Buffering#read_nonblock;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"=Reads at most _maxlen_ bytes in the non-blocking manner.;To:RDoc::Markup::BlankLineo; ; [I"9When no data can be read without blocking it raises ;TI"MOpenSSL::SSL::SSLError extended by IO::WaitReadable or IO::WaitWritable.;T@o; ; [I"JIO::WaitReadable means SSL needs to read internally so read_nonblock ;TI"?should be called again when the underlying IO is readable.;T@o; ; [I"KIO::WaitWritable means SSL needs to write internally so read_nonblock ;TI"@should be called again after the underlying IO is writable.;T@o; ; [I"IOpenSSL::Buffering#read_nonblock needs two rescue clause as follows:;T@o:RDoc::Markup::Verbatim; [I"-# emulates blocking read (readpartial). ;TI" begin ;TI"* result = ssl.read_nonblock(maxlen) ;TI"rescue IO::WaitReadable ;TI" IO.select([io]) ;TI" retry ;TI"rescue IO::WaitWritable ;TI" IO.select(nil, [io]) ;TI" retry ;TI" end ;T: @format0o; ; [I"LNote that one reason that read_nonblock writes to the underlying IO is ;TI"Nwhen the peer requests a new TLS/SSL handshake. See openssl the FAQ for ;TI";more details. http://www.openssl.org/support/faq.html;T@o; ; [ I"OBy specifying a keyword argument _exception_ to +false+, you can indicate ;TI"Ithat read_nonblock should not raise an IO::Wait*able exception, but ;TI"Mreturn the symbol +:wait_writable+ or +:wait_readable+ instead. At EOF, ;TI"6it will return +nil+ instead of raising EOFError.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"'(maxlen, buf=nil, exception: true);T@5FI"Buffering;TcRDoc::NormalModule00PKI ](Buffering/readchar-i.rinu[U:RDoc::AnyMethod[iI" readchar:ETI" OpenSSL::Buffering#readchar;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NReads a one-character string from the stream. Raises an EOFError at end ;TI" of file.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"Buffering;TcRDoc::NormalModule00PKI ];=kkBuffering/consume_rbuff-i.rinu[U:RDoc::AnyMethod[iI"consume_rbuff:ETI"%OpenSSL::Buffering#consume_rbuff;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"*Consumes _size_ bytes from the buffer;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"(size=nil);T@FI"Buffering;TcRDoc::NormalModule00PKI ])Buffering/readline-i.rinu[U:RDoc::AnyMethod[iI" readline:ETI" OpenSSL::Buffering#readline;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I">Reads a line from the stream which is separated by _eol_.;To:RDoc::Markup::BlankLineo; ; [I"'Raises EOFError if at end of file.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I" (eol=$/);T@FI"Buffering;TcRDoc::NormalModule00PKI ]Ja$wwBuffering/each_byte-i.rinu[U:RDoc::AnyMethod[iI"each_byte:ETI"!OpenSSL::Buffering#each_byte;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I" 81 ;T0[I"();T@FI"Buffering;TcRDoc::NormalModule00PKI ]pbbBuffering/close-i.rinu[U:RDoc::AnyMethod[iI" close:ETI"OpenSSL::Buffering#close;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"9Closes the SSLSocket and flushes any unwritten data.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"Buffering;TcRDoc::NormalModule00PKI ](Buffering/printf-i.rinu[U:RDoc::AnyMethod[iI" printf:ETI"OpenSSL::Buffering#printf;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MFormats and writes to the stream converting parameters under control of ;TI"the format string.;To:RDoc::Markup::BlankLineo; ; [I"2See Kernel#sprintf for format string details.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"(s, *args);T@FI"Buffering;TcRDoc::NormalModule00PKI ]P۸Buffering/cdesc-Buffering.rinu[U:RDoc::NormalModule[iI"Buffering:ETI"OpenSSL::Buffering;T0o:RDoc::Markup::Document: @parts[o;;[ o:RDoc::Markup::Paragraph;[I"(OpenSSL IO buffering mix-in module.;To:RDoc::Markup::BlankLineo; ;[I"HThis module allows an OpenSSL::SSL::SSLSocket to behave like an IO.;T@o; ;[I"QYou typically won't use this module directly, you can see it implemented in ;TI"OpenSSL::SSL::SSLSocket.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[ I" sync;TI"RW;T: privateFI")ext/openssl/lib/openssl/buffering.rb;T[U:RDoc::Constant[iI"BLOCK_SIZE;TI"#OpenSSL::Buffering::BLOCK_SIZE;T: public0o;;[o; ;[I"ODefault size to read from or write to the SSLSocket for buffer operations.;T; @; 0@@cRDoc::NormalModule0[[I"Enumerable;To;;[; @; 0@[[I" class;T[[;[[:protected[[; [[I"new;T@[I" instance;T[[;[[;[[; [[I"<<;T@[I" close;T@[I"consume_rbuff;T@[I" do_write;T@[I" each;T@[I"each_byte;T@[I"each_line;T@[I"eof;T@[I" eof?;T@[I"fill_rbuff;T@[I" flush;T@[I" getbyte;T@[I" getc;T@[I" gets;T@[I" print;T@[I" printf;T@[I" puts;T@[I" read;T@[I"read_nonblock;T@[I" readchar;T@[I" readline;T@[I"readlines;T@[I"readpartial;T@[I" ungetc;T@[I" write;T@[I"write_nonblock;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I")ext/openssl/lib/openssl/buffering.rb;TI" OpenSSL;T@(PKI ]Buffering/sync-i.rinu[U:RDoc::Attr[iI" sync:ETI"OpenSSL::Buffering#sync;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"&The "sync mode" of the SSLSocket.;To:RDoc::Markup::BlankLineo; ; [I""See IO#sync for full details.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::Buffering;TcRDoc::NormalModule0PKI ]0Buffering/write-i.rinu[U:RDoc::AnyMethod[iI" write:ETI"OpenSSL::Buffering#write;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KWrites _s_ to the stream. If the argument is not a String it will be ;TI"Jconverted using +.to_s+ method. Returns the number of bytes written.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I" (*s);T@FI"Buffering;TcRDoc::NormalModule00PKI ]D  Buffering/Buffer/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"$OpenSSL::Buffering::Buffer::new;TT: privateo:RDoc::Markup::Document: @parts[: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ TI" Buffer;TcRDoc::NormalClass00PKI ] Buffering/Buffer/cdesc-Buffer.rinu[U:RDoc::NormalClass[iI" Buffer:ETI"OpenSSL::Buffering::Buffer;TI" String;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"0A buffer which will retain binary encoding.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[U:RDoc::Constant[iI" BINARY;TI"'OpenSSL::Buffering::Buffer::BINARY;T: public0o;;[; @; 0@@cRDoc::NormalClass0[[[I" class;T[[; [[:protected[[: private[[I"new;TI")ext/openssl/lib/openssl/buffering.rb;T[I" instance;T[[; [[;[[;[[I"<<;T@([I" concat;T@([[U:RDoc::Context::Section[i0o;;[; 0; 0[I")ext/openssl/lib/openssl/buffering.rb;TI"OpenSSL::Buffering;TcRDoc::NormalModulePKI ]r"@@Buffering/Buffer/concat-i.rinu[U:RDoc::AnyMethod[iI" concat:ETI"&OpenSSL::Buffering::Buffer#concat;TF: privateo:RDoc::Markup::Document: @parts[: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I" (string);T@ FI" Buffer;TcRDoc::NormalClass0[I"OpenSSL::Buffering::Buffer;TFI"<<;TPKI ]**Buffering/Buffer/%3c%3c-i.rinu[U:RDoc::AnyMethod[iI"<<:ETI""OpenSSL::Buffering::Buffer#<<;TF: privateo:RDoc::Markup::Document: @parts[: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[[I" concat;To;; [; @ ; 0I" (string);T@ TI" Buffer;TcRDoc::NormalClass00PKI ]h8QQBuffering/ungetc-i.rinu[U:RDoc::AnyMethod[iI" ungetc:ETI"OpenSSL::Buffering#ungetc;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"OPushes character _c_ back onto the stream such that a subsequent buffered ;TI"#character read will return it.;To:RDoc::Markup::BlankLineo; ; [I"FUnlike IO#getc multiple bytes may be pushed back onto the stream.;T@o; ; [I":Has no effect on unbuffered reads (such as #sysread).;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"(c);T@FI"Buffering;TcRDoc::NormalModule00PKI ]_Buffering/read-i.rinu[U:RDoc::AnyMethod[iI" read:ETI"OpenSSL::Buffering#read;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GReads _size_ bytes from the stream. If _buf_ is provided it must ;TI"4reference a string which will receive the data.;To:RDoc::Markup::BlankLineo; ; [I""See IO#read for full details.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"(size=nil, buf=nil);T@FI"Buffering;TcRDoc::NormalModule00PKI ]=iBuffering/gets-i.rinu[U:RDoc::AnyMethod[iI" gets:ETI"OpenSSL::Buffering#gets;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"OReads the next "line" from the stream. Lines are separated by _eol_. If ;TI"P_limit_ is provided the result will not be longer than the given number of ;TI" bytes.;To:RDoc::Markup::BlankLineo; ; [I"%_eol_ may be a String or Regexp.;T@o; ; [I"?Unlike IO#gets the line read will not be assigned to +$_+.;T@o; ; [I"JUnlike IO#gets the separator must be provided if a limit is provided.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"(eol=$/, limit=nil);T@FI"Buffering;TcRDoc::NormalModule00PKI ]aBlBuffering/readlines-i.rinu[U:RDoc::AnyMethod[iI"readlines:ETI"!OpenSSL::Buffering#readlines;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I">Reads lines from the stream which are separated by _eol_.;To:RDoc::Markup::BlankLineo; ; [I"See also #gets;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I" (eol=$/);T@FI"Buffering;TcRDoc::NormalModule00PKI ] Buffering/each-i.rinu[U:RDoc::AnyMethod[iI" each:ETI"OpenSSL::Buffering#each;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OExecutes the block for every line in the stream where lines are separated ;TI"by _eol_.;To:RDoc::Markup::BlankLineo; ; [I"See also #gets;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below00I" line;T[[I"each_line;To;; [; @; 0I" (eol=$/);T@FI"Buffering;TcRDoc::NormalModule00PKI ]~~Buffering/getc-i.rinu[U:RDoc::AnyMethod[iI" getc:ETI"OpenSSL::Buffering#getc;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KReads one character from the stream. Returns nil if called at end of ;TI" file.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"Buffering;TcRDoc::NormalModule00PKI ]s Buffering/%3c%3c-i.rinu[U:RDoc::AnyMethod[iI"<<:ETI"OpenSSL::Buffering#<<;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HWrites _s_ to the stream. _s_ will be converted to a String using ;TI"+.to_s+ method.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"(s);T@FI"Buffering;TcRDoc::NormalModule00PKI ]ﲺBuffering/readpartial-i.rinu[U:RDoc::AnyMethod[iI"readpartial:ETI"#OpenSSL::Buffering#readpartial;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LReads at most _maxlen_ bytes from the stream. If _buf_ is provided it ;TI"9must reference a string which will receive the data.;To:RDoc::Markup::BlankLineo; ; [I")See IO#readpartial for full details.;T: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I"(maxlen, buf=nil);T@FI"Buffering;TcRDoc::NormalModule00PKI ]3<<Buffering/each_line-i.rinu[U:RDoc::AnyMethod[iI"each_line:ETI"!OpenSSL::Buffering#each_line;TF: privateo:RDoc::Markup::Document: @parts[: @fileI")ext/openssl/lib/openssl/buffering.rb;T:0@omit_headings_from_table_of_contents_below000[I" (eol=$/);T@ FI"Buffering;TcRDoc::NormalModule0[I"OpenSSL::Buffering;TFI" each;TPKI ]$D"OpenSSLError/cdesc-OpenSSLError.rinu[U:RDoc::NormalClass[iI"OpenSSLError:ETI"OpenSSL::OpenSSLError;TI"StandardError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"Generic error, ;TI"0common for all classes under OpenSSL module;T: @fileI"ext/openssl/ossl.c;T:0@omit_headings_from_table_of_contents_below0o;;[; I"ext/openssl/ossl_asn1.c;T; 0o;;[; I"ext/openssl/ossl_bn.c;T; 0o;;[; I"ext/openssl/ossl_cipher.c;T; 0o;;[; I"ext/openssl/ossl_config.c;T; 0o;;[; I"ext/openssl/ossl_digest.c;T; 0o;;[; I"ext/openssl/ossl_engine.c;T; 0o;;[; I"ext/openssl/ossl_hmac.c;T; 0o;;[; I"ext/openssl/ossl_kdf.c;T; 0o;;[; I"ext/openssl/ossl_ns_spki.c;T; 0o;;[; I"ext/openssl/ossl_ocsp.c;T; 0o;;[; I"ext/openssl/ossl_pkcs12.c;T; 0o;;[; I"ext/openssl/ossl_pkcs7.c;T; 0o;;[; I"ext/openssl/ossl_pkey.c;T; 0o;;[; I"ext/openssl/ossl_pkey_ec.c;T; 0o;;[; I"ext/openssl/ossl_rand.c;T; 0o;;[; I"ext/openssl/ossl_ssl.c;T; 0o;;[; I"#ext/openssl/ossl_ssl_session.c;T; 0o;;[; I" ext/openssl/ossl_x509attr.c;T; 0o;;[; I" ext/openssl/ossl_x509cert.c;T; 0o;;[; I"ext/openssl/ossl_x509crl.c;T; 0o;;[; I"ext/openssl/ossl_x509ext.c;T; 0o;;[; I" ext/openssl/ossl_x509name.c;T; 0o;;[; I"ext/openssl/ossl_x509req.c;T; 0o;;[; I"#ext/openssl/ossl_x509revoked.c;T; 0o;;[; I"!ext/openssl/ossl_x509store.c;T; 0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]gCBN/rand_range-c.rinu[U:RDoc::AnyMethod[iI"rand_range:ETI"OpenSSL::BN::rand_range;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LGenerates a cryptographically strong pseudo-random number in the range ;TI"0...+range+.;To:RDoc::Markup::BlankLineo; ; [I",See also the man page BN_rand_range(3).;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"!BN.rand_range(range) -> aBN ;T0[I" (p1);T@FI"BN;TcRDoc::NormalClass00PKI ]rQ BN/%25-i.rinu[U:RDoc::AnyMethod[iI"%:ETI"OpenSSL::BN#%;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn % bn2 => aBN;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]]$  BN/num_bits-i.rinu[U:RDoc::AnyMethod[iI" num_bits:ETI"OpenSSL::BN#num_bits;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.num_bits => integer;T0[I"();T@ FI"BN;TcRDoc::NormalClass00PKI ]u7xBN/bit_set%3f-i.rinu[U:RDoc::AnyMethod[iI" bit_set?:ETI"OpenSSL::BN#bit_set?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KTests bit _bit_ in _bn_ and returns +true+ if set, +false+ if not set.;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"&bn.bit_set?(bit) => true | false ;T0[I" (p1);T@FI"BN;TcRDoc::NormalClass00PKI ]?QBN/generate_prime-c.rinu[U:RDoc::AnyMethod[iI"generate_prime:ETI" OpenSSL::BN::generate_prime;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"OGenerates a random prime number of bit length _bits_. If _safe_ is set to ;TI"S+true+, generates a safe prime. If _add_ is specified, generates a prime that ;TI"/fulfills condition p % add = rem.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[ o:RDoc::Markup::ListItem: @label0; [o; ; [I"_bits_ - integer;To;;0; [o; ; [I"_safe_ - boolean;To;;0; [o; ; [I"_add_ - BN;To;;0; [o; ; [I"_rem_ - BN;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"=BN.generate_prime(bits, [, safe [, add [, rem]]]) => bn ;T0[I"$(p1, p2 = v2, p3 = v3, p4 = v4);T@)FI"BN;TcRDoc::NormalClass00PKI ]M\BN/rshift%21-i.rinu[U:RDoc::AnyMethod[iI" rshift!:ETI"OpenSSL::BN#rshift!;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.rshift!(bits) -> self;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]~ BN/sqr-i.rinu[U:RDoc::AnyMethod[iI"sqr:ETI"OpenSSL::BN#sqr;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.sqr => aBN;T0[I"();T@ FI"BN;TcRDoc::NormalClass00PKI ],BN/cdesc-BN.rinu[U:RDoc::NormalClass[iI"BN:ETI"OpenSSL::BN;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI""ext/openssl/lib/openssl/bn.rb;T:0@omit_headings_from_table_of_contents_below0o;;[; I"ext/openssl/ossl_bn.c;T; 0; 0; 0[[U:RDoc::Constant[iI"CONSTTIME;TI"OpenSSL::BN::CONSTTIME;T: public0o;;[; @; 0@@cRDoc::NormalClass0U; [iI" MALLOCED;TI"OpenSSL::BN::MALLOCED;T; 0o;;[; @; 0@@@0U; [iI"STATIC_DATA;TI"OpenSSL::BN::STATIC_DATA;T; 0o;;[; @; 0@@@0[[I"Comparable;To;;[; @; 0I""ext/openssl/lib/openssl/bn.rb;T[[I" class;T[[; [[:protected[[: private[ [I"generate_prime;TI"ext/openssl/ossl_bn.c;T[I"new;T@9[I" rand;T@9[I"rand_range;T@9[I" instance;T[[; [[; [[;[6[I"%;T@9[I"*;T@9[I"**;T@9[I"+;T@9[I"+@;T@9[I"-;T@9[I"-@;T@9[I"/;T@9[I"<<;T@9[I"<=>;T@9[I"==;T@9[I"===;T@9[I">>;T@9[I"abs;T@9[I" bit_set?;T@9[I"clear_bit!;T@9[I"cmp;T@9[I" coerce;T@9[I" copy;T@9[I" eql?;T@9[I"gcd;T@9[I"get_flags;T@9[I" hash;T@9[I"initialize_copy;T@9[I" lshift!;T@9[I" mod_add;T@9[I" mod_exp;T@9[I"mod_inverse;T@9[I" mod_mul;T@9[I" mod_sqr;T@9[I" mod_sub;T@9[I"negative?;T@9[I" num_bits;T@9[I"num_bytes;T@9[I" odd?;T@9[I" one?;T@9[I"pretty_print;T@,[I" prime?;T@9[I"prime_fasttest?;T@9[I" rshift!;T@9[I" set_bit!;T@9[I"set_flags;T@9[I"sqr;T@9[I" to_bn;T@9[I" to_i;T@9[I" to_int;T@9[I" to_s;T@9[I" ucmp;T@9[I" zero?;T@9[[U:RDoc::Context::Section[i0o;;[; 0; 0[I""ext/openssl/lib/openssl/bn.rb;TI"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ] BN/gcd-i.rinu[U:RDoc::AnyMethod[iI"gcd:ETI"OpenSSL::BN#gcd;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.gcd(bn2) => aBN;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]';? BN/copy-i.rinu[U:RDoc::AnyMethod[iI" copy:ETI"OpenSSL::BN#copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"BN;TcRDoc::NormalClass0[I"OpenSSL::BN;TFI"initialize_copy;TPKI ]سBN/eql%3f-i.rinu[U:RDoc::AnyMethod[iI" eql?:ETI"OpenSSL::BN#eql?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"7Returns true only if obj is a ;TI"NOpenSSL::BN with the same value as bn. Contrast this ;TI":with OpenSSL::BN#==, which performs type conversions.;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"#bn.eql?(obj) => true or false ;T0[I" (p1);T@FI"BN;TcRDoc::NormalClass00PKI ]{L BN/to_bn-i.rinu[U:RDoc::AnyMethod[iI" to_bn:ETI"OpenSSL::BN#to_bn;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"BN;TcRDoc::NormalClass00PKI ] 8ff BN/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::BN::new;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I",Construct a new \OpenSSL BIGNUM object.;To:RDoc::Markup::BlankLineo; ; [I"IIf +bn+ is an Integer or OpenSSL::BN, a new instance of OpenSSL::BN ;TI"Mrepresenting the same value is returned. See also Integer#to_bn for the ;TI"short-hand.;T@o; ; [I"JIf a String is given, the content will be parsed according to +base+.;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" +string+;T; [o; ; [I"The string to be parsed.;To;;[I" +base+;T; [o; ; [I".The format. Must be one of the following:;To; ; : BULLET;[ o;;0; [o; ; [I"B+0+ - MPI format. See the man page BN_mpi2bn(3) for details.;To;;0; [o; ; [I"I+2+ - Variable-length and big-endian binary encoding of a positive ;TI" number.;To;;0; [o; ; [I"M+10+ - Decimal number representation, with a leading '-' for a negative ;TI" number.;To;;0; [o; ; [I"H+16+ - Hexadeciaml number representation, with a leading '-' for a ;TI"negative number.;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"jOpenSSL::BN.new(bn) -> aBN OpenSSL::BN.new(integer) -> aBN OpenSSL::BN.new(string, base = 10) -> aBN ;T0[I"(p1, p2 = v2);T@@FI"BN;TcRDoc::NormalClass00PKI ]?VBN/coerce-i.rinu[U:RDoc::AnyMethod[iI" coerce:ETI"OpenSSL::BN#coerce;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ] BN/to_i-i.rinu[U:RDoc::AnyMethod[iI" to_i:ETI"OpenSSL::BN#to_i;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.to_i => integer;T0[[I" to_int;T@ I"();T@ FI"BN;TcRDoc::NormalClass00PKI ]GHBUUBN/get_flags-i.rinu[U:RDoc::AnyMethod[iI"get_flags:ETI"OpenSSL::BN#get_flags;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I")Returns the flags on the BN object. ;TI"(The argument is used as a bit mask.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"_flags_ - integer;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I""bn.get_flags(flags) => flags ;T0[I" (p1);T@FI"BN;TcRDoc::NormalClass00PKI ]wBN/%2b%40-i.rinu[U:RDoc::AnyMethod[iI"+@:ETI"OpenSSL::BN#+@;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"+bn -> aBN;T0[I"();T@ FI"BN;TcRDoc::NormalClass00PKI ]|? BN/%2a-i.rinu[U:RDoc::AnyMethod[iI"*:ETI"OpenSSL::BN#*;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn * bn2 => aBN;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]$ BN/ucmp-i.rinu[U:RDoc::AnyMethod[iI" ucmp:ETI"OpenSSL::BN#ucmp;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.ucmp(bn2) => integer;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]~iBN/%3e%3e-i.rinu[U:RDoc::AnyMethod[iI">>:ETI"OpenSSL::BN#>>;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn >> bits -> aBN;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]*Y BN/rand-c.rinu[U:RDoc::AnyMethod[iI" rand:ETI"OpenSSL::BN::rand;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"IGenerates a cryptographically strong pseudo-random number of +bits+.;To:RDoc::Markup::BlankLineo; ; [I"&See also the man page BN_rand(3).;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"+BN.rand(bits [, fill [, odd]]) -> aBN ;T0[I"(p1, p2 = v2, p3 = v3);T@FI"BN;TcRDoc::NormalClass00PKI ]iI BN/cmp-i.rinu[U:RDoc::AnyMethod[iI"cmp:ETI"OpenSSL::BN#cmp;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.cmp(bn2) => integer;T0[[I"<=>;T@ I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]}&BN/clear_bit%21-i.rinu[U:RDoc::AnyMethod[iI"clear_bit!:ETI"OpenSSL::BN#clear_bit!;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.clear_bit!(bit) -> self;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]}BN/one%3f-i.rinu[U:RDoc::AnyMethod[iI" one?:ETI"OpenSSL::BN#one?;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.one? => true | false;T0[I"();T@ FI"BN;TcRDoc::NormalClass00PKI ]@1PBN/%2a%2a-i.rinu[U:RDoc::AnyMethod[iI"**:ETI"OpenSSL::BN#**;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn ** bn2 => aBN;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ][RR BN/%2f-i.rinu[U:RDoc::AnyMethod[iI"/:ETI"OpenSSL::BN#/;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"&Division of OpenSSL::BN instances;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"&bn1 / bn2 => [result, remainder] ;T0[I" (p1);T@FI"BN;TcRDoc::NormalClass00PKI ]hBN/num_bytes-i.rinu[U:RDoc::AnyMethod[iI"num_bytes:ETI"OpenSSL::BN#num_bytes;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.num_bytes => integer;T0[I"();T@ FI"BN;TcRDoc::NormalClass00PKI ]eBN/mod_mul-i.rinu[U:RDoc::AnyMethod[iI" mod_mul:ETI"OpenSSL::BN#mod_mul;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I" bn.mod_mul(bn1, bn2) -> aBN;T0[I" (p1, p2);T@ FI"BN;TcRDoc::NormalClass00PKI ]^A l  BN/prime%3f-i.rinu[U:RDoc::AnyMethod[iI" prime?:ETI"OpenSSL::BN#prime?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"CPerforms a Miller-Rabin probabilistic primality test for +bn+.;To:RDoc::Markup::BlankLineo; ; [I"N+checks+ parameter is deprecated in version 3.0. It has no effect.;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"Abn.prime? => true | false bn.prime?(checks) => true | false ;T0[I" (*args);T@FI"BN;TcRDoc::NormalClass00PKI ]QG== BN/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI"OpenSSL::BN#to_s;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"5Returns the string representation of the bignum.;To:RDoc::Markup::BlankLineo; ; [I"MBN.new can parse the encoded string to convert back into an OpenSSL::BN.;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" +base+;T; [o; ; [I".The format. Must be one of the following:;To; ; : BULLET;[ o;;0; [o; ; [I"B+0+ - MPI format. See the man page BN_bn2mpi(3) for details.;To;;0; [o; ; [I"H+2+ - Variable-length and big-endian binary encoding. The sign of ;TI"the bignum is ignored.;To;;0; [o; ; [I"M+10+ - Decimal number representation, with a leading '-' for a negative ;TI" bignum.;To;;0; [o; ; [I"H+16+ - Hexadeciaml number representation, with a leading '-' for a ;TI"negative bignum.;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I""bn.to_s(base = 10) -> string ;T0[I"(p1 = v1);T@4FI"BN;TcRDoc::NormalClass00PKI ]մ  BN/to_int-i.rinu[U:RDoc::AnyMethod[iI" to_int:ETI"OpenSSL::BN#to_int;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"BN;TcRDoc::NormalClass0[I"OpenSSL::BN;TFI" to_i;TPKI ]BN/lshift%21-i.rinu[U:RDoc::AnyMethod[iI" lshift!:ETI"OpenSSL::BN#lshift!;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.lshift!(bits) -> self;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]BN/mod_sub-i.rinu[U:RDoc::AnyMethod[iI" mod_sub:ETI"OpenSSL::BN#mod_sub;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I" bn.mod_sub(bn1, bn2) -> aBN;T0[I" (p1, p2);T@ FI"BN;TcRDoc::NormalClass00PKI ]rjRBN/mod_exp-i.rinu[U:RDoc::AnyMethod[iI" mod_exp:ETI"OpenSSL::BN#mod_exp;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I" bn.mod_exp(bn1, bn2) -> aBN;T0[I" (p1, p2);T@ FI"BN;TcRDoc::NormalClass00PKI ]Fc|LBN/set_bit%21-i.rinu[U:RDoc::AnyMethod[iI" set_bit!:ETI"OpenSSL::BN#set_bit!;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.set_bit!(bit) -> self;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]E}BN/odd%3f-i.rinu[U:RDoc::AnyMethod[iI" odd?:ETI"OpenSSL::BN#odd?;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.odd? => true | false;T0[I"();T@ FI"BN;TcRDoc::NormalClass00PKI ]g!NBN/%3d%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"===:ETI"OpenSSL::BN#===;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LReturns +true+ only if _obj_ has the same value as _bn_. Contrast this ;TI"Awith OpenSSL::BN#eql?, which requires obj to be OpenSSL::BN.;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@FI"BN;TcRDoc::NormalClass0[I"OpenSSL::BN;TFI"==;TPKI ]]۴BN/%2d%40-i.rinu[U:RDoc::AnyMethod[iI"-@:ETI"OpenSSL::BN#-@;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"-bn -> aBN;T0[I"();T@ FI"BN;TcRDoc::NormalClass00PKI ] BN/%2b-i.rinu[U:RDoc::AnyMethod[iI"+:ETI"OpenSSL::BN#+;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn + bn2 => aBN;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]wiBN/set_flags-i.rinu[U:RDoc::AnyMethod[iI"set_flags:ETI"OpenSSL::BN#set_flags;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I")Enables the flags on the BN object. ;TI"NCurrently, the flags argument can contain zero of OpenSSL::BN::CONSTTIME.;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I" bn.set_flags(flags) => nil ;T0[I" (p1);T@FI"BN;TcRDoc::NormalClass00PKI ]lBN/negative%3f-i.rinu[U:RDoc::AnyMethod[iI"negative?:ETI"OpenSSL::BN#negative?;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"!bn.negative? => true | false;T0[I"();T@ FI"BN;TcRDoc::NormalClass00PKI ]NBN/pretty_print-i.rinu[U:RDoc::AnyMethod[iI"pretty_print:ETI"OpenSSL::BN#pretty_print;TF: privateo:RDoc::Markup::Document: @parts[: @fileI""ext/openssl/lib/openssl/bn.rb;T:0@omit_headings_from_table_of_contents_below000[I"(q);T@ FI"BN;TcRDoc::NormalClass00PKI ]mrBN/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI" OpenSSL::BN#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below000[[I" copy;To;; [; @ ; 0I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]ww BN/abs-i.rinu[U:RDoc::AnyMethod[iI"abs:ETI"OpenSSL::BN#abs;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.abs -> aBN;T0[I"();T@ FI"BN;TcRDoc::NormalClass00PKI ],( BN/%2d-i.rinu[U:RDoc::AnyMethod[iI"-:ETI"OpenSSL::BN#-;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn - bn2 => aBN;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]eBN/%3c%3c-i.rinu[U:RDoc::AnyMethod[iI"<<:ETI"OpenSSL::BN#<<;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn << bits -> aBN;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]{HIXBN/prime_fasttest%3f-i.rinu[U:RDoc::AnyMethod[iI"prime_fasttest?:ETI" OpenSSL::BN#prime_fasttest?;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"CPerforms a Miller-Rabin probabilistic primality test for +bn+.;To:RDoc::Markup::BlankLineo; ; [I";Deprecated in version 3.0. Use #prime? instead.;T@o; ; [I"C+checks+ and +trial_div+ parameters no longer have any effect.;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.prime_fasttest? => true | false bn.prime_fasttest?(checks) => true | false bn.prime_fasttest?(checks, trial_div) => true | false ;T0[I" (*args);T@FI"BN;TcRDoc::NormalClass00PKI ]ΪaBN/mod_add-i.rinu[U:RDoc::AnyMethod[iI" mod_add:ETI"OpenSSL::BN#mod_add;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I" bn.mod_add(bn1, bn2) -> aBN;T0[I" (p1, p2);T@ FI"BN;TcRDoc::NormalClass00PKI ]aBN/%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI"OpenSSL::BN#==;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LReturns +true+ only if _obj_ has the same value as _bn_. Contrast this ;TI"Awith OpenSSL::BN#eql?, which requires obj to be OpenSSL::BN.;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I" bn == obj => true or false ;T0[[I"===;T@ I" (p1);T@FI"BN;TcRDoc::NormalClass00PKI ]OBN/zero%3f-i.rinu[U:RDoc::AnyMethod[iI" zero?:ETI"OpenSSL::BN#zero?;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.zero? => true | false;T0[I"();T@ FI"BN;TcRDoc::NormalClass00PKI ]ZBBN/%3c%3d%3e-i.rinu[U:RDoc::AnyMethod[iI"<=>:ETI"OpenSSL::BN#<=>;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"BN;TcRDoc::NormalClass0[I"OpenSSL::BN;TFI"cmp;TPKI ]m ފ BN/hash-i.rinu[U:RDoc::AnyMethod[iI" hash:ETI"OpenSSL::BN#hash;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I")Returns a hash code for this object.;To:RDoc::Markup::BlankLineo; ; [I"See also Object#hash.;T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.hash => Integer ;T0[I"();T@FI"BN;TcRDoc::NormalClass00PKI ]N(BN/mod_inverse-i.rinu[U:RDoc::AnyMethod[iI"mod_inverse:ETI"OpenSSL::BN#mod_inverse;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.mod_inverse(bn2) => aBN;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]Xp  BN/mod_sqr-i.rinu[U:RDoc::AnyMethod[iI" mod_sqr:ETI"OpenSSL::BN#mod_sqr;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0I"bn.mod_sqr(bn2) => aBN;T0[I" (p1);T@ FI"BN;TcRDoc::NormalClass00PKI ]R55PKey/DH/export-i.rinu[U:RDoc::AnyMethod[iI" export:ETI"OpenSSL::PKey::DH#export;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MEncodes this DH to its PEM encoding. Note that any existing per-session ;TI"Ipublic/private keys will *not* get encoded, just the Diffie-Hellman ;TI" parameters will be encoded.;T: @fileI"ext/openssl/ossl_pkey_dh.c;T:0@omit_headings_from_table_of_contents_below0I"Bdh.export -> aString dh.to_pem -> aString dh.to_s -> aString ;T0[[I" to_pem;T@ [I" to_s;T@ I"();T@FI"DH;TcRDoc::NormalClass00PKI ]ӶPKey/DH/private%3f-i.rinu[U:RDoc::AnyMethod[iI" private?:ETI"OpenSSL::PKey::DH#private?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PIndicates whether this DH instance has a private key associated with it or ;TI" true | false ;T0[I"();T@FI"DH;TcRDoc::NormalClass00PKI ]hPKey/DH/public%3f-i.rinu[U:RDoc::AnyMethod[iI" public?:ETI"OpenSSL::PKey::DH#public?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OIndicates whether this DH instance has a public key associated with it or ;TI":not. The public key may be retrieved with DH#pub_key.;T: @fileI"ext/openssl/ossl_pkey_dh.c;T:0@omit_headings_from_table_of_contents_below0I" dh.public? -> true | false ;T0[I"();T@FI"DH;TcRDoc::NormalClass00PKI ]&ݜPKey/DH/set_key-i.rinu[U:RDoc::AnyMethod[iI" set_key:ETI"OpenSSL::PKey::DH#set_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PSets _pub_key_ and _priv_key_ for the DH instance. _priv_key_ may be +nil+.;T: @fileI"ext/openssl/ossl_pkey_dh.c;T:0@omit_headings_from_table_of_contents_below0I"+dh.set_key(pub_key, priv_key) -> self ;T0[I" (p1, p2);T@FI"DH;TcRDoc::NormalClass00PKI ]PKey/DH/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::PKey::DH::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"1Creates a new instance of OpenSSL::PKey::DH.;To:RDoc::Markup::BlankLineo; ; [I"QIf called without arguments, an empty instance without any parameter or key ;TI"Scomponents is created. Use #set_pqg to manually set the parameters afterwards ;TI"H(and optionally #set_key to set private and public key components).;T@o; ; [I"SIf a String is given, tries to parse it as a DER- or PEM- encoded parameters. ;TI"CSee also OpenSSL::PKey.read which can parse keys of any kinds.;T@o; ; [I"DThe DH.new(size [, generator]) form is an alias of DH.generate.;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" +string+;T; [o; ; [I"7A String that contains the DER or PEM encoded key.;To;;[I" +size+;T; [o; ; [I"See DH.generate.;To;;[I"+generator+;T; [o; ; [I"See DH.generate.;T@o; ; [I"Examples:;To:RDoc::Markup::Verbatim; [I")# Creating an instance from scratch ;TI"O# Note that this is deprecated and will not work on OpenSSL 3.0 or later. ;TI" dh = OpenSSL::PKey::DH.new ;TI"!dh.set_pqg(bn_p, nil, bn_g) ;TI" ;TI".# Generating a parameters and a key pair ;TI"Udh = OpenSSL::PKey::DH.new(2048) # An alias of OpenSSL::PKey::DH.generate(2048) ;TI" ;TI"# Reading DH parameters ;TI"\dh_params = OpenSSL::PKey::DH.new(File.read('parameters.pem')) # loads parameters only ;TI"Fdh = OpenSSL::PKey.generate_key(dh_params) # generates a key pair;T: @format0: @fileI"ext/openssl/ossl_pkey_dh.c;T:0@omit_headings_from_table_of_contents_below0I"HDH.new -> dh DH.new(string) -> dh DH.new(size [, generator]) -> dh ;T0[I"(p1 = v1);T@BFI"DH;TcRDoc::NormalClass00PKI ]gd d PKey/DH/cdesc-DH.rinu[U:RDoc::NormalClass[iI"DH:ETI"OpenSSL::PKey::DH;TI"OpenSSL::PKey::PKey;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0o;;[ o:RDoc::Markup::Paragraph;[I"LAn implementation of the Diffie-Hellman key exchange protocol based on ;TI"Ldiscrete logarithms in finite fields, the same basis that DSA is built ;TI"on.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"7Accessor methods for the Diffie-Hellman parameters;To:RDoc::Markup::List: @type: NOTE: @items[ o:RDoc::Markup::ListItem: @label[I" DH#p;T;[o; ;[I"AThe prime (an OpenSSL::BN) of the Diffie-Hellman parameters.;To;;[I" DH#g;T;[o; ;[I"GThe generator (an OpenSSL::BN) g of the Diffie-Hellman parameters.;To;;[I"DH#pub_key;T;[o; ;[I"KThe per-session public key (an OpenSSL::BN) matching the private key. ;TI"/This needs to be passed to DH#compute_key.;To;;[I"DH#priv_key;T;[o; ;[I"1The per-session private key, an OpenSSL::BN.;T@S; ;i;I"Example of a key exchange;To:RDoc::Markup::Verbatim;[I"L# you may send the parameters (der) and own public key (pub1) publicly ;TI""# to the participating party ;TI"'dh1 = OpenSSL::PKey::DH.new(2048) ;TI"der = dh1.to_der ;TI"pub1 = dh1.pub_key ;TI" ;TI":# the other party generates its per-session key pair ;TI"+dhparams = OpenSSL::PKey::DH.new(der) ;TI"0dh2 = OpenSSL::PKey.generate_key(dhparams) ;TI"pub2 = dh2.pub_key ;TI" ;TI"'symm_key1 = dh1.compute_key(pub2) ;TI"'symm_key2 = dh2.compute_key(pub1) ;TI"*puts symm_key1 == symm_key2 # => true;T: @format0; I"ext/openssl/ossl_pkey_dh.c;T; 0; 0; 0[[[[I"OpenSSL::Marshal;To;;[; @; 0I"$ext/openssl/lib/openssl/pkey.rb;T[[I" class;T[[: public[[:protected[[: private[[I" generate;T@R[I"new;TI"ext/openssl/ossl_pkey_dh.c;T[I" instance;T[[;[[;[[;[[I"compute_key;T@R[I" export;T@a[I"generate_key!;T@R[I"initialize_copy;T@a[I" params;T@a[I"params_ok?;T@a[I" private?;T@a[I" public?;T@a[I"public_key;T@R[I" set_key;T@a[I" set_pqg;T@a[I" to_der;T@a[I" to_pem;T@a[I" to_s;T@a[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/pkey.rb;TI"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey;TcRDoc::NormalModulePKI ]}EVVPKey/DH/compute_key-i.rinu[U:RDoc::AnyMethod[iI"compute_key:ETI""OpenSSL::PKey::DH#compute_key;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"IReturns a String containing a shared secret computed from the other ;TI"party's public value.;To:RDoc::Markup::BlankLineo; ; [I"LThis method is provided for backwards compatibility, and calls #derive ;TI"internally.;T@S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"B_pub_bn_ is a OpenSSL::BN, *not* the DH instance returned by ;TI";DH#public_key as that contains the DH parameters only.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"&dh.compute_key(pub_bn) -> string ;T0[I" (pub_bn);T@FI"DH;TcRDoc::NormalClass00PKI ]EO(PKey/DH/generate-c.rinu[U:RDoc::AnyMethod[iI" generate:ETI" OpenSSL::PKey::DH::generate;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"LCreates a new DH instance from scratch by generating random parameters ;TI"and a key pair.;To:RDoc::Markup::BlankLineo; ; [I"4See also OpenSSL::PKey.generate_parameters and ;TI" OpenSSL::PKey.generate_key.;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" +size+;T; [o; ; [I""The desired key size in bits.;To;;[I"+generator+;T; [o; ; [I"The generator.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I",DH.generate(size, generator = 2) -> dh ;T0[I" (size, generator = 2, &blk);T@$FI"DH;TcRDoc::NormalClass00PKI ]UJPKey/DH/params-i.rinu[U:RDoc::AnyMethod[iI" params:ETI"OpenSSL::PKey::DH#params;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Stores all parameters of key to the hash ;TI"4INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!! ;TI"#Don't use :-)) (I's up to you);T: @fileI"ext/openssl/ossl_pkey_dh.c;T:0@omit_headings_from_table_of_contents_below0I"dh.params -> hash ;T0[I"();T@FI"DH;TcRDoc::NormalClass00PKI ]x`PKey/DH/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI"OpenSSL::PKey::DH#to_s;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MEncodes this DH to its PEM encoding. Note that any existing per-session ;TI"Ipublic/private keys will *not* get encoded, just the Diffie-Hellman ;TI" parameters will be encoded.;T: @fileI"ext/openssl/ossl_pkey_dh.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"DH;TcRDoc::NormalClass0[I"OpenSSL::PKey::DH;TFI" export;TPKI ]֟UNNPKey/DH/public_key-i.rinu[U:RDoc::AnyMethod[iI"public_key:ETI"!OpenSSL::PKey::DH#public_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DReturns a new DH instance that carries just the \DH parameters.;To:RDoc::Markup::BlankLineo; ; [I"GContrary to the method name, the returned DH object contains only ;TI"'parameters and not the public key.;T@o; ; [I"OThis method is provided for backwards compatibility. In most cases, there ;TI"$is no need to call this method.;T@o; ; [I"EFor the purpose of re-generating the key pair while keeping the ;TI"2parameters, check OpenSSL::PKey.generate_key.;T@o; ; [I" Example:;To:RDoc::Markup::Verbatim; [ I"I# OpenSSL::PKey::DH.generate by default generates a random key pair ;TI",dh1 = OpenSSL::PKey::DH.generate(2048) ;TI"2p dh1.priv_key #=> # ;TI"dhcopy = dh1.public_key ;TI"p dhcopy.priv_key #=> nil;T: @format0: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"dh.public_key -> dhnew ;T0[I"();T@%FI"DH;TcRDoc::NormalClass00PKI ]K9OPKey/DH/to_pem-i.rinu[U:RDoc::AnyMethod[iI" to_pem:ETI"OpenSSL::PKey::DH#to_pem;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MEncodes this DH to its PEM encoding. Note that any existing per-session ;TI"Ipublic/private keys will *not* get encoded, just the Diffie-Hellman ;TI" parameters will be encoded.;T: @fileI"ext/openssl/ossl_pkey_dh.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"DH;TcRDoc::NormalClass0[I"OpenSSL::PKey::DH;TFI" export;TPKI ]wPKey/DH/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"OpenSSL::PKey::DH#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MEncodes this DH to its DER encoding. Note that any existing per-session ;TI"Ipublic/private keys will *not* get encoded, just the Diffie-Hellman ;TI" parameters will be encoded.;T: @fileI"ext/openssl/ossl_pkey_dh.c;T:0@omit_headings_from_table_of_contents_below0I"dh.to_der -> aString ;T0[I"();T@FI"DH;TcRDoc::NormalClass00PKI ]fۭqqPKey/DH/set_pqg-i.rinu[U:RDoc::AnyMethod[iI" set_pqg:ETI"OpenSSL::PKey::DH#set_pqg;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"+Sets _p_, _q_, _g_ to the DH instance.;T: @fileI"ext/openssl/ossl_pkey_dh.c;T:0@omit_headings_from_table_of_contents_below0I"!dh.set_pqg(p, q, g) -> self ;T0[I"(p1, p2, p3);T@FI"DH;TcRDoc::NormalClass00PKI ] [eePKey/DH/params_ok%3f-i.rinu[U:RDoc::AnyMethod[iI"params_ok?:ETI"!OpenSSL::PKey::DH#params_ok?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LValidates the Diffie-Hellman parameters associated with this instance. ;TI"OIt checks whether a safe prime and a suitable generator are used. If this ;TI"*is not the case, +false+ is returned.;To:RDoc::Markup::BlankLineo; ; [I"3See also the man page EVP_PKEY_param_check(3).;T: @fileI"ext/openssl/ossl_pkey_dh.c;T:0@omit_headings_from_table_of_contents_below0I"#dh.params_ok? -> true | false ;T0[I"();T@FI"DH;TcRDoc::NormalClass00PKI ]ɈPKey/DH/generate_key%21-i.rinu[U:RDoc::AnyMethod[iI"generate_key!:ETI"$OpenSSL::PKey::DH#generate_key!;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"MGenerates a private and public key unless a private key already exists. ;TI"KIf this DH instance was generated from public \DH parameters (e.g. by ;TI"Iencoding the result of DH#public_key), then this method needs to be ;TI"Ncalled first in order to generate the per-session keys before performing ;TI"the actual key exchange.;To:RDoc::Markup::BlankLineo; ; [I"HDeprecated in version 3.0. This method is incompatible with ;TI"OpenSSL 3.0.0 or later.;T@o; ; [I")See also OpenSSL::PKey.generate_key.;T@o; ; [I" Example:;To:RDoc::Markup::Verbatim; [I"D# DEPRECATED USAGE: This will not work on OpenSSL 3.0 or later ;TI"'dh0 = OpenSSL::PKey::DH.new(2048) ;TI"\dh = dh0.public_key # #public_key only copies the DH parameters (contrary to the name) ;TI"dh.generate_key! ;TI" puts dh.private? # => true ;TI".puts dh0.pub_key == dh.pub_key #=> false ;TI" ;TI"'# With OpenSSL::PKey.generate_key ;TI"'dh0 = OpenSSL::PKey::DH.new(2048) ;TI"*dh = OpenSSL::PKey.generate_key(dh0) ;TI"-puts dh0.pub_key == dh.pub_key #=> false;T: @format0: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"dh.generate_key! -> self ;T0[I"();T@*FI"DH;TcRDoc::NormalClass00PKI ]M  PKey/DH/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"&OpenSSL::PKey::DH#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkey_dh.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"DH;TcRDoc::NormalClass00PKI ]IPKey/generate_key-c.rinu[U:RDoc::AnyMethod[iI"generate_key:ETI" OpenSSL::PKey::generate_key;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I" Generates a new key (pair).;To:RDoc::Markup::BlankLineo; ; [ I"OIf a String is given as the first argument, it generates a new random key ;TI"Qfor the algorithm specified by the name just as ::generate_parameters does. ;TI"OIf an OpenSSL::PKey::PKey is given instead, it generates a new random key ;TI"Nfor the same algorithm as the key, using the parameters the key contains.;T@o; ; [I"PSee ::generate_parameters for the details of _options_ and the given block.;T@S:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I"Ypkey_params = OpenSSL::PKey.generate_parameters("DSA", "dsa_paramgen_bits" => 2048) ;TI""pkey_params.priv_key #=> nil ;TI"4pkey = OpenSSL::PKey.generate_key(pkey_params) ;TI",pkey.priv_key #=> # pkey OpenSSL::PKey.generate_key(pkey [, options]) -> pkey ;T0[I" (*args);T@ FI" PKey;TcRDoc::NormalModule00PKI ]IPKey/DSAError/cdesc-DSAError.rinu[U:RDoc::NormalClass[iI" DSAError:ETI"OpenSSL::PKey::DSAError;TI"OpenSSL::PKey::PKeyError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"DGeneric exception that is raised if an operation on a DSA PKey ;TI"Jfails unexpectedly or in case an instantiation of an instance of DSA ;TI",fails due to non-conformant input data.;T: @fileI" ext/openssl/ossl_pkey_dsa.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey;TcRDoc::NormalModulePKI ]6+HHPKey/cdesc-PKey.rinu[U:RDoc::NormalModule[iI" PKey:ETI"OpenSSL::PKey;T0o:RDoc::Markup::Document: @parts[ o;;[: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0o;;[S:RDoc::Markup::Heading: leveli: textI"%Asymmetric Public Key Algorithms;To:RDoc::Markup::BlankLineo:RDoc::Markup::Paragraph;[ I"LAsymmetric public key algorithms solve the problem of establishing and ;TI"Esharing secret keys to en-/decrypt messages. The key in such an ;TI"Kalgorithm consists of two parts: a public key that may be distributed ;TI"=to others and a private key that needs to remain secret.;T@o;;[ I"CMessages encrypted with a public key can only be decrypted by ;TI"Frecipients that are in possession of the associated private key. ;TI"HSince public key algorithms are considerably slower than symmetric ;TI"Kkey algorithms (cf. OpenSSL::Cipher) they are often used to establish ;TI"Ja symmetric key shared between two parties that are in possession of ;TI"each other's public key.;T@o;;[I"KAsymmetric algorithms offer a lot of nice features that are used in a ;TI"Klot of different areas. A very common application is the creation and ;TI"Ivalidation of digital signatures. To sign a document, the signatory ;TI"Hgenerally uses a message digest algorithm (cf. OpenSSL::Digest) to ;TI"Kcompute a digest of the document that is then encrypted (i.e. signed) ;TI"Lusing the private key. Anyone in possession of the public key may then ;TI"Jverify the signature by computing the message digest of the original ;TI"Kdocument on their own, decrypting the signature using the signatory's ;TI"Dpublic key and comparing the result to the message digest they ;TI"Dpreviously computed. The signature is valid if and only if the ;TI"9decrypted signature is equal to this message digest.;T@o;;[I"IThe PKey module offers support for three popular public/private key ;TI"algorithms:;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0;[o;;[I"RSA (OpenSSL::PKey::RSA);To;;0;[o;;[I"DSA (OpenSSL::PKey::DSA);To;;0;[o;;[I"4Elliptic Curve Cryptography (OpenSSL::PKey::EC);To;;[I"JEach of these implementations is in fact a sub-class of the abstract ;TI"MPKey class which offers the interface for supporting digital signatures ;TI".in the form of PKey#sign and PKey#verify.;T@S; ; i; I" Diffie-Hellman Key Exchange;T@o;;[I"HFinally PKey also features OpenSSL::PKey::DH, an implementation of ;TI"Kthe Diffie-Hellman key exchange protocol based on discrete logarithms ;TI" PKey OpenSSL::PKey.read(io [, pwd ]) -> PKey ;T0[I"(p1, p2 = v2);T@&FI" PKey;TcRDoc::NormalModule00PKI ]ӴPKey/PKey/cdesc-PKey.rinu[U:RDoc::NormalClass[iI" PKey:ETI"OpenSSL::PKey::PKey;TI" Object;To:RDoc::Markup::Document: @parts[ o;;[o:RDoc::Markup::Paragraph;[I"GAn abstract class that bundles signature creation (PKey#sign) and ;TI"Kvalidation (PKey#verify) that is common to all implementations except ;TI"OpenSSL::PKey::DH;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0;[o; ;[I"OpenSSL::PKey::RSA;To;;0;[o; ;[I"OpenSSL::PKey::DSA;To;;0;[o; ;[I"OpenSSL::PKey::EC;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0o;;[;I"ext/openssl/ossl_pkey_dh.c;T;0o;;[;I" ext/openssl/ossl_pkey_dsa.c;T;0o;;[;I"ext/openssl/ossl_pkey_ec.c;T;0o;;[;I" ext/openssl/ossl_pkey_rsa.c;T;0;0;0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_pkey.c;T[I" instance;T[[;[[;[[;[[I" compare?;T@@[I" decrypt;T@@[I" derive;T@@[I" encrypt;T@@[I"initialize_copy;T@@[I" inspect;T@@[I"oid;T@@[I"private_to_der;T@@[I"private_to_pem;T@@[I"public_to_der;T@@[I"public_to_pem;T@@[I" sign;T@@[I" sign_raw;T@@[I" to_text;T@@[I" verify;T@@[I"verify_raw;T@@[I"verify_recover;T@@[[U:RDoc::Context::Section[i0o;;[;0;0[I"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey;TcRDoc::NormalModulePKI ]}PKey/PKey/verify_raw-i.rinu[U:RDoc::AnyMethod[iI"verify_raw:ETI"#OpenSSL::PKey::PKey#verify_raw;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OVerifies the +signature+ for the +data+ using a public key +pkey+. Unlike ;TI"K#verify, this method will not hash +data+ with +digest+ automatically.;To:RDoc::Markup::BlankLineo; ; [I"RReturns +true+ if the signature is successfully verified, +false+ otherwise. ;TI",The caller must check the return value.;T@o; ; [I"ASee #sign_raw for the signing operation and an example code.;T@o; ; [I"DAdded in version 3.0. See also the man page EVP_PKEY_verify(3).;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I"+signature+;T; [o; ; [I"6A String containing the signature to be verified.;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"Kpkey.verify_raw(digest, signature, data [, options]) -> true or false ;T0[I"(p1, p2, p3, p4 = v4);T@#FI" PKey;TcRDoc::NormalClass00PKI ],iiPKey/PKey/inspect-i.rinu[U:RDoc::AnyMethod[iI" inspect:ETI" OpenSSL::PKey::PKey#inspect;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"1Returns a string describing the PKey object.;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"pkey.inspect -> string ;T0[I"();T@FI" PKey;TcRDoc::NormalClass00PKI ]y\MMPKey/PKey/decrypt-i.rinu[U:RDoc::AnyMethod[iI" decrypt:ETI" OpenSSL::PKey::PKey#decrypt;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"=Performs a public key decryption operation using +pkey+.;To:RDoc::Markup::BlankLineo; ; [I"ESee #encrypt for a description of the parameters and an example.;T@o; ; [I"EAdded in version 3.0. See also the man page EVP_PKEY_decrypt(3).;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I".pkey.decrypt(data [, options]) -> string ;T0[I"(p1, p2 = v2);T@FI" PKey;TcRDoc::NormalClass00PKI ]}ٹPKey/PKey/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::PKey::PKey::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PBecause PKey is an abstract class, actually calling this method explicitly ;TI"&will raise a NotImplementedError.;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"PKeyClass.new -> self ;T0[I"();T@FI" PKey;TcRDoc::NormalClass00PKI ]4PKey/PKey/derive-i.rinu[U:RDoc::AnyMethod[iI" derive:ETI"OpenSSL::PKey::PKey#derive;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NDerives a shared secret from _pkey_ and _peer_pkey_. _pkey_ must contain ;TI"Lthe private components, _peer_pkey_ must contain the public components.;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"&pkey.derive(peer_pkey) -> string ;T0[I" (p1);T@FI" PKey;TcRDoc::NormalClass00PKI ] PKey/PKey/sign_raw-i.rinu[U:RDoc::AnyMethod[iI" sign_raw:ETI"!OpenSSL::PKey::PKey#sign_raw;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OSigns +data+ using a private key +pkey+. Unlike #sign, +data+ will not be ;TI"&hashed by +digest+ automatically.;To:RDoc::Markup::BlankLineo; ; [I"4See #verify_raw for the verification operation.;T@o; ; [I"BAdded in version 3.0. See also the man page EVP_PKEY_sign(3).;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" +digest+;T; [o; ; [ I"JA String that represents the message digest algorithm name, or +nil+ ;TI"4if the PKey type requires no digest algorithm. ;TI"QAlthough this method will not hash +data+ with it, this parameter may still ;TI"6be required depending on the signature algorithm.;To;;[I" +data+;T; [o; ; [I"%A String. The data to be signed.;To;;[I"+options+;T; [o; ; [I"MA Hash that contains algorithm specific control operations to \OpenSSL. ;TI"ASee OpenSSL's man page EVP_PKEY_CTX_ctrl_str(3) for details.;T@o; ; [I" Example:;To:RDoc::Markup::Verbatim; [I"data = "Sign me!" ;TI"3hash = OpenSSL::Digest.digest("SHA256", data) ;TI"Epkey = OpenSSL::PKey.generate_key("RSA", rsa_keygen_bits: 2048) ;TI",signopts = { rsa_padding_mode: "pss" } ;TI"9signature = pkey.sign_raw("SHA256", hash, signopts) ;TI" ;TI"N# Creates a copy of the RSA key pkey, but without the private components ;TI"pub_key = pkey.public_key ;TI"Kputs pub_key.verify_raw("SHA256", signature, hash, signopts) # => true;T: @format0: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"7pkey.sign_raw(digest, data [, options]) -> string ;T0[I"(p1, p2, p3 = v3);T@?FI" PKey;TcRDoc::NormalClass00PKI ]׈|PKey/PKey/public_to_der-i.rinu[U:RDoc::AnyMethod[iI"public_to_der:ETI"&OpenSSL::PKey::PKey#public_to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PSerializes the public key to DER-encoded X.509 SubjectPublicKeyInfo format.;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I""pkey.public_to_der -> string ;T0[I"();T@FI" PKey;TcRDoc::NormalClass00PKI ]Z|CjjPKey/PKey/oid-i.rinu[U:RDoc::AnyMethod[iI"oid:ETI"OpenSSL::PKey::PKey#oid;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I">Returns the short name of the OID associated with _pkey_.;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"pkey.oid -> string ;T0[I"();T@FI" PKey;TcRDoc::NormalClass00PKI ]V=PKey/PKey/public_to_pem-i.rinu[U:RDoc::AnyMethod[iI"public_to_pem:ETI"&OpenSSL::PKey::PKey#public_to_pem;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PSerializes the public key to PEM-encoded X.509 SubjectPublicKeyInfo format.;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I""pkey.public_to_pem -> string ;T0[I"();T@FI" PKey;TcRDoc::NormalClass00PKI ]ñPKey/PKey/private_to_der-i.rinu[U:RDoc::AnyMethod[iI"private_to_der:ETI"'OpenSSL::PKey::PKey#private_to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"QSerializes the private key to DER-encoded PKCS #8 format. If called without ;TI"Rarguments, unencrypted PKCS #8 PrivateKeyInfo format is used. If called with ;TI"Oa cipher name and a password, PKCS #8 EncryptedPrivateKeyInfo format with ;TI"%PBES2 encryption scheme is used.;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"epkey.private_to_der -> string pkey.private_to_der(cipher, password) -> string ;T0[I" (*args);T@FI" PKey;TcRDoc::NormalClass00PKI ]Fq,PKey/PKey/sign-i.rinu[U:RDoc::AnyMethod[iI" sign:ETI"OpenSSL::PKey::PKey#sign;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OHashes and signs the +data+ using a message digest algorithm +digest+ and ;TI"a private key +pkey+.;To:RDoc::Markup::BlankLineo; ; [I"0See #verify for the verification operation.;T@o; ; [I"-See also the man page EVP_DigestSign(3).;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" +digest+;T; [o; ; [ I"JA String that represents the message digest algorithm name, or +nil+ ;TI"4if the PKey type requires no digest algorithm. ;TI"NFor backwards compatibility, this can be an instance of OpenSSL::Digest. ;TI"-Its state will not affect the signature.;To;;[I" +data+;T; [o; ; [I"0A String. The data to be hashed and signed.;To;;[I"+options+;T; [o; ; [I"MA Hash that contains algorithm specific control operations to \OpenSSL. ;TI"BSee OpenSSL's man page EVP_PKEY_CTX_ctrl_str(3) for details. ;TI"2+options+ parameter was added in version 3.0.;T@o; ; [I" Example:;To:RDoc::Markup::Verbatim; [ I"data = "Sign me!" ;TI"Epkey = OpenSSL::PKey.generate_key("RSA", rsa_keygen_bits: 2048) ;TI",signopts = { rsa_padding_mode: "pss" } ;TI"5signature = pkey.sign("SHA256", data, signopts) ;TI" ;TI"N# Creates a copy of the RSA key pkey, but without the private components ;TI"pub_key = pkey.public_key ;TI"Gputs pub_key.verify("SHA256", signature, data, signopts) # => true;T: @format0: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"3pkey.sign(digest, data [, options]) -> string ;T0[I"(p1, p2, p3 = v3);T@?FI" PKey;TcRDoc::NormalClass00PKI ]zsPKey/PKey/compare%3f-i.rinu[U:RDoc::AnyMethod[iI" compare?:ETI"!OpenSSL::PKey::PKey#compare?;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"eUsed primarily to check if an OpenSSL::X509::Certificate#public_key compares to its private key.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I"Dx509 = OpenSSL::X509::Certificate.new(pem_encoded_certificate) ;TI"?rsa_key = OpenSSL::PKey::RSA.new(pem_encoded_private_key) ;TI" ;TI"6rsa_key.compare?(x509.public_key) => true | false;T: @format0: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"1pkey.compare?(another_pkey) -> true | false ;T0[I" (p1);T@FI" PKey;TcRDoc::NormalClass00PKI ]Sx:PKey/PKey/verify_recover-i.rinu[U:RDoc::AnyMethod[iI"verify_recover:ETI"'OpenSSL::PKey::PKey#verify_recover;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"RRecovers the signed data from +signature+ using a public key +pkey+. Not all ;TI"1signature algorithms support this operation.;To:RDoc::Markup::BlankLineo; ; [I"LAdded in version 3.0. See also the man page EVP_PKEY_verify_recover(3).;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I"+signature+;T; [o; ; [I"6A String containing the signature to be verified.;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"Bpkey.verify_recover(digest, signature [, options]) -> string ;T0[I"(p1, p2, p3 = v3);T@FI" PKey;TcRDoc::NormalClass00PKI ]ƳPKey/PKey/private_to_pem-i.rinu[U:RDoc::AnyMethod[iI"private_to_pem:ETI"'OpenSSL::PKey::PKey#private_to_pem;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"SSerializes the private key to PEM-encoded PKCS #8 format. See #private_to_der ;TI"for more details.;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"epkey.private_to_pem -> string pkey.private_to_pem(cipher, password) -> string ;T0[I" (*args);T@FI" PKey;TcRDoc::NormalClass00PKI ]0%PKey/PKey/verify-i.rinu[U:RDoc::AnyMethod[iI" verify:ETI"OpenSSL::PKey::PKey#verify;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NVerifies the +signature+ for the +data+ using a message digest algorithm ;TI"&+digest+ and a public key +pkey+.;To:RDoc::Markup::BlankLineo; ; [I"RReturns +true+ if the signature is successfully verified, +false+ otherwise. ;TI",The caller must check the return value.;T@o; ; [I"8See #sign for the signing operation and an example.;T@o; ; [I"/See also the man page EVP_DigestVerify(3).;T@o:RDoc::Markup::List: @type: NOTE: @items[ o:RDoc::Markup::ListItem: @label[I" +digest+;T; [o; ; [I"See #sign.;To;;[I"+signature+;T; [o; ; [I"6A String containing the signature to be verified.;To;;[I" +data+;T; [o; ; [I"See #sign.;To;;[I"+options+;T; [o; ; [I"=See #sign. +options+ parameter was added in version 3.0.;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"Gpkey.verify(digest, signature, data [, options]) -> true or false ;T0[I"(p1, p2, p3, p4 = v4);T@8FI" PKey;TcRDoc::NormalClass00PKI ]tPKey/PKey/encrypt-i.rinu[U:RDoc::AnyMethod[iI" encrypt:ETI" OpenSSL::PKey::PKey#encrypt;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"=Performs a public key encryption operation using +pkey+.;To:RDoc::Markup::BlankLineo; ; [I",See #decrypt for the reverse operation.;T@o; ; [I"EAdded in version 3.0. See also the man page EVP_PKEY_encrypt(3).;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" +data+;T; [o; ; [I"A String to be encrypted.;To;;[I"+options+;T; [o; ; [I"MA Hash that contains algorithm specific control operations to \OpenSSL. ;TI"ASee OpenSSL's man page EVP_PKEY_CTX_ctrl_str(3) for details.;T@o; ; [I" Example:;To:RDoc::Markup::Verbatim; [ I"Epkey = OpenSSL::PKey.generate_key("RSA", rsa_keygen_bits: 2048) ;TI"data = "secret data" ;TI">encrypted = pkey.encrypt(data, rsa_padding_mode: "oaep") ;TI">decrypted = pkey.decrypt(data, rsa_padding_mode: "oaep") ;TI""p decrypted #=> "secret data";T: @format0: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I".pkey.encrypt(data [, options]) -> string ;T0[I"(p1, p2 = v2);T@0FI" PKey;TcRDoc::NormalClass00PKI ]]  PKey/PKey/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"(OpenSSL::PKey::PKey#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" PKey;TcRDoc::NormalClass00PKI ]?ECCPKey/PKey/to_text-i.rinu[U:RDoc::AnyMethod[iI" to_text:ETI" OpenSSL::PKey::PKey#to_text;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"ODumps key parameters, public key, and private key components contained in ;TI"(the key into a human-readable text.;To:RDoc::Markup::BlankLineo; ; [I",This is intended for debugging purpose.;T@o; ; [I"5See also the man page EVP_PKEY_print_private(3).;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"pkey.to_text -> string ;T0[I"();T@FI" PKey;TcRDoc::NormalClass00PKI ](Yu!PKey/PKeyError/cdesc-PKeyError.rinu[U:RDoc::NormalClass[iI"PKeyError:ETI"OpenSSL::PKey::PKeyError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[ o;;[o:RDoc::Markup::Paragraph;[I">Raised when errors occur during PKey#sign or PKey#verify.;T: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0o;;[; I"ext/openssl/ossl_pkey_dh.c;T; 0o;;[; I" ext/openssl/ossl_pkey_dsa.c;T; 0o;;[; I"ext/openssl/ossl_pkey_ec.c;T; 0o;;[; I" ext/openssl/ossl_pkey_rsa.c;T; 0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey;TcRDoc::NormalModulePKI ]T̂PKey/DSA/sysverify-i.rinu[U:RDoc::AnyMethod[iI"sysverify:ETI"!OpenSSL::PKey::DSA#sysverify;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"MVerifies whether the signature is valid given the message digest input. ;TI"NIt does so by validating +sig+ using the public key of this DSA instance.;To:RDoc::Markup::BlankLineo; ; [I"'Deprecated in version 3.0. ;TI"JConsider using PKey::PKey#sign_raw and PKey::PKey#verify_raw instead.;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" +digest+;T; [o; ; [I">A message digest of the original input data to be signed.;To;;[I" +sig+;T; [o; ; [I"A \DSA signature value.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"0dsa.sysverify(digest, sig) -> true | false ;T0[I"(digest, sig);T@$FI"DSA;TcRDoc::NormalClass00PKI ]|y^PKey/DSA/export-i.rinu[U:RDoc::AnyMethod[iI" export:ETI"OpenSSL::PKey::DSA#export;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"*Encodes this DSA to its PEM encoding.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"$_cipher_ is an OpenSSL::Cipher.;To;;0; [o; ; [I"5_password_ is a string containing your password.;T@S; ; i;I" Examples;To:RDoc::Markup::Verbatim; [I"DSA.to_pem -> aString ;TI"0DSA.to_pem(cipher, 'mypassword') -> aString;T: @format0: @fileI" ext/openssl/ossl_pkey_dsa.c;T:0@omit_headings_from_table_of_contents_below0I"|dsa.export([cipher, password]) -> aString dsa.to_pem([cipher, password]) -> aString dsa.to_s([cipher, password]) -> aString ;T0[[I" to_pem;T@ [I" to_s;T@ I" (*args);T@#FI"DSA;TcRDoc::NormalClass00PKI ]rPKey/DSA/private%3f-i.rinu[U:RDoc::AnyMethod[iI" private?:ETI" OpenSSL::PKey::DSA#private?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QIndicates whether this DSA instance has a private key associated with it or ;TI"@not. The private key may be retrieved with DSA#private_key.;T: @fileI" ext/openssl/ossl_pkey_dsa.c;T:0@omit_headings_from_table_of_contents_below0I""dsa.private? -> true | false ;T0[I"();T@FI"DSA;TcRDoc::NormalClass00PKI ]PKey/DSA/public%3f-i.rinu[U:RDoc::AnyMethod[iI" public?:ETI"OpenSSL::PKey::DSA#public?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PIndicates whether this DSA instance has a public key associated with it or ;TI">not. The public key may be retrieved with DSA#public_key.;T: @fileI" ext/openssl/ossl_pkey_dsa.c;T:0@omit_headings_from_table_of_contents_below0I"!dsa.public? -> true | false ;T0[I"();T@FI"DSA;TcRDoc::NormalClass00PKI ]RⷡPKey/DSA/set_key-i.rinu[U:RDoc::AnyMethod[iI" set_key:ETI"OpenSSL::PKey::DSA#set_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QSets _pub_key_ and _priv_key_ for the DSA instance. _priv_key_ may be +nil+.;T: @fileI" ext/openssl/ossl_pkey_dsa.c;T:0@omit_headings_from_table_of_contents_below0I",dsa.set_key(pub_key, priv_key) -> self ;T0[I" (p1, p2);T@FI"DSA;TcRDoc::NormalClass00PKI ]TttPKey/DSA/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::PKey::DSA::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"ICreates a new DSA instance by reading an existing key from _string_.;To:RDoc::Markup::BlankLineo; ; [I"PIf called without arguments, creates a new instance with no key components ;TI"@set. They can be set individually by #set_pqg and #set_key.;T@o; ; [I"SIf called with a String, tries to parse as DER or PEM encoding of a \DSA key. ;TI"CSee also OpenSSL::PKey.read which can parse keys of any kinds.;T@o; ; [I"OIf called with a number, generates random parameters and a key pair. This ;TI",form works as an alias of DSA.generate.;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" +string+;T; [o; ; [I"5A String that contains a DER or PEM encoded key.;To;;[I" +pass+;T; [o; ; [I"1A String that contains an optional password.;To;;[I" +size+;T; [o; ; [I"See DSA.generate.;T@o; ; [I"Examples:;To:RDoc::Markup::Verbatim; [ I"$p OpenSSL::PKey::DSA.new(1024) ;TI":#=> # ;TI" ;TI"4p OpenSSL::PKey::DSA.new(File.read('dsa.pem')) ;TI":#=> # ;TI" ;TI"Bp OpenSSL::PKey::DSA.new(File.read('dsa.pem'), 'mypassword') ;TI"9#=> #;T: @format0: @fileI" ext/openssl/ossl_pkey_dsa.c;T:0@omit_headings_from_table_of_contents_below0I"IDSA.new -> dsa DSA.new(string [, pass]) -> dsa DSA.new(size) -> dsa ;T0[I"(p1 = v1, p2 = v2);T@?FI"DSA;TcRDoc::NormalClass00PKI ]hPKey/DSA/generate-c.rinu[U:RDoc::AnyMethod[iI" generate:ETI"!OpenSSL::PKey::DSA::generate;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"HCreates a new DSA instance by generating a private/public key pair ;TI"from scratch.;To:RDoc::Markup::BlankLineo; ; [I"4See also OpenSSL::PKey.generate_parameters and ;TI" OpenSSL::PKey.generate_key.;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" +size+;T; [o; ; [I""The desired key size in bits.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"DSA.generate(size) -> dsa ;T0[I"(size, &blk);T@FI"DSA;TcRDoc::NormalClass00PKI ]PKey/DSA/params-i.rinu[U:RDoc::AnyMethod[iI" params:ETI"OpenSSL::PKey::DSA#params;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Stores all parameters of key to the hash ;TI"4INSECURE: PRIVATE INFORMATIONS CAN LEAK OUT!!! ;TI"#Don't use :-)) (I's up to you);T: @fileI" ext/openssl/ossl_pkey_dsa.c;T:0@omit_headings_from_table_of_contents_below0I"dsa.params -> hash ;T0[I"();T@FI"DSA;TcRDoc::NormalClass00PKI ]cOl@@PKey/DSA/syssign-i.rinu[U:RDoc::AnyMethod[iI" syssign:ETI"OpenSSL::PKey::DSA#syssign;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"LComputes and returns the \DSA signature of +string+, where +string+ is ;TI"Mexpected to be an already-computed message digest of the original input ;TI"Ndata. The signature is issued using the private key of this DSA instance.;To:RDoc::Markup::BlankLineo; ; [I"'Deprecated in version 3.0. ;TI"JConsider using PKey::PKey#sign_raw and PKey::PKey#verify_raw instead.;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" +string+;T; [o; ; [I">A message digest of the original input data to be signed.;T@o; ; [I" Example:;To:RDoc::Markup::Verbatim; [I"(dsa = OpenSSL::PKey::DSA.new(2048) ;TI"doc = "Sign me" ;TI"2digest = OpenSSL::Digest.digest('SHA1', doc) ;TI" ;TI",# With legacy #syssign and #sysverify: ;TI"sig = dsa.syssign(digest) ;TI"+p dsa.sysverify(digest, sig) #=> true ;TI" ;TI"'# With #sign_raw and #verify_raw: ;TI"%sig = dsa.sign_raw(nil, digest) ;TI"0p dsa.verify_raw(nil, sig, digest) #=> true;T: @format0: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"#dsa.syssign(string) -> string ;T0[I" (string);T@.FI"DSA;TcRDoc::NormalClass00PKI ]Mp ""PKey/DSA/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI"OpenSSL::PKey::DSA#to_s;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"*Encodes this DSA to its PEM encoding.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"$_cipher_ is an OpenSSL::Cipher.;To;;0; [o; ; [I"5_password_ is a string containing your password.;T@S; ; i;I" Examples;To:RDoc::Markup::Verbatim; [I"DSA.to_pem -> aString ;TI"0DSA.to_pem(cipher, 'mypassword') -> aString;T: @format0: @fileI" ext/openssl/ossl_pkey_dsa.c;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@#FI"DSA;TcRDoc::NormalClass0[I"OpenSSL::PKey::DSA;TFI" export;TPKI ]pPKey/DSA/public_key-i.rinu[U:RDoc::AnyMethod[iI"public_key:ETI""OpenSSL::PKey::DSA#public_key;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"NReturns a new DSA instance that carries just the \DSA parameters and the ;TI"public key.;To:RDoc::Markup::BlankLineo; ; [I"OThis method is provided for backwards compatibility. In most cases, there ;TI"$is no need to call this method.;T@o; ; [I"NFor the purpose of serializing the public key, to PEM or DER encoding of ;TI"EX.509 SubjectPublicKeyInfo format, check PKey#public_to_pem and ;TI"PKey#public_to_der.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"dsa.public_key -> dsanew ;T0[I"();T@FI"DSA;TcRDoc::NormalClass00PKI ]ь&&PKey/DSA/to_pem-i.rinu[U:RDoc::AnyMethod[iI" to_pem:ETI"OpenSSL::PKey::DSA#to_pem;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"*Encodes this DSA to its PEM encoding.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"$_cipher_ is an OpenSSL::Cipher.;To;;0; [o; ; [I"5_password_ is a string containing your password.;T@S; ; i;I" Examples;To:RDoc::Markup::Verbatim; [I"DSA.to_pem -> aString ;TI"0DSA.to_pem(cipher, 'mypassword') -> aString;T: @format0: @fileI" ext/openssl/ossl_pkey_dsa.c;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@#FI"DSA;TcRDoc::NormalClass0[I"OpenSSL::PKey::DSA;TFI" export;TPKI ]BaaPKey/DSA/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"OpenSSL::PKey::DSA#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"*Encodes this DSA to its DER encoding.;T: @fileI" ext/openssl/ossl_pkey_dsa.c;T:0@omit_headings_from_table_of_contents_below0I"dsa.to_der -> aString ;T0[I"();T@FI"DSA;TcRDoc::NormalClass00PKI ]`zvvPKey/DSA/set_pqg-i.rinu[U:RDoc::AnyMethod[iI" set_pqg:ETI"OpenSSL::PKey::DSA#set_pqg;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I",Sets _p_, _q_, _g_ to the DSA instance.;T: @fileI" ext/openssl/ossl_pkey_dsa.c;T:0@omit_headings_from_table_of_contents_below0I""dsa.set_pqg(p, q, g) -> self ;T0[I"(p1, p2, p3);T@FI"DSA;TcRDoc::NormalClass00PKI ]zPKey/DSA/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"'OpenSSL::PKey::DSA#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_pkey_dsa.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"DSA;TcRDoc::NormalClass00PKI ]pP:bbPKey/DSA/cdesc-DSA.rinu[U:RDoc::NormalClass[iI"DSA:ETI"OpenSSL::PKey::DSA;TI"OpenSSL::PKey::PKey;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0o;;[o:RDoc::Markup::Paragraph;[I"BDSA, the Digital Signature Algorithm, is specified in NIST's ;TI"KFIPS 186-3. It is an asymmetric public key algorithm that may be used ;TI"similar to e.g. RSA.;T; I" ext/openssl/ossl_pkey_dsa.c;T; 0; 0; 0[[[[I"OpenSSL::Marshal;To;;[; @; 0I"$ext/openssl/lib/openssl/pkey.rb;T[[I" class;T[[: public[[:protected[[: private[[I" generate;T@[I"new;TI" ext/openssl/ossl_pkey_dsa.c;T[I" instance;T[[; [[; [[;[[I" export;T@-[I"initialize_copy;T@-[I" params;T@-[I" private?;T@-[I" public?;T@-[I"public_key;T@[I" set_key;T@-[I" set_pqg;T@-[I" syssign;T@[I"sysverify;T@[I" to_der;T@-[I" to_pem;T@-[I" to_s;T@-[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/pkey.rb;TI"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey;TcRDoc::NormalModulePKI ] nPKey/ECError/cdesc-ECError.rinu[U:RDoc::NormalClass[iI" ECError:ETI"OpenSSL::PKey::ECError;TI"OpenSSL::PKey::PKeyError;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey;TcRDoc::NormalModulePKI ]FPKey/generate_parameters-c.rinu[U:RDoc::AnyMethod[iI"generate_parameters:ETI"'OpenSSL::PKey::generate_parameters;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"NGenerates new parameters for the algorithm. _algo_name_ is a String that ;TI"Nrepresents the algorithm. The optional argument _options_ is a Hash that ;TI"Ospecifies the options specific to the algorithm. The order of the options ;TI"can be important.;To:RDoc::Markup::BlankLineo; ; [I"NA block can be passed optionally. The meaning of the arguments passed to ;TI"Rthe block varies depending on the implementation of the algorithm. The block ;TI"Emay be called once or multiple times, or may not even be called.;T@o; ; [I"PFor the supported options, see the documentation for the 'openssl genpkey' ;TI"utility command.;T@S:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [I"Rpkey = OpenSSL::PKey.generate_parameters("DSA", "dsa_paramgen_bits" => 2048) ;TI"p pkey.p.num_bits #=> 2048;T: @format0: @fileI"ext/openssl/ossl_pkey.c;T:0@omit_headings_from_table_of_contents_below0I"FOpenSSL::PKey.generate_parameters(algo_name [, options]) -> pkey ;T0[I" (*args);T@!FI" PKey;TcRDoc::NormalModule00PKI ])pPKey/RSAError/cdesc-RSAError.rinu[U:RDoc::NormalClass[iI" RSAError:ETI"OpenSSL::PKey::RSAError;TI"OpenSSL::PKey::PKeyError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"EGeneric exception that is raised if an operation on an RSA PKey ;TI"Jfails unexpectedly or in case an instantiation of an instance of RSA ;TI",fails due to non-conformant input data.;T: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey;TcRDoc::NormalModulePKI ]t7PKey/DHError/cdesc-DHError.rinu[U:RDoc::NormalClass[iI" DHError:ETI"OpenSSL::PKey::DHError;TI"OpenSSL::PKey::PKeyError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"CGeneric exception that is raised if an operation on a DH PKey ;TI"Ifails unexpectedly or in case an instantiation of an instance of DH ;TI",fails due to non-conformant input data.;T: @fileI"ext/openssl/ossl_pkey_dh.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey;TcRDoc::NormalModulePKI ](CPKey/RSA/public_encrypt-i.rinu[U:RDoc::AnyMethod[iI"public_encrypt:ETI"&OpenSSL::PKey::RSA#public_encrypt;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"BEncrypt +string+ with the public key. +padding+ defaults to ;TI"GPKCS1_PADDING. The encrypted string output can be decrypted using ;TI"#private_decrypt.;To:RDoc::Markup::BlankLineo; ; [I"'Deprecated in version 3.0. ;TI"FConsider using PKey::PKey#encrypt and PKey::PKey#decrypt instead.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"arsa.public_encrypt(string) -> String rsa.public_encrypt(string, padding) -> String ;T0[I"$(data, padding = PKCS1_PADDING);T@FI"RSA;TcRDoc::NormalClass00PKI ] =PKey/RSA/cdesc-RSA.rinu[U:RDoc::NormalClass[iI"RSA:ETI"OpenSSL::PKey::RSA;TI"OpenSSL::PKey::PKey;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0o;;[o:RDoc::Markup::Paragraph;[ I"KRSA is an asymmetric public key algorithm that has been formalized in ;TI"KRFC 3447. It is in widespread use in public key infrastructures (PKI) ;TI"Jwhere certificates (cf. OpenSSL::X509::Certificate) often are issued ;TI"Jon the basis of a public/private RSA key pair. RSA is used in a wide ;TI"Ifield of applications such as secure (symmetric) key exchange, e.g. ;TI"Gwhen establishing a secure TLS/SSL connection. It is also used in ;TI"'various digital signature schemes.;T; I" ext/openssl/ossl_pkey_rsa.c;T; 0; 0; 0[[ U:RDoc::Constant[iI"PKCS1_PADDING;TI"&OpenSSL::PKey::RSA::PKCS1_PADDING;T: public0o;;[; @; 0@@cRDoc::NormalClass0U; [iI"SSLV23_PADDING;TI"'OpenSSL::PKey::RSA::SSLV23_PADDING;T; 0o;;[; @; 0@@@#0U; [iI"NO_PADDING;TI"#OpenSSL::PKey::RSA::NO_PADDING;T; 0o;;[; @; 0@@@#0U; [iI"PKCS1_OAEP_PADDING;TI"+OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING;T; 0o;;[; @; 0@@@#0[[I"OpenSSL::Marshal;To;;[; @; 0I"$ext/openssl/lib/openssl/pkey.rb;T[[I" class;T[[; [[:protected[[: private[[I" generate;T@;[I"new;TI" ext/openssl/ossl_pkey_rsa.c;T[I" instance;T[[; [[;[[;[[I" export;T@J[I"initialize_copy;T@J[I" params;T@J[I" private?;T@J[I"private_decrypt;T@;[I"private_encrypt;T@;[I" public?;T@J[I"public_decrypt;T@;[I"public_encrypt;T@;[I"public_key;T@;[I"set_crt_params;T@J[I"set_factors;T@J[I" set_key;T@J[I" sign_pss;T@J[I" to_der;T@J[I" to_pem;T@J[I" to_s;T@J[I"translate_padding_mode;T@;[I"verify_pss;T@J[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/pkey.rb;TI"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey;TcRDoc::NormalModulePKI ]ePKey/RSA/export-i.rinu[U:RDoc::AnyMethod[iI" export:ETI"OpenSSL::PKey::RSA#export;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NOutputs this keypair in PEM encoding. If _cipher_ and _pass_phrase_ are ;TI"Fgiven they will be used to encrypt the key. _cipher_ must be an ;TI"OpenSSL::Cipher instance.;T: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below0I"rsa.export([cipher, pass_phrase]) => PEM-format String rsa.to_pem([cipher, pass_phrase]) => PEM-format String rsa.to_s([cipher, pass_phrase]) => PEM-format String ;T0[[I" to_pem;T@ [I" to_s;T@ I" (*args);T@FI"RSA;TcRDoc::NormalClass00PKI ]ooPKey/RSA/private%3f-i.rinu[U:RDoc::AnyMethod[iI" private?:ETI" OpenSSL::PKey::RSA#private?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"-Does this keypair contain a private key?;T: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below0I""rsa.private? => true | false ;T0[I"();T@FI"RSA;TcRDoc::NormalClass00PKI ]PKey/RSA/public%3f-i.rinu[U:RDoc::AnyMethod[iI" public?:ETI"OpenSSL::PKey::RSA#public?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PThe return value is always +true+ since every private key is also a public ;TI" key.;T: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below0I"rsa.public? => true ;T0[I"();T@FI"RSA;TcRDoc::NormalClass00PKI ]7}wwPKey/RSA/set_key-i.rinu[U:RDoc::AnyMethod[iI" set_key:ETI"OpenSSL::PKey::RSA#set_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"-Sets _n_, _e_, _d_ for the RSA instance.;T: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below0I""rsa.set_key(n, e, d) -> self ;T0[I"(p1, p2, p3);T@FI"RSA;TcRDoc::NormalClass00PKI ]22PKey/RSA/verify_pss-i.rinu[U:RDoc::AnyMethod[iI"verify_pss:ETI""OpenSSL::PKey::RSA#verify_pss;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"HVerifies _data_ using the Probabilistic Signature Scheme (RSA-PSS).;To:RDoc::Markup::BlankLineo; ; [I"NThe return value is +true+ if the signature is valid, +false+ otherwise. ;TI"0RSAError will be raised if an error occurs.;T@o; ; [I"ASee #sign_pss for the signing operation and an example code.;T@S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: NOTE: @items[ o:RDoc::Markup::ListItem: @label[I" _digest_;T; [o; ; [I";A String containing the message digest algorithm name.;To;;[I" _data_;T; [o; ; [I"%A String. The data to be signed.;To;;[I"_salt_length_;T; [o; ; [I"HThe length in octets of the salt. Two special values are reserved: ;TI"H+:digest+ means the digest length, and +:auto+ means automatically ;TI"3determining the length based on the signature.;To;;[I"_mgf1_hash_;T; [o; ; [I"%The hash algorithm used in MGF1.;T: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below0I"Wrsa.verify_pss(digest, signature, data, salt_length:, mgf1_hash:) -> true | false ;T0[I"(p1, p2, p3, p4 = {});T@8FI"RSA;TcRDoc::NormalClass00PKI ]7E **PKey/RSA/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::PKey::RSA::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"(Generates or loads an \RSA keypair.;To:RDoc::Markup::BlankLineo; ; [I"PIf called without arguments, creates a new instance with no key components ;TI"Fset. They can be set individually by #set_key, #set_factors, and ;TI"#set_crt_params.;T@o; ; [ I"TIf called with a String, tries to parse as DER or PEM encoding of an \RSA key. ;TI"QNote that, if _passphrase_ is not specified but the key is encrypted with a ;TI".passphrase, \OpenSSL will prompt for it. ;TI"CSee also OpenSSL::PKey.read which can parse keys of any kinds.;T@o; ; [I"NIf called with a number, generates a new key pair. This form works as an ;TI"alias of RSA.generate.;T@o; ; [I"Examples:;To:RDoc::Markup::Verbatim; [I"!OpenSSL::PKey::RSA.new 2048 ;TI"0OpenSSL::PKey::RSA.new File.read 'rsa.pem' ;TI"BOpenSSL::PKey::RSA.new File.read('rsa.pem'), 'my pass phrase';T: @format0: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below0I"RSA.new -> rsa RSA.new(encoded_key [, passphrase]) -> rsa RSA.new(encoded_key) { passphrase } -> rsa RSA.new(size [, exponent]) -> rsa ;T0[I"(p1 = v1, p2 = v2);T@&FI"RSA;TcRDoc::NormalClass00PKI ].4nPKey/RSA/set_crt_params-i.rinu[U:RDoc::AnyMethod[iI"set_crt_params:ETI"&OpenSSL::PKey::RSA#set_crt_params;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NSets _dmp1_, _dmq1_, _iqmp_ for the RSA instance. They are calculated by ;TI"Nd mod (p - 1), d mod (q - 1) and q^(-1) mod p ;TI"respectively.;T: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below0I"2rsa.set_crt_params(dmp1, dmq1, iqmp) -> self ;T0[I"(p1, p2, p3);T@FI"RSA;TcRDoc::NormalClass00PKI ]b~PKey/RSA/sign_pss-i.rinu[U:RDoc::AnyMethod[iI" sign_pss:ETI" OpenSSL::PKey::RSA#sign_pss;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QSigns _data_ using the Probabilistic Signature Scheme (RSA-PSS) and returns ;TI"the calculated signature.;To:RDoc::Markup::BlankLineo; ; [I"0RSAError will be raised if an error occurs.;T@o; ; [I"4See #verify_pss for the verification operation.;T@S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: NOTE: @items[ o:RDoc::Markup::ListItem: @label[I" _digest_;T; [o; ; [I";A String containing the message digest algorithm name.;To;;[I" _data_;T; [o; ; [I"%A String. The data to be signed.;To;;[I"_salt_length_;T; [o; ; [ I"HThe length in octets of the salt. Two special values are reserved: ;TI"N+:digest+ means the digest length, and +:max+ means the maximum possible ;TI"Llength for the combination of the private key and the selected message ;TI"digest algorithm.;To;;[I"_mgf1_hash_;T; [o; ; [I"NThe hash algorithm used in MGF1 (the currently supported mask generation ;TI"function (MGF)).;T@S; ; i;I" Example;To:RDoc::Markup::Verbatim; [ I"data = "Sign me!" ;TI")pkey = OpenSSL::PKey::RSA.new(2048) ;TI"Wsignature = pkey.sign_pss("SHA256", data, salt_length: :max, mgf1_hash: "SHA256") ;TI"6pub_key = OpenSSL::PKey.read(pkey.public_to_der) ;TI"8puts pub_key.verify_pss("SHA256", signature, data, ;TI"O salt_length: :auto, mgf1_hash: "SHA256") # => true;T: @format0: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below0I"Drsa.sign_pss(digest, data, salt_length:, mgf1_hash:) -> String ;T0[I"(p1, p2, p3 = {});T@DFI"RSA;TcRDoc::NormalClass00PKI ]J1wwPKey/RSA/set_factors-i.rinu[U:RDoc::AnyMethod[iI"set_factors:ETI"#OpenSSL::PKey::RSA#set_factors;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"(Sets _p_, _q_ for the RSA instance.;T: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below0I"#rsa.set_factors(p, q) -> self ;T0[I" (p1, p2);T@FI"RSA;TcRDoc::NormalClass00PKI ],APKey/RSA/generate-c.rinu[U:RDoc::AnyMethod[iI" generate:ETI"!OpenSSL::PKey::RSA::generate;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"Generates an \RSA keypair.;To:RDoc::Markup::BlankLineo; ; [I")See also OpenSSL::PKey.generate_key.;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" +size+;T; [o; ; [I""The desired key size in bits.;To;;[I"+exponent+;T; [o; ; [I".An odd Integer, normally 3, 17, or 65537.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"1RSA.generate(size, exponent = 65537) -> RSA ;T0[I" (size, exp = 0x10001, &blk);T@"FI"RSA;TcRDoc::NormalClass00PKI ];|(CCPKey/RSA/params-i.rinu[U:RDoc::AnyMethod[iI" params:ETI"OpenSSL::PKey::RSA#params;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"ATHIS METHOD IS INSECURE, PRIVATE INFORMATION CAN LEAK OUT!!!;To:RDoc::Markup::BlankLineo; ; [I"QStores all parameters of key to the hash. The hash has keys 'n', 'e', 'd', ;TI"&'p', 'q', 'dmp1', 'dmq1', 'iqmp'.;T@o; ; [I"$Don't use :-)) (It's up to you);T: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below0I"rsa.params => hash ;T0[I"();T@FI"RSA;TcRDoc::NormalClass00PKI ]+2!!$PKey/RSA/translate_padding_mode-i.rinu[U:RDoc::AnyMethod[iI"translate_padding_mode:ETI".OpenSSL::PKey::RSA#translate_padding_mode;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below000[I" (num);T@ FI"RSA;TcRDoc::NormalClass00PKI ]9!PKey/RSA/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI"OpenSSL::PKey::RSA#to_s;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NOutputs this keypair in PEM encoding. If _cipher_ and _pass_phrase_ are ;TI"Fgiven they will be used to encrypt the key. _cipher_ must be an ;TI"OpenSSL::Cipher instance.;T: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@FI"RSA;TcRDoc::NormalClass0[I"OpenSSL::PKey::RSA;TFI" export;TPKI ]e~>PKey/RSA/public_key-i.rinu[U:RDoc::AnyMethod[iI"public_key:ETI""OpenSSL::PKey::RSA#public_key;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"LReturns a new RSA instance that carries just the public key components.;To:RDoc::Markup::BlankLineo; ; [I"OThis method is provided for backwards compatibility. In most cases, there ;TI"$is no need to call this method.;T@o; ; [I"NFor the purpose of serializing the public key, to PEM or DER encoding of ;TI"EX.509 SubjectPublicKeyInfo format, check PKey#public_to_pem and ;TI"PKey#public_to_der.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"rsa.public_key -> rsanew ;T0[I"();T@FI"RSA;TcRDoc::NormalClass00PKI ]E@PKey/RSA/to_pem-i.rinu[U:RDoc::AnyMethod[iI" to_pem:ETI"OpenSSL::PKey::RSA#to_pem;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NOutputs this keypair in PEM encoding. If _cipher_ and _pass_phrase_ are ;TI"Fgiven they will be used to encrypt the key. _cipher_ must be an ;TI"OpenSSL::Cipher instance.;T: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@FI"RSA;TcRDoc::NormalClass0[I"OpenSSL::PKey::RSA;TFI" export;TPKI ] DER-format String ;T0[I"();T@FI"RSA;TcRDoc::NormalClass00PKI ](JPKey/RSA/private_decrypt-i.rinu[U:RDoc::AnyMethod[iI"private_decrypt:ETI"'OpenSSL::PKey::RSA#private_decrypt;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NDecrypt +string+, which has been encrypted with the public key, with the ;TI"6private key. +padding+ defaults to PKCS1_PADDING.;To:RDoc::Markup::BlankLineo; ; [I"'Deprecated in version 3.0. ;TI"FConsider using PKey::PKey#encrypt and PKey::PKey#decrypt instead.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"crsa.private_decrypt(string) -> String rsa.private_decrypt(string, padding) -> String ;T0[I"$(data, padding = PKCS1_PADDING);T@FI"RSA;TcRDoc::NormalClass00PKI ]ZPKey/RSA/public_decrypt-i.rinu[U:RDoc::AnyMethod[iI"public_decrypt:ETI"&OpenSSL::PKey::RSA#public_decrypt;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"ODecrypt +string+, which has been encrypted with the private key, with the ;TI"6public key. +padding+ defaults to PKCS1_PADDING.;To:RDoc::Markup::BlankLineo; ; [I"'Deprecated in version 3.0. ;TI"GConsider using PKey::PKey#sign_raw and PKey::PKey#verify_raw, and ;TI"'PKey::PKey#verify_recover instead.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"arsa.public_decrypt(string) -> String rsa.public_decrypt(string, padding) -> String ;T0[I"&(string, padding = PKCS1_PADDING);T@FI"RSA;TcRDoc::NormalClass00PKI ]w(]PKey/RSA/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"'OpenSSL::PKey::RSA#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_pkey_rsa.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"RSA;TcRDoc::NormalClass00PKI ]hPKey/RSA/private_encrypt-i.rinu[U:RDoc::AnyMethod[iI"private_encrypt:ETI"'OpenSSL::PKey::RSA#private_encrypt;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"CEncrypt +string+ with the private key. +padding+ defaults to ;TI"GPKCS1_PADDING. The encrypted string output can be decrypted using ;TI"#public_decrypt.;To:RDoc::Markup::BlankLineo; ; [I"'Deprecated in version 3.0. ;TI"GConsider using PKey::PKey#sign_raw and PKey::PKey#verify_raw, and ;TI"'PKey::PKey#verify_recover instead.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"crsa.private_encrypt(string) -> String rsa.private_encrypt(string, padding) -> String ;T0[I"&(string, padding = PKCS1_PADDING);T@FI"RSA;TcRDoc::NormalClass00PKI ]JhhPKey/EC/dh_compute_key-i.rinu[U:RDoc::AnyMethod[iI"dh_compute_key:ETI"%OpenSSL::PKey::EC#dh_compute_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"FDerives a shared secret by ECDH. _pubkey_ must be an instance of ;TI"@OpenSSL::PKey::EC::Point and must belong to the same group.;To:RDoc::Markup::BlankLineo; ; [I"LThis method is provided for backwards compatibility, and calls #derive ;TI"internally.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I")ec.dh_compute_key(pubkey) -> string ;T0[I" (pubkey);T@FI"EC;TcRDoc::NormalClass00PKI ]yI\PKey/EC/private_key%3f-i.rinu[U:RDoc::AnyMethod[iI"private_key?:ETI"#OpenSSL::PKey::EC#private_key?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RReturns whether this EC instance has a private key. The private key (BN) can ;TI"&be retrieved with EC#private_key.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"EC;TcRDoc::NormalClass0[I"OpenSSL::PKey::EC;TFI" private?;TPKI ] ڂPKey/EC/public_key%3d-i.rinu[U:RDoc::AnyMethod[iI"public_key=:ETI""OpenSSL::PKey::EC#public_key=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I">See the OpenSSL documentation for EC_KEY_set_public_key();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"key.public_key = ec_point ;T0[I" (p1);T@FI"EC;TcRDoc::NormalClass00PKI ]sPKey/EC/export-i.rinu[U:RDoc::AnyMethod[iI" export:ETI"OpenSSL::PKey::EC#export;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"ROutputs the EC key in PEM encoding. If _cipher_ and _pass_phrase_ are given ;TI"Pthey will be used to encrypt the key. _cipher_ must be an OpenSSL::Cipher ;TI"Ninstance. Note that encryption will only be effective for a private key, ;TI"6public keys will always be encoded in plain text.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"]key.export([cipher, pass_phrase]) => String key.to_pem([cipher, pass_phrase]) => String ;T0[[I" to_pem;T@ I" (*args);T@FI"EC;TcRDoc::NormalClass00PKI ]"PKey/EC/private%3f-i.rinu[U:RDoc::AnyMethod[iI" private?:ETI"OpenSSL::PKey::EC#private?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RReturns whether this EC instance has a private key. The private key (BN) can ;TI"&be retrieved with EC#private_key.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"#key.private? => true or false ;T0[[I"private_key?;T@ I"();T@FI"EC;TcRDoc::NormalClass00PKI ]ǚڗPKey/EC/public%3f-i.rinu[U:RDoc::AnyMethod[iI" public?:ETI"OpenSSL::PKey::EC#public?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GReturns whether this EC instance has a public key. The public key ;TI"5(EC::Point) can be retrieved with EC#public_key.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I""key.public? => true or false ;T0[[I"public_key?;T@ I"();T@FI"EC;TcRDoc::NormalClass00PKI ]7JPKey/EC/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::PKey::EC::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"2Creates a new EC object from given arguments.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"OpenSSL::PKey::EC.new OpenSSL::PKey::EC.new(ec_key) OpenSSL::PKey::EC.new(ec_group) OpenSSL::PKey::EC.new("secp112r1") OpenSSL::PKey::EC.new(pem_string [, pwd]) OpenSSL::PKey::EC.new(der_string) ;T0[I"(p1 = v1, p2 = v2);T@FI"EC;TcRDoc::NormalClass00PKI ]Q)8PKey/EC/group-i.rinu[U:RDoc::AnyMethod[iI" group:ETI"OpenSSL::PKey::EC#group;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"SReturns the EC::Group that the key is associated with. Modifying the returned ;TI"!group does not affect _key_.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"key.group => group ;T0[I"();T@FI"EC;TcRDoc::NormalClass00PKI ]h PKey/EC/Group/curve_name-i.rinu[U:RDoc::AnyMethod[iI"curve_name:ETI"(OpenSSL::PKey::EC::Group#curve_name;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"!Returns the curve name (sn).;To:RDoc::Markup::BlankLineo; ; [I"@See the OpenSSL documentation for EC_GROUP_get_curve_name();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"!group.curve_name => String ;T0[I"();T@FI" Group;TcRDoc::NormalClass00PKI ]RPKey/EC/Group/asn1_flag%3d-i.rinu[U:RDoc::AnyMethod[iI"asn1_flag=:ETI"(OpenSSL::PKey::EC::Group#asn1_flag=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"PSets flags on the group. The flag value is used to determine how to encode ;TI"Gthe group: encode explicit parameters or named curve using an OID.;To:RDoc::Markup::BlankLineo; ; [I"%The flag value can be either of:;T@o:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"EC::NAMED_CURVE;To;;0; [o; ; [I"EC::EXPLICIT_CURVE;T@o; ; [I"@See the OpenSSL documentation for EC_GROUP_set_asn1_flag().;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"group.asn1_flag = flags ;T0[I" (p1);T@"FI" Group;TcRDoc::NormalClass00PKI ]善PKey/EC/Group/order-i.rinu[U:RDoc::AnyMethod[iI" order:ETI"#OpenSSL::PKey::EC::Group#order;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"$Returns the order of the group.;To:RDoc::Markup::BlankLineo; ; [I";See the OpenSSL documentation for EC_GROUP_get_order();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"#group.get_order => order_bn ;T0[I"();T@FI" Group;TcRDoc::NormalClass00PKI ]ll PKey/EC/Group/set_generator-i.rinu[U:RDoc::AnyMethod[iI"set_generator:ETI"+OpenSSL::PKey::EC::Group#set_generator;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RSets the curve parameters. _generator_ must be an instance of EC::Point that ;TI":is on the curve. _order_ and _cofactor_ are integers.;To:RDoc::Markup::BlankLineo; ; [I"?See the OpenSSL documentation for EC_GROUP_set_generator();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"?group.set_generator(generator, order, cofactor) => self ;T0[I"(p1, p2, p3);T@FI" Group;TcRDoc::NormalClass00PKI ]7lPKey/EC/Group/eql%3f-i.rinu[U:RDoc::AnyMethod[iI" eql?:ETI""OpenSSL::PKey::EC::Group#eql?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KReturns +true+ if the two groups use the same curve and have the same ;TI"#parameters, +false+ otherwise.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"Ngroup1.eql?(group2) => true | false group1 == group2 => true | false ;T0[[I"==;T@ I" (p1);T@FI" Group;TcRDoc::NormalClass00PKI ]1zPKey/EC/Group/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI""OpenSSL::PKey::EC::Group::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"$Creates a new EC::Group object.;To:RDoc::Markup::BlankLineo; ; [I"LIf the first argument is :GFp or :GF2m, creates a new curve with given ;TI"parameters.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"OpenSSL::PKey::EC::Group.new(ec_group) OpenSSL::PKey::EC::Group.new(pem_or_der_encoded) OpenSSL::PKey::EC::Group.new(:GFp, bignum_p, bignum_a, bignum_b) OpenSSL::PKey::EC::Group.new(:GF2m, bignum_p, bignum_a, bignum_b) ;T0[I"$(p1, p2 = v2, p3 = v3, p4 = v4);T@FI" Group;TcRDoc::NormalClass00PKI ]Ƀ"PKey/EC/Group/Error/cdesc-Error.rinu[U:RDoc::NormalClass[iI" Error:ETI"$OpenSSL::PKey::EC::Group::Error;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey::EC::Group;TcRDoc::NormalClassPKI ]1}}PKey/EC/Group/seed-i.rinu[U:RDoc::AnyMethod[iI" seed:ETI""OpenSSL::PKey::EC::Group#seed;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I";See the OpenSSL documentation for EC_GROUP_get0_seed();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"#group.seed => String or nil ;T0[I"();T@FI" Group;TcRDoc::NormalClass00PKI ]owPKey/EC/Group/generator-i.rinu[U:RDoc::AnyMethod[iI"generator:ETI"'OpenSSL::PKey::EC::Group#generator;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"(Returns the generator of the group.;To:RDoc::Markup::BlankLineo; ; [I"@See the OpenSSL documentation for EC_GROUP_get0_generator();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"#group.generator => ec_point ;T0[I"();T@FI" Group;TcRDoc::NormalClass00PKI ]T%PKey/EC/Group/to_pem-i.rinu[U:RDoc::AnyMethod[iI" to_pem:ETI"$OpenSSL::PKey::EC::Group#to_pem;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"ESee the OpenSSL documentation for PEM_write_bio_ECPKParameters();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"group.to_pem => String ;T0[I"();T@FI" Group;TcRDoc::NormalClass00PKI ]6PKey/EC/Group/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"$OpenSSL::PKey::EC::Group#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"?See the OpenSSL documentation for i2d_ECPKParameters_bio();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"group.to_der => String ;T0[I"();T@FI" Group;TcRDoc::NormalClass00PKI ]6Q~~PKey/EC/Group/degree-i.rinu[U:RDoc::AnyMethod[iI" degree:ETI"$OpenSSL::PKey::EC::Group#degree;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I" integer ;T0[I"();T@FI" Group;TcRDoc::NormalClass00PKI ]88PKey/EC/Group/asn1_flag-i.rinu[U:RDoc::AnyMethod[iI"asn1_flag:ETI"'OpenSSL::PKey::EC::Group#asn1_flag;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"(Returns the flags set on the group.;To:RDoc::Markup::BlankLineo; ; [I"See also #asn1_flag=.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I" group.asn1_flag -> Integer ;T0[I"();T@FI" Group;TcRDoc::NormalClass00PKI ]E"PKey/EC/Group/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"-OpenSSL::PKey::EC::Group#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Group;TcRDoc::NormalClass00PKI ]]h(PKey/EC/Group/point_conversion_form-i.rinu[U:RDoc::AnyMethod[iI"point_conversion_form:ETI"3OpenSSL::PKey::EC::Group#point_conversion_form;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"=Returns the form how EC::Point data is encoded as ASN.1.;To:RDoc::Markup::BlankLineo; ; [I"&See also #point_conversion_form=.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"+group.point_conversion_form -> Symbol ;T0[I"();T@FI" Group;TcRDoc::NormalClass00PKI ]PKey/EC/Group/to_text-i.rinu[U:RDoc::AnyMethod[iI" to_text:ETI"%OpenSSL::PKey::EC::Group#to_text;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"=See the OpenSSL documentation for ECPKParameters_print();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"group.to_text => String ;T0[I"();T@FI" Group;TcRDoc::NormalClass00PKI ]"PKey/EC/Group/%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI" OpenSSL::PKey::EC::Group#==;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KReturns +true+ if the two groups use the same curve and have the same ;TI"#parameters, +false+ otherwise.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@FI" Group;TcRDoc::NormalClass0[I"OpenSSL::PKey::EC::Group;TFI" eql?;TPKI ]"ldbEE+PKey/EC/Group/point_conversion_form%3d-i.rinu[U:RDoc::AnyMethod[iI"point_conversion_form=:ETI"4OpenSSL::PKey::EC::Group#point_conversion_form=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"NSets the form how EC::Point data is encoded as ASN.1 as defined in X9.62.;To:RDoc::Markup::BlankLineo; ; [I""_format_ can be one of these:;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I"+:compressed+;T; [o; ; [I"KEncoded as z||x, where z is an octet indicating which solution of the ;TI"+equation y is. z will be 0x02 or 0x03.;To;;[I"+:uncompressed+;T; [o; ; [I"2Encoded as z||x||y, where z is an octet 0x04.;To;;[I"+:hybrid+;T; [o; ; [I"NEncodes as z||x||y, where z is an octet indicating which solution of the ;TI"+equation y is. z will be 0x06 or 0x07.;T@o; ; [I"KSee the OpenSSL documentation for EC_GROUP_set_point_conversion_form();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"(group.point_conversion_form = form ;T0[I" (p1);T@.FI" Group;TcRDoc::NormalClass00PKI ]J}}PKey/EC/Group/seed%3d-i.rinu[U:RDoc::AnyMethod[iI" seed=:ETI"#OpenSSL::PKey::EC::Group#seed=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I":See the OpenSSL documentation for EC_GROUP_set_seed();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I" group.seed = seed => seed ;T0[I" (p1);T@FI" Group;TcRDoc::NormalClass00PKI ]L:PKey/EC/Group/cofactor-i.rinu[U:RDoc::AnyMethod[iI" cofactor:ETI"&OpenSSL::PKey::EC::Group#cofactor;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"'Returns the cofactor of the group.;To:RDoc::Markup::BlankLineo; ; [I">See the OpenSSL documentation for EC_GROUP_get_cofactor();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I")group.get_cofactor => cofactor_bn ;T0[I"();T@FI" Group;TcRDoc::NormalClass00PKI ]TDPPPKey/EC/Group/cdesc-Group.rinu[U:RDoc::NormalClass[iI" Group:ETI"OpenSSL::PKey::EC::Group;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_pkey_ec.c;T[I" instance;T[[; [[; [[; [[I"==;T@[I"asn1_flag;T@[I"asn1_flag=;T@[I" cofactor;T@[I"curve_name;T@[I" degree;T@[I" eql?;T@[I"generator;T@[I"initialize_copy;T@[I" order;T@[I"point_conversion_form;T@[I"point_conversion_form=;T@[I" seed;T@[I" seed=;T@[I"set_generator;T@[I" to_der;T@[I" to_pem;T@[I" to_text;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey::EC;TcRDoc::NormalClassPKI ] PKey/EC/generate-c.rinu[U:RDoc::AnyMethod[iI" generate:ETI" OpenSSL::PKey::EC::generate;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HCreates a new EC instance with a new random private and public key.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I";EC.generate(ec_group) -> ec EC.generate(string) -> ec ;T0[I" (p1);T@FI"EC;TcRDoc::NormalClass00PKI ]ZHVVPKey/EC/Point/eql%3f-i.rinu[U:RDoc::AnyMethod[iI" eql?:ETI""OpenSSL::PKey::EC::Point#eql?;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"Ipoint1.eql?(point2) => true | false point1 == point2 => true | false;T0[[I"==;T@ I" (p1);T@ FI" Point;TcRDoc::NormalClass00PKI ]c6PKey/EC/Point/to_bn-i.rinu[U:RDoc::AnyMethod[iI" to_bn:ETI"#OpenSSL::PKey::EC::Point#to_bn;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"OReturns the octet string representation of the EC point as an instance of ;TI"OpenSSL::BN.;To:RDoc::Markup::BlankLineo; ; [I"NIf _conversion_form_ is not given, the _point_conversion_form_ attribute ;TI"set to the group is used.;T@o; ; [I"/See #to_octet_string for more information.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"3point.to_bn([conversion_form]) -> OpenSSL::BN ;T0[I"4(conversion_form = group.point_conversion_form);T@FI" Point;TcRDoc::NormalClass00PKI ]S' PKey/EC/Point/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI""OpenSSL::PKey::EC::Point::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QCreates a new instance of OpenSSL::PKey::EC::Point. If the only argument is ;TI"Nan instance of EC::Point, a copy is returned. Otherwise, creates a point ;TI"that belongs to _group_.;To:RDoc::Markup::BlankLineo; ; [I"K_encoded_point_ is the octet string representation of the point. This ;TI"/must be either a String or an OpenSSL::BN.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"_OpenSSL::PKey::EC::Point.new(point) OpenSSL::PKey::EC::Point.new(group [, encoded_point]) ;T0[I"(p1, p2 = v2);T@FI" Point;TcRDoc::NormalClass00PKI ]"^ "PKey/EC/Point/Error/cdesc-Error.rinu[U:RDoc::NormalClass[iI" Error:ETI"$OpenSSL::PKey::EC::Point::Error;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey::EC::Point;TcRDoc::NormalClassPKI ])RPKey/EC/Point/group-i.rinu[U:RDoc::Attr[iI" group:ETI"#OpenSSL::PKey::EC::Point#group;TI"R;T: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0F@ I"OpenSSL::PKey::EC::Point;TcRDoc::NormalClass0PKI ]lPKey/EC/Point/mul-i.rinu[U:RDoc::AnyMethod[iI"mul:ETI"!OpenSSL::PKey::EC::Point#mul;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"2Performs elliptic curve point multiplication.;To:RDoc::Markup::BlankLineo; ; [I"PThe first form calculates bn1 * point + bn2 * G, where +G+ is the ;TI"Pgenerator of the group of _point_. _bn2_ may be omitted, and in that case, ;TI"-the result is just bn1 * point.;T@o; ; [ I"NThe second form calculates bns[0] * point + bns[1] * points[0] + ... ;TI"P+ bns[-1] * points[-1] + bn2 * G. _bn2_ may be omitted. _bns_ must be ;TI";an array of OpenSSL::BN. _points_ must be an array of ;TI"JOpenSSL::PKey::EC::Point. Please note that points[0] is not ;TI"8multiplied by bns[0], but bns[1].;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"Mpoint.mul(bn1 [, bn2]) => point point.mul(bns, points [, bn2]) => point ;T0[I"(p1, p2 = v2, p3 = v3);T@FI" Point;TcRDoc::NormalClass00PKI ]ìPKey/EC/Point/invert%21-i.rinu[U:RDoc::AnyMethod[iI" invert!:ETI"%OpenSSL::PKey::EC::Point#invert!;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"point.invert! => self;T0[I"();T@ FI" Point;TcRDoc::NormalClass00PKI ]Ͱ["PKey/EC/Point/to_octet_string-i.rinu[U:RDoc::AnyMethod[iI"to_octet_string:ETI"-OpenSSL::PKey::EC::Point#to_octet_string;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"IReturns the octet string representation of the elliptic curve point.;To:RDoc::Markup::BlankLineo; ; [I"Q_conversion_form_ specifies how the point is converted. Possible values are:;T@o:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"+:compressed+;To;;0; [o; ; [I"+:uncompressed+;To;;0; [o; ; [I"+:hybrid+;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"6point.to_octet_string(conversion_form) -> String ;T0[I" (p1);T@#FI" Point;TcRDoc::NormalClass00PKI ]؝q!PKey/EC/Point/make_affine%21-i.rinu[U:RDoc::AnyMethod[iI"make_affine!:ETI"*OpenSSL::PKey::EC::Point#make_affine!;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GThis method is deprecated and should not be used. This is a no-op.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I" point.make_affine! => self ;T0[I"();T@FI" Point;TcRDoc::NormalClass00PKI ]#C#jjPKey/EC/Point/add-i.rinu[U:RDoc::AnyMethod[iI"add:ETI"!OpenSSL::PKey::EC::Point#add;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I",Performs elliptic curve point addition.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"point.add(point) => point ;T0[I" (p1);T@FI" Point;TcRDoc::NormalClass00PKI ]I$ShhPKey/EC/Point/cdesc-Point.rinu[U:RDoc::NormalClass[iI" Point:ETI"OpenSSL::PKey::EC::Point;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0o;;[; I"ext/openssl/ossl_pkey_ec.c;T; 0; 0; 0[[ I" group;TI"R;T: privateFI"ext/openssl/ossl_pkey_ec.c;T[[[[I" class;T[[: public[[:protected[[; [[I"new;T@[I" instance;T[[; [[; [[; [[I"==;T@[I"add;T@[I" eql?;T@[I"infinity?;T@[I"initialize_copy;T@[I" invert!;T@[I"make_affine!;T@[I"mul;T@[I"on_curve?;T@[I"set_to_infinity!;T@[I" to_bn;TI"$ext/openssl/lib/openssl/pkey.rb;T[I"to_octet_string;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/pkey.rb;TI"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey::EC;TcRDoc::NormalClassPKI ]F9m"PKey/EC/Point/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"-OpenSSL::PKey::EC::Point#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Point;TcRDoc::NormalClass00PKI ]5`99%PKey/EC/Point/set_to_infinity%21-i.rinu[U:RDoc::AnyMethod[iI"set_to_infinity!:ETI".OpenSSL::PKey::EC::Point#set_to_infinity!;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"#point.set_to_infinity! => self;T0[I"();T@ FI" Point;TcRDoc::NormalClass00PKI ]Ǵ''PKey/EC/Point/%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI" OpenSSL::PKey::EC::Point#==;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Point;TcRDoc::NormalClass0[I"OpenSSL::PKey::EC::Point;TFI" eql?;TPKI ]&,,PKey/EC/Point/on_curve%3f-i.rinu[U:RDoc::AnyMethod[iI"on_curve?:ETI"'OpenSSL::PKey::EC::Point#on_curve?;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"$point.on_curve? => true | false;T0[I"();T@ FI" Point;TcRDoc::NormalClass00PKI ],,PKey/EC/Point/infinity%3f-i.rinu[U:RDoc::AnyMethod[iI"infinity?:ETI"'OpenSSL::PKey::EC::Point#infinity?;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"$point.infinity? => true | false;T0[I"();T@ FI" Point;TcRDoc::NormalClass00PKI ]Sj  PKey/EC/builtin_curves-c.rinu[U:RDoc::AnyMethod[iI"builtin_curves:ETI"&OpenSSL::PKey::EC::builtin_curves;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MObtains a list of all predefined curves by the OpenSSL. Curve names are ;TI"returned as sn.;To:RDoc::Markup::BlankLineo; ; [I"?See the OpenSSL documentation for EC_get_builtin_curves().;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"/EC.builtin_curves => [[sn, comment], ...] ;T0[I"();T@FI"EC;TcRDoc::NormalClass00PKI ]"IfPKey/EC/generate_key-i.rinu[U:RDoc::AnyMethod[iI"generate_key:ETI"#OpenSSL::PKey::EC#generate_key;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"3Generates a new random private and public key.;To:RDoc::Markup::BlankLineo; ; [I"ASee also the OpenSSL documentation for EC_KEY_generate_key();T@S:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I".ec = OpenSSL::PKey::EC.new("prime256v1") ;TI"p ec.private_key # => nil ;TI"ec.generate_key! ;TI"0p ec.private_key # => #;T: @format0: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"EC;TcRDoc::NormalClass0[I"OpenSSL::PKey::EC;TFI"generate_key!;TPKI ]/PKey/EC/public_key-i.rinu[U:RDoc::AnyMethod[iI"public_key:ETI"!OpenSSL::PKey::EC#public_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"?See the OpenSSL documentation for EC_KEY_get0_public_key();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"2key.public_key => OpenSSL::PKey::EC::Point ;T0[I"();T@FI"EC;TcRDoc::NormalClass00PKI ]7žPKey/EC/cdesc-EC.rinu[U:RDoc::NormalClass[iI"EC:ETI"OpenSSL::PKey::EC;TI"OpenSSL::PKey::PKey;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0o;;[ o:RDoc::Markup::Paragraph;[I"KOpenSSL::PKey::EC provides access to Elliptic Curve Digital Signature ;TI"@Algorithm (ECDSA) and Elliptic Curve Diffie-Hellman (ECDH).;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"Key exchange;To:RDoc::Markup::Verbatim;[ I"4ec1 = OpenSSL::PKey::EC.generate("prime256v1") ;TI"4ec2 = OpenSSL::PKey::EC.generate("prime256v1") ;TI"5# ec1 and ec2 have own private key respectively ;TI"6shared_key1 = ec1.dh_compute_key(ec2.public_key) ;TI"6shared_key2 = ec2.dh_compute_key(ec1.public_key) ;TI" ;TI"*p shared_key1 == shared_key2 #=> true;T: @format0; I"ext/openssl/ossl_pkey_ec.c;T; 0; 0; 0[[U:RDoc::Constant[iI"NAMED_CURVE;TI"#OpenSSL::PKey::EC::NAMED_CURVE;T: public0o;;[; @!; 0@!@cRDoc::NormalClass0U;[iI"EXPLICIT_CURVE;TI"&OpenSSL::PKey::EC::EXPLICIT_CURVE;T;0o;;[; @!; 0@!@@*0[[I"OpenSSL::Marshal;To;;[; @; 0I"$ext/openssl/lib/openssl/pkey.rb;T[[I" class;T[[;[[:protected[[: private[[I"builtin_curves;TI"ext/openssl/ossl_pkey_ec.c;T[I" generate;T@C[I"new;T@C[I" instance;T[[;[[;[[;[[I"check_key;T@C[I"dh_compute_key;T@6[I"dsa_sign_asn1;T@6[I"dsa_verify_asn1;T@6[I" export;T@C[I"generate_key;T@C[I"generate_key!;T@C[I" group;T@C[I" group=;T@C[I"initialize_copy;T@C[I" private?;T@C[I"private_key;T@C[I"private_key=;T@C[I"private_key?;T@C[I" public?;T@C[I"public_key;T@C[I"public_key=;T@C[I"public_key?;T@C[I" to_der;T@C[I" to_pem;T@C[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/pkey.rb;TI"ext/openssl/ossl_pkey.c;TI"OpenSSL::PKey;TcRDoc::NormalModulePKI ] ttppPKey/EC/to_pem-i.rinu[U:RDoc::AnyMethod[iI" to_pem:ETI"OpenSSL::PKey::EC#to_pem;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"ROutputs the EC key in PEM encoding. If _cipher_ and _pass_phrase_ are given ;TI"Pthey will be used to encrypt the key. _cipher_ must be an OpenSSL::Cipher ;TI"Ninstance. Note that encryption will only be effective for a private key, ;TI"6public keys will always be encoded in plain text.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@FI"EC;TcRDoc::NormalClass0[I"OpenSSL::PKey::EC;TFI" export;TPKI ]bW\rrPKey/EC/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"OpenSSL::PKey::EC#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"=See the OpenSSL documentation for i2d_ECPrivateKey_bio();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"key.to_der => String ;T0[I"();T@FI"EC;TcRDoc::NormalClass00PKI ]@݉PKey/EC/private_key-i.rinu[U:RDoc::AnyMethod[iI"private_key:ETI""OpenSSL::PKey::EC#private_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"@See the OpenSSL documentation for EC_KEY_get0_private_key();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"&key.private_key => OpenSSL::BN ;T0[I"();T@FI"EC;TcRDoc::NormalClass00PKI ]=.PKey/EC/private_key%3d-i.rinu[U:RDoc::AnyMethod[iI"private_key=:ETI"#OpenSSL::PKey::EC#private_key=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"?See the OpenSSL documentation for EC_KEY_set_private_key();T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I""key.private_key = openssl_bn ;T0[I" (p1);T@FI"EC;TcRDoc::NormalClass00PKI ]BPKey/EC/public_key%3f-i.rinu[U:RDoc::AnyMethod[iI"public_key?:ETI""OpenSSL::PKey::EC#public_key?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GReturns whether this EC instance has a public key. The public key ;TI"5(EC::Point) can be retrieved with EC#public_key.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"EC;TcRDoc::NormalClass0[I"OpenSSL::PKey::EC;TFI" public?;TPKI ]-2PKey/EC/generate_key%21-i.rinu[U:RDoc::AnyMethod[iI"generate_key!:ETI"$OpenSSL::PKey::EC#generate_key!;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"3Generates a new random private and public key.;To:RDoc::Markup::BlankLineo; ; [I"ASee also the OpenSSL documentation for EC_KEY_generate_key();T@S:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I".ec = OpenSSL::PKey::EC.new("prime256v1") ;TI"p ec.private_key # => nil ;TI"ec.generate_key! ;TI"0p ec.private_key # => #;T: @format0: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"!key.generate_key! => self ;T0[[I"generate_key;T@ I"();T@FI"EC;TcRDoc::NormalClass00PKI ]&c  PKey/EC/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"&OpenSSL::PKey::EC#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"EC;TcRDoc::NormalClass00PKI ]zwPKey/EC/group%3d-i.rinu[U:RDoc::AnyMethod[iI" group=:ETI"OpenSSL::PKey::EC#group=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QSets the EC::Group for the key. The group structure is internally copied so ;TI"Omodification to _group_ after assigning to a key has no effect on the key.;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"key.group = group ;T0[I" (p1);T@FI"EC;TcRDoc::NormalClass00PKI ]PKey/EC/dsa_verify_asn1-i.rinu[U:RDoc::AnyMethod[iI"dsa_verify_asn1:ETI"&OpenSSL::PKey::EC#dsa_verify_asn1;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"'Deprecated in version 3.0. ;TI"JConsider using PKey::PKey#sign_raw and PKey::PKey#verify_raw instead.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"4key.dsa_verify_asn1(data, sig) -> true | false ;T0[I"(data, sig);T@FI"EC;TcRDoc::NormalClass00PKI ]PKey/EC/dsa_sign_asn1-i.rinu[U:RDoc::AnyMethod[iI"dsa_sign_asn1:ETI"$OpenSSL::PKey::EC#dsa_sign_asn1;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"'Deprecated in version 3.0. ;TI"JConsider using PKey::PKey#sign_raw and PKey::PKey#verify_raw instead.;T: @fileI"$ext/openssl/lib/openssl/pkey.rb;T:0@omit_headings_from_table_of_contents_below0I"'key.dsa_sign_asn1(data) -> String ;T0[I" (data);T@FI"EC;TcRDoc::NormalClass00PKI ]PKey/EC/check_key-i.rinu[U:RDoc::AnyMethod[iI"check_key:ETI" OpenSSL::PKey::EC#check_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"/Raises an exception if the key is invalid.;To:RDoc::Markup::BlankLineo; ; [I"4See also the man page EVP_PKEY_public_check(3).;T: @fileI"ext/openssl/ossl_pkey_ec.c;T:0@omit_headings_from_table_of_contents_below0I"key.check_key => true ;T0[I"();T@FI"EC;TcRDoc::NormalClass00PKI ] 55 Digest-i.rinu[U:RDoc::AnyMethod[iI" Digest:ETI"OpenSSL#Digest;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"(Returns a Digest subclass by _name_;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"require 'openssl' ;TI" ;TI"OpenSSL::Digest("MD5") ;TI"# => OpenSSL::Digest::MD5 ;TI" ;TI"Digest("Foo") ;TI",# => NameError: wrong constant name Foo;T: @format0: @fileI"&ext/openssl/lib/openssl/digest.rb;T:0@omit_headings_from_table_of_contents_below000[I" (name);T@FI" OpenSSL;TcRDoc::NormalModule00PKI ]ןKK ConfigError/cdesc-ConfigError.rinu[U:RDoc::NormalClass[iI"ConfigError:ETI"OpenSSL::ConfigError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"RGeneral error for openssl library configuration files. Including formatting, ;TI"parsing errors, etc.;T: @fileI"ext/openssl/ossl_config.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]mOXXcdesc-OpenSSL.rinu[U:RDoc::NormalModule[iI" OpenSSL:ET@0o:RDoc::Markup::Document: @parts[*o;;[: @fileI"ext/openssl/lib/openssl.rb;T:0@omit_headings_from_table_of_contents_below0o;;[; I""ext/openssl/lib/openssl/bn.rb;T; 0o;;[; I"&ext/openssl/lib/openssl/cipher.rb;T; 0o;;[; I"&ext/openssl/lib/openssl/digest.rb;T; 0o;;[; I"$ext/openssl/lib/openssl/hmac.rb;T; 0o;;[; I"'ext/openssl/lib/openssl/marshal.rb;T; 0o;;[; I"%ext/openssl/lib/openssl/pkcs5.rb;T; 0o;;[; I"#ext/openssl/lib/openssl/ssl.rb;T; 0o;;[; I"'ext/openssl/lib/openssl/version.rb;T; 0o;;[; I"$ext/openssl/lib/openssl/x509.rb;T; 0o;;[o:RDoc::Markup::Paragraph;[I"OOpenSSL provides SSL, TLS and general purpose cryptography. It wraps the ;TI"/OpenSSL[https://www.openssl.org/] library.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Examples;T@.o; ;[I"6All examples assume you have loaded OpenSSL with:;T@.o:RDoc::Markup::Verbatim;[I"require 'openssl' ;T: @format0o; ;[I"OThese examples build atop each other. For example the key created in the ;TI"/next is used in throughout these examples.;T@.S; ;i;I" Keys;T@.S; ;i;I"Creating a Key;T@.o; ;[I"NThis example creates a 2048 bit RSA keypair and writes it to the current ;TI"directory.;T@.o;;[ I"'key = OpenSSL::PKey::RSA.new 2048 ;TI" ;TI"Aopen 'private_key.pem', 'w' do |io| io.write key.to_pem end ;TI"Kopen 'public_key.pem', 'w' do |io| io.write key.public_key.to_pem end ;T;0S; ;i;I"Exporting a Key;T@.o; ;[I"MKeys saved to disk without encryption are not secure as anyone who gets ;TI"Oahold of the key may use it unless it is encrypted. In order to securely ;TI"7export a key you may export it with a pass phrase.;T@.o;;[ I"0cipher = OpenSSL::Cipher.new 'aes-256-cbc' ;TI"5pass_phrase = 'my secure pass phrase goes here' ;TI" ;TI"1key_secure = key.export cipher, pass_phrase ;TI" ;TI",open 'private.secure.pem', 'w' do |io| ;TI" io.write key_secure ;TI" end ;T;0o; ;[I"AOpenSSL::Cipher.ciphers returns a list of available ciphers.;T@.S; ;i;I"Loading a Key;T@.o; ;[I"*A key can also be loaded from a file.;T@.o;;[I";key2 = OpenSSL::PKey.read File.read 'private_key.pem' ;TI"key2.public? # => true ;TI"key2.private? # => true ;T;0o; ;[I"or;T@.o;;[I":key3 = OpenSSL::PKey.read File.read 'public_key.pem' ;TI"key3.public? # => true ;TI"key3.private? # => false ;T;0S; ;i;I"Loading an Encrypted Key;T@.o; ;[I"QOpenSSL will prompt you for your pass phrase when loading an encrypted key. ;TI"PIf you will not be able to type in the pass phrase you may provide it when ;TI"loading the key:;T@.o;;[I"/key4_pem = File.read 'private.secure.pem' ;TI"5pass_phrase = 'my secure pass phrase goes here' ;TI"5key4 = OpenSSL::PKey.read key4_pem, pass_phrase ;T;0S; ;i;I"RSA Encryption;T@.o; ;[I"ORSA provides encryption and decryption using the public and private keys. ;TI"QYou can use a variety of padding methods depending upon the intended use of ;TI"encrypted data.;T@.S; ;i;I"Encryption & Decryption;T@.o; ;[ I"NAsymmetric public/private key encryption is slow and victim to attack in ;TI"Qcases where it is used without padding or directly to encrypt larger chunks ;TI"Rof data. Typical use cases for RSA encryption involve "wrapping" a symmetric ;TI"Pkey with the public key of the recipient who would "unwrap" that symmetric ;TI"(key again using their private key. ;TI"LThe following illustrates a simplified example of such a key transport ;TI"Nscheme. It shouldn't be used in practice, though, standardized protocols ;TI" should always be preferred.;T@.o;;[I"*wrapped_key = key.public_encrypt key ;T;0o; ;[I"NA symmetric key encrypted with the public key can only be decrypted with ;TI"4the corresponding private key of the recipient.;T@.o;;[I"4original_key = key.private_decrypt wrapped_key ;T;0o; ;[I"LBy default PKCS#1 padding will be used, but it is also possible to use ;TI"?other forms of padding, see PKey::RSA for further details.;T@.S; ;i;I"Signatures;T@.o; ;[ I"JUsing "private_encrypt" to encrypt some data with the private key is ;TI"Iequivalent to applying a digital signature to the data. A verifying ;TI"Lparty may validate the signature by comparing the result of decrypting ;TI"Hthe signature with "public_decrypt" to the original data. However, ;TI"GOpenSSL::PKey already has methods "sign" and "verify" that handle ;TI"Fdigital signatures in a standardized way - "private_encrypt" and ;TI"4"public_decrypt" shouldn't be used in practice.;T@.o; ;[I"LTo sign a document, a cryptographically secure hash of the document is ;TI"@computed first, which is then signed using the private key.;T@.o;;[I"-signature = key.sign 'SHA256', document ;T;0o; ;[ I"MTo validate the signature, again a hash of the document is computed and ;TI"Ithe signature is decrypted using the public key. The result is then ;TI"Mcompared to the hash just computed, if they are equal the signature was ;TI" valid.;T@.o;;[ I"1if key.verify 'SHA256', signature, document ;TI" puts 'Valid' ;TI" else ;TI" puts 'Invalid' ;TI" end ;T;0S; ;i;I"%PBKDF2 Password-based Encryption;T@.o; ;[ I"IIf supported by the underlying OpenSSL version used, Password-based ;TI"IEncryption should use the features of PKCS5. If not supported or if ;TI"Orequired by legacy applications, the older, less secure methods specified ;TI"0in RFC 2898 are also supported (see below).;T@.o; ;[ I"9PKCS5 supports PBKDF2 as it was specified in PKCS#5 ;TI"Hv2.0[http://www.rsa.com/rsalabs/node.asp?id=2127]. It still uses a ;TI"Ipassword, a salt, and additionally a number of iterations that will ;TI"Mslow the key derivation process down. The slower this is, the more work ;TI"=it requires being able to brute-force the resulting key.;T@.S; ;i;I"Encryption;T@.o; ;[ I"GThe strategy is to first instantiate a Cipher for encryption, and ;TI"Gthen to generate a random IV plus a key derived from the password ;TI"Jusing PBKDF2. PKCS #5 v2.0 recommends at least 8 bytes for the salt, ;TI"Ithe number of iterations largely depends on the hardware being used.;T@.o;;[I"0cipher = OpenSSL::Cipher.new 'aes-256-cbc' ;TI"cipher.encrypt ;TI"iv = cipher.random_iv ;TI" ;TI"=pwd = 'some hopefully not to easily guessable password' ;TI",salt = OpenSSL::Random.random_bytes 16 ;TI"iter = 20000 ;TI"key_len = cipher.key_len ;TI",digest = OpenSSL::Digest.new('SHA256') ;TI" ;TI"Hkey = OpenSSL::PKCS5.pbkdf2_hmac(pwd, salt, iter, key_len, digest) ;TI"cipher.key = key ;TI" ;TI"Now encrypt the data: ;TI" ;TI"(encrypted = cipher.update document ;TI"encrypted << cipher.final ;T;0S; ;i;I"Decryption;T@.o; ;[I"MUse the same steps as before to derive the symmetric AES key, this time ;TI"*setting the Cipher up for decryption.;T@.o;;[I"0cipher = OpenSSL::Cipher.new 'aes-256-cbc' ;TI"cipher.decrypt ;TI"8cipher.iv = iv # the one generated with #random_iv ;TI" ;TI"=pwd = 'some hopefully not to easily guessable password' ;TI"*salt = ... # the one generated above ;TI"iter = 20000 ;TI"key_len = cipher.key_len ;TI",digest = OpenSSL::Digest.new('SHA256') ;TI" ;TI"Hkey = OpenSSL::PKCS5.pbkdf2_hmac(pwd, salt, iter, key_len, digest) ;TI"cipher.key = key ;TI" ;TI"Now decrypt the data: ;TI" ;TI")decrypted = cipher.update encrypted ;TI"decrypted << cipher.final ;T;0S; ;i;I"&PKCS #5 Password-based Encryption;T@.o; ;[ I"CPKCS #5 is a password-based encryption standard documented at ;TI"RRFC2898[http://www.ietf.org/rfc/rfc2898.txt]. It allows a short password or ;TI"Rpassphrase to be used to create a secure encryption key. If possible, PBKDF2 ;TI"Eas described above should be used if the circumstances allow it.;T@.o; ;[I"OPKCS #5 uses a Cipher, a pass phrase and a salt to generate an encryption ;TI" key.;T@.o;;[I"5pass_phrase = 'my secure pass phrase goes here' ;TI"salt = '8 octets' ;T;0S; ;i;I"Encryption;T@.o; ;[I"+First set up the cipher for encryption;T@.o;;[I"3encryptor = OpenSSL::Cipher.new 'aes-256-cbc' ;TI"encryptor.encrypt ;TI"0encryptor.pkcs5_keyivgen pass_phrase, salt ;T;0o; ;[I"3Then pass the data you want to encrypt through;T@.o;;[I"8encrypted = encryptor.update 'top secret document' ;TI""encrypted << encryptor.final ;T;0S; ;i;I"Decryption;T@.o; ;[I"4Use a new Cipher instance set up for decryption;T@.o;;[I"3decryptor = OpenSSL::Cipher.new 'aes-256-cbc' ;TI"decryptor.decrypt ;TI"0decryptor.pkcs5_keyivgen pass_phrase, salt ;T;0o; ;[I"3Then pass the data you want to decrypt through;T@.o;;[I"(plain = decryptor.update encrypted ;TI"plain << decryptor.final ;T;0S; ;i;I"X509 Certificates;T@.S; ;i;I"Creating a Certificate;T@.o; ;[I"PThis example creates a self-signed certificate using an RSA key and a SHA1 ;TI"signature.;T@.o;;[I"'key = OpenSSL::PKey::RSA.new 2048 ;TI">name = OpenSSL::X509::Name.parse '/CN=nobody/DC=example' ;TI" ;TI"+cert = OpenSSL::X509::Certificate.new ;TI"cert.version = 2 ;TI"cert.serial = 0 ;TI" cert.not_before = Time.now ;TI"&cert.not_after = Time.now + 3600 ;TI" ;TI"&cert.public_key = key.public_key ;TI"cert.subject = name ;T;0S; ;i;I"Certificate Extensions;T@.o; ;[I"4You can add extensions to the certificate with ;TI"OOpenSSL::SSL::ExtensionFactory to indicate the purpose of the certificate.;T@.o;;[I"Gextension_factory = OpenSSL::X509::ExtensionFactory.new nil, cert ;TI" ;TI"cert.add_extension \ ;TI"P extension_factory.create_extension('basicConstraints', 'CA:FALSE', true) ;TI" ;TI"cert.add_extension \ ;TI"+ extension_factory.create_extension( ;TI"J 'keyUsage', 'keyEncipherment,dataEncipherment,digitalSignature') ;TI" ;TI"cert.add_extension \ ;TI"J extension_factory.create_extension('subjectKeyIdentifier', 'hash') ;T;0o; ;[I"PThe list of supported extensions (and in some cases their possible values) ;TI"Ican be derived from the "objects.h" file in the OpenSSL source code.;T@.S; ;i;I"Signing a Certificate;T@.o; ;[ I"RTo sign a certificate set the issuer and use OpenSSL::X509::Certificate#sign ;TI"Swith a digest algorithm. This creates a self-signed cert because we're using ;TI"Mthe same name and key to sign the certificate as was used to create the ;TI"certificate.;T@.o;;[ I"cert.issuer = name ;TI"0cert.sign key, OpenSSL::Digest.new('SHA1') ;TI" ;TI"Bopen 'certificate.pem', 'w' do |io| io.write cert.to_pem end ;T;0S; ;i;I"Loading a Certificate;T@.o; ;[I"7Like a key, a cert can also be loaded from a file.;T@.o;;[I"Hcert2 = OpenSSL::X509::Certificate.new File.read 'certificate.pem' ;T;0S; ;i;I"Verifying a Certificate;T@.o; ;[I"PCertificate#verify will return true when a certificate was signed with the ;TI"given public key.;T@.o;;[I"Eraise 'certificate can not be verified' unless cert2.verify key ;T;0S; ;i;I"Certificate Authority;T@.o; ;[ I"NA certificate authority (CA) is a trusted third party that allows you to ;TI"Qverify the ownership of unknown certificates. The CA issues key signatures ;TI"Pthat indicate it trusts the user of that key. A user encountering the key ;TI";can verify the signature by using the CA's public key.;T@.S; ;i;I" CA Key;T@.o; ;[I"QCA keys are valuable, so we encrypt and save it to disk and make sure it is ;TI"!not readable by other users.;T@.o;;[ I"*ca_key = OpenSSL::PKey::RSA.new 2048 ;TI"5pass_phrase = 'my secure pass phrase goes here' ;TI" ;TI"0cipher = OpenSSL::Cipher.new 'aes-256-cbc' ;TI" ;TI"*open 'ca_key.pem', 'w', 0400 do |io| ;TI"3 io.write ca_key.export(cipher, pass_phrase) ;TI" end ;T;0S; ;i;I"CA Certificate;T@.o; ;[I"RA CA certificate is created the same way we created a certificate above, but ;TI"with different extensions.;T@.o;;[I"=ca_name = OpenSSL::X509::Name.parse '/CN=ca/DC=example' ;TI" ;TI".ca_cert = OpenSSL::X509::Certificate.new ;TI"ca_cert.serial = 0 ;TI"ca_cert.version = 2 ;TI"#ca_cert.not_before = Time.now ;TI"*ca_cert.not_after = Time.now + 86400 ;TI" ;TI",ca_cert.public_key = ca_key.public_key ;TI"ca_cert.subject = ca_name ;TI"ca_cert.issuer = ca_name ;TI" ;TI"=extension_factory = OpenSSL::X509::ExtensionFactory.new ;TI"5extension_factory.subject_certificate = ca_cert ;TI"4extension_factory.issuer_certificate = ca_cert ;TI" ;TI"ca_cert.add_extension \ ;TI"J extension_factory.create_extension('subjectKeyIdentifier', 'hash') ;T;0o; ;[I"?This extension indicates the CA's key may be used as a CA.;T@.o;;[I"ca_cert.add_extension \ ;TI"O extension_factory.create_extension('basicConstraints', 'CA:TRUE', true) ;T;0o; ;[I"OThis extension indicates the CA's key may be used to verify signatures on ;TI"3both certificates and certificate revocations.;T@.o;;[I"ca_cert.add_extension \ ;TI"+ extension_factory.create_extension( ;TI"2 'keyUsage', 'cRLSign,keyCertSign', true) ;T;0o; ;[I"*Root CA certificates are self-signed.;T@.o;;[I"6ca_cert.sign ca_key, OpenSSL::Digest.new('SHA1') ;T;0o; ;[I"MThe CA certificate is saved to disk so it may be distributed to all the ;TI")users of the keys this CA will sign.;T@.o;;[I"%open 'ca_cert.pem', 'w' do |io| ;TI" io.write ca_cert.to_pem ;TI" end ;T;0S; ;i;I" Certificate Signing Request;T@.o; ;[I"MThe CA signs keys through a Certificate Signing Request (CSR). The CSR ;TI"context.ca_file is not set ;TI"Cwhen verifying peers an OpenSSL::SSL::SSLError will be raised.;T; I"ext/openssl/ossl.c;T; 0o;;[; I"ext/openssl/ossl_asn1.c;T; 0o;;[; I"ext/openssl/ossl_bn.c;T; 0o;;[; I"ext/openssl/ossl_cipher.c;T; 0o;;[; I"ext/openssl/ossl_config.c;T; 0o;;[; I"ext/openssl/ossl_digest.c;T; 0o;;[; I"ext/openssl/ossl_engine.c;T; 0o;;[; I"ext/openssl/ossl_hmac.c;T; 0o;;[; I"ext/openssl/ossl_kdf.c;T; 0o;;[; I"ext/openssl/ossl_ns_spki.c;T; 0o;;[; I"ext/openssl/ossl_ocsp.c;T; 0o;;[; I"ext/openssl/ossl_pkcs12.c;T; 0o;;[; I"ext/openssl/ossl_pkcs7.c;T; 0o;;[; I"ext/openssl/ossl_pkey.c;T; 0o;;[; I"ext/openssl/ossl_rand.c;T; 0o;;[; I"ext/openssl/ossl_ssl.c;T; 0o;;[; I"#ext/openssl/ossl_ssl_session.c;T; 0o;;[; I"ext/openssl/ossl_ts.c;T; 0o;;[; I"ext/openssl/ossl_x509.c;T; 0o;;[; I" ext/openssl/ossl_x509attr.c;T; 0o;;[; I" ext/openssl/ossl_x509cert.c;T; 0o;;[; I"ext/openssl/ossl_x509crl.c;T; 0o;;[; I"ext/openssl/ossl_x509ext.c;T; 0o;;[; I" ext/openssl/ossl_x509name.c;T; 0o;;[; I"ext/openssl/ossl_x509req.c;T; 0o;;[; I"#ext/openssl/ossl_x509revoked.c;T; 0o;;[; I"!ext/openssl/ossl_x509store.c;T; 0; 0; 0[[ U:RDoc::Constant[iI" VERSION;TI"OpenSSL::VERSION;T: public0o;;[; @$; 0@$@cRDoc::NormalModule0U;[iI"OPENSSL_VERSION;TI"OpenSSL::OPENSSL_VERSION;T;0o;;[o; ;[I"AVersion of OpenSSL the ruby OpenSSL extension was built with;T; @f; 0@f@@0U;[iI"OPENSSL_LIBRARY_VERSION;TI"%OpenSSL::OPENSSL_LIBRARY_VERSION;T;0o;;[; @f; 0@f@@0U;[iI"OPENSSL_VERSION_NUMBER;TI"$OpenSSL::OPENSSL_VERSION_NUMBER;T;0o;;[o; ;[I"IVersion number of OpenSSL the ruby OpenSSL extension was built with ;TI"(base 16);T; @f; 0@f@@0U;[iI"OPENSSL_FIPS;TI"OpenSSL::OPENSSL_FIPS;T;0o;;[o; ;[I">Boolean indicating whether OpenSSL is FIPS-capable or not;T; @f; 0@f@@0[[[I" class;T[[;[[:protected[[: private[[I" Digest;TI"&ext/openssl/lib/openssl/digest.rb;T[I" debug;TI"ext/openssl/ossl.c;T[I" debug=;T@[I" errors;T@[I"fips_mode;T@[I"fips_mode=;T@[I" fixed_length_secure_compare;T@[I"mem_check_start;T@[I"print_mem_leaks;T@[I"secure_compare;TI"ext/openssl/lib/openssl.rb;T[I" instance;T[[;[[;[[;[[@@[[U:RDoc::Context::Section[i0o;;[; 0; 0[9I"ext/openssl/lib/openssl.rb;TI""ext/openssl/lib/openssl/bn.rb;TI")ext/openssl/lib/openssl/buffering.rb;TI"&ext/openssl/lib/openssl/cipher.rb;TI"&ext/openssl/lib/openssl/digest.rb;TI"$ext/openssl/lib/openssl/hmac.rb;TI"'ext/openssl/lib/openssl/marshal.rb;TI"%ext/openssl/lib/openssl/pkcs5.rb;TI"$ext/openssl/lib/openssl/pkey.rb;TI"#ext/openssl/lib/openssl/ssl.rb;TI"'ext/openssl/lib/openssl/version.rb;TI"$ext/openssl/lib/openssl/x509.rb;TI"ext/openssl/ossl.c;TI"ext/openssl/ossl_asn1.c;TI"ext/openssl/ossl_bn.c;TI"ext/openssl/ossl_cipher.c;TI"ext/openssl/ossl_config.c;TI"ext/openssl/ossl_digest.c;TI"ext/openssl/ossl_engine.c;TI"ext/openssl/ossl_hmac.c;TI"ext/openssl/ossl_kdf.c;TI"ext/openssl/ossl_ns_spki.c;TI"ext/openssl/ossl_ocsp.c;TI"ext/openssl/ossl_pkcs12.c;TI"ext/openssl/ossl_pkcs7.c;TI"ext/openssl/ossl_pkey.c;TI"ext/openssl/ossl_rand.c;TI"ext/openssl/ossl_ssl.c;TI"#ext/openssl/ossl_ssl_session.c;TI"ext/openssl/ossl_ts.c;TI"ext/openssl/ossl_x509.c;TI" ext/openssl/ossl_x509attr.c;TI" ext/openssl/ossl_x509cert.c;TI"ext/openssl/ossl_x509crl.c;TI"ext/openssl/ossl_x509ext.c;TI" ext/openssl/ossl_x509name.c;TI"ext/openssl/ossl_x509req.c;TI"#ext/openssl/ossl_x509revoked.c;TI"!ext/openssl/ossl_x509store.c;TI"lib/drb/ssl.rb;TI"lib/net/http.rb;TI"lib/open-uri.rb;TI"*lib/rubygems/commands/cert_command.rb;TI"lib/rubygems/request.rb;TI""lib/rubygems/s3_uri_signer.rb;TI"lib/rubygems/security.rb;TI"$lib/rubygems/security/policy.rb;TI"$lib/rubygems/security/signer.rb;TI"'lib/rubygems/security/trust_dir.rb;TI"lib/rubygems/source/git.rb;TI"lib/securerandom.rb;TI"lib/un.rb;T@cRDoc::TopLevelPKI ]XLn<ASN1/decode-c.rinu[U:RDoc::AnyMethod[iI" decode:ETI"OpenSSL::ASN1::decode;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"QDecodes a BER- or DER-encoded value and creates an ASN1Data instance. _der_ ;TI"Qmay be a String or any object that features a +.to_der+ method transforming ;TI"'it into a BER-/DER-encoded String+;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [I"$der = File.binread('asn1data') ;TI"%asn1 = OpenSSL::ASN1.decode(der);T: @format0: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0I"+OpenSSL::ASN1.decode(der) -> ASN1Data ;T0[I" (p1);T@FI" ASN1;TcRDoc::NormalModule00PKI ]1e/ASN1/ASN1Data/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"!OpenSSL::ASN1::ASN1Data::new;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"O_value_: Please have a look at Constructive and Primitive to see how Ruby ;TI"4types are mapped to ASN.1 types and vice versa.;To:RDoc::Markup::BlankLineo; ; [I"1_tag_: An Integer indicating the tag number.;T@o; ; [I"I_tag_class_: A Symbol indicating the tag class. Please cf. ASN1 for ;TI"possible values.;T@S:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [I"easn1_int = OpenSSL::ASN1Data.new(42, 2, :UNIVERSAL) # => Same as OpenSSL::ASN1::Integer.new(42) ;TI"_tagged_int = OpenSSL::ASN1Data.new(42, 0, :CONTEXT_SPECIFIC) # implicitly 0-tagged INTEGER;T: @format0: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0I"DOpenSSL::ASN1::ASN1Data.new(value, tag, tag_class) => ASN1Data ;T0[I"(p1, p2, p3);T@FI" ASN1Data;TcRDoc::NormalClass00PKI ];;;"ASN1/ASN1Data/infinite_length-i.rinu[U:RDoc::Attr[iI"infinite_length:ETI",OpenSSL::ASN1::ASN1Data#infinite_length;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GNever +nil+. A boolean value indicating whether the encoding uses ;TI"Iindefinite length (in the case of parsing) or whether an indefinite ;TI"7length form shall be used (in the encoding case). ;TI"KIn DER, every value uses definite length form. But in scenarios where ;TI"Klarge amounts of data need to be transferred it might be desirable to ;TI"4have some kind of streaming support available. ;TI"JFor example, huge OCTET STRINGs are preferably sent in smaller-sized ;TI"chunks, each at a time. ;TI"HThis is possible in BER by setting the length bytes of an encoding ;TI"Eto zero and by this indicating that the following value will be ;TI"Isent in chunks. Indefinite length encodings are always constructed. ;TI"FThe end of such a stream of chunks is indicated by sending a EOC ;TI"K(End of Content) tag. SETs and SEQUENCEs may use an indefinite length ;TI"Fencoding, but also primitive types such as e.g. OCTET STRINGS or ;TI"CBIT STRINGS may leverage this functionality (cf. ITU-T X.690).;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::ASN1::ASN1Data;TcRDoc::NormalClass0PKI ]rooASN1/ASN1Data/cdesc-ASN1Data.rinu[U:RDoc::NormalClass[iI" ASN1Data:ETI"OpenSSL::ASN1::ASN1Data;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"GThe top-level class representing any ASN.1 object. When parsed by ;TI"FASN1.decode, tagged values are always represented by an instance ;TI"of ASN1Data.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"3The role of ASN1Data for parsing tagged values;T@o; ;[ I"FWhen encoding an ASN.1 type it is inherently clear what original ;TI"Gtype (e.g. INTEGER, OCTET STRING etc.) this value has, regardless ;TI"of its tagging. ;TI"JBut opposed to the time an ASN.1 type is to be encoded, when parsing ;TI"Athem it is not possible to deduce the "real type" of tagged ;TI"Jvalues. This is why tagged values are generally parsed into ASN1Data ;TI"Ginstances, but with a different outcome for implicit and explicit ;TI" tagging.;T@S; ; i; I"0Example of a parsed implicitly tagged value;T@o; ;[I"?An implicitly 1-tagged INTEGER value will be parsed as an ;TI"ASN1Data with;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0;[o; ;[I"_tag_ equal to 1;To;;0;[o; ;[I"-_tag_class_ equal to +:CONTEXT_SPECIFIC+;To;;0;[o; ;[I"=_value_ equal to a String that carries the raw encoding ;TI"of the INTEGER.;To; ;[I"AThis implies that a subsequent decoding step is required to ;TI"0completely decode implicitly tagged values.;T@S; ; i; I"0Example of a parsed explicitly tagged value;T@o; ;[I"?An explicitly 1-tagged INTEGER value will be parsed as an ;TI"ASN1Data with;To;;;;[o;;0;[o; ;[I"_tag_ equal to 1;To;;0;[o; ;[I"-_tag_class_ equal to +:CONTEXT_SPECIFIC+;To;;0;[o; ;[ I";_value_ equal to an Array with one single element, an ;TI"@instance of OpenSSL::ASN1::Integer, i.e. the inner element ;TI"Gis the non-tagged primitive value, and the tagging is represented ;TI"in the outer ASN1Data;T@S; ; i; I"4Example - Decoding an implicitly tagged INTEGER;To:RDoc::Markup::Verbatim;[I"Kint = OpenSSL::ASN1::Integer.new(1, 0, :IMPLICIT) # implicit 0-tagged ;TI"0seq = OpenSSL::ASN1::Sequence.new( [int] ) ;TI"der = seq.to_der ;TI"&asn1 = OpenSSL::ASN1.decode(der) ;TI"6# pp asn1 => #]> ;TI"raw_int = asn1.value[0] ;TI"H# manually rewrite tag and tag class to make it an UNIVERSAL value ;TI"*raw_int.tag = OpenSSL::ASN1::INTEGER ;TI"$raw_int.tag_class = :UNIVERSAL ;TI"*int2 = OpenSSL::ASN1.decode(raw_int) ;TI"puts int2.value # => 1 ;T: @format0S; ; i; I"4Example - Decoding an explicitly tagged INTEGER;To;;[I"Kint = OpenSSL::ASN1::Integer.new(1, 0, :EXPLICIT) # explicit 0-tagged ;TI"0seq = OpenSSL::ASN1::Sequence.new( [int] ) ;TI"der = seq.to_der ;TI"&asn1 = OpenSSL::ASN1.decode(der) ;TI"6# pp asn1 => #]>]> ;TI"#int2 = asn1.value[0].value[0] ;TI"puts int2.value # => 1;T;0: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ I"indefinite_length;TI"RW;T: privateFI"ext/openssl/ossl_asn1.c;T[ I"infinite_length;T@;F@[ I"tag;T@;F@[ I"tag_class;T@;F@[ I" value;T@;F@[[[[I" class;T[[: public[[:protected[[;[[I"new;T@[I" instance;T[[;[[;[[;[[I" to_der;T@[[U:RDoc::Context::Section[i0o;;[;0;0[I"ext/openssl/ossl_asn1.c;TI"OpenSSL::ASN1;TcRDoc::NormalModulePKI ] %nnASN1/ASN1Data/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"#OpenSSL::ASN1::ASN1Data#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"JEncodes this ASN1Data into a DER-encoded String value. The result is ;TI"HDER-encoded except for the possibility of indefinite length forms. ;TI"QIndefinite length forms are not allowed in strict DER, so strictly speaking ;TI" DER-encoded String ;T0[I"();T@FI" ASN1Data;TcRDoc::NormalClass00PKI ]pASN1/ASN1Data/tag_class-i.rinu[U:RDoc::Attr[iI"tag_class:ETI"&OpenSSL::ASN1::ASN1Data#tag_class;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HA Symbol representing the tag class of this ASN1Data. Never +nil+. ;TI"&See ASN1Data for possible values.;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::ASN1::ASN1Data;TcRDoc::NormalClass0PKI ]!5iiASN1/ASN1Data/tag-i.rinu[U:RDoc::Attr[iI"tag:ETI" OpenSSL::ASN1::ASN1Data#tag;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"JAn Integer representing the tag number of this ASN1Data. Never +nil+.;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::ASN1::ASN1Data;TcRDoc::NormalClass0PKI ]??$ASN1/ASN1Data/indefinite_length-i.rinu[U:RDoc::Attr[iI"indefinite_length:ETI".OpenSSL::ASN1::ASN1Data#indefinite_length;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GNever +nil+. A boolean value indicating whether the encoding uses ;TI"Iindefinite length (in the case of parsing) or whether an indefinite ;TI"7length form shall be used (in the encoding case). ;TI"KIn DER, every value uses definite length form. But in scenarios where ;TI"Klarge amounts of data need to be transferred it might be desirable to ;TI"4have some kind of streaming support available. ;TI"JFor example, huge OCTET STRINGs are preferably sent in smaller-sized ;TI"chunks, each at a time. ;TI"HThis is possible in BER by setting the length bytes of an encoding ;TI"Eto zero and by this indicating that the following value will be ;TI"Isent in chunks. Indefinite length encodings are always constructed. ;TI"FThe end of such a stream of chunks is indicated by sending a EOC ;TI"K(End of Content) tag. SETs and SEQUENCEs may use an indefinite length ;TI"Fencoding, but also primitive types such as e.g. OCTET STRINGS or ;TI"CBIT STRINGS may leverage this functionality (cf. ITU-T X.690).;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::ASN1::ASN1Data;TcRDoc::NormalClass0PKI ]ASN1/ASN1Data/value-i.rinu[U:RDoc::Attr[iI" value:ETI""OpenSSL::ASN1::ASN1Data#value;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"(Carries the value of a ASN.1 type. ;TI"GPlease confer Constructive and Primitive for the mappings between ;TI"'ASN.1 data types and Ruby classes.;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::ASN1::ASN1Data;TcRDoc::NormalClass0PKI ]RwASN1/ObjectId/cdesc-ObjectId.rinu[U:RDoc::NormalClass[iI" ObjectId:ETI"OpenSSL::ASN1::ObjectId;TI"OpenSSL::ASN1::Primitive;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"9Represents the primitive object id for OpenSSL::ASN1;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" register;TI"ext/openssl/ossl_asn1.c;T[I" instance;T[[; [[; [[;[ [I"==;T@![I"ln;T@![I"long_name;T@![I"oid;T@![I"short_name;T@![I"sn;T@![[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_asn1.c;TI"OpenSSL::ASN1;TcRDoc::NormalModulePKI ]ASN1/ObjectId/long_name-i.rinu[U:RDoc::AnyMethod[iI"long_name:ETI"&OpenSSL::ASN1::ObjectId#long_name;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"FThe long name of the ObjectId, as defined in .;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" ObjectId;TcRDoc::NormalClass0[I"OpenSSL::ASN1::ObjectId;TFI"ln;TPKI ]ASN1/ObjectId/short_name-i.rinu[U:RDoc::AnyMethod[iI"short_name:ETI"'OpenSSL::ASN1::ObjectId#short_name;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GThe short name of the ObjectId, as defined in .;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" ObjectId;TcRDoc::NormalClass0[I"OpenSSL::ASN1::ObjectId;TFI"sn;TPKI ]~ASN1/ObjectId/oid-i.rinu[U:RDoc::AnyMethod[iI"oid:ETI" OpenSSL::ASN1::ObjectId#oid;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NReturns a String representing the Object Identifier in the dot notation, ;TI"e.g. "1.2.3.4.5";T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0I"oid.oid -> string ;T0[I"();T@FI" ObjectId;TcRDoc::NormalClass00PKI ]ܻ>ASN1/ObjectId/register-c.rinu[U:RDoc::AnyMethod[iI" register:ETI"&OpenSSL::ASN1::ObjectId::register;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OThis adds a new ObjectId to the internal tables. Where _object_id_ is the ;TI"Qnumerical form, _short_name_ is the short name, and _long_name_ is the long ;TI" name.;To:RDoc::Markup::BlankLineo; ; [I"RReturns +true+ if successful. Raises an OpenSSL::ASN1::ASN1Error if it fails.;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0I"HOpenSSL::ASN1::ObjectId.register(object_id, short_name, long_name) ;T0[I"(p1, p2, p3);T@FI" ObjectId;TcRDoc::NormalClass00PKI ]}ASN1/ObjectId/ln-i.rinu[U:RDoc::AnyMethod[iI"ln:ETI"OpenSSL::ASN1::ObjectId#ln;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"FThe long name of the ObjectId, as defined in .;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0I".oid.ln -> string oid.long_name -> string ;T0[[I"long_name;T@ I"();T@FI" ObjectId;TcRDoc::NormalClass00PKI ]r~zzASN1/ObjectId/%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI"OpenSSL::ASN1::ObjectId#==;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"7Returns +true+ if _other_oid_ is the same as _oid_;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0I"'oid == other_oid => true or false ;T0[I" (p1);T@FI" ObjectId;TcRDoc::NormalClass00PKI ]{ASN1/ObjectId/sn-i.rinu[U:RDoc::AnyMethod[iI"sn:ETI"OpenSSL::ASN1::ObjectId#sn;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GThe short name of the ObjectId, as defined in .;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0I"/oid.sn -> string oid.short_name -> string ;T0[[I"short_name;T@ I"();T@FI" ObjectId;TcRDoc::NormalClass00PKI ]9`CCASN1/cdesc-ASN1.rinu[U:RDoc::NormalModule[iI" ASN1:ETI"OpenSSL::ASN1;T0o:RDoc::Markup::Document: @parts[o;;[-o:RDoc::Markup::Paragraph;[I"EAbstract Syntax Notation One (or ASN.1) is a notation syntax to ;TI"Jdescribe data structures and is defined in ITU-T X.680. ASN.1 itself ;TI"Ldoes not mandate any encoding or parsing rules, but usually ASN.1 data ;TI"Lstructures are encoded using the Distinguished Encoding Rules (DER) or ;TI"Mless often the Basic Encoding Rules (BER) described in ITU-T X.690. DER ;TI"Land BER encodings are binary Tag-Length-Value (TLV) encodings that are ;TI"Kquite concise compared to other popular data description formats such ;TI"as XML, JSON etc. ;TI"JASN.1 data structures are very common in cryptographic applications, ;TI"He.g. X.509 public key certificates or certificate revocation lists ;TI"M(CRLs) are all defined in ASN.1 and DER-encoded. ASN.1, DER and BER are ;TI"2the building blocks of applied cryptography. ;TI"JThe ASN1 module provides the necessary classes that allow generation ;TI"Iof ASN.1 data structures and the methods to encode them using a DER ;TI"Kencoding. The decode method allows parsing arbitrary BER-/DER-encoded ;TI"Ldata to a Ruby object that can then be modified and re-encoded at will.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"ASN.1 class hierarchy;T@o; ;[I"OThe base class representing ASN.1 structures is ASN1Data. ASN1Data offers ;TI"Kattributes to read and set the _tag_, the _tag_class_ and finally the ;TI"I_value_ of a particular ASN.1 item. Upon parsing, any tagged values ;TI"N(implicit or explicit) will be represented by ASN1Data instances because ;TI"Ltheir "real type" can only be determined using out-of-band information ;TI"Ifrom the ASN.1 type declaration. Since this information is normally ;TI"Fknown when encoding a type, all sub-classes of ASN1Data offer an ;TI"Madditional attribute _tagging_ that allows to encode a value implicitly ;TI"/(+:IMPLICIT+) or explicitly (+:EXPLICIT+).;T@S; ; i; I"Constructive;T@o; ;[ I"BConstructive is, as its name implies, the base class for all ;TI"Gconstructed encodings, i.e. those that consist of several values, ;TI"Oopposed to "primitive" encodings with just one single value. The value of ;TI"(an Constructive is always an Array.;T@S; ; i ; I"!ASN1::Set and ASN1::Sequence;T@o; ;[I"MThe most common constructive encodings are SETs and SEQUENCEs, which is ;TI"Hwhy there are two sub-classes of Constructive representing each of ;TI" them.;T@S; ; i; I"Primitive;T@o; ;[ I"@This is the super class of all primitive values. Primitive ;TI"Gitself is not used when parsing ASN.1 data, all values are either ;TI"Einstances of a corresponding sub-class of Primitive or they are ;TI"Minstances of ASN1Data if the value was tagged implicitly or explicitly. ;TI"GPlease cf. Primitive documentation for details on sub-classes and ;TI"Ctheir respective mappings of ASN.1 data types to Ruby objects.;T@S; ; i; I""Possible values for _tagging_;T@o; ;[ I"HWhen constructing an ASN1Data object the ASN.1 type definition may ;TI"Lrequire certain elements to be either implicitly or explicitly tagged. ;TI"JThis can be achieved by setting the _tagging_ attribute manually for ;TI"Fsub-classes of ASN1Data. Use the symbol +:IMPLICIT+ for implicit ;TI"Ftagging and +:EXPLICIT+ if the element requires explicit tagging.;T@S; ; i; I"$Possible values for _tag_class_;T@o; ;[I"KIt is possible to create arbitrary ASN1Data objects that also support ;TI"Ma PRIVATE or APPLICATION tag class. Possible values for the _tag_class_ ;TI"attribute are:;To:RDoc::Markup::List: @type: BULLET: @items[ o:RDoc::Markup::ListItem: @label0;[o; ;[I"3+:UNIVERSAL+ (the default for untagged values);To;;0;[o; ;[I"8+:CONTEXT_SPECIFIC+ (the default for tagged values);To;;0;[o; ;[I"+:APPLICATION+;To;;0;[o; ;[I"+:PRIVATE+;T@S; ; i; I"Tag constants;T@o; ;[I"8There is a constant defined for each universal tag:;To;;;;[o;;0;[o; ;[I"OpenSSL::ASN1::EOC (0);To;;0;[o; ;[I"OpenSSL::ASN1::BOOLEAN (1);To;;0;[o; ;[I"OpenSSL::ASN1::INTEGER (2);To;;0;[o; ;[I""OpenSSL::ASN1::BIT_STRING (3);To;;0;[o; ;[I"$OpenSSL::ASN1::OCTET_STRING (4);To;;0;[o; ;[I"OpenSSL::ASN1::NULL (5);To;;0;[o; ;[I"OpenSSL::ASN1::OBJECT (6);To;;0;[o; ;[I"#OpenSSL::ASN1::ENUMERATED (10);To;;0;[o; ;[I"#OpenSSL::ASN1::UTF8STRING (12);To;;0;[o; ;[I"!OpenSSL::ASN1::SEQUENCE (16);To;;0;[o; ;[I"OpenSSL::ASN1::SET (17);To;;0;[o; ;[I"&OpenSSL::ASN1::NUMERICSTRING (18);To;;0;[o; ;[I"(OpenSSL::ASN1::PRINTABLESTRING (19);To;;0;[o; ;[I""OpenSSL::ASN1::T61STRING (20);To;;0;[o; ;[I"'OpenSSL::ASN1::VIDEOTEXSTRING (21);To;;0;[o; ;[I""OpenSSL::ASN1::IA5STRING (22);To;;0;[o; ;[I" OpenSSL::ASN1::UTCTIME (23);To;;0;[o; ;[I"(OpenSSL::ASN1::GENERALIZEDTIME (24);To;;0;[o; ;[I"&OpenSSL::ASN1::GRAPHICSTRING (25);To;;0;[o; ;[I"$OpenSSL::ASN1::ISO64STRING (26);To;;0;[o; ;[I"&OpenSSL::ASN1::GENERALSTRING (27);To;;0;[o; ;[I"(OpenSSL::ASN1::UNIVERSALSTRING (28);To;;0;[o; ;[I""OpenSSL::ASN1::BMPSTRING (30);T@S; ; i; I" UNIVERSAL_TAG_NAME constant;T@o; ;[I"JAn Array that stores the name of a given tag number. These names are ;TI"Lthe same as the name of the tag constant that is additionally defined, ;TI"Oe.g. +UNIVERSAL_TAG_NAME[2] = "INTEGER"+ and +OpenSSL::ASN1::INTEGER = 2+.;T@S; ; i; I"Example usage;T@S; ; i; I",Decoding and viewing a DER-encoded file;To:RDoc::Markup::Verbatim;[ I"require 'openssl' ;TI"require 'pp' ;TI"$der = File.binread('data.der') ;TI"&asn1 = OpenSSL::ASN1.decode(der) ;TI" pp der ;T: @format0S; ; i; I"4Creating an ASN.1 structure and DER-encoding it;To;;[ I"require 'openssl' ;TI"-version = OpenSSL::ASN1::Integer.new(1) ;TI"># Explicitly 0-tagged implies context-specific tag class ;TI"Qserial = OpenSSL::ASN1::Integer.new(12345, 0, :EXPLICIT, :CONTEXT_SPECIFIC) ;TI"9name = OpenSSL::ASN1::PrintableString.new('Data 1') ;TI"Isequence = OpenSSL::ASN1::Sequence.new( [ version, serial, name ] ) ;TI"der = sequence.to_der;T;0: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0;0;0[[U:RDoc::Constant[iI"UNIVERSAL_TAG_NAME;TI"&OpenSSL::ASN1::UNIVERSAL_TAG_NAME;T: public0o;;[o; ;[I"0Array storing tag names at the tag's index.;T;@;0@@cRDoc::NormalModule0[[[I" class;T[[;[[:protected[[: private[[I" decode;TI"ext/openssl/ossl_asn1.c;T[I"decode_all;T@[I" traverse;T@[I" instance;T[[;[[;[[;[[[U:RDoc::Context::Section[i0o;;[;0;0[I"ext/openssl/ossl.c;TI" OpenSSL;T@ PKI ] ASN1/traverse-c.rinu[U:RDoc::AnyMethod[iI" traverse:ETI"OpenSSL::ASN1::traverse;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"JIf a block is given, it prints out each of the elements encountered. ;TI"*Block parameters are (in that order):;To:RDoc::Markup::List: @type: BULLET: @items[ o:RDoc::Markup::ListItem: @label0; [o; ; [I"adepth: The recursion depth, plus one with each constructed value being encountered (Integer);To;;0; [o; ; [I"*offset: Current byte offset (Integer);To;;0; [o; ; [I"Uheader length: Combined length in bytes of the Tag and Length headers. (Integer);To;;0; [o; ; [I"Flength: The overall remaining length of the entire data (Integer);To;;0; [o; ; [I"Dconstructed: Whether this value is constructed or not (Boolean);To;;0; [o; ; [I"*tag_class: Current tag class (Symbol);To;;0; [o; ; [I"*tag: The current tag number (Integer);To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I"(der = File.binread('asn1data.der') ;TI"fOpenSSL::ASN1.traverse(der) do | depth, offset, header_len, length, constructed, tag_class, tag| ;TI"B puts "Depth: #{depth} Offset: #{offset} Length: #{length}" ;TI"k puts "Header length: #{header_len} Tag: #{tag} Tag class: #{tag_class} Constructed: #{constructed}" ;TI"end;T: @format0: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0I")OpenSSL::ASN1.traverse(asn1) -> nil ;T0[I" (p1);T@>FI" ASN1;TcRDoc::NormalModule00PKI ]g9??ASN1/Primitive/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI""OpenSSL::ASN1::Primitive::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"_value_: is mandatory.;To:RDoc::Markup::BlankLineo; ; [I"I_tag_: optional, may be specified for tagged values. If no _tag_ is ;TI"Kspecified, the UNIVERSAL tag corresponding to the Primitive sub-class ;TI"is used by default.;T@o; ; [I"I_tagging_: may be used as an encoding hint to encode a value either ;TI" Primitive ;T0[I"$(p1, p2 = v2, p3 = v3, p4 = v4);T@%FI"Primitive;TcRDoc::NormalClass00PKI ]q$ASN1/Primitive/tagging-i.rinu[U:RDoc::Attr[iI" tagging:ETI"%OpenSSL::ASN1::Primitive#tagging;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"EMay be used as a hint for encoding a value either implicitly or ;TI"Gexplicitly by setting it either to +:IMPLICIT+ or to +:EXPLICIT+. ;TI"A_tagging_ is not set when a ASN.1 structure is parsed using ;TI"OpenSSL::ASN1.decode.;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::ASN1::Primitive;TcRDoc::NormalClass0PKI ]ѡ5ppASN1/Primitive/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"$OpenSSL::ASN1::Primitive#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"%See ASN1Data#to_der for details.;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0I"'asn1.to_der => DER-encoded String ;T0[I"();T@FI"Primitive;TcRDoc::NormalClass00PKI ] !ASN1/Primitive/cdesc-Primitive.rinu[U:RDoc::NormalClass[iI"Primitive:ETI"OpenSSL::ASN1::Primitive;TI"OpenSSL::ASN1::ASN1Data;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[ I"NThe parent class for all primitive encodings. Attributes are the same as ;TI"3for ASN1Data, with the addition of _tagging_. ;TI"MPrimitive values can never be encoded with indefinite length form, thus ;TI"Oit is not possible to set the _indefinite_length_ attribute for Primitive ;TI"and its sub-classes.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" _value_ is always +nil+;To;;0;[o; ;[I"DOpenSSL::ASN1::Boolean <=> _value_ is +true+ or +false+;To;;0;[o; ;[I"AOpenSSL::ASN1::Integer <=> _value_ is an OpenSSL::BN;To;;0;[o; ;[I";OpenSSL::ASN1::BitString <=> _value_ is a String;To;;0;[o; ;[I";OpenSSL::ASN1::OctetString <=> _value_ is a String;To;;0;[o; ;[I"?OpenSSL::ASN1::Null <=> _value_ is always +nil+;To;;0;[o; ;[I";OpenSSL::ASN1::Object <=> _value_ is a String;To;;0;[o; ;[I"AOpenSSL::ASN1::Enumerated <=> _value_ is an OpenSSL::BN;To;;0;[o; ;[I";OpenSSL::ASN1::UTF8String <=> _value_ is a String;To;;0;[o; ;[I";OpenSSL::ASN1::NumericString <=> _value_ is a String;To;;0;[o; ;[I";OpenSSL::ASN1::PrintableString <=> _value_ is a String;To;;0;[o; ;[I";OpenSSL::ASN1::T61String <=> _value_ is a String;To;;0;[o; ;[I";OpenSSL::ASN1::VideotexString <=> _value_ is a String;To;;0;[o; ;[I";OpenSSL::ASN1::IA5String <=> _value_ is a String;To;;0;[o; ;[I"9OpenSSL::ASN1::UTCTime <=> _value_ is a Time;To;;0;[o; ;[I"9OpenSSL::ASN1::GeneralizedTime <=> _value_ is a Time;To;;0;[o; ;[I";OpenSSL::ASN1::GraphicString <=> _value_ is a String;To;;0;[o; ;[I";OpenSSL::ASN1::ISO64String <=> _value_ is a String;To;;0;[o; ;[I";OpenSSL::ASN1::GeneralString <=> _value_ is a String;To;;0;[o; ;[I";OpenSSL::ASN1::UniversalString <=> _value_ is a String;To;;0;[o; ;[I";OpenSSL::ASN1::BMPString <=> _value_ is a String;T@S; ; i; I"OpenSSL::ASN1::BitString;T@S; ; i; I"Additional attributes;To; ;[ I"3_unused_bits_: if the underlying BIT STRING's ;TI"Blength is a multiple of 8 then _unused_bits_ is 0. Otherwise ;TI"J_unused_bits_ indicates the number of bits that are to be ignored in ;TI"0the final octet of the BitString's _value_.;T@S; ; i; I"OpenSSL::ASN1::ObjectId;T@o; ;[I"KNOTE: While OpenSSL::ASN1::ObjectId.new will allocate a new ObjectId, ;TI"Oit is not typically allocated this way, but rather that are received from ;TI"parsed ASN1 encodings.;T@S; ; i; I"Additional attributes;To;;;;[ o;;0;[o; ;[I"<_sn_: the short name as defined in .;To;;0;[o; ;[I";_ln_: the long name as defined in .;To;;0;[o; ;[I"?_oid_: the object identifier as a String, e.g. "1.2.3.4.5";To;;0;[o; ;[I""_short_name_: alias for _sn_.;To;;0;[o; ;[I"!_long_name_: alias for _ln_.;T@S; ; i; I" Examples;To; ;[I"MWith the Exception of OpenSSL::ASN1::EndOfContent, each Primitive class ;TI";constructor takes at least one parameter, the _value_.;T@S; ; i; I"Creating EndOfContent;To:RDoc::Markup::Verbatim;[I"+eoc = OpenSSL::ASN1::EndOfContent.new ;T: @format0S; ; i; I"!Creating any other Primitive;To;;[I"Zprim = .new(value) # being one of the sub-classes except EndOfContent ;TI"Bprim_zero_tagged_implicit = .new(value, 0, :IMPLICIT) ;TI"Aprim_zero_tagged_explicit = .new(value, 0, :EXPLICIT);T;0: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0;0;0[[ I" tagging;TI"RW;T: privateFI"ext/openssl/ossl_asn1.c;T[[[[I" class;T[[: public[[:protected[[;[[I"new;T@[I" instance;T[[;[[;[[;[[I" to_der;T@[[U:RDoc::Context::Section[i0o;;[;0;0[I"ext/openssl/ossl_asn1.c;TI"OpenSSL::ASN1;TcRDoc::NormalModulePKI ]+LRLL!ASN1/ASN1Error/cdesc-ASN1Error.rinu[U:RDoc::NormalClass[iI"ASN1Error:ETI"OpenSSL::ASN1::ASN1Error;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"FGeneric error class for all errors raised in ASN1 and any of the ;TI"classes defined in it.;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_asn1.c;TI"OpenSSL::ASN1;TcRDoc::NormalModulePKI ]5}o&&ASN1/decode_all-c.rinu[U:RDoc::AnyMethod[iI"decode_all:ETI"OpenSSL::ASN1::decode_all;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"ESimilar to #decode with the difference that #decode expects one ;TI"Fdistinct value represented in _der_. #decode_all on the contrary ;TI"Gdecodes a sequence of sequential BER/DER values lined up in _der_ ;TI""and returns them as an array.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [I")ders = File.binread('asn1data_seq') ;TI".asn1_ary = OpenSSL::ASN1.decode_all(ders);T: @format0: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0I"8OpenSSL::ASN1.decode_all(der) -> Array of ASN1Data ;T0[I" (p1);T@FI" ASN1;TcRDoc::NormalModule00PKI ]Uͬ__'ASN1/Constructive/cdesc-Constructive.rinu[U:RDoc::NormalClass[iI"Constructive:ETI" OpenSSL::ASN1::Constructive;TI"OpenSSL::ASN1::ASN1Data;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"KThe parent class for all constructed encodings. The _value_ attribute ;TI"Fof a Constructive is always an Array. Attributes are the same as ;TI"2for ASN1Data, with the addition of _tagging_.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"SET and SEQUENCE;T@o; ;[I"IMost constructed encodings come in the form of a SET or a SEQUENCE. ;TI"FThese encodings are represented by one of the two sub-classes of ;TI"Constructive:;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0;[o; ;[I"OpenSSL::ASN1::Set;To;;0;[o; ;[I"OpenSSL::ASN1::Sequence;To; ;[I"DPlease note that tagged sequences and sets are still parsed as ;TI"Binstances of ASN1Data. Find further details on tagged values ;TI" there.;T@S; ; i; I"&Example - constructing a SEQUENCE;To:RDoc::Markup::Verbatim;[I")int = OpenSSL::ASN1::Integer.new(1) ;TI"5str = OpenSSL::ASN1::PrintableString.new('abc') ;TI" Primitive ;T0[I"$(p1, p2 = v2, p3 = v3, p4 = v4);T@%FI"Constructive;TcRDoc::NormalClass00PKI ]+ASN1/Constructive/tagging-i.rinu[U:RDoc::Attr[iI" tagging:ETI"(OpenSSL::ASN1::Constructive#tagging;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"EMay be used as a hint for encoding a value either implicitly or ;TI"Gexplicitly by setting it either to +:IMPLICIT+ or to +:EXPLICIT+. ;TI"A_tagging_ is not set when a ASN.1 structure is parsed using ;TI"OpenSSL::ASN1.decode.;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0F@I" OpenSSL::ASN1::Constructive;TcRDoc::NormalClass0PKI ]avvASN1/Constructive/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"'OpenSSL::ASN1::Constructive#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"%See ASN1Data#to_der for details.;T: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0I"'asn1.to_der => DER-encoded String ;T0[I"();T@FI"Constructive;TcRDoc::NormalClass00PKI ] ͵ASN1/Constructive/each-i.rinu[U:RDoc::AnyMethod[iI" each:ETI"%OpenSSL::ASN1::Constructive#each;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"OCalls the given block once for each element in self, passing that element ;TI"Jas parameter _asn1_. If no block is given, an enumerator is returned ;TI" instead.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [I"asn1_ary.each do |asn1| ;TI" puts asn1 ;TI"end;T: @format0: @fileI"ext/openssl/ossl_asn1.c;T:0@omit_headings_from_table_of_contents_below0I"0asn1_ary.each { |asn1| block } => asn1_ary ;T0[I"();T@FI"Constructive;TcRDoc::NormalClass00PKI ]{y=ttRandom/seed-c.rinu[U:RDoc::AnyMethod[iI" seed:ETI"OpenSSL::Random::seed;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"F::seed is equivalent to ::add where _entropy_ is length of _str_.;T: @fileI"ext/openssl/ossl_rand.c;T:0@omit_headings_from_table_of_contents_below0I"seed(str) -> str ;T0[I" (p1);T@FI" Random;TcRDoc::NormalModule00PKI ] ?Random/status%3f-c.rinu[U:RDoc::AnyMethod[iI" status?:ETI"OpenSSL::Random::status?;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"SReturn +true+ if the PRNG has been seeded with enough data, +false+ otherwise.;T: @fileI"ext/openssl/ossl_rand.c;T:0@omit_headings_from_table_of_contents_below0I"status? => true | false ;T0[I"();T@FI" Random;TcRDoc::NormalModule00PKI ]>$OYYRandom/cdesc-Random.rinu[U:RDoc::NormalModule[iI" Random:ETI"OpenSSL::Random;T0o:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_rand.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[ [I"egd;TI"ext/openssl/ossl_rand.c;T[I"egd_bytes;T@[I"load_random_file;T@[I"random_add;T@[I"random_bytes;T@[I" seed;T@[I" status?;T@[I"write_random_file;T@[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]׶##Random/egd_bytes-c.rinu[U:RDoc::AnyMethod[iI"egd_bytes:ETI"OpenSSL::Random::egd_bytes;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QQueries the entropy gathering daemon EGD on socket path given by _filename_.;To:RDoc::Markup::BlankLineo; ; [I"RFetches _length_ number of bytes and uses ::add to seed the OpenSSL built-in ;TI" PRNG.;T: @fileI"ext/openssl/ossl_rand.c;T:0@omit_headings_from_table_of_contents_below0I")egd_bytes(filename, length) -> true ;T0[I" (p1, p2);T@FI" Random;TcRDoc::NormalModule00PKI ]Y'Random/RandomError/cdesc-RandomError.rinu[U:RDoc::NormalClass[iI"RandomError:ETI"!OpenSSL::Random::RandomError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_rand.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_rand.c;TI"OpenSSL::Random;TcRDoc::NormalModulePKI ]%_Random/load_random_file-c.rinu[U:RDoc::AnyMethod[iI"load_random_file:ETI"&OpenSSL::Random::load_random_file;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I";Reads bytes from _filename_ and adds them to the PRNG.;T: @fileI"ext/openssl/ossl_rand.c;T:0@omit_headings_from_table_of_contents_below0I"(load_random_file(filename) -> true ;T0[I" (p1);T@FI" Random;TcRDoc::NormalModule00PKI ]7kkRandom/egd-c.rinu[U:RDoc::AnyMethod[iI"egd:ETI"OpenSSL::Random::egd;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I":Same as ::egd_bytes but queries 255 bytes by default.;T: @fileI"ext/openssl/ossl_rand.c;T:0@omit_headings_from_table_of_contents_below0I"egd(filename) -> true ;T0[I" (p1);T@FI" Random;TcRDoc::NormalModule00PKI ](HRandom/write_random_file-c.rinu[U:RDoc::AnyMethod[iI"write_random_file:ETI"'OpenSSL::Random::write_random_file;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NWrites a number of random generated bytes (currently 1024) to _filename_ ;TI"Qwhich can be used to initialize the PRNG by calling ::load_random_file in a ;TI"later session.;T: @fileI"ext/openssl/ossl_rand.c;T:0@omit_headings_from_table_of_contents_below0I")write_random_file(filename) -> true ;T0[I" (p1);T@FI" Random;TcRDoc::NormalModule00PKI ]!ccRandom/random_bytes-c.rinu[U:RDoc::AnyMethod[iI"random_bytes:ETI""OpenSSL::Random::random_bytes;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"IGenerates a String with _length_ number of cryptographically strong ;TI"pseudo-random bytes.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;T@o:RDoc::Markup::Verbatim; [I"&OpenSSL::Random.random_bytes(12) ;TI"#=> "...";T: @format0: @fileI"ext/openssl/ossl_rand.c;T:0@omit_headings_from_table_of_contents_below0I"$random_bytes(length) -> string ;T0[I" (p1);T@FI" Random;TcRDoc::NormalModule00PKI ]cF2  Random/random_add-c.rinu[U:RDoc::AnyMethod[iI"random_add:ETI" OpenSSL::Random::random_add;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NMixes the bytes from _str_ into the Pseudo Random Number Generator(PRNG) ;TI" state.;To:RDoc::Markup::BlankLineo; ; [I"JThus, if the data from _str_ are unpredictable to an adversary, this ;TI"Nincreases the uncertainty about the state and makes the PRNG output less ;TI"predictable.;T@o; ; [I"LThe _entropy_ argument is (the lower bound of) an estimate of how much ;TI"9randomness is contained in _str_, measured in bytes.;T@S:RDoc::Markup::Heading: leveli: textI" Example;T@o:RDoc::Markup::Verbatim; [ I"pid = $$ ;TI"now = Time.now ;TI"+ary = [now.to_i, now.nsec, 1000, pid] ;TI"(OpenSSL::Random.add(ary.join, 0.0) ;TI"#OpenSSL::Random.seed(ary.join);T: @format0: @fileI"ext/openssl/ossl_rand.c;T:0@omit_headings_from_table_of_contents_below0I"add(str, entropy) -> self ;T0[I" (p1, p2);T@"FI" Random;TcRDoc::NormalModule00PKI ]Digest/reset-i.rinu[U:RDoc::AnyMethod[iI" reset:ETI"OpenSSL::Digest#reset;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"IResets the Digest in the sense that any Digest#update that has been ;TI"Mperformed is abandoned and the Digest is set to its initial state again.;T: @fileI"ext/openssl/ossl_digest.c;T:0@omit_headings_from_table_of_contents_below0I"digest.reset -> self ;T0[I"();T@FI" Digest;TcRDoc::NormalClass00PKI ]HHDigest/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::Digest::new;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"ICreates a Digest instance based on _string_, which is either the ln ;TI"D(long name) or sn (short name) of a supported digest algorithm.;To:RDoc::Markup::BlankLineo; ; [I"KIf _data_ (a String) is given, it is used as the initial input to the ;TI"Digest instance, i.e.;T@o:RDoc::Markup::Verbatim; [I":digest = OpenSSL::Digest.new('sha256', 'digestdata') ;T: @format0o; ; [I"is equivalent to;T@o; ; [I",digest = OpenSSL::Digest.new('sha256') ;TI" digest.update('digestdata');T; 0: @fileI"ext/openssl/ossl_digest.c;T:0@omit_headings_from_table_of_contents_below0I"+Digest.new(string [, data]) -> Digest ;T0[I"(p1, p2 = v2);T@FI" Digest;TcRDoc::NormalClass00PKI ]lYTT'Digest/DigestError/cdesc-DigestError.rinu[U:RDoc::NormalClass[iI"DigestError:ETI"!OpenSSL::Digest::DigestError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"HGeneric Exception class that is raised if an error occurs during a ;TI"Digest operation.;T: @fileI"ext/openssl/ossl_digest.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_digest.c;TI"OpenSSL::Digest;TcRDoc::NormalClassPKI ]%XXDigest/update-i.rinu[U:RDoc::AnyMethod[iI" update:ETI"OpenSSL::Digest#update;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"ONot every message digest can be computed in one single pass. If a message ;TI"Mdigest is to be computed from several subsequent sources, then each may ;TI"3be passed individually to the Digest instance.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I",digest = OpenSSL::Digest.new('SHA256') ;TI""digest.update('First input') ;TI"Ldigest << 'Second input' # equivalent to digest.update('Second input') ;TI"result = digest.digest;T: @format0: @fileI"ext/openssl/ossl_digest.c;T:0@omit_headings_from_table_of_contents_below0I"&digest.update(string) -> aString ;T0[[I"<<;T@ I" (p1);T@FI" Digest;TcRDoc::NormalClass00PKI ]]Digest/digest_length-i.rinu[U:RDoc::AnyMethod[iI"digest_length:ETI""OpenSSL::Digest#digest_length;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"LReturns the output size of the digest, i.e. the length in bytes of the ;TI"!final message digest result.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [I"*digest = OpenSSL::Digest.new('SHA1') ;TI"&puts digest.digest_length # => 20;T: @format0: @fileI"ext/openssl/ossl_digest.c;T:0@omit_headings_from_table_of_contents_below0I"%digest.digest_length -> integer ;T0[I"();T@FI" Digest;TcRDoc::NormalClass00PKI ] zzDigest/cdesc-Digest.rinu[U:RDoc::NormalClass[iI" Digest:ETI"OpenSSL::Digest;TI"OpenSSL::Digest::Class;To:RDoc::Markup::Document: @parts[o;;[: @fileI"&ext/openssl/lib/openssl/digest.rb;T:0@omit_headings_from_table_of_contents_below0o;;[ o:RDoc::Markup::Paragraph;[ I"FOpenSSL::Digest allows you to compute message digests (sometimes ;TI"Ainterchangeably called "hashes") of arbitrary data that are ;TI"Icryptographically secure, i.e. a Digest implements a secure one-way ;TI"function.;To:RDoc::Markup::BlankLineo; ;[ I"DOne-way functions offer some useful properties. E.g. given two ;TI"Edistinct inputs the probability that both yield the same output ;TI"Jis highly unlikely. Combined with the fact that every message digest ;TI"Jalgorithm has a fixed-length output of just a few bytes, digests are ;TI"Joften used to create unique identifiers for arbitrary data. A common ;TI"Jexample is the creation of a unique id for binary documents that are ;TI"stored in a database.;T@o; ;[ I"LAnother useful characteristic of one-way functions (and thus the name) ;TI"Fis that given a digest there is no indication about the original ;TI"Mdata that produced it, i.e. the only way to identify the original input ;TI"Fis to "brute-force" through every possible combination of inputs.;T@o; ;[ I"HThese characteristics make one-way functions also ideal companions ;TI"Gfor public key signature algorithms: instead of signing an entire ;TI"Ldocument, first a hash of the document is produced with a considerably ;TI"Jfaster message digest algorithm and only the few bytes of its output ;TI"Jneed to be signed using the slower public key algorithm. To validate ;TI"Lthe integrity of a signed document, it suffices to re-compute the hash ;TI":and verify that it is equal to that in the signature.;T@o; ;[I"MYou can get a list of all digest algorithms supported on your system by ;TI"+running this command in your terminal:;T@o:RDoc::Markup::Verbatim;[I"%openssl list -digest-algorithms ;T: @format0o; ;[I"EAmong the OpenSSL 1.1.1 supported message digest algorithms are:;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0;[o; ;[I">SHA224, SHA256, SHA384, SHA512, SHA512-224 and SHA512-256;To;;0;[o; ;[I".SHA3-224, SHA3-256, SHA3-384 and SHA3-512;To;;0;[o; ;[I"BLAKE2s256 and BLAKE2b512;T@o; ;[I"AEach of these algorithms can be instantiated using the name:;T@o; ;[I",digest = OpenSSL::Digest.new('SHA256') ;T;0o; ;[ I"E"Breaking" a message digest algorithm means defying its one-way ;TI"Kfunction characteristics, i.e. producing a collision or finding a way ;TI"Gto get to the original data by means that are more efficient than ;TI"Gbrute-forcing etc. Most of the supported digest algorithms can be ;TI"Iconsidered broken in this sense, even the very popular MD5 and SHA1 ;TI"Jalgorithms. Should security be your highest concern, then you should ;TI"7probably rely on SHA224, SHA256, SHA384 or SHA512.;T@S:RDoc::Markup::Heading: leveli: textI"Hashing a file;T@o; ;[I"%data = File.binread('document') ;TI",sha256 = OpenSSL::Digest.new('SHA256') ;TI""digest = sha256.digest(data) ;T;0S;;i;I"+Hashing several pieces of data at once;T@o; ;[ I"#data1 = File.binread('file1') ;TI"#data2 = File.binread('file2') ;TI"#data3 = File.binread('file3') ;TI",sha256 = OpenSSL::Digest.new('SHA256') ;TI"sha256 << data1 ;TI"sha256 << data2 ;TI"sha256 << data3 ;TI"digest = sha256.digest ;T;0S;;i;I"Reuse a Digest instance;T@o; ;[ I"#data1 = File.binread('file1') ;TI",sha256 = OpenSSL::Digest.new('SHA256') ;TI"$digest1 = sha256.digest(data1) ;TI" ;TI"#data2 = File.binread('file2') ;TI"sha256.reset ;TI"#digest2 = sha256.digest(data2);T;0; I"ext/openssl/ossl_digest.c;T; 0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" digest;TI"&ext/openssl/lib/openssl/digest.rb;T[I"new;TI"ext/openssl/ossl_digest.c;T[I" instance;T[[;[[;[[;[ [I"<<;T@[I"block_length;T@[I"digest_length;T@[I" finish;T@[I"initialize_copy;T@[I" name;T@[I" reset;T@[I" update;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[ I"&ext/openssl/lib/openssl/digest.rb;TI"ext/openssl/ossl.c;TI""lib/rubygems/s3_uri_signer.rb;TI"lib/rubygems/source/git.rb;TI" OpenSSL;TcRDoc::NormalModulePKI ]"vDigest/digest-c.rinu[U:RDoc::AnyMethod[iI" digest:ETI"OpenSSL::Digest::digest;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"MReturn the hash value computed with _name_ Digest. _name_ is either the ;TI"=long name or short name of a supported digest algorithm.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Examples;T@o:RDoc::Markup::Verbatim; [I"-OpenSSL::Digest.digest("SHA256", "abc") ;T: @format0o; ; [I"which is equivalent to:;T@o;; [I",OpenSSL::Digest.digest('SHA256', "abc");T;0: @fileI"&ext/openssl/lib/openssl/digest.rb;T:0@omit_headings_from_table_of_contents_below000[I"(name, data);T@TI" Digest;TcRDoc::NormalClass00PKI ]-n((Digest/name-i.rinu[U:RDoc::AnyMethod[iI" name:ETI"OpenSSL::Digest#name;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"-Returns the sn of this Digest algorithm.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [I",digest = OpenSSL::Digest.new('SHA512') ;TI"!puts digest.name # => SHA512;T: @format0: @fileI"ext/openssl/ossl_digest.c;T:0@omit_headings_from_table_of_contents_below0I"digest.name -> string ;T0[I"();T@FI" Digest;TcRDoc::NormalClass00PKI ]YB#Digest/finish-i.rinu[U:RDoc::AnyMethod[iI" finish:ETI"OpenSSL::Digest#finish;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_digest.c;T:0@omit_headings_from_table_of_contents_below0I"digest.finish -> aString;T0[I"(p1 = v1);T@ FI" Digest;TcRDoc::NormalClass00PKI ]Digest/block_length-i.rinu[U:RDoc::AnyMethod[iI"block_length:ETI"!OpenSSL::Digest#block_length;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"PReturns the block length of the digest algorithm, i.e. the length in bytes ;TI"Nof an individual block. Most modern algorithms partition a message to be ;TI"Edigested into a sequence of fix-sized blocks that are processed ;TI"consecutively.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [I"*digest = OpenSSL::Digest.new('SHA1') ;TI"%puts digest.block_length # => 64;T: @format0: @fileI"ext/openssl/ossl_digest.c;T:0@omit_headings_from_table_of_contents_below0I"$digest.block_length -> integer ;T0[I"();T@FI" Digest;TcRDoc::NormalClass00PKI ]n  Digest/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"$OpenSSL::Digest#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_digest.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Digest;TcRDoc::NormalClass00PKI ]}pAADigest/%3c%3c-i.rinu[U:RDoc::AnyMethod[iI"<<:ETI"OpenSSL::Digest#<<;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"ONot every message digest can be computed in one single pass. If a message ;TI"Mdigest is to be computed from several subsequent sources, then each may ;TI"3be passed individually to the Digest instance.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I",digest = OpenSSL::Digest.new('SHA256') ;TI""digest.update('First input') ;TI"Ldigest << 'Second input' # equivalent to digest.update('Second input') ;TI"result = digest.digest;T: @format0: @fileI"ext/openssl/ossl_digest.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@FI" Digest;TcRDoc::NormalClass0[I"OpenSSL::Digest;TFI" update;TPKI ]UqDOOmem_check_start-c.rinu[U:RDoc::AnyMethod[iI"mem_check_start:ETI"OpenSSL::mem_check_start;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HCalls CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON). Starts tracking memory ;TI"3allocations. See also OpenSSL.print_mem_leaks.;To:RDoc::Markup::BlankLineo; ; [I"QThis is available only when built with a capable OpenSSL and --enable-debug ;TI"configure option.;T: @fileI"ext/openssl/ossl.c;T:0@omit_headings_from_table_of_contents_below0I"$OpenSSL.mem_check_start -> nil ;T0[I"();T@FI" OpenSSL;TcRDoc::NormalModule00PKI ]C66 Digest-c.rinu[U:RDoc::AnyMethod[iI" Digest:ETI"OpenSSL::Digest;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"(Returns a Digest subclass by _name_;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"require 'openssl' ;TI" ;TI"OpenSSL::Digest("MD5") ;TI"# => OpenSSL::Digest::MD5 ;TI" ;TI"Digest("Foo") ;TI",# => NameError: wrong constant name Foo;T: @format0: @fileI"&ext/openssl/lib/openssl/digest.rb;T:0@omit_headings_from_table_of_contents_below000[I" (name);T@FI" OpenSSL;TcRDoc::NormalModule00PKI ]Cipher/block_size-i.rinu[U:RDoc::AnyMethod[iI"block_size:ETI"OpenSSL::Cipher#block_size;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NReturns the size in bytes of the blocks on which this Cipher operates on.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I""cipher.block_size -> integer ;T0[I"();T@FI" Cipher;TcRDoc::NormalClass00PKI ].@@Cipher/reset-i.rinu[U:RDoc::AnyMethod[iI" reset:ETI"OpenSSL::Cipher#reset;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LFully resets the internal state of the Cipher. By using this, the same ;TI"RCipher instance may be used several times for encryption or decryption tasks.;To:RDoc::Markup::BlankLineo; ; [I"IInternally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, -1).;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"cipher.reset -> self ;T0[I"();T@FI" Cipher;TcRDoc::NormalClass00PKI ]zCipher/random_iv-i.rinu[U:RDoc::AnyMethod[iI"random_iv:ETI"OpenSSL::Cipher#random_iv;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OGenerate a random IV with OpenSSL::Random.random_bytes and sets it to the ;TI"cipher, and returns it.;To:RDoc::Markup::BlankLineo; ; [I"CYou must call #encrypt or #decrypt before calling this method.;T: @fileI"&ext/openssl/lib/openssl/cipher.rb;T:0@omit_headings_from_table_of_contents_below0I"cipher.random_iv -> iv ;T0[I"();T@FI" Cipher;TcRDoc::NormalClass00PKI ]j:Cipher/iv%3d-i.rinu[U:RDoc::AnyMethod[iI"iv=:ETI"OpenSSL::Cipher#iv=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"NSets the cipher IV. Please note that since you should never be using ECB ;TI"Jmode, an IV is always explicitly required and should be set prior to ;TI"Kencryption. The IV itself can be safely transmitted in public, but it ;TI"Nshould be unpredictable to prevent certain kinds of attacks. You may use ;TI"3Cipher#random_iv to create a secure random IV.;To:RDoc::Markup::BlankLineo; ; [I"JOnly call this method after calling Cipher#encrypt or Cipher#decrypt.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I""cipher.iv = string -> string ;T0[I" (p1);T@FI" Cipher;TcRDoc::NormalClass00PKI ]uCipher/ccm_data_len%3d-i.rinu[U:RDoc::AnyMethod[iI"ccm_data_len=:ETI""OpenSSL::Cipher#ccm_data_len=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HSets the length of the plaintext / ciphertext message that will be ;TI"Jprocessed in CCM mode. Make sure to call this method after #key= and ;TI"0#iv= have been set, and before #auth_data=.;To:RDoc::Markup::BlankLineo; ; [I"JOnly call this method after calling Cipher#encrypt or Cipher#decrypt.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I".cipher.ccm_data_len = integer -> integer ;T0[I" (p1);T@FI" Cipher;TcRDoc::NormalClass00PKI ]UCipher/key%3d-i.rinu[U:RDoc::AnyMethod[iI" key=:ETI"OpenSSL::Cipher#key=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"LSets the cipher key. To generate a key, you should either use a secure ;TI"Mrandom byte string or, if the key is to be derived from a password, you ;TI"Hshould rely on PBKDF2 functionality provided by OpenSSL::PKCS5. To ;TI"Ggenerate a secure random-based key, Cipher#random_key may be used.;To:RDoc::Markup::BlankLineo; ; [I"JOnly call this method after calling Cipher#encrypt or Cipher#decrypt.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"#cipher.key = string -> string ;T0[I" (p1);T@FI" Cipher;TcRDoc::NormalClass00PKI ]r Cipher/auth_tag-i.rinu[U:RDoc::AnyMethod[iI" auth_tag:ETI"OpenSSL::Cipher#auth_tag;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"NGets the authentication tag generated by Authenticated Encryption Cipher ;TI"Pmodes (GCM for example). This tag may be stored along with the ciphertext, ;TI"Kthen set on the decryption cipher to authenticate the contents of the ;TI"Pciphertext against changes. If the optional integer parameter _tag_len_ is ;TI"Ogiven, the returned tag will be _tag_len_ bytes long. If the parameter is ;TI"Momitted, the default length of 16 bytes or the length previously set by ;TI"M#auth_tag_len= will be used. For maximum security, the longest possible ;TI"should be chosen.;To:RDoc::Markup::BlankLineo; ; [I">The tag may only be retrieved after calling Cipher#final.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"-cipher.auth_tag(tag_len = 16) -> String ;T0[I"(p1 = v1);T@FI" Cipher;TcRDoc::NormalClass00PKI ]BECipher/decrypt-i.rinu[U:RDoc::AnyMethod[iI" decrypt:ETI"OpenSSL::Cipher#decrypt;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"+Initializes the Cipher for decryption.;To:RDoc::Markup::BlankLineo; ; [I"PMake sure to call Cipher#encrypt or Cipher#decrypt before using any of the ;TI"following methods:;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; : LABEL;[o;;[I":#key=, #iv=, #random_key, #random_iv, #pkcs5_keyivgen;T; [@o; ; [I"HInternally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 0).;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"cipher.decrypt -> self ;T0[I" (*args);T@ FI" Cipher;TcRDoc::NormalClass00PKI ]RCipher/pkcs5_keyivgen-i.rinu[U:RDoc::AnyMethod[iI"pkcs5_keyivgen:ETI"#OpenSSL::Cipher#pkcs5_keyivgen;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"7Generates and sets the key/IV based on a password.;To:RDoc::Markup::BlankLineo; ; [ I"Q*WARNING*: This method is only PKCS5 v1.5 compliant when using RC2, RC4-40, ;TI"Oor DES with MD5 or SHA1. Using anything else (like AES) will generate the ;TI"Lkey/iv using an OpenSSL specific method. This method is deprecated and ;TI"Ishould no longer be used. Use a PKCS5 v2 key generation method from ;TI"OpenSSL::PKCS5 instead.;T@S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"1_salt_ must be an 8 byte string if provided.;To;;0; [o; ; [I"7_iterations_ is an integer with a default of 2048.;To;;0; [o; ; [I"7_digest_ is a Digest object that defaults to 'MD5';T@o; ; [I"1A minimum of 1000 iterations is recommended.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"Wcipher.pkcs5_keyivgen(pass, salt = nil, iterations = 2048, digest = "MD5") -> nil ;T0[I"$(p1, p2 = v2, p3 = v3, p4 = v4);T@,FI" Cipher;TcRDoc::NormalClass00PKI ],9u'Cipher/CipherError/cdesc-CipherError.rinu[U:RDoc::NormalClass[iI"CipherError:ETI"!OpenSSL::Cipher::CipherError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_cipher.c;TI"OpenSSL::Cipher;TcRDoc::NormalClassPKI ] Cipher/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::Cipher::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DThe string must contain a valid cipher name like "aes-256-cbc".;To:RDoc::Markup::BlankLineo; ; [I"LA list of cipher names is available by calling OpenSSL::Cipher.ciphers.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I""Cipher.new(string) -> cipher ;T0[I" (p1);T@FI" Cipher;TcRDoc::NormalClass00PKI ]rCipher/update-i.rinu[U:RDoc::AnyMethod[iI" update:ETI"OpenSSL::Cipher#update;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"KEncrypts data in a streaming fashion. Hand consecutive blocks of data ;TI"Ito the #update method in order to encrypt it. Returns the encrypted ;TI"Ndata chunk. When done, the output of Cipher#final should be additionally ;TI"added to the result.;To:RDoc::Markup::BlankLineo; ; [I"OIf _buffer_ is given, the encryption/decryption result will be written to ;TI"0it. _buffer_ will be resized automatically.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"8cipher.update(data [, buffer]) -> string or buffer ;T0[I"(p1, p2 = v2);T@FI" Cipher;TcRDoc::NormalClass00PKI ]f  Cipher/iv_len%3d-i.rinu[U:RDoc::AnyMethod[iI" iv_len=:ETI"OpenSSL::Cipher#iv_len=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PSets the IV/nonce length of the Cipher. Normally block ciphers don't allow ;TI"Ochanging the IV length, but some make use of IV for 'nonce'. You may need ;TI"7this for interoperability with other applications.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"(cipher.iv_len = integer -> integer ;T0[I" (p1);T@FI" Cipher;TcRDoc::NormalClass00PKI ]<%||Cipher/iv_len-i.rinu[U:RDoc::AnyMethod[iI" iv_len:ETI"OpenSSL::Cipher#iv_len;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DReturns the expected length in bytes for an IV for this Cipher.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"cipher.iv_len -> integer ;T0[I"();T@FI" Cipher;TcRDoc::NormalClass00PKI ]K4Cipher/auth_tag_len%3d-i.rinu[U:RDoc::AnyMethod[iI"auth_tag_len=:ETI""OpenSSL::Cipher#auth_tag_len=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RSets the length of the authentication tag to be generated or to be given for ;TI"QAEAD ciphers that requires it as in input parameter. Note that not all AEAD ;TI"!ciphers support this method.;To:RDoc::Markup::BlankLineo; ; [I"LIn OCB mode, the length must be supplied both when encrypting and when ;TI"5decrypting, and must be before specifying an IV.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I".cipher.auth_tag_len = Integer -> Integer ;T0[I" (p1);T@FI" Cipher;TcRDoc::NormalClass00PKI ]!ςCipher/Cipher/cdesc-Cipher.rinu[U:RDoc::NormalClass[iI" Cipher:ETI"OpenSSL::Cipher::Cipher;TI"OpenSSL::Cipher;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"Deprecated.;To:RDoc::Markup::BlankLineo; ;[I">This class is only provided for backwards compatibility. ;TI"Use OpenSSL::Cipher.;T: @fileI"&ext/openssl/lib/openssl/cipher.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[;[[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"&ext/openssl/lib/openssl/cipher.rb;TI"OpenSSL::Cipher;TcRDoc::NormalClassPKI ])uCipher/auth_data%3d-i.rinu[U:RDoc::AnyMethod[iI"auth_data=:ETI"OpenSSL::Cipher#auth_data=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"ISets the cipher's additional authenticated data. This field must be ;TI"Kset when using AEAD cipher modes such as GCM or CCM. If no associated ;TI"Pdata shall be used, this method must *still* be called with a value of "". ;TI"KThe contents of this field should be non-sensitive data which will be ;TI"Padded to the ciphertext to generate the authentication tag which validates ;TI"$the contents of the ciphertext.;To:RDoc::Markup::BlankLineo; ; [ I"PThe AAD must be set prior to encryption or decryption. In encryption mode, ;TI"Mit must be set after calling Cipher#encrypt and setting Cipher#key= and ;TI"PCipher#iv=. When decrypting, the authenticated data must be set after key, ;TI"Piv and especially *after* the authentication tag has been set. I.e. set it ;TI"Donly after calling Cipher#decrypt, Cipher#key=, Cipher#iv= and ;TI"Cipher#auth_tag= first.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I")cipher.auth_data = string -> string ;T0[I" (p1);T@FI" Cipher;TcRDoc::NormalClass00PKI ]|ȖCipher/name-i.rinu[U:RDoc::AnyMethod[iI" name:ETI"OpenSSL::Cipher#name;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PReturns the name of the cipher which may differ slightly from the original ;TI"name provided.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"cipher.name -> string ;T0[I"();T@FI" Cipher;TcRDoc::NormalClass00PKI ]eannCipher/key_len-i.rinu[U:RDoc::AnyMethod[iI" key_len:ETI"OpenSSL::Cipher#key_len;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"3Returns the key length in bytes of the Cipher.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"cipher.key_len -> integer ;T0[I"();T@FI" Cipher;TcRDoc::NormalClass00PKI ]w4Cipher/key_len%3d-i.rinu[U:RDoc::AnyMethod[iI" key_len=:ETI"OpenSSL::Cipher#key_len=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"PSets the key length of the cipher. If the cipher is a fixed length cipher ;TI"Mthen attempting to set the key length to any value other than the fixed ;TI"value is an error.;To:RDoc::Markup::BlankLineo; ; [I"]Under normal circumstances you do not need to call this method (and probably shouldn't).;T@o; ; [I"?See EVP_CIPHER_CTX_set_key_length for further information.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I")cipher.key_len = integer -> integer ;T0[I" (p1);T@FI" Cipher;TcRDoc::NormalClass00PKI ]⢠&&Cipher/cdesc-Cipher.rinu[U:RDoc::NormalClass[iI" Cipher:ETI"OpenSSL::Cipher;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"&ext/openssl/lib/openssl/cipher.rb;T:0@omit_headings_from_table_of_contents_below0o;;[Mo:RDoc::Markup::Paragraph;[I"FProvides symmetric algorithms for encryption and decryption. The ;TI"Dalgorithms that are available depend on the particular version ;TI""of OpenSSL that is installed.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"%Listing all supported algorithms;T@o; ;[I"6A list of supported algorithms can be obtained by;T@o:RDoc::Markup::Verbatim;[I""puts OpenSSL::Cipher.ciphers ;T: @format0S; ;i;I"Instantiating a Cipher;T@o; ;[ I"FThere are several ways to create a Cipher instance. Generally, a ;TI"ICipher algorithm is categorized by its name, the key length in bits ;TI"Fand the cipher mode to be used. The most generic way to create a ;TI"Cipher is the following;T@o;;[I"@cipher = OpenSSL::Cipher.new('--') ;T;0o; ;[I"IThat is, a string consisting of the hyphenated concatenation of the ;TI"Kindividual components name, key length and mode. Either all uppercase ;TI"7or all lowercase strings may be used, for example:;T@o;;[I"1cipher = OpenSSL::Cipher.new('aes-128-cbc') ;T;0S; ;i;I"2Choosing either encryption or decryption mode;T@o; ;[ I"EEncryption and decryption are often very similar operations for ;TI"Esymmetric algorithms, this is reflected by not having to choose ;TI"Hdifferent classes for either operation, both can be done using the ;TI"Fsame class. Still, after obtaining a Cipher instance, we need to ;TI"Ftell the instance what it is that we intend to do with it, so we ;TI"need to call either;T@o;;[I"cipher.encrypt ;T;0o; ;[I"or;T@o;;[I"cipher.decrypt ;T;0o; ;[I"Jon the Cipher instance. This should be the first call after creating ;TI"Kthe instance, otherwise configuration that has already been set could ;TI"get lost in the process.;T@S; ;i;I"Choosing a key;T@o; ;[ I"MSymmetric encryption requires a key that is the same for the encrypting ;TI"Mand for the decrypting party and after initial key establishment should ;TI"Gbe kept as private information. There are a lot of ways to create ;TI"Minsecure keys, the most notable is to simply take a password as the key ;TI"Iwithout processing the password further. A simple and secure way to ;TI",create a key for a particular Cipher is;T@o;;[I"1cipher = OpenSSL::Cipher.new('aes-256-cfb') ;TI"cipher.encrypt ;TI"Ikey = cipher.random_key # also sets the generated key on the Cipher ;T;0o; ;[ I"EIf you absolutely need to use passwords as encryption keys, you ;TI"Eshould use Password-Based Key Derivation Function 2 (PBKDF2) by ;TI"Ggenerating the key with the help of the functionality provided by ;TI"COpenSSL::PKCS5.pbkdf2_hmac_sha1 or OpenSSL::PKCS5.pbkdf2_hmac.;T@o; ;[I"HAlthough there is Cipher#pkcs5_keyivgen, its use is deprecated and ;TI"Kit should only be used in legacy applications because it does not use ;TI"$the newer PKCS#5 v2 algorithms.;T@S; ;i;I"Choosing an IV;T@o; ;[ I"HThe cipher modes CBC, CFB, OFB and CTR all need an "initialization ;TI"Lvector", or short, IV. ECB mode is the only mode that does not require ;TI"Ean IV, but there is almost no legitimate use case for this mode ;TI"Fbecause of the fact that it does not sufficiently hide plaintext ;TI"patterns. Therefore;T@o; ;[I"JYou should never use ECB mode unless you are absolutely sure that ;TI"you absolutely need it;T@o; ;[ I"KBecause of this, you will end up with a mode that explicitly requires ;TI"Kan IV in any case. Although the IV can be seen as public information, ;TI"Ji.e. it may be transmitted in public once generated, it should still ;TI"Hstay unpredictable to prevent certain kinds of attacks. Therefore, ;TI" ideally;T@o; ;[I"FAlways create a secure random IV for every encryption of your ;TI"Cipher;T@o; ;[I"LA new, random IV should be created for every encryption of data. Think ;TI"Jof the IV as a nonce (number used once) - it's public but random and ;TI"@unpredictable. A secure random IV can be created as follows;T@o;;[ I"cipher = ... ;TI"cipher.encrypt ;TI"key = cipher.random_key ;TI"Fiv = cipher.random_iv # also sets the generated IV on the Cipher ;T;0o; ;[ I"KAlthough the key is generally a random value, too, it is a bad choice ;TI"Kas an IV. There are elaborate ways how an attacker can take advantage ;TI"Jof such an IV. As a general rule of thumb, exposing the key directly ;TI"Hor indirectly should be avoided at all cost and exceptions only be ;TI"made with good reason.;T@S; ;i;I"Calling Cipher#final;T@o; ;[ I"HECB (which should not be used) and CBC are both block-based modes. ;TI"FThis means that unlike for the other streaming-based modes, they ;TI"Hoperate on fixed-size blocks of data, and therefore they require a ;TI"K"finalization" step to produce or correctly decrypt the last block of ;TI"Jdata by appropriately handling some form of padding. Therefore it is ;TI"Bessential to add the output of OpenSSL::Cipher#final to your ;TI"Lencryption/decryption buffer or you will end up with decryption errors ;TI"or truncated data.;T@o; ;[ I"MAlthough this is not really necessary for streaming-mode ciphers, it is ;TI"Istill recommended to apply the same pattern of adding the output of ;TI"HCipher#final there as well - it also enables you to switch between ;TI"%modes more easily in the future.;T@S; ;i;I"(Encrypting and decrypting some data;T@o;;[I"+data = "Very, very confidential data" ;TI" ;TI"1cipher = OpenSSL::Cipher.new('aes-128-cbc') ;TI"cipher.encrypt ;TI"key = cipher.random_key ;TI"iv = cipher.random_iv ;TI" ;TI"4encrypted = cipher.update(data) + cipher.final ;TI" ... ;TI"3decipher = OpenSSL::Cipher.new('aes-128-cbc') ;TI"decipher.decrypt ;TI"decipher.key = key ;TI"decipher.iv = iv ;TI" ;TI"9plain = decipher.update(encrypted) + decipher.final ;TI" ;TI"!puts data == plain #=> true ;T;0S; ;i;I"8Authenticated Encryption and Associated Data (AEAD);T@o; ;[ I"JIf the OpenSSL version used supports it, an Authenticated Encryption ;TI"Cmode (such as GCM or CCM) should always be preferred over any ;TI"Nunauthenticated mode. Currently, OpenSSL supports AE only in combination ;TI"Nwith Associated Data (AEAD) where additional associated data is included ;TI"Nin the encryption process to compute a tag at the end of the encryption. ;TI"KThis tag will also be used in the decryption process and by verifying ;TI"Iits validity, the authenticity of a given ciphertext is established.;T@o; ;[ I"KThis is superior to unauthenticated modes in that it allows to detect ;TI"Fif somebody effectively changed the ciphertext after it had been ;TI"Mencrypted. This prevents malicious modifications of the ciphertext that ;TI"Ncould otherwise be exploited to modify ciphertexts in ways beneficial to ;TI"potential attackers.;T@o; ;[ I"OAn associated data is used where there is additional information, such as ;TI"Gheaders or some metadata, that must be also authenticated but not ;TI"Knecessarily need to be encrypted. If no associated data is needed for ;TI"Kencryption and later decryption, the OpenSSL library still requires a ;TI"@value to be set - "" may be used in case none is available.;T@o; ;[ I"NAn example using the GCM (Galois/Counter Mode). You have 16 bytes _key_, ;TI"M12 bytes (96 bits) _nonce_ and the associated data _auth_data_. Be sure ;TI"Inot to reuse the _key_ and _nonce_ pair. Reusing an nonce ruins the ;TI"%security guarantees of GCM mode.;T@o;;[ I"9cipher = OpenSSL::Cipher.new('aes-128-gcm').encrypt ;TI"cipher.key = key ;TI"cipher.iv = nonce ;TI""cipher.auth_data = auth_data ;TI" ;TI"4encrypted = cipher.update(data) + cipher.final ;TI">tag = cipher.auth_tag # produces 16 bytes tag by default ;T;0o; ;[ I"MNow you are the receiver. You know the _key_ and have received _nonce_, ;TI"K_auth_data_, _encrypted_ and _tag_ through an untrusted network. Note ;TI"Nthat GCM accepts an arbitrary length tag between 1 and 16 bytes. You may ;TI"Nadditionally need to check that the received tag has the correct length, ;TI"Nor you allow attackers to forge a valid single byte tag for the tampered ;TI",ciphertext with a probability of 1/256.;T@o;;[I"9raise "tag is truncated!" unless tag.bytesize == 16 ;TI";decipher = OpenSSL::Cipher.new('aes-128-gcm').decrypt ;TI"decipher.key = key ;TI"decipher.iv = nonce ;TI"decipher.auth_tag = tag ;TI"$decipher.auth_data = auth_data ;TI" ;TI"=decrypted = decipher.update(encrypted) + decipher.final ;TI" ;TI"$puts data == decrypted #=> true;T;0; I"ext/openssl/ossl_cipher.c;T; 0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" ciphers;TI"ext/openssl/ossl_cipher.c;T[I"new;T@[I" instance;T[[;[[;[[;[[I"auth_data=;T@[I" auth_tag;T@[I"auth_tag=;T@[I"auth_tag_len=;T@[I"authenticated?;T@[I"block_size;T@[I"ccm_data_len=;T@[I" decrypt;T@[I" encrypt;T@[I" final;T@[I"initialize_copy;T@[I"iv=;T@[I" iv_len;T@[I" iv_len=;T@[I" key=;T@[I" key_len;T@[I" key_len=;T@[I" name;T@[I" padding=;T@[I"pkcs5_keyivgen;T@[I"random_iv;TI"&ext/openssl/lib/openssl/cipher.rb;T[I"random_key;T@2[I" reset;T@[I" update;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"&ext/openssl/lib/openssl/cipher.rb;TI"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]Cipher/encrypt-i.rinu[U:RDoc::AnyMethod[iI" encrypt:ETI"OpenSSL::Cipher#encrypt;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"+Initializes the Cipher for encryption.;To:RDoc::Markup::BlankLineo; ; [I"PMake sure to call Cipher#encrypt or Cipher#decrypt before using any of the ;TI"following methods:;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; : LABEL;[o;;[I":#key=, #iv=, #random_key, #random_iv, #pkcs5_keyivgen;T; [@o; ; [I"HInternally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, 1).;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"cipher.encrypt -> self ;T0[I" (*args);T@ FI" Cipher;TcRDoc::NormalClass00PKI ] ϊCipher/ciphers-c.rinu[U:RDoc::AnyMethod[iI" ciphers:ETI"OpenSSL::Cipher::ciphers;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I" array[string...] ;T0[I"();T@FI" Cipher;TcRDoc::NormalClass00PKI ]  Cipher/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"$OpenSSL::Cipher#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Cipher;TcRDoc::NormalClass00PKI ]G Cipher/random_key-i.rinu[U:RDoc::AnyMethod[iI"random_key:ETI"OpenSSL::Cipher#random_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LGenerate a random key with OpenSSL::Random.random_bytes and sets it to ;TI" the cipher, and returns it.;To:RDoc::Markup::BlankLineo; ; [I"CYou must call #encrypt or #decrypt before calling this method.;T: @fileI"&ext/openssl/lib/openssl/cipher.rb;T:0@omit_headings_from_table_of_contents_below0I"cipher.random_key -> key ;T0[I"();T@FI" Cipher;TcRDoc::NormalClass00PKI ]U/55Cipher/auth_tag%3d-i.rinu[U:RDoc::AnyMethod[iI"auth_tag=:ETI"OpenSSL::Cipher#auth_tag=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"LSets the authentication tag to verify the integrity of the ciphertext. ;TI"NThis can be called only when the cipher supports AE. The tag must be set ;TI"Jafter calling Cipher#decrypt, Cipher#key= and Cipher#iv=, but before ;TI"Icalling Cipher#final. After all decryption is performed, the tag is ;TI"8verified automatically in the call to Cipher#final.;To:RDoc::Markup::BlankLineo; ; [I"GFor OCB mode, the tag length must be supplied with #auth_tag_len= ;TI"beforehand.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"(cipher.auth_tag = string -> string ;T0[I" (p1);T@FI" Cipher;TcRDoc::NormalClass00PKI ]JCipher/authenticated%3f-i.rinu[U:RDoc::AnyMethod[iI"authenticated?:ETI"#OpenSSL::Cipher#authenticated?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MIndicated whether this Cipher instance uses an Authenticated Encryption ;TI" mode.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"+cipher.authenticated? -> true | false ;T0[I"();T@FI" Cipher;TcRDoc::NormalClass00PKI ]UH?Cipher/final-i.rinu[U:RDoc::AnyMethod[iI" final:ETI"OpenSSL::Cipher#final;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"LReturns the remaining data held in the cipher object. Further calls to ;TI"PCipher#update or Cipher#final will return garbage. This call should always ;TI"Nbe made as the last call of an encryption or decryption operation, after ;TI"Jhaving fed the entire plaintext or ciphertext to the Cipher instance.;To:RDoc::Markup::BlankLineo; ; [ I"MIf an authenticated cipher was used, a CipherError is raised if the tag ;TI"Jcould not be authenticated successfully. Only call this method after ;TI"Ksetting the authentication tag and passing the entire contents of the ;TI" ciphertext into the cipher.;T: @fileI"ext/openssl/ossl_cipher.c;T:0@omit_headings_from_table_of_contents_below0I"cipher.final -> string ;T0[I"();T@FI" Cipher;TcRDoc::NormalClass00PKI ]VCipher/padding%3d-i.rinu[U:RDoc::AnyMethod[iI" padding=:ETI"OpenSSL::Cipher#padding=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"sEnables or disables padding. By default encryption operations are padded using standard block padding and the ;TI"tpadding is checked and removed when decrypting. If the pad parameter is zero then no padding is performed, the ;TI"rtotal amount of data encrypted or decrypted must then be a multiple of the block size or an error will occur.;To:RDoc::Markup::BlankLineo; ; [I" integer ;T0[I" (p1);T@FI" Cipher;TcRDoc::NormalClass00PKI ]&6aHMACError/cdesc-HMACError.rinu[U:RDoc::NormalClass[iI"HMACError:ETI"OpenSSL::HMACError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I""Document-class: OpenSSL::HMAC;To:RDoc::Markup::BlankLineo; ;[ I"KOpenSSL::HMAC allows computing Hash-based Message Authentication Code ;TI"K(HMAC). It is a type of message authentication code (MAC) involving a ;TI"Mhash function in combination with a key. HMAC can be used to verify the ;TI"8integrity of a message as well as the authenticity.;T@o; ;[I">OpenSSL::HMAC has a similar interface to OpenSSL::Digest.;T@S:RDoc::Markup::Heading: leveli: textI")HMAC-SHA256 using one-shot interface;T@o:RDoc::Markup::Verbatim;[ I"key = "key" ;TI"*data = "message-to-be-authenticated" ;TI"8mac = OpenSSL::HMAC.hexdigest("SHA256", key, data) ;TI"L#=> "cddb0db23f469c8bf072b21fd837149bd6ace9ab771cceef14c9e517cc93282e" ;T: @format0S; ; i; I",HMAC-SHA256 using incremental interface;T@o;;[ I"#data1 = File.binread("file1") ;TI"#data2 = File.binread("file2") ;TI"key = "key" ;TI"-hmac = OpenSSL::HMAC.new(key, 'SHA256') ;TI"hmac << data1 ;TI"hmac << data2 ;TI"mac = hmac.digest;T;0: @fileI"ext/openssl/ossl_hmac.c;T:0@omit_headings_from_table_of_contents_below0;0;0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[;[[;[[;[[[U:RDoc::Context::Section[i0o;;[;0;0[I"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]lKȤConfig/inspect-i.rinu[U:RDoc::AnyMethod[iI" inspect:ETI"OpenSSL::Config#inspect;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MString representation of this configuration object, including the class ;TI"name and its sections.;T: @fileI"ext/openssl/ossl_config.c;T:0@omit_headings_from_table_of_contents_below0I"config.inspect -> string ;T0[I"();T@FI" Config;TcRDoc::NormalClass00PKI ]:CConfig/cdesc-Config.rinu[U:RDoc::NormalClass[iI" Config:ETI"OpenSSL::Config;TI" Object;To:RDoc::Markup::Document: @parts[o;;[ o:RDoc::Markup::Paragraph;[I"+Configuration for the openssl library.;To:RDoc::Markup::BlankLineo; ;[I"NMany system's installation of openssl library will depend on your system ;TI"Nconfiguration. See the value of OpenSSL::Config::DEFAULT_CONFIG_FILE for ;TI",the location of the file for your host.;T@o; ;[I":See also http://www.openssl.org/docs/apps/config.html;T: @fileI"ext/openssl/ossl_config.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[U:RDoc::Constant[iI"DEFAULT_CONFIG_FILE;TI")OpenSSL::Config::DEFAULT_CONFIG_FILE;T: public0o;;[o; ;[I"7The default system configuration file for OpenSSL.;T; @; 0@@cRDoc::NormalClass0[[I"Enumerable;To;;[; @; 0I"ext/openssl/ossl_config.c;T[[I" class;T[[;[[:protected[[: private[[I"new;T@,[I" parse;T@,[I"parse_config;T@,[I" instance;T[[;[[;[[;[ [I"[];T@,[I" each;T@,[I"get_value;T@,[I"initialize_copy;T@,[I" inspect;T@,[I" sections;T@,[I" to_s;T@,[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]}ZMEConfig/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::Config::new;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"ICreates an instance of OpenSSL::Config from the content of the file ;TI"specified by _filename_.;To:RDoc::Markup::BlankLineo; ; [I"NThis can be used in contexts like OpenSSL::X509::ExtensionFactory.config=;T@o; ; [I"NThis can raise IO exceptions based on the access, or availability of the ;TI"Nfile. A ConfigError exception may be raised depending on the validity of ;TI"the data being configured.;T: @fileI"ext/openssl/ossl_config.c;T:0@omit_headings_from_table_of_contents_below0I"-Config.new(filename) -> OpenSSL::Config ;T0[I"(p1 = v1);T@FI" Config;TcRDoc::NormalClass00PKI ]O੗Config/parse-c.rinu[U:RDoc::AnyMethod[iI" parse:ETI"OpenSSL::Config::parse;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OParses a given _string_ as a blob that contains configuration for OpenSSL.;T: @fileI"ext/openssl/ossl_config.c;T:0@omit_headings_from_table_of_contents_below0I"-Config.parse(string) -> OpenSSL::Config ;T0[I" (p1);T@FI" Config;TcRDoc::NormalClass00PKI ]*IConfig/sections-i.rinu[U:RDoc::AnyMethod[iI" sections:ETI"OpenSSL::Config#sections;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"@Get the names of all sections in the current configuration.;T: @fileI"ext/openssl/ossl_config.c;T:0@omit_headings_from_table_of_contents_below0I"(config.sections -> array of string ;T0[I"();T@FI" Config;TcRDoc::NormalClass00PKI ]ՃCCConfig/%5b%5d-i.rinu[U:RDoc::AnyMethod[iI"[]:ETI"OpenSSL::Config#[];TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"GGets all key-value pairs in a specific _section_ from the current ;TI"configuration.;To:RDoc::Markup::BlankLineo; ; [I"9Given the following configurating file being loaded:;T@o:RDoc::Markup::Verbatim; [ I".config = OpenSSL::Config.load('foo.cnf') ;TI"3 #=> # ;TI"puts config.to_s ;TI" #=> [ default ] ;TI" # foo=bar ;T: @format0o; ; [I"8You can get a hash of the specific section like so:;T@o; ; [I"config['default'] ;TI" #=> {"foo"=>"bar"};T; 0: @fileI"ext/openssl/ossl_config.c;T:0@omit_headings_from_table_of_contents_below0I"config[section] -> hash ;T0[I" (p1);T@!FI" Config;TcRDoc::NormalClass00PKI ]}\yyConfig/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI"OpenSSL::Config#to_s;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"9Gets the parsable form of the current configuration.;To:RDoc::Markup::BlankLineo; ; [I"5Given the following configuration being created:;T@o:RDoc::Markup::Verbatim; [ I""config = OpenSSL::Config.new ;TI"* #=> # ;TI"5config['default'] = {"foo"=>"bar","baz"=>"buz"} ;TI"( #=> {"foo"=>"bar", "baz"=>"buz"} ;TI"puts config.to_s ;TI" #=> [ default ] ;TI" # foo=bar ;TI" # baz=buz ;T: @format0o; ; [I"OYou can parse get the serialized configuration using #to_s and then parse ;TI"it later:;T@o; ; [ I"%serialized_config = config.to_s ;TI"# much later... ;TI";new_config = OpenSSL::Config.parse(serialized_config) ;TI"3 #=> # ;TI"puts new_config ;TI" #=> [ default ] ;TI" foo=bar ;TI" baz=buz;T; 0: @fileI"ext/openssl/ossl_config.c;T:0@omit_headings_from_table_of_contents_below0I"config.to_s -> string ;T0[I"();T@*FI" Config;TcRDoc::NormalClass00PKI ]pOConfig/parse_config-c.rinu[U:RDoc::AnyMethod[iI"parse_config:ETI""OpenSSL::Config::parse_config;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PParses the configuration data read from _io_ and returns the whole content ;TI"as a Hash.;T: @fileI"ext/openssl/ossl_config.c;T:0@omit_headings_from_table_of_contents_below0I"%Config.parse_config(io) -> hash ;T0[I" (p1);T@FI" Config;TcRDoc::NormalClass00PKI ]A.ttConfig/get_value-i.rinu[U:RDoc::AnyMethod[iI"get_value:ETI"OpenSSL::Config#get_value;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"6Gets the value of _key_ from the given _section_.;To:RDoc::Markup::BlankLineo; ; [I"9Given the following configurating file being loaded:;T@o:RDoc::Markup::Verbatim; [ I".config = OpenSSL::Config.load('foo.cnf') ;TI"3 #=> # ;TI"puts config.to_s ;TI" #=> [ default ] ;TI" # foo=bar ;T: @format0o; ; [I"LYou can get a specific value from the config if you know the _section_ ;TI"and _key_ like so:;T@o; ; [I"'config.get_value('default','foo') ;TI" #=> "bar";T; 0: @fileI"ext/openssl/ossl_config.c;T:0@omit_headings_from_table_of_contents_below0I".config.get_value(section, key) -> string ;T0[I" (p1, p2);T@!FI" Config;TcRDoc::NormalClass00PKI ]O\Config/each-i.rinu[U:RDoc::AnyMethod[iI" each:ETI"OpenSSL::Config#each;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GRetrieves the section and its pairs for the current configuration.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"*config.each do |section, key, value| ;TI" # ... ;TI"end;T: @format0: @fileI"ext/openssl/ossl_config.c;T:0@omit_headings_from_table_of_contents_below0I"+config.each { |section, key, value| } ;T0[I"();T@FI" Config;TcRDoc::NormalClass00PKI ]nEP  Config/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"$OpenSSL::Config#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_config.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Config;TcRDoc::NormalClass00PKI ] 0%$PKCS7/PKCS7Error/cdesc-PKCS7Error.rinu[U:RDoc::NormalClass[iI"PKCS7Error:ETI"OpenSSL::PKCS7::PKCS7Error;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_pkcs7.c;TI"OpenSSL::PKCS7;TcRDoc::NormalClassPKI ]a<PKCS7/add_signer-i.rinu[U:RDoc::AnyMethod[iI"add_signer:ETI"OpenSSL::PKCS7#add_signer;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]_#PKCS7/detached-i.rinu[U:RDoc::AnyMethod[iI" detached:ETI"OpenSSL::PKCS7#detached;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]U\PKCS7/data-i.rinu[U:RDoc::Attr[iI" data:ETI"OpenSSL::PKCS7#data;TI"R;T: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0F@ I"OpenSSL::PKCS7;TcRDoc::NormalClass0PKI ]  PKCS7/decrypt-i.rinu[U:RDoc::AnyMethod[iI" decrypt:ETI"OpenSSL::PKCS7#decrypt;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"(p1, p2 = v2, p3 = v3);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]  PKCS7/add_certificate-i.rinu[U:RDoc::AnyMethod[iI"add_certificate:ETI"#OpenSSL::PKCS7#add_certificate;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]Y@PKCS7/signers-i.rinu[U:RDoc::AnyMethod[iI" signers:ETI"OpenSSL::PKCS7#signers;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]Rm(PKCS7/type-i.rinu[U:RDoc::AnyMethod[iI" type:ETI"OpenSSL::PKCS7#type;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0I" pkcs7.type => string or nil;T0[I"();T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]tM~~PKCS7/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::PKCS7::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"2Many methods in this class aren't documented.;T: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0I"3PKCS7.new => pkcs7 PKCS7.new(string) => pkcs7 ;T0[I"(p1 = v1);T@FI" PKCS7;TcRDoc::NormalClass00PKI ]5OOPKCS7/encrypt-c.rinu[U:RDoc::AnyMethod[iI" encrypt:ETI"OpenSSL::PKCS7::encrypt;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0I">PKCS7.encrypt(certs, data, [, cipher [, flags]]) => pkcs7;T0[I"(p1, p2, p3 = v3, p4 = v4);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]FӉPKCS7/cdesc-PKCS7.rinu[U:RDoc::NormalClass[iI" PKCS7:ETI"OpenSSL::PKCS7;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[ I" data;TI"R;T: privateFI"ext/openssl/ossl_pkcs7.c;T[ I"error_string;TI"RW;T; F@[U:RDoc::Constant[iI" Signer;TI"OpenSSL::PKCS7::Signer;T: public0o;;[; @; 0@@cRDoc::NormalClass0[[[I" class;T[[; [[:protected[[; [ [I" encrypt;T@[I"new;T@[I"read_smime;T@[I" sign;T@[I"write_smime;T@[I" instance;T[[; [[;[[; [[I"add_certificate;T@[I" add_crl;T@[I" add_data;T@[I"add_recipient;T@[I"add_signer;T@[I"certificates;T@[I"certificates=;T@[I" cipher=;T@[I" crls;T@[I" crls=;T@[I" data=;T@[I" decrypt;T@[I" detached;T@[I"detached=;T@[I"detached?;T@[I"initialize_copy;T@[I"recipients;T@[I" signers;T@[I" to_der;T@[I" to_pem;T@[I" to_s;T@[I" type;T@[I" type=;T@[I" verify;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ] pPKCS7/detached%3d-i.rinu[U:RDoc::AnyMethod[iI"detached=:ETI"OpenSSL::PKCS7#detached=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]2t  PKCS7/add_data-i.rinu[U:RDoc::AnyMethod[iI" add_data:ETI"OpenSSL::PKCS7#add_data;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[[I" data=;T@ I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]L$0PKCS7/crls-i.rinu[U:RDoc::AnyMethod[iI" crls:ETI"OpenSSL::PKCS7#crls;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]WPKCS7/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI"OpenSSL::PKCS7#to_s;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" PKCS7;TcRDoc::NormalClass0[I"OpenSSL::PKCS7;TFI" to_pem;TPKI ]+PKCS7/error_string-i.rinu[U:RDoc::Attr[iI"error_string:ETI" OpenSSL::PKCS7#error_string;TI"RW;T: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0F@ I"OpenSSL::PKCS7;TcRDoc::NormalClass0PKI ]47PKCS7/to_pem-i.rinu[U:RDoc::AnyMethod[iI" to_pem:ETI"OpenSSL::PKCS7#to_pem;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[[I" to_s;T@ I"();T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]>#YPKCS7/data%3d-i.rinu[U:RDoc::AnyMethod[iI" data=:ETI"OpenSSL::PKCS7#data=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass0[I"OpenSSL::PKCS7;TFI" add_data;TPKI ]nLPKCS7/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"OpenSSL::PKCS7#to_der;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]1f6PKCS7/certificates%3d-i.rinu[U:RDoc::AnyMethod[iI"certificates=:ETI"!OpenSSL::PKCS7#certificates=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]PKCS7/crls%3d-i.rinu[U:RDoc::AnyMethod[iI" crls=:ETI"OpenSSL::PKCS7#crls=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]PKCS7/recipients-i.rinu[U:RDoc::AnyMethod[iI"recipients:ETI"OpenSSL::PKCS7#recipients;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]}3PKCS7/add_recipient-i.rinu[U:RDoc::AnyMethod[iI"add_recipient:ETI"!OpenSSL::PKCS7#add_recipient;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]o8  PKCS7/SignerInfo/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"$OpenSSL::PKCS7::SignerInfo::new;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"(p1, p2, p3);T@ FI"SignerInfo;TcRDoc::NormalClass00PKI ]1GbPKCS7/SignerInfo/issuer-i.rinu[U:RDoc::AnyMethod[iI" issuer:ETI"&OpenSSL::PKCS7::SignerInfo#issuer;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"SignerInfo;TcRDoc::NormalClass00PKI ]-j!!$PKCS7/SignerInfo/cdesc-SignerInfo.rinu[U:RDoc::NormalClass[iI"SignerInfo:ETI"OpenSSL::PKCS7::SignerInfo;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_pkcs7.c;T[I" instance;T[[; [[; [[; [[I" issuer;T@[I" serial;T@[I"signed_time;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_pkcs7.c;TI"OpenSSL::PKCS7;TcRDoc::NormalClassPKI ]"t!PKCS7/SignerInfo/signed_time-i.rinu[U:RDoc::AnyMethod[iI"signed_time:ETI"+OpenSSL::PKCS7::SignerInfo#signed_time;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"SignerInfo;TcRDoc::NormalClass00PKI ]7PKCS7/SignerInfo/serial-i.rinu[U:RDoc::AnyMethod[iI" serial:ETI"&OpenSSL::PKCS7::SignerInfo#serial;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"SignerInfo;TcRDoc::NormalClass00PKI ]AIPKCS7/type%3d-i.rinu[U:RDoc::AnyMethod[iI" type=:ETI"OpenSSL::PKCS7#type=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0I"pkcs7.type = type => type;T0[I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]]  PKCS7/verify-i.rinu[U:RDoc::AnyMethod[iI" verify:ETI"OpenSSL::PKCS7#verify;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"(p1, p2, p3 = v3, p4 = v4);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]C'!OOPKCS7/write_smime-c.rinu[U:RDoc::AnyMethod[iI"write_smime:ETI" OpenSSL::PKCS7::write_smime;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0I":PKCS7.write_smime(pkcs7 [, data [, flags]]) => string;T0[I"(p1, p2 = v2, p3 = v3);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]{GE\  PKCS7/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"#OpenSSL::PKCS7#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]n9  PKCS7/RecipientInfo/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"'OpenSSL::PKCS7::RecipientInfo::new;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"RecipientInfo;TcRDoc::NormalClass00PKI ]b  PKCS7/RecipientInfo/issuer-i.rinu[U:RDoc::AnyMethod[iI" issuer:ETI")OpenSSL::PKCS7::RecipientInfo#issuer;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"RecipientInfo;TcRDoc::NormalClass00PKI ]B  PKCS7/RecipientInfo/serial-i.rinu[U:RDoc::AnyMethod[iI" serial:ETI")OpenSSL::PKCS7::RecipientInfo#serial;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"RecipientInfo;TcRDoc::NormalClass00PKI ]H04##*PKCS7/RecipientInfo/cdesc-RecipientInfo.rinu[U:RDoc::NormalClass[iI"RecipientInfo:ETI""OpenSSL::PKCS7::RecipientInfo;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_pkcs7.c;T[I" instance;T[[; [[; [[; [[I" enc_key;T@[I" issuer;T@[I" serial;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_pkcs7.c;TI"OpenSSL::PKCS7;TcRDoc::NormalClassPKI ]_  PKCS7/RecipientInfo/enc_key-i.rinu[U:RDoc::AnyMethod[iI" enc_key:ETI"*OpenSSL::PKCS7::RecipientInfo#enc_key;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"RecipientInfo;TcRDoc::NormalClass00PKI ].HPKCS7/cipher%3d-i.rinu[U:RDoc::AnyMethod[iI" cipher=:ETI"OpenSSL::PKCS7#cipher=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]2PKCS7/certificates-i.rinu[U:RDoc::AnyMethod[iI"certificates:ETI" OpenSSL::PKCS7#certificates;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]Ә^PKCS7/detached%3f-i.rinu[U:RDoc::AnyMethod[iI"detached?:ETI"OpenSSL::PKCS7#detached?;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]ePKCS7/add_crl-i.rinu[U:RDoc::AnyMethod[iI" add_crl:ETI"OpenSSL::PKCS7#add_crl;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]nGMMPKCS7/sign-c.rinu[U:RDoc::AnyMethod[iI" sign:ETI"OpenSSL::PKCS7::sign;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0I">PKCS7.sign(cert, key, data, [, certs [, flags]]) => pkcs7;T0[I"#(p1, p2, p3, p4 = v4, p5 = v5);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]Mj''PKCS7/read_smime-c.rinu[U:RDoc::AnyMethod[iI"read_smime:ETI"OpenSSL::PKCS7::read_smime;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs7.c;T:0@omit_headings_from_table_of_contents_below0I"&PKCS7.read_smime(string) => pkcs7;T0[I" (p1);T@ FI" PKCS7;TcRDoc::NormalClass00PKI ]޺' Netscape/SPKI/public_key%3d-i.rinu[U:RDoc::AnyMethod[iI"public_key=:ETI"(OpenSSL::Netscape::SPKI#public_key=;TF: privateo:RDoc::Markup::Document: @parts[S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o:RDoc::Markup::Paragraph; [I"7_pub_ - the public key to be set for this instance;To:RDoc::Markup::BlankLineo;; [I"HSets the public key to be associated with the SPKI, an instance of ;TI"GOpenSSL::PKey. This should be the public key corresponding to the ;TI"+private key used for signing the SPKI.;T: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below0I"#spki.public_key = pub => pkey ;T0[I" (p1);T@FI" SPKI;TcRDoc::NormalClass00PKI ]c;Netscape/SPKI/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"!OpenSSL::Netscape::SPKI::new;TT: privateo:RDoc::Markup::Document: @parts[S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o:RDoc::Markup::Paragraph; [I"C_request_ - optional raw request, either in PEM or DER format.;T: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below0I"!SPKI.new([request]) => spki ;T0[I"(p1 = v1);T@FI" SPKI;TcRDoc::NormalClass00PKI ]ttNetscape/SPKI/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI"!OpenSSL::Netscape::SPKI#to_s;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"+Returns the PEM encoding of this SPKI.;T: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" SPKI;TcRDoc::NormalClass0[I"OpenSSL::Netscape::SPKI;TFI" to_pem;TPKI ]Q[PnNetscape/SPKI/challenge-i.rinu[U:RDoc::AnyMethod[iI"challenge:ETI"&OpenSSL::Netscape::SPKI#challenge;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I" string ;T0[I"();T@FI" SPKI;TcRDoc::NormalClass00PKI ]χ}Netscape/SPKI/public_key-i.rinu[U:RDoc::AnyMethod[iI"public_key:ETI"'OpenSSL::Netscape::SPKI#public_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"EReturns the public key associated with the SPKI, an instance of ;TI"OpenSSL::PKey.;T: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below0I"spki.public_key => pkey ;T0[I"();T@FI" SPKI;TcRDoc::NormalClass00PKI ] Netscape/SPKI/to_pem-i.rinu[U:RDoc::AnyMethod[iI" to_pem:ETI"#OpenSSL::Netscape::SPKI#to_pem;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"+Returns the PEM encoding of this SPKI.;T: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below0I"'spki.to_pem => PEM-encoded string ;T0[[I" to_s;T@ I"();T@FI" SPKI;TcRDoc::NormalClass00PKI ]$p ssNetscape/SPKI/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"#OpenSSL::Netscape::SPKI#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"+Returns the DER encoding of this SPKI.;T: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below0I"'spki.to_der => DER-encoded string ;T0[I"();T@FI" SPKI;TcRDoc::NormalClass00PKI ]?ClNetscape/SPKI/sign-i.rinu[U:RDoc::AnyMethod[iI" sign:ETI"!OpenSSL::Netscape::SPKI#sign;TF: privateo:RDoc::Markup::Document: @parts[S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o:RDoc::Markup::Paragraph; [I"A_key_ - the private key to be used for signing this instance;To;;0; [o;; [I"?_digest_ - the digest to be used for signing this instance;To:RDoc::Markup::BlankLineo;; [ I"JTo sign an SPKI, the private key corresponding to the public key set ;TI"Lfor this instance should be used, in addition to a digest algorithm in ;TI"Nthe form of an OpenSSL::Digest. The private key should be an instance of ;TI"OpenSSL::PKey.;T: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below0I"$spki.sign(key, digest) => spki ;T0[I" (p1, p2);T@ FI" SPKI;TcRDoc::NormalClass00PKI ]QNetscape/SPKI/verify-i.rinu[U:RDoc::AnyMethod[iI" verify:ETI"#OpenSSL::Netscape::SPKI#verify;TF: privateo:RDoc::Markup::Document: @parts[S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o:RDoc::Markup::Paragraph; [I"G_key_ - the public key to be used for verifying the SPKI signature;To:RDoc::Markup::BlankLineo;; [I"OReturns +true+ if the signature is valid, +false+ otherwise. To verify an ;TI"CSPKI, the public key contained within the SPKI should be used.;T: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below0I"!spki.verify(key) => boolean ;T0[I" (p1);T@FI" SPKI;TcRDoc::NormalClass00PKI ]±Netscape/SPKI/to_text-i.rinu[U:RDoc::AnyMethod[iI" to_text:ETI"$OpenSSL::Netscape::SPKI#to_text;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"IReturns a textual representation of this SPKI, useful for debugging ;TI"purposes.;T: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below0I"spki.to_text => string ;T0[I"();T@FI" SPKI;TcRDoc::NormalClass00PKI ]'w¬Netscape/SPKI/challenge%3d-i.rinu[U:RDoc::AnyMethod[iI"challenge=:ETI"'OpenSSL::Netscape::SPKI#challenge=;TF: privateo:RDoc::Markup::Document: @parts[S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o:RDoc::Markup::Paragraph; [I"=_str_ - the challenge string to be set for this instance;To:RDoc::Markup::BlankLineo;; [I"KSets the challenge to be associated with the SPKI. May be used by the ;TI"$server, e.g. to prevent replay.;T: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below0I"$spki.challenge = str => string ;T0[I" (p1);T@FI" SPKI;TcRDoc::NormalClass00PKI ]55Netscape/SPKI/cdesc-SPKI.rinu[U:RDoc::NormalClass[iI" SPKI:ETI"OpenSSL::Netscape::SPKI;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"NA Simple Public Key Infrastructure implementation (pronounced "spooky"). ;TI" The structure is defined as;To:RDoc::Markup::Verbatim;[I"*PublicKeyAndChallenge ::= SEQUENCE { ;TI"" spki SubjectPublicKeyInfo, ;TI" challenge IA5STRING ;TI"} ;TI" ;TI"0SignedPublicKeyAndChallenge ::= SEQUENCE { ;TI"4 publicKeyAndChallenge PublicKeyAndChallenge, ;TI"/ signatureAlgorithm AlgorithmIdentifier, ;TI" signature BIT STRING ;TI"} ;T: @format0o; ;[ I"Owhere the definitions of SubjectPublicKeyInfo and AlgorithmIdentifier can ;TI"Lbe found in RFC5280. SPKI is typically used in browsers for generating ;TI"Ka public/private key pair and a subsequent certificate request, using ;TI"the HTML element.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Examples;T@$S; ;i;I"Creating an SPKI;To; ;[ I"'key = OpenSSL::PKey::RSA.new 2048 ;TI"(spki = OpenSSL::Netscape::SPKI.new ;TI"(spki.challenge = "RandomChallenge" ;TI"&spki.public_key = key.public_key ;TI"3spki.sign(key, OpenSSL::Digest.new('SHA256')) ;TI"J#send a request containing this to a server generating a certificate ;T; 0S; ;i;I"Verifying an SPKI request;To; ;[ I"request = #... ;TI"0spki = OpenSSL::Netscape::SPKI.new request ;TI")unless spki.verify(spki.public_key) ;TI" # signature is invalid ;TI" end ;TI" #proceed;T; 0: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below0;0;0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_ns_spki.c;T[I" instance;T[[;[[;[[;[[I"challenge;T@K[I"challenge=;T@K[I"public_key;T@K[I"public_key=;T@K[I" sign;T@K[I" to_der;T@K[I" to_pem;T@K[I" to_s;T@K[I" to_text;T@K[I" verify;T@K[[U:RDoc::Context::Section[i0o;;[;0;0[I"ext/openssl/ossl_ns_spki.c;TI"OpenSSL::Netscape;TcRDoc::NormalModulePKI ]%{{%Netscape/SPKIError/cdesc-SPKIError.rinu[U:RDoc::NormalClass[iI"SPKIError:ETI"!OpenSSL::Netscape::SPKIError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"IGeneric Exception class that is raised if an error occurs during an ;TI"9operation on an instance of OpenSSL::Netscape::SPKI.;T: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_ns_spki.c;TI"OpenSSL::Netscape;TcRDoc::NormalModulePKI ]k6wNetscape/cdesc-Netscape.rinu[U:RDoc::NormalModule[iI" Netscape:ETI"OpenSSL::Netscape;T0o:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[ I"BOpenSSL::Netscape is a namespace for SPKI (Simple Public Key ;TI"GInfrastructure) which implements Signed Public Key and Challenge. ;TI"ASee {RFC 2692}[http://tools.ietf.org/html/rfc2692] and {RFC ;TI";2693}[http://tools.ietf.org/html/rfc2692] for details.;T: @fileI"ext/openssl/ossl_ns_spki.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]ExtConfig/cdesc-ExtConfig.rinu[U:RDoc::NormalModule[iI"ExtConfig:ETI"OpenSSL::ExtConfig;T0o:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[ I"MThis module contains configuration information about the SSL extension, ;TI"Nfor example if socket support is enabled, or the host name TLS extension ;TI"Ois enabled. Constants in this module will always be defined, but contain ;TI"M+true+ or +false+ values depending on the configuration of your OpenSSL ;TI"installation.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[U:RDoc::Constant[iI"HAVE_TLSEXT_HOST_NAME;TI".OpenSSL::ExtConfig::HAVE_TLSEXT_HOST_NAME;T: public0o;;[; @; 0@@cRDoc::NormalModule0U; [iI"OPENSSL_NO_SOCK;TI"(OpenSSL::ExtConfig::OPENSSL_NO_SOCK;T; 0o;;[; @; 0@@@0[[[I" class;T[[; [[:protected[[: private[[I" instance;T[[; [[;[[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl.c;TI" OpenSSL;T@PKI ]n2Marshal/_dump-i.rinu[U:RDoc::AnyMethod[iI" _dump:ETI"OpenSSL::Marshal#_dump;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"'ext/openssl/lib/openssl/marshal.rb;T:0@omit_headings_from_table_of_contents_below000[I" (_level);T@ FI" Marshal;TcRDoc::NormalModule00PKI ]&7  Marshal/included-c.rinu[U:RDoc::AnyMethod[iI" included:ETI"OpenSSL::Marshal::included;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"'ext/openssl/lib/openssl/marshal.rb;T:0@omit_headings_from_table_of_contents_below000[I" (base);T@ FI" Marshal;TcRDoc::NormalModule00PKI ](VQMarshal/cdesc-Marshal.rinu[U:RDoc::NormalModule[iI" Marshal:ETI"OpenSSL::Marshal;T0o:RDoc::Markup::Document: @parts[o;;[: @fileI"'ext/openssl/lib/openssl/marshal.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" included;TI"'ext/openssl/lib/openssl/marshal.rb;T[I" instance;T[[; [[; [[; [[I" _dump;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"'ext/openssl/lib/openssl/marshal.rb;TI" OpenSSL;TcRDoc::NormalModulePKI ]i@!Marshal/ClassMethods/_load-i.rinu[U:RDoc::AnyMethod[iI" _load:ETI")OpenSSL::Marshal::ClassMethods#_load;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"'ext/openssl/lib/openssl/marshal.rb;T:0@omit_headings_from_table_of_contents_below000[I" (string);T@ FI"ClassMethods;TcRDoc::NormalModule00PKI ]*Marshal/ClassMethods/cdesc-ClassMethods.rinu[U:RDoc::NormalModule[iI"ClassMethods:ETI"#OpenSSL::Marshal::ClassMethods;T0o:RDoc::Markup::Document: @parts[o;;[: @fileI"'ext/openssl/lib/openssl/marshal.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[I" _load;TI"'ext/openssl/lib/openssl/marshal.rb;T[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"'ext/openssl/lib/openssl/marshal.rb;TI"OpenSSL::Marshal;TcRDoc::NormalModulePKI ]l%B(Timestamp/Request/cert_requested%3f-i.rinu[U:RDoc::AnyMethod[iI"cert_requested?:ETI"0OpenSSL::Timestamp::Request#cert_requested?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LIndicates whether the response shall contain the timestamp authority's ;TI"certificate or not.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I".request.cert_requested? -> true or false;T0[I"();T@FI" Request;TcRDoc::NormalClass00PKI ]n&Timestamp/Request/message_imprint-i.rinu[U:RDoc::AnyMethod[iI"message_imprint:ETI"0OpenSSL::Timestamp::Request#message_imprint;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HReturns the message imprint (digest) of the data to be timestamped.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"0request.message_imprint -> string or nil;T0[I"();T@FI" Request;TcRDoc::NormalClass00PKI ]r(PPTimestamp/Request/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"%OpenSSL::Timestamp::Request::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HWhen creating a Request with the +File+ or +string+ parameter, the ;TI":corresponding +File+ or +string+ must be DER-encoded.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"OpenSSL::Timestamp::Request.new(file) -> request OpenSSL::Timestamp::Request.new(string) -> request OpenSSL::Timestamp::Request.new -> empty request;T0[I"(p1 = v1);T@FI" Request;TcRDoc::NormalClass00PKI ]S!Timestamp/Request/version%3d-i.rinu[U:RDoc::AnyMethod[iI" version=:ETI")OpenSSL::Timestamp::Request#version=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PSets the version number for this Request. This should be +1+ for compliant ;TI" servers.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"+request.version = number -> Integer;T0[I" (p1);T@FI" Request;TcRDoc::NormalClass00PKI ]' VTimestamp/Request/nonce-i.rinu[U:RDoc::AnyMethod[iI" nonce:ETI"&OpenSSL::Timestamp::Request#nonce;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OReturns the nonce (number used once) that the server shall include in its ;TI"response.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I""request.nonce -> BN or nil;T0[I"();T@FI" Request;TcRDoc::NormalClass00PKI ] z Timestamp/Request/policy_id-i.rinu[U:RDoc::AnyMethod[iI"policy_id:ETI"*OpenSSL::Timestamp::Request#policy_id;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KReturns the 'short name' of the object identifier that represents the ;TI"Htimestamp policy under which the server shall create the timestamp.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"*request.policy_id -> string or nil;T0[I"();T@FI" Request;TcRDoc::NormalClass00PKI ] >$(Timestamp/Request/cert_requested%3d-i.rinu[U:RDoc::AnyMethod[iI"cert_requested=:ETI"0OpenSSL::Timestamp::Request#cert_requested=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"JSpecify whether the response shall contain the timestamp authority's ;TI"5certificate or not. The default value is +true+.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"6request.cert_requested = boolean -> true or false;T0[I" (p1);T@FI" Request;TcRDoc::NormalClass00PKI ]JTimestamp/Request/nonce%3d-i.rinu[U:RDoc::AnyMethod[iI" nonce=:ETI"'OpenSSL::Timestamp::Request#nonce=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LSets the nonce (number used once) that the server shall include in its ;TI"Sresponse. If the nonce is set, the server must return the same nonce value in ;TI"a valid Response.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"$request.nonce = number -> BN;T0[I" (p1);T@FI" Request;TcRDoc::NormalClass00PKI ]X)Timestamp/Request/message_imprint%3d-i.rinu[U:RDoc::AnyMethod[iI"message_imprint=:ETI"1OpenSSL::Timestamp::Request#message_imprint=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"$Set the message imprint digest.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"4request.message_imprint = "string" -> string;T0[I" (p1);T@FI" Request;TcRDoc::NormalClass00PKI ]iAmmTimestamp/Request/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"'OpenSSL::Timestamp::Request#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DER-encodes this Request.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I",request.to_der -> DER-encoded string;T0[I"();T@FI" Request;TcRDoc::NormalClass00PKI ];$Timestamp/Request/version-i.rinu[U:RDoc::AnyMethod[iI" version:ETI"(OpenSSL::Timestamp::Request#version;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"CReturns the version of this request. +1+ is the default value.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"request.version -> Integer;T0[I"();T@FI" Request;TcRDoc::NormalClass00PKI ]- #Timestamp/Request/algorithm%3d-i.rinu[U:RDoc::AnyMethod[iI"algorithm=:ETI"+OpenSSL::Timestamp::Request#algorithm=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"EAllows to set the object identifier or the 'short name' of the ;TI"Balgorithm that was used to create the message imprint digest.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example:;To:RDoc::Markup::Verbatim; [I"request.algorithm = "SHA1";T: @format0: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I".request.algorithm = "string" -> string;T0[I" (p1);T@FI" Request;TcRDoc::NormalClass00PKI ]j;"Timestamp/Request/cdesc-Request.rinu[U:RDoc::NormalClass[iI" Request:ETI" OpenSSL::Timestamp::Request;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"NAllows to create timestamp requests or parse existing ones. A Request is ;TI"Ialso needed for creating timestamps from scratch with Factory. When ;TI"7created from scratch, some default values are set:;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0;[o; ;[I"version is set to +1+;To;;0;[o; ;[I"$cert_requested is set to +true+;To;;0;[o; ;[I"Halgorithm, message_imprint, policy_id, and nonce are set to +false+;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0;0;0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_ts.c;T[I" instance;T[[;[[;[[;[[I"algorithm;T@4[I"algorithm=;T@4[I"cert_requested=;T@4[I"cert_requested?;T@4[I"message_imprint;T@4[I"message_imprint=;T@4[I" nonce;T@4[I" nonce=;T@4[I"policy_id;T@4[I"policy_id=;T@4[I" to_der;T@4[I" version;T@4[I" version=;T@4[[U:RDoc::Context::Section[i0o;;[;0;0[I"ext/openssl/ossl_ts.c;TI"OpenSSL::Timestamp;TcRDoc::NormalModulePKI ]jn Timestamp/Request/algorithm-i.rinu[U:RDoc::AnyMethod[iI"algorithm:ETI"*OpenSSL::Timestamp::Request#algorithm;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KReturns the 'short name' of the object identifier that represents the ;TI"Balgorithm that was used to create the message imprint digest.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"#request.algorithm -> string;T0[I"();T@FI" Request;TcRDoc::NormalClass00PKI ]]:#Timestamp/Request/policy_id%3d-i.rinu[U:RDoc::AnyMethod[iI"policy_id=:ETI"+OpenSSL::Timestamp::Request#policy_id=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"=Allows to set the object identifier that represents the ;TI"Ntimestamp policy under which the server shall create the timestamp. This ;TI"Jmay be left +nil+, implying that the timestamp server will issue the ;TI")timestamp using some default policy.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example:;To:RDoc::Markup::Verbatim; [I"$request.policy_id = "1.2.3.4.5";T: @format0: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"-request.policy_id = "string" -> string;T0[I" (p1);T@FI" Request;TcRDoc::NormalClass00PKI ]##0Timestamp/TimestampError/cdesc-TimestampError.rinu[U:RDoc::NormalClass[iI"TimestampError:ETI"'OpenSSL::Timestamp::TimestampError;TI"eOSSLError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"5Generic exception class of the Timestamp module.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_ts.c;TI"OpenSSL::Timestamp;TcRDoc::NormalModulePKI ]$'.]$Timestamp/Response/failure_info-i.rinu[U:RDoc::AnyMethod[iI"failure_info:ETI".OpenSSL::Timestamp::Response#failure_info;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"OIn cases no timestamp token has been created, this field contains further ;TI"Sinfo about the reason why response creation failed. The method returns either ;TI"Rnil (the request was successful and a timestamp token was created) or one of ;TI"the following:;To:RDoc::Markup::List: @type: BULLET: @items[ o:RDoc::Markup::ListItem: @label0; [o; ; [I"H:BAD_ALG - Indicates that the timestamp server rejects the message ;TI"*imprint algorithm used in the Request;To;;0; [o; ; [I"P:BAD_REQUEST - Indicates that the timestamp server was not able to process ;TI"the Request properly;To;;0; [o; ; [I"L:BAD_DATA_FORMAT - Indicates that the timestamp server was not able to ;TI"&parse certain data in the Request;To;;0; [o; ; [I"O:TIME_NOT_AVAILABLE - Indicates that the server could not access its time ;TI" source;To;;0; [o; ; [I"P:UNACCEPTED_POLICY - Indicates that the requested policy identifier is not ;TI"4recognized or supported by the timestamp server;To;;0; [o; ; [I"L:UNACCEPTED_EXTENSIION - Indicates that an extension in the Request is ;TI"*not supported by the timestamp server;To;;0; [o; ; [I"N:ADD_INFO_NOT_AVAILABLE -Indicates that additional information requested ;TI"8is either not understood or currently not available;To;;0; [o; ; [I"O:SYSTEM_FAILURE - Timestamp creation failed due to an internal error that ;TI"%occurred on the timestamp server;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"+response.failure_info -> nil or symbol;T0[I"();T@CFI" Response;TcRDoc::NormalClass00PKI ]ATimestamp/Response/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"&OpenSSL::Timestamp::Response::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"ACreates a Response from a +File+ or +string+ parameter, the ;TI"Gcorresponding +File+ or +string+ must be DER-encoded. Please note ;TI"Lthat Response is an immutable read-only class. If you'd like to create ;TI"0timestamps please refer to Factory instead.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"pOpenSSL::Timestamp::Response.new(file) -> response OpenSSL::Timestamp::Response.new(string) -> response;T0[I" (p1);T@FI" Response;TcRDoc::NormalClass00PKI ]CTimestamp/Response/token-i.rinu[U:RDoc::AnyMethod[iI" token:ETI"'OpenSSL::Timestamp::Response#token;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GIf a timestamp token is present, this returns it in the form of a ;TI"OpenSSL::PKCS7.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I",response.token -> nil or OpenSSL::PKCS7;T0[I"();T@FI" Response;TcRDoc::NormalClass00PKI ]*$Timestamp/Response/cdesc-Response.rinu[U:RDoc::NormalClass[iI" Response:ETI"!OpenSSL::Timestamp::Response;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[ I"MImmutable and read-only representation of a timestamp response returned ;TI"Kfrom a timestamp server after receiving an associated Request. Allows ;TI"Jaccess to specific information about the response but also allows to ;TI"verify the Response.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[ U:RDoc::Constant[iI" GRANTED;TI"*OpenSSL::Timestamp::Response::GRANTED;T: public0o;;[o; ;[I"3Indicates a successful response. Equal to +0+.;T; @; 0@@cRDoc::NormalClass0U; [iI"GRANTED_WITH_MODS;TI"4OpenSSL::Timestamp::Response::GRANTED_WITH_MODS;T; 0o;;[o; ;[I"JIndicates a successful response that probably contains modifications ;TI",from the initial request. Equal to +1+.;T; @; 0@@@ 0U; [iI"REJECTION;TI",OpenSSL::Timestamp::Response::REJECTION;T; 0o;;[o; ;[I"GIndicates a failure. No timestamp token was created. Equal to +2+.;T; @; 0@@@ 0U; [iI" WAITING;TI"*OpenSSL::Timestamp::Response::WAITING;T; 0o;;[o; ;[I"GIndicates a failure. No timestamp token was created. Equal to +3+.;T; @; 0@@@ 0U; [iI"REVOCATION_WARNING;TI"5OpenSSL::Timestamp::Response::REVOCATION_WARNING;T; 0o;;[o; ;[I"JIndicates a failure. No timestamp token was created. Revocation of a ;TI"+certificate is imminent. Equal to +4+.;T; @; 0@@@ 0U; [iI"REVOCATION_NOTIFICATION;TI":OpenSSL::Timestamp::Response::REVOCATION_NOTIFICATION;T; 0o;;[o; ;[I"HIndicates a failure. No timestamp token was created. A certificate ;TI"$has been revoked. Equal to +5+.;T; @; 0@@@ 0[[[I" class;T[[; [[:protected[[: private[[I"new;TI"ext/openssl/ossl_ts.c;T[I" instance;T[[; [[;[[;[ [I"failure_info;T@^[I" status;T@^[I"status_text;T@^[I" to_der;T@^[I" token;T@^[I"token_info;T@^[I"tsa_certificate;T@^[I" verify;T@^[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_ts.c;TI"OpenSSL::Timestamp;TcRDoc::NormalModulePKI ])/..Timestamp/Response/status-i.rinu[U:RDoc::AnyMethod[iI" status:ETI"(OpenSSL::Timestamp::Response#status;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DReturns one of GRANTED, GRANTED_WITH_MODS, REJECTION, WAITING, ;TI"JREVOCATION_WARNING or REVOCATION_NOTIFICATION. A timestamp token has ;TI"Qbeen created only in case +status+ is equal to GRANTED or GRANTED_WITH_MODS.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"&response.status -> BN (never nil);T0[I"();T@FI" Response;TcRDoc::NormalClass00PKI ]rUqqTimestamp/Response/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"(OpenSSL::Timestamp::Response#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Returns the Response in DER-encoded form.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"response.to_der -> string;T0[I"();T@FI" Response;TcRDoc::NormalClass00PKI ]^5#Timestamp/Response/status_text-i.rinu[U:RDoc::AnyMethod[iI"status_text:ETI"-OpenSSL::Timestamp::Response#status_text;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LIn cases of failure this field may contain an array of strings further ;TI"*describing the origin of the failure.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"4response.status_text -> Array of strings or nil;T0[I"();T@FI" Response;TcRDoc::NormalClass00PKI ]Y"Timestamp/Response/token_info-i.rinu[U:RDoc::AnyMethod[iI"token_info:ETI",OpenSSL::Timestamp::Response#token_info;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Get the response's token info if present.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"@response.token_info -> nil or OpenSSL::Timestamp::TokenInfo;T0[I"();T@FI" Response;TcRDoc::NormalClass00PKI ]- ``Timestamp/Response/verify-i.rinu[U:RDoc::AnyMethod[iI" verify:ETI"(OpenSSL::Timestamp::Response#verify;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"JVerifies a timestamp token by checking the signature, validating the ;TI"Qcertificate chain implied by tsa_certificate and by checking conformance to ;TI"Na given Request. Mandatory parameters are the Request associated to this ;TI" Response response.verify(Request, root_store, [intermediate_cert]) -> Response;T0[I"(p1, p2, p3 = v3);T@(FI" Response;TcRDoc::NormalClass00PKI ]W))'Timestamp/Response/tsa_certificate-i.rinu[U:RDoc::AnyMethod[iI"tsa_certificate:ETI"1OpenSSL::Timestamp::Response#tsa_certificate;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"=If the Request specified to request the TSA certificate ;TI"C(Request#cert_requested = true), then this field contains the ;TI",certificate of the timestamp authority.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"Bresponse.tsa_certificate -> OpenSSL::X509::Certificate or nil;T0[I"();T@FI" Response;TcRDoc::NormalClass00PKI ]ΐ'Timestamp/Factory/create_timestamp-i.rinu[U:RDoc::AnyMethod[iI"create_timestamp:ETI"1OpenSSL::Timestamp::Factory#create_timestamp;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I">Creates a Response with the help of an OpenSSL::PKey, an ;TI".OpenSSL::X509::Certificate and a Request.;To:RDoc::Markup::BlankLineo; ; [I"LMandatory parameters for timestamp creation that need to be set in the ;TI" Request:;T@o:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"Request#algorithm;To;;0; [o; ; [I"Request#message_imprint;T@o; ; [I"=Mandatory parameters that need to be set in the Factory:;To; ; ;;[o;;0; [o; ; [I"Factory#serial_number;To;;0; [o; ; [I"Factory#gen_time;To;;0; [o; ; [I"Factory#allowed_digests;T@o; ; [I"NIn addition one of either Request#policy_id or Factory#default_policy_id ;TI"must be set.;T@o; ; [I"RRaises a TimestampError if creation fails, though successfully created error ;TI"responses may be returned.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"Dfactory.create_timestamp(key, certificate, request) -> Response;T0[I"(p1, p2, p3);T@p12 = OpenSSL::PKCS12.new(File.binread('ts.p12'), 'pwd') ;TI"Iinter1 = OpenSSL::X509::Certificate.new(File.binread('inter1.cer')) ;TI"Iinter2 = OpenSSL::X509::Certificate.new(File.binread('inter2.cer')) ;TI"+fac = OpenSSL::Timestamp::Factory.new ;TI"fac.gen_time = Time.now ;TI"fac.serial_number = 1 ;TI":fac.allowed_digests = ["sha256", "sha384", "sha512"] ;TI"@#needed because the Request contained no policy identifier ;TI")fac.default_policy_id = '1.2.3.4.5' ;TI"6fac.additional_certificates = [ inter1, inter2 ] ;TI"Etimestamp = fac.create_timestamp(p12.key, p12.certificate, req) ;T: @format0S; ; i; I"Attributes;T@S; ; i; I"default_policy_id;T@o; ;[ I"LRequest#policy_id will always be preferred over this if present in the ;TI"LRequest, only if Request#policy_id is nil default_policy will be used. ;TI"MIf none of both is present, a TimestampError will be raised when trying ;TI"to create a Response.;T@o; ;[I"call-seq:;To;;[I"4factory.default_policy_id = "string" -> string ;TI";factory.default_policy_id -> string or nil ;T;0S; ; i; I"serial_number;T@o; ;[I"LSets or retrieves the serial number to be used for timestamp creation. ;TI",Must be present for timestamp creation.;T@o; ;[I"call-seq:;To;;[I".factory.serial_number = number -> number ;TI"5factory.serial_number -> number or nil ;T;0S; ; i; I" gen_time;T@o; ;[I"JSets or retrieves the Time value to be used in the Response. Must be ;TI"$present for timestamp creation.;T@o; ;[I"call-seq:;To;;[I"%factory.gen_time = Time -> Time ;TI",factory.gen_time -> Time or nil ;T;0S; ; i; I"additional_certs;T@o; ;[I"HSets or retrieves additional certificates apart from the timestamp ;TI"Ocertificate (e.g. intermediate certificates) to be added to the Response. ;TI"4Must be an Array of OpenSSL::X509::Certificate.;T@o; ;[I"call-seq:;To;;[I"Cfactory.additional_certs = [cert1, cert2] -> [ cert1, cert2 ] ;TI"?factory.additional_certs -> array or nil ;T;0S; ; i; I"allowed_digests;T@o; ;[ I"ISets or retrieves the digest algorithms that the factory is allowed ;TI"Ncreate timestamps for. Known vulnerable or weak algorithms should not be ;TI"allowed where possible. ;TI"FMust be an Array of String or OpenSSL::Digest subclass instances.;T@o; ;[I"call-seq:;To;;[I"kfactory.allowed_digests = ["sha1", OpenSSL::Digest.new('SHA256').new] -> [ "sha1", OpenSSL::Digest) ] ;TI"Zfactory.allowed_digests -> array or nil;T;0: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ I"additional_certs;TI"RW;T: privateFI"ext/openssl/ossl_ts.c;T[ I"allowed_digests;T@;F@[ I"default_policy_id;T@;F@[ I" gen_time;T@;F@[ I"serial_number;T@;F@[[[[I" class;T[[: public[[:protected[[;[[I" instance;T[[;[[;[[;[[I"create_timestamp;T@[[U:RDoc::Context::Section[i0o;;[;0;0[I"ext/openssl/ossl_ts.c;TI"OpenSSL::Timestamp;TcRDoc::NormalModulePKI ]c'Timestamp/Factory/additional_certs-i.rinu[U:RDoc::Attr[iI"additional_certs:ETI"1OpenSSL::Timestamp::Factory#additional_certs;TI"RW;T: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0F@ I" OpenSSL::Timestamp::Factory;TcRDoc::NormalClass0PKI ]`!Timestamp/TokenInfo/gen_time-i.rinu[U:RDoc::AnyMethod[iI" gen_time:ETI"+OpenSSL::Timestamp::TokenInfo#gen_time;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QReturns time when this timestamp token was created. If status is GRANTED or ;TI",GRANTED_WITH_MODS, this is never +nil+.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I" token_info.gen_time -> Time;T0[I"();T@FI"TokenInfo;TcRDoc::NormalClass00PKI ]!0oAoo!Timestamp/TokenInfo/ordering-i.rinu[U:RDoc::AnyMethod[iI" ordering:ETI"+OpenSSL::Timestamp::TokenInfo#ordering;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"KIf the ordering field is missing, or if the ordering field is present ;TI"Iand set to false, then the genTime field only indicates the time at ;TI"Hwhich the time-stamp token has been created by the TSA. In such a ;TI"Gcase, the ordering of time-stamp tokens issued by the same TSA or ;TI"Edifferent TSAs is only possible when the difference between the ;TI"IgenTime of the first time-stamp token and the genTime of the second ;TI"Gtime-stamp token is greater than the sum of the accuracies of the ;TI"'genTime for each time-stamp token.;To:RDoc::Markup::BlankLineo; ; [I"HIf the ordering field is present and set to true, every time-stamp ;TI"Htoken from the same TSA can always be ordered based on the genTime ;TI"/field, regardless of the genTime accuracy.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"/token_info.ordering -> true, falses or nil;T0[I"();T@FI"TokenInfo;TcRDoc::NormalClass00PKI ]zc(Timestamp/TokenInfo/message_imprint-i.rinu[U:RDoc::AnyMethod[iI"message_imprint:ETI"2OpenSSL::Timestamp::TokenInfo#message_imprint;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"?Returns the message imprint digest. For valid timestamps, ;TI"Cthis is the same value that was already given in the Request. ;TI"DIf status is GRANTED or GRANTED_WITH_MODS, this is never +nil+.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example:;To:RDoc::Markup::Verbatim; [I"!mi = token_info.msg_imprint ;TI")puts mi -> "DEADBEEF";T: @format0: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"&token_info.msg_imprint -> string.;T0[I"();T@FI"TokenInfo;TcRDoc::NormalClass00PKI ],QTimestamp/TokenInfo/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"'OpenSSL::Timestamp::TokenInfo::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"BCreates a TokenInfo from a +File+ or +string+ parameter, the ;TI"Gcorresponding +File+ or +string+ must be DER-encoded. Please note ;TI"Mthat TokenInfo is an immutable read-only class. If you'd like to create ;TI"0timestamps please refer to Factory instead.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"vOpenSSL::Timestamp::TokenInfo.new(file) -> token-info OpenSSL::Timestamp::TokenInfo.new(string) -> token-info;T0[I" (p1);T@FI"TokenInfo;TcRDoc::NormalClass00PKI ] Timestamp/TokenInfo/nonce-i.rinu[U:RDoc::AnyMethod[iI" nonce:ETI"(OpenSSL::Timestamp::TokenInfo#nonce;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RIf the timestamp token is valid then this field contains the same nonce that ;TI"?was passed to the timestamp server in the initial Request.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I""token_info.nonce -> BN or nil;T0[I"();T@FI"TokenInfo;TcRDoc::NormalClass00PKI ]V"Timestamp/TokenInfo/policy_id-i.rinu[U:RDoc::AnyMethod[iI"policy_id:ETI",OpenSSL::Timestamp::TokenInfo#policy_id;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"QReturns the timestamp policy object identifier of the policy this timestamp ;TI"Qwas created under. If status is GRANTED or GRANTED_WITH_MODS, this is never ;TI" +nil+.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example:;To:RDoc::Markup::Verbatim; [I"id = token_info.policy_id ;TI"+puts id -> "1.2.3.4.5";T: @format0: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"*token_info.policy_id -> string or nil;T0[I"();T@FI"TokenInfo;TcRDoc::NormalClass00PKI ]%BvvTimestamp/TokenInfo/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI")OpenSSL::Timestamp::TokenInfo#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"/Returns the TokenInfo in DER-encoded form.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I" token_info.to_der -> string;T0[I"();T@FI"TokenInfo;TcRDoc::NormalClass00PKI ]=`FF&Timestamp/TokenInfo/serial_number-i.rinu[U:RDoc::AnyMethod[iI"serial_number:ETI"0OpenSSL::Timestamp::TokenInfo#serial_number;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QReturns serial number of the timestamp token. This value shall never be the ;TI"Nsame for two timestamp tokens issued by a dedicated timestamp authority. ;TI"DIf status is GRANTED or GRANTED_WITH_MODS, this is never +nil+.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"*token_info.serial_number -> BN or nil;T0[I"();T@FI"TokenInfo;TcRDoc::NormalClass00PKI ] Timestamp/TokenInfo/version-i.rinu[U:RDoc::AnyMethod[iI" version:ETI"*OpenSSL::Timestamp::TokenInfo#version;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KReturns the version number of the token info. With compliant servers, ;TI"Bthis value should be +1+ if present. If status is GRANTED or ;TI"GRANTED_WITH_MODS.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I")token_info.version -> Integer or nil;T0[I"();T@FI"TokenInfo;TcRDoc::NormalClass00PKI ]0s&Timestamp/TokenInfo/cdesc-TokenInfo.rinu[U:RDoc::NormalClass[iI"TokenInfo:ETI""OpenSSL::Timestamp::TokenInfo;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"MImmutable and read-only representation of a timestamp token info from a ;TI"Response.;T: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_ts.c;T[I" instance;T[[; [[; [[;[[I"algorithm;T@"[I" gen_time;T@"[I"message_imprint;T@"[I" nonce;T@"[I" ordering;T@"[I"policy_id;T@"[I"serial_number;T@"[I" to_der;T@"[I" version;T@"[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_ts.c;TI"OpenSSL::Timestamp;TcRDoc::NormalModulePKI ] KK"Timestamp/TokenInfo/algorithm-i.rinu[U:RDoc::AnyMethod[iI"algorithm:ETI",OpenSSL::Timestamp::TokenInfo#algorithm;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"RReturns the 'short name' of the object identifier representing the algorithm ;TI"Othat was used to derive the message imprint digest. For valid timestamps, ;TI"Pthis is the same value that was already given in the Request. If status is ;TI"7GRANTED or GRANTED_WITH_MODS, this is never +nil+.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example:;To:RDoc::Markup::Verbatim; [I"!algo = token_info.algorithm ;TI"'puts algo -> "SHA1";T: @format0: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0I"*token_info.algorithm -> string or nil;T0[I"();T@FI"TokenInfo;TcRDoc::NormalClass00PKI ] Timestamp/cdesc-Timestamp.rinu[U:RDoc::NormalModule[iI"Timestamp:ETI"OpenSSL::Timestamp;T0o:RDoc::Markup::Document: @parts[o;;[ o:RDoc::Markup::Paragraph;[ I"BProvides classes and methods to request, create and validate ;TI"J{RFC3161-compliant}[http://www.ietf.org/rfc/rfc3161.txt] timestamps. ;TI"LRequest may be used to either create requests from scratch or to parse ;TI"Kexisting requests that again can be used to request timestamps from a ;TI"Ftimestamp server, e.g. via the net/http. The resulting timestamp ;TI"+response may be parsed using Response.;To:RDoc::Markup::BlankLineo; ;[I"GPlease note that Response is read-only and immutable. To create a ;TI"LResponse, an instance of Factory as well as a valid Request are needed.;T@S:RDoc::Markup::Heading: leveli: textI"Create a Response:;To:RDoc::Markup::Verbatim;[I"E#Assumes ts.p12 is a PKCS#12-compatible file with a private key ;TI"I#and a certificate that has an extended key usage of 'timeStamping' ;TI">p12 = OpenSSL::PKCS12.new(File.binread('ts.p12'), 'pwd') ;TI"&md = OpenSSL::Digest.new('SHA1') ;TI"@hash = md.digest(data) #some binary data to be timestamped ;TI"+req = OpenSSL::Timestamp::Request.new ;TI"req.algorithm = 'SHA1' ;TI" req.message_imprint = hash ;TI"!req.policy_id = "1.2.3.4.5" ;TI"req.nonce = 42 ;TI"+fac = OpenSSL::Timestamp::Factory.new ;TI"fac.gen_time = Time.now ;TI"fac.serial_number = 1 ;TI"Etimestamp = fac.create_timestamp(p12.key, p12.certificate, req) ;T: @format0S; ; i; I"!Verify a timestamp response:;To;;[I"?#Assume we have a timestamp token in a file called ts.der ;TI"Cts = OpenSSL::Timestamp::Response.new(File.binread('ts.der')) ;TI"I#Assume we have the Request for this token in a file called req.der ;TI"Dreq = OpenSSL::Timestamp::Request.new(File.binread('req.der')) ;TI"C# Assume the associated root CA certificate is contained in a ;TI"'# DER-encoded file named root.cer ;TI"Eroot = OpenSSL::X509::Certificate.new(File.binread('root.cer')) ;TI"A# get the necessary intermediate certificates, available in ;TI"5# DER-encoded form in inter1.cer and inter2.cer ;TI"Iinter1 = OpenSSL::X509::Certificate.new(File.binread('inter1.cer')) ;TI"Iinter2 = OpenSSL::X509::Certificate.new(File.binread('inter2.cer')) ;TI"Zts.verify(req, root, inter1, inter2) -> ts or raises an exception if validation fails;T;0: @fileI"ext/openssl/ossl_ts.c;T:0@omit_headings_from_table_of_contents_below0;0;0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[;[[;[[;[[[U:RDoc::Context::Section[i0o;;[;0;0[I"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]b\fips_mode%3d-c.rinu[U:RDoc::AnyMethod[iI"fips_mode=:ETI"OpenSSL::fips_mode=;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"QTurns FIPS mode on or off. Turning on FIPS mode will obviously only have an ;TI"Peffect for FIPS-capable installations of the OpenSSL library. Trying to do ;TI"*so otherwise will result in an error.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Examples;To:RDoc::Markup::Verbatim; [I"4OpenSSL.fips_mode = true # turn FIPS mode on ;TI"/OpenSSL.fips_mode = false # and off again;T: @format0: @fileI"ext/openssl/ossl.c;T:0@omit_headings_from_table_of_contents_below0I",OpenSSL.fips_mode = boolean -> boolean ;T0[I" (p1);T@FI" OpenSSL;TcRDoc::NormalModule00PKI ]A debug%3d-c.rinu[U:RDoc::AnyMethod[iI" debug=:ETI"OpenSSL::debug=;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RTurns on or off debug mode. With debug mode, all errors added to the OpenSSL ;TI"+error queue will be printed to stderr.;T: @fileI"ext/openssl/ossl.c;T:0@omit_headings_from_table_of_contents_below0I"(OpenSSL.debug = boolean -> boolean ;T0[I" (p1);T@FI" OpenSSL;TcRDoc::NormalModule00PKI ]Zsecure_compare-c.rinu[U:RDoc::AnyMethod[iI"secure_compare:ETI"OpenSSL::secure_compare;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NConstant time memory comparison. Inputs are hashed using SHA-256 to mask ;TI"Lthe length of the secret. Returns +true+ if the strings are identical, ;TI"+false+ otherwise.;T: @fileI"ext/openssl/lib/openssl.rb;T:0@omit_headings_from_table_of_contents_below0I"7OpenSSL.secure_compare(string, string) -> boolean ;T0[I" (a, b);T@FI" OpenSSL;TcRDoc::NormalModule00PKI ]MBNError/cdesc-BNError.rinu[U:RDoc::NormalClass[iI" BNError:ETI"OpenSSL::BNError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"3Generic Error for all of OpenSSL::BN (big num);T: @fileI"ext/openssl/ossl_bn.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]U errors-c.rinu[U:RDoc::AnyMethod[iI" errors:ETI"OpenSSL::errors;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I",See any remaining errors held in queue.;To:RDoc::Markup::BlankLineo; ; [I"IAny errors you see here are probably due to a bug in Ruby's OpenSSL ;TI"implementation.;T: @fileI"ext/openssl/ossl.c;T:0@omit_headings_from_table_of_contents_below0I"#OpenSSL.errors -> [String...] ;T0[I"();T@FI" OpenSSL;TcRDoc::NormalModule00PKI ]PKCS5/pbkdf2_hmac-i.rinu[U:RDoc::AnyMethod[iI"pbkdf2_hmac:ETI"OpenSSL::PKCS5#pbkdf2_hmac;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NOpenSSL::PKCS5.pbkdf2_hmac has been renamed to OpenSSL::KDF.pbkdf2_hmac. ;TI"9This method is provided for backwards compatibility.;T: @fileI"%ext/openssl/lib/openssl/pkcs5.rb;T:0@omit_headings_from_table_of_contents_below000[I"'(pass, salt, iter, keylen, digest);T@FI" PKCS5;TcRDoc::NormalModule00PKI ]G_**PKCS5/pbkdf2_hmac_sha1-i.rinu[U:RDoc::AnyMethod[iI"pbkdf2_hmac_sha1:ETI"$OpenSSL::PKCS5#pbkdf2_hmac_sha1;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"%ext/openssl/lib/openssl/pkcs5.rb;T:0@omit_headings_from_table_of_contents_below000[I"(pass, salt, iter, keylen);T@ FI" PKCS5;TcRDoc::NormalModule00PKI ]I_7PKCS5/cdesc-PKCS5.rinu[U:RDoc::NormalModule[iI" PKCS5:ETI"OpenSSL::PKCS5;T0o:RDoc::Markup::Document: @parts[o;;[: @fileI"%ext/openssl/lib/openssl/pkcs5.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[I"pbkdf2_hmac;TI"%ext/openssl/lib/openssl/pkcs5.rb;T[I"pbkdf2_hmac_sha1;T@&[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"%ext/openssl/lib/openssl/pkcs5.rb;TI" OpenSSL;TcRDoc::NormalModulePKI ]fnPKCS12/create-c.rinu[U:RDoc::AnyMethod[iI" create:ETI"OpenSSL::PKCS12::create;TT: privateo:RDoc::Markup::Document: @parts[ S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o:RDoc::Markup::Paragraph; [I"_pass_ - string;To;;0; [o;; [I"*_name_ - A string describing the key.;To;;0; [o;; [I"_key_ - Any PKey.;To;;0; [o;; [I""_cert_ - A X509::Certificate.;To; ;;;[o;;0; [o;; [I"OThe public_key portion of the certificate must contain a valid public key.;To;;0; [o;; [I";The not_before and not_after fields must be filled in.;To;;0; [o;; [I"5_ca_ - An optional array of X509::Certificate's.;To;;0; [o;; [I"_key_pbe_ - string;To;;0; [o;; [I"_cert_pbe_ - string;To;;0; [o;; [I"_key_iter_ - integer;To;;0; [o;; [I"_mac_iter_ - integer;To;;0; [o;; [I"D_keytype_ - An integer representing an MSIE specific extension.;To:RDoc::Markup::BlankLineo;; [I"VAny optional arguments may be supplied as +nil+ to preserve the OpenSSL defaults.;T@Mo;; [I"7See the OpenSSL documentation for PKCS12_create().;T: @fileI"ext/openssl/ossl_pkcs12.c;T:0@omit_headings_from_table_of_contents_below0I"qPKCS12.create(pass, name, key, cert [, ca, [, key_pbe [, cert_pbe [, key_iter [, mac_iter [, keytype]]]]]]) ;T0[I"M(p1, p2, p3, p4, p5 = v5, p6 = v6, p7 = v7, p8 = v8, p9 = v9, p10 = v10);T@TFI" PKCS12;TcRDoc::NormalClass00PKI ]BbbPKCS12/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::PKCS12::new;TT: privateo:RDoc::Markup::Document: @parts[S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o:RDoc::Markup::Paragraph; [I"1_str_ - Must be a DER encoded PKCS12 string.;To;;0; [o;; [I"_pass_ - string;T: @fileI"ext/openssl/ossl_pkcs12.c;T:0@omit_headings_from_table_of_contents_below0I"TPKCS12.new -> pkcs12 PKCS12.new(str) -> pkcs12 PKCS12.new(str, pass) -> pkcs12 ;T0[I"(p1 = v1, p2 = v2);T@FI" PKCS12;TcRDoc::NormalClass00PKI ]V'PKCS12/PKCS12Error/cdesc-PKCS12Error.rinu[U:RDoc::NormalClass[iI"PKCS12Error:ETI"!OpenSSL::PKCS12::PKCS12Error;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_pkcs12.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_pkcs12.c;TI"OpenSSL::PKCS12;TcRDoc::NormalClassPKI ]k`ح++PKCS12/cdesc-PKCS12.rinu[U:RDoc::NormalClass[iI" PKCS12:ETI"OpenSSL::PKCS12;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"DDefines a file format commonly used to store private keys with ;TI"Kaccompanying public key certificates, protected with a password-based ;TI"symmetric key.;T: @fileI"ext/openssl/ossl_pkcs12.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[ I" ca_certs;TI"R;T: privateFI"ext/openssl/ossl_pkcs12.c;T[ I"certificate;TI"R;T; F@[ I"key;TI"R;T; F@[[[[I" class;T[[: public[[:protected[[; [[I" create;T@[I"new;T@[I" instance;T[[; [[;[[; [[I"initialize_copy;T@[I" to_der;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]PKCS12/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"OpenSSL::PKCS12#to_der;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs12.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" PKCS12;TcRDoc::NormalClass00PKI ]omPKCS12/certificate-i.rinu[U:RDoc::Attr[iI"certificate:ETI" OpenSSL::PKCS12#certificate;TI"R;T: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs12.c;T:0@omit_headings_from_table_of_contents_below0F@ I"OpenSSL::PKCS12;TcRDoc::NormalClass0PKI ]%PKCS12/key-i.rinu[U:RDoc::Attr[iI"key:ETI"OpenSSL::PKCS12#key;TI"R;T: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs12.c;T:0@omit_headings_from_table_of_contents_below0F@ I"OpenSSL::PKCS12;TcRDoc::NormalClass0PKI ]qF  PKCS12/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"$OpenSSL::PKCS12#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs12.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" PKCS12;TcRDoc::NormalClass00PKI ]haPKCS12/ca_certs-i.rinu[U:RDoc::Attr[iI" ca_certs:ETI"OpenSSL::PKCS12#ca_certs;TI"R;T: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_pkcs12.c;T:0@omit_headings_from_table_of_contents_below0F@ I"OpenSSL::PKCS12;TcRDoc::NormalClass0PKI ]v3)SSL/SSLContext/session_cache_mode%3d-i.rinu[U:RDoc::AnyMethod[iI"session_cache_mode=:ETI"1OpenSSL::SSL::SSLContext#session_cache_mode=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GSets the SSL session cache mode. Bitwise-or together the desired ;TI"RSESSION_CACHE_* constants to set. See SSL_CTX_set_session_cache_mode(3) for ;TI" details.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"1ctx.session_cache_mode=(integer) -> Integer ;T0[I" (p1);T@FI"SSLContext;TcRDoc::NormalClass00PKI ]]N  SSL/SSLContext/set_params-i.rinu[U:RDoc::AnyMethod[iI"set_params:ETI"(OpenSSL::SSL::SSLContext#set_params;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"HSets saner defaults optimized for the use with HTTP-like protocols.;To:RDoc::Markup::BlankLineo; ; [I"IIf a Hash _params_ is given, the parameters are overridden with it. ;TI"CThe keys in _params_ must be assignment methods on SSLContext.;T@o; ; [I"DIf the verify_mode is not VERIFY_NONE and ca_file, ca_path and ;TI"Icert_store are not set then the system default certificate store is ;TI" used.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0I"+ctx.set_params(params = {}) -> params ;T0[I"(params={});T@FI"SSLContext;TcRDoc::NormalClass00PKI ]`]"SSL/SSLContext/client_cert_cb-i.rinu[U:RDoc::Attr[iI"client_cert_cb:ETI",OpenSSL::SSL::SSLContext#client_cert_cb;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KA callback invoked when a client certificate is requested by a server ;TI"%and no certificate has been set.;To:RDoc::Markup::BlankLineo; ; [I"EThe callback is invoked with a Session and must return an Array ;TI"Lcontaining an OpenSSL::X509::Certificate and an OpenSSL::PKey. If any ;TI"8other value is returned the handshake is suspended.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]5>>SSL/SSLContext/setup-i.rinu[U:RDoc::AnyMethod[iI" setup:ETI"#OpenSSL::SSL::SSLContext#setup;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"JThis method is called automatically when a new SSLSocket is created. ;TI"GHowever, it is not thread-safe and must be called before creating ;TI"3SSLSocket objects in a multi-threaded program.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"Cctx.setup => Qtrue # first time ctx.setup => nil # thereafter ;T0[[I" freeze;T@ I"();T@FI"SSLContext;TcRDoc::NormalClass00PKI ]&j "SSL/SSLContext/ecdh_curves%3d-i.rinu[U:RDoc::AnyMethod[iI"ecdh_curves=:ETI"*OpenSSL::SSL::SSLContext#ecdh_curves=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"CSets the list of "supported elliptic curves" for this context.;To:RDoc::Markup::BlankLineo; ; [I"RFor a TLS client, the list is directly used in the Supported Elliptic Curves ;TI"RExtension. For a server, the list is used by OpenSSL to determine the set of ;TI"Gshared curves. OpenSSL will pick the most appropriate one from it.;T@S:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [I")ctx1 = OpenSSL::SSL::SSLContext.new ;TI"-ctx1.ecdh_curves = "X25519:P-256:P-224" ;TI"6svr = OpenSSL::SSL::SSLServer.new(tcp_svr, ctx1) ;TI"Thread.new { svr.accept } ;TI" ;TI")ctx2 = OpenSSL::SSL::SSLContext.new ;TI" ctx2.ecdh_curves = "P-256" ;TI"7cli = OpenSSL::SSL::SSLSocket.new(tcp_sock, ctx2) ;TI"cli.connect ;TI" ;TI"$p cli.tmp_key.group.curve_name ;TI"3# => "prime256v1" (is an alias for NIST P-256);T: @format0: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"0ctx.ecdh_curves = curve_list -> curve_list ;T0[I" (p1);T@$FI"SSLContext;TcRDoc::NormalClass00PKI ]_mmSSL/SSLContext/cert_store-i.rinu[U:RDoc::Attr[iI"cert_store:ETI"(OpenSSL::SSL::SSLContext#cert_store;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"?An OpenSSL::X509::Store used for certificate verification.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]T&SSL/SSLContext/session_id_context-i.rinu[U:RDoc::Attr[iI"session_id_context:ETI"0OpenSSL::SSL::SSLContext#session_id_context;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"ESets the context in which a session can be reused. This allows ;TI"Msessions for multiple applications to be distinguished, for example, by ;TI" name.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]\SSL/SSLContext/tmp_dh%3d-i.rinu[U:RDoc::AnyMethod[iI" tmp_dh=:ETI"%OpenSSL::SSL::SSLContext#tmp_dh=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"QSets DH parameters used for ephemeral DH key exchange. This is relevant for ;TI"servers only.;To:RDoc::Markup::BlankLineo; ; [I"J+pkey+ is an instance of OpenSSL::PKey::DH. Note that key components ;TI"Ncontained in the key object, if any, are ignored. The server will always ;TI"0generate a new key pair for each handshake.;T@o; ; [I"IAdded in version 3.0. See also the man page SSL_set0_tmp_dh_pkey(3).;T@o; ; [I" Example:;To:RDoc::Markup::Verbatim; [ I"(ctx = OpenSSL::SSL::SSLContext.new ;TI"-ctx.tmp_dh = OpenSSL::DH.generate(2048) ;TI"5svr = OpenSSL::SSL::SSLServer.new(tcp_svr, ctx) ;TI"Thread.new { svr.accept };T: @format0: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"ctx.tmp_dh = pkey ;T0[I" (p1);T@!FI"SSLContext;TcRDoc::NormalClass00PKI ]/;)SSL/SSLContext/session_cache_size%3d-i.rinu[U:RDoc::AnyMethod[iI"session_cache_size=:ETI"1OpenSSL::SSL::SSLContext#session_cache_size=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NSets the session cache size. Returns the previously valid session cache ;TI"Fsize. Zero is used to represent an unlimited session cache size.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"1ctx.session_cache_size=(integer) -> Integer ;T0[I" (p1);T@FI"SSLContext;TcRDoc::NormalClass00PKI ]SH]~~#SSL/SSLContext/add_certificate-i.rinu[U:RDoc::AnyMethod[iI"add_certificate:ETI"-OpenSSL::SSL::SSLContext#add_certificate;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OAdds a certificate to the context. _pkey_ must be a corresponding private ;TI"key with _certificate_.;To:RDoc::Markup::BlankLineo; ; [I"JMultiple certificates with different public key type can be added by ;TI"Qrepeated calls of this method, and OpenSSL will choose the most appropriate ;TI"&certificate during the handshake.;T@o; ; [I"P#cert=, #key=, and #extra_chain_cert= are old accessor methods for setting ;TI"1certificate and internally call this method.;T@S:RDoc::Markup::Heading: leveli: textI"Parameters;To:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I"_certificate_;T; [o; ; [I">A certificate. An instance of OpenSSL::X509::Certificate.;To;;[I" _pkey_;T; [o; ; [I"KThe private key for _certificate_. An instance of OpenSSL::PKey::PKey.;To;;[I"_extra_certs_;T; [o; ; [I"FOptional. An array of OpenSSL::X509::Certificate. When sending a ;TI"Ncertificate chain, the certificates specified by this are sent following ;TI"._certificate_, in the order in the array.;T@S; ; i;I" Example;To:RDoc::Markup::Verbatim; [I"4rsa_cert = OpenSSL::X509::Certificate.new(...) ;TI"(rsa_pkey = OpenSSL::PKey.read(...) ;TI"@ca_intermediate_cert = OpenSSL::X509::Certificate.new(...) ;TI"Ectx.add_certificate(rsa_cert, rsa_pkey, [ca_intermediate_cert]) ;TI" ;TI"ecdsa_cert = ... ;TI"ecdsa_pkey = ... ;TI"another_ca_cert = ... ;TI"Cctx.add_certificate(ecdsa_cert, ecdsa_pkey, [another_ca_cert]);T: @format0: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"Dctx.add_certificate(certificate, pkey [, extra_certs]) -> self ;T0[I"(p1, p2, p3 = v3);T@AFI"SSLContext;TcRDoc::NormalClass00PKI ]qd%SSL/SSLContext/session_remove_cb-i.rinu[U:RDoc::Attr[iI"session_remove_cb:ETI"/OpenSSL::SSL::SSLContext#session_remove_cb;TI"RW;T: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"JA callback invoked when a session is removed from the internal cache.;To:RDoc::Markup::BlankLineo; ; [I">The callback is invoked with an SSLContext and a Session.;T@o; ; [I"JIMPORTANT NOTE: It is currently not possible to use this safely in a ;TI"Mmulti-threaded application. The callback is called inside a global lock ;TI"Aand it can randomly cause deadlock on Ruby thread switching.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]pp.G"SSL/SSLContext/session_new_cb-i.rinu[U:RDoc::Attr[iI"session_new_cb:ETI",OpenSSL::SSL::SSLContext#session_new_cb;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I":A callback invoked when a new session was negotiated.;To:RDoc::Markup::BlankLineo; ; [I"LThe callback is invoked with an SSLSocket. If +false+ is returned the ;TI"5session will be removed from the internal cache.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]5Stt#SSL/SSLContext/verify_callback-i.rinu[U:RDoc::Attr[iI"verify_callback:ETI"-OpenSSL::SSL::SSLContext#verify_callback;TI"RW;T: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"JA callback for additional certificate verification. The callback is ;TI"/invoked for each certificate in the chain.;To:RDoc::Markup::BlankLineo; ; [ I"HThe callback is invoked with two values. _preverify_ok_ indicates ;TI"Iindicates if the verification was passed (+true+) or not (+false+). ;TI"F_store_context_ is an OpenSSL::X509::StoreContext containing the ;TI"/context used for certificate verification.;T@o; ; [I"LIf the callback returns +false+, the chain verification is immediately ;TI"6stopped and a bad_certificate alert is then sent.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]['SSL/SSLContext/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI""OpenSSL::SSL::SSLContext::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Creates a new SSL context.;To:RDoc::Markup::BlankLineo; ; [I"KIf an argument is given, #ssl_version= is called with the value. Note ;TI"Mthat this form is deprecated. New applications should use #min_version= ;TI"$and #max_version= as necessary.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0I"eSSLContext.new -> ctx SSLContext.new(:TLSv1) -> ctx SSLContext.new("SSLv23") -> ctx ;T0[I"(version = nil);T@FI"SSLContext;TcRDoc::NormalClass00PKI ]|:8&SSL/SSLContext/session_cache_size-i.rinu[U:RDoc::AnyMethod[iI"session_cache_size:ETI"0OpenSSL::SSL::SSLContext#session_cache_size;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KReturns the current session cache size. Zero is used to represent an ;TI"unlimited cache size.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"'ctx.session_cache_size -> Integer ;T0[I"();T@FI"SSLContext;TcRDoc::NormalClass00PKI ]oSSL/SSLContext/freeze-i.rinu[U:RDoc::AnyMethod[iI" freeze:ETI"$OpenSSL::SSL::SSLContext#freeze;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"JThis method is called automatically when a new SSLSocket is created. ;TI"GHowever, it is not thread-safe and must be called before creating ;TI"3SSLSocket objects in a multi-threaded program.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"SSLContext;TcRDoc::NormalClass0[I"OpenSSL::SSL::SSLContext;TFI" setup;TPKI ]|9 &SSL/SSLContext/session_cache_mode-i.rinu[U:RDoc::AnyMethod[iI"session_cache_mode:ETI"0OpenSSL::SSL::SSLContext#session_cache_mode;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"$The current session cache mode.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"'ctx.session_cache_mode -> Integer ;T0[I"();T@FI"SSLContext;TcRDoc::NormalClass00PKI ]&SSSL/SSLContext/cert-i.rinu[U:RDoc::Attr[iI" cert:ETI""OpenSSL::SSL::SSLContext#cert;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Context certificate;To:RDoc::Markup::BlankLineo; ; [I"JThe _cert_, _key_, and _extra_chain_cert_ attributes are deprecated. ;TI"7It is recommended to use #add_certificate instead.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]2"SSL/SSLContext/ssl_version%3d-i.rinu[U:RDoc::AnyMethod[iI"ssl_version=:ETI"*OpenSSL::SSL::SSLContext#ssl_version=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"DSets the SSL/TLS protocol version for the context. This forces ;TI"Econnections to use only the specified protocol version. This is ;TI"Cdeprecated and only provided for backwards compatibility. Use ;TI"-#min_version= and #max_version= instead.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" History;To; ; [ I"HAs the name hints, this used to call the SSL_CTX_set_ssl_version() ;TI"Jfunction which sets the SSL method used for connections created from ;TI"Bthe context. As of Ruby/OpenSSL 2.1, this accessor method is ;TI"Aimplemented to call #min_version= and #max_version= instead.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0I"9ctx.ssl_version = :TLSv1 ctx.ssl_version = "SSLv23" ;T0[I" (meth);T@FI"SSLContext;TcRDoc::NormalClass00PKI ]y"SSL/SSLContext/security_level-i.rinu[U:RDoc::AnyMethod[iI"security_level:ETI",OpenSSL::SSL::SSLContext#security_level;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"0Returns the security level for the context.;To:RDoc::Markup::BlankLineo; ; [I"7See also OpenSSL::SSL::SSLContext#security_level=.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"#ctx.security_level -> Integer ;T0[I"();T@FI"SSLContext;TcRDoc::NormalClass00PKI ]@DxxSSL/SSLContext/client_ca-i.rinu[U:RDoc::Attr[iI"client_ca:ETI"'OpenSSL::SSL::SSLContext#client_ca;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LA certificate or Array of certificates that will be sent to the client.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]44"SSL/SSLContext/alpn_select_cb-i.rinu[U:RDoc::Attr[iI"alpn_select_cb:ETI",OpenSSL::SSL::SSLContext#alpn_select_cb;TI"RW;T: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"KA callback invoked on the server side when the server needs to select ;TI"Ma protocol from the list sent by the client. Supported in OpenSSL 1.0.2 ;TI"Land higher. The callback must return a protocol of those advertised by ;TI"Ithe client. If none is acceptable, raising an error in the callback ;TI"Lwill cause the handshake to fail. Not setting this callback explicitly ;TI"Kmeans not supporting the ALPN extension on the server - any protocols ;TI".advertised by the client will be ignored.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;T@o:RDoc::Markup::Verbatim; [ I"0ctx.alpn_select_cb = lambda do |protocols| ;TI". # inspect the protocols and select one ;TI" protocols.first ;TI"end;T: @format0: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]RII!SSL/SSLContext/servername_cb-i.rinu[U:RDoc::Attr[iI"servername_cb:ETI"+OpenSSL::SSL::SSLContext#servername_cb;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HA callback invoked at connect time to distinguish between multiple ;TI"server names.;To:RDoc::Markup::BlankLineo; ; [I"GThe callback is invoked with an SSLSocket and a server name. The ;TI"Ccallback must return an SSLContext for the server name or nil.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]bGGSSL/SSLContext/options-i.rinu[U:RDoc::AnyMethod[iI" options:ETI"%OpenSSL::SSL::SSLContext#options;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I""Gets various OpenSSL options.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"SSLContext;TcRDoc::NormalClass00PKI ]z+%#rr"SSL/SSLContext/session_get_cb-i.rinu[U:RDoc::Attr[iI"session_get_cb:ETI",OpenSSL::SSL::SSLContext#session_get_cb;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MA callback invoked on a server when a session is proposed by the client ;TI"Gbut the session could not be found in the server's internal cache.;To:RDoc::Markup::BlankLineo; ; [I"EThe callback is invoked with the SSLSocket and session id. The ;TI":callback may return a Session from an external cache.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]Y]"SSL/SSLContext/cdesc-SSLContext.rinu[U:RDoc::NormalClass[iI"SSLContext:ETI"OpenSSL::SSL::SSLContext;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0o;;[o:RDoc::Markup::Paragraph;[I"JAn SSLContext is used to set various options regarding certificates, ;TI"Halgorithms, verification, session caching, etc. The SSLContext is ;TI"!used to create an SSLSocket.;To:RDoc::Markup::BlankLineo; ;[I"DAll attributes must be set before creating an SSLSocket as the ;TI")SSLContext will be frozen afterward.;T; I"ext/openssl/ossl_ssl.c;T; 0; 0; 0[[ I"alpn_protocols;TI"RW;T: privateFI"ext/openssl/ossl_ssl.c;T[ I"alpn_select_cb;T@; F@ [ I" ca_file;T@; F@ [ I" ca_path;T@; F@ [ I" cert;T@; F@ [ I"cert_store;T@; F@ [ I"client_ca;T@; F@ [ I"client_cert_cb;T@; F@ [ I"extra_chain_cert;T@; F@ [ I"key;T@; F@ [ I"npn_protocols;T@; F@ [ I"npn_select_cb;T@; F@ [ I"renegotiation_cb;T@; F@ [ I"servername_cb;T@; FI"#ext/openssl/lib/openssl/ssl.rb;T[ I"session_get_cb;T@; F@ [ I"session_id_context;T@; F@ [ I"session_new_cb;T@; F@ [ I"session_remove_cb;T@; F@ [ I"ssl_timeout;T@; F@ [ I" timeout;T@; F@ [ I"tmp_dh_callback;T@; F@;[ I"verify_callback;T@; F@ [ I"verify_depth;T@; F@ [ I"verify_hostname;T@; F@ [ I"verify_mode;T@; F@ [U:RDoc::Constant[iI"DEFAULT_2048;TI"+OpenSSL::SSL::SSLContext::DEFAULT_2048;T: public0o;;[; @; 0@@cRDoc::NormalClass0U;[iI"METHODS_MAP;TI"*OpenSSL::SSL::SSLContext::METHODS_MAP;T; 0o;;[; @; 0@@@Y0U;[iI" METHODS;TI"&OpenSSL::SSL::SSLContext::METHODS;T;0o;;[o; ;[I"KThe list of available SSL/TLS methods. This constant is only provided ;TI"!for backwards compatibility.;T; @; 0@@@Y0U;[iI"SESSION_CACHE_OFF;TI"0OpenSSL::SSL::SSLContext::SESSION_CACHE_OFF;T;0o;;[o; ;[I",No session caching for client or server;T; @; 0@@@Y0U;[iI"SESSION_CACHE_CLIENT;TI"3OpenSSL::SSL::SSLContext::SESSION_CACHE_CLIENT;T;0o;;[o; ;[I"3Client sessions are added to the session cache;T; @; 0@@@Y0U;[iI"SESSION_CACHE_SERVER;TI"3OpenSSL::SSL::SSLContext::SESSION_CACHE_SERVER;T;0o;;[o; ;[I"3Server sessions are added to the session cache;T; @; 0@@@Y0U;[iI"SESSION_CACHE_BOTH;TI"1OpenSSL::SSL::SSLContext::SESSION_CACHE_BOTH;T;0o;;[o; ;[I"CBoth client and server sessions are added to the session cache;T; @; 0@@@Y0U;[iI" SESSION_CACHE_NO_AUTO_CLEAR;TI":OpenSSL::SSL::SSLContext::SESSION_CACHE_NO_AUTO_CLEAR;T;0o;;[o; ;[ I"JNormally the session cache is checked for expired sessions every 255 ;TI"Mconnections. Since this may lead to a delay that cannot be controlled, ;TI"Gthe automatic flushing may be disabled and #flush_sessions can be ;TI"called explicitly.;T; @; 0@@@Y0U;[iI"%SESSION_CACHE_NO_INTERNAL_LOOKUP;TI"?OpenSSL::SSL::SSLContext::SESSION_CACHE_NO_INTERNAL_LOOKUP;T;0o;;[o; ;[I"IAlways perform external lookups of sessions even if they are in the ;TI"internal cache.;T@o; ;[I"'This flag has no effect on clients;T; @; 0@@@Y0U;[iI"$SESSION_CACHE_NO_INTERNAL_STORE;TI">OpenSSL::SSL::SSLContext::SESSION_CACHE_NO_INTERNAL_STORE;T;0o;;[o; ;[I">Never automatically store sessions in the internal store.;T; @; 0@@@Y0U;[iI"SESSION_CACHE_NO_INTERNAL;TI"8OpenSSL::SSL::SSLContext::SESSION_CACHE_NO_INTERNAL;T;0o;;[o; ;[I"7Enables both SESSION_CACHE_NO_INTERNAL_LOOKUP and ;TI"%SESSION_CACHE_NO_INTERNAL_STORE.;T; @; 0@@@Y0[[[I" class;T[[;[[:protected[[; [[I"new;T@;[I" instance;T[[;[[;[[; [[I"add_certificate;T@ [I" ciphers;T@ [I" ciphers=;T@ [I"ecdh_curves=;T@ [I"enable_fallback_scsv;T@ [I"flush_sessions;T@ [I" freeze;T@ [I"max_version=;T@;[I"min_version=;T@;[I" options;T@ [I" options=;T@ [I"security_level;T@ [I"security_level=;T@ [I"session_add;T@ [I"session_cache_mode;T@ [I"session_cache_mode=;T@ [I"session_cache_size;T@ [I"session_cache_size=;T@ [I"session_cache_stats;T@ [I"session_remove;T@ [I"set_minmax_proto_version;T@ [I"set_params;T@;[I" setup;T@ [I"ssl_version=;T@;[I" tmp_dh=;T@ [[U:RDoc::Context::Section[i0o;;[; 0; 0[I"#ext/openssl/lib/openssl/ssl.rb;TI"ext/openssl/ossl_ssl.c;TI"lib/net/http.rb;TI"OpenSSL::SSL;TcRDoc::NormalModulePKI ]M_M22!SSL/SSLContext/npn_protocols-i.rinu[U:RDoc::Attr[iI"npn_protocols:ETI"+OpenSSL::SSL::SSLContext#npn_protocols;TI"RW;T: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"GAn Enumerable of Strings. Each String represents a protocol to be ;TI"Eadvertised as the list of supported protocols for Next Protocol ;TI"GNegotiation. Supported in OpenSSL 1.0.1 and higher. Has no effect ;TI"Gon the client side. If not set explicitly, the NPN extension will ;TI"0not be sent by the server in the handshake.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;T@o:RDoc::Markup::Verbatim; [I"/ctx.npn_protocols = ["http/1.1", "spdy/2"];T: @format0: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]yqYYSSL/SSLContext/ssl_timeout-i.rinu[U:RDoc::Attr[iI"ssl_timeout:ETI")OpenSSL::SSL::SSLContext#ssl_timeout;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I")Maximum session lifetime in seconds.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ] QQSSL/SSLContext/timeout-i.rinu[U:RDoc::Attr[iI" timeout:ETI"%OpenSSL::SSL::SSLContext#timeout;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I")Maximum session lifetime in seconds.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]vs'SSL/SSLContext/session_cache_stats-i.rinu[U:RDoc::AnyMethod[iI"session_cache_stats:ETI"1OpenSSL::SSL::SSLContext#session_cache_stats;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"2Returns a Hash containing the following keys:;To:RDoc::Markup::BlankLineo:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I" :accept;T; [o; ; [I"8Number of started SSL/TLS handshakes in server mode;To;;[I":accept_good;T; [o; ; [I":Number of established SSL/TLS sessions in server mode;To;;[I":accept_renegotiate;T; [o; ; [I"2Number of start renegotiations in server mode;To;;[I":cache_full;T; [o; ; [I"?Number of sessions that were removed due to cache overflow;To;;[I":cache_hits;T; [o; ; [I".Number of successfully reused connections;To;;[I":cache_misses;T; [o; ; [I"@Number of sessions proposed by clients that were not found ;TI"in the cache;To;;[I":cache_num;T; [o; ; [I"5Number of sessions in the internal session cache;To;;[I" :cb_hits;T; [o; ; [I"DNumber of sessions retrieved from the external cache in server ;TI" mode;To;;[I" :connect;T; [o; ; [I"8Number of started SSL/TLS handshakes in client mode;To;;[I":connect_good;T; [o; ; [I":Number of established SSL/TLS sessions in client mode;To;;[I":connect_renegotiate;T; [o; ; [I"2Number of start renegotiations in client mode;To;;[I":timeouts;T; [o; ; [I"CNumber of sessions proposed by clients that were found in the ;TI"*cache but had expired due to timeouts;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"%ctx.session_cache_stats -> Hash ;T0[I"();T@hFI"SSLContext;TcRDoc::NormalClass00PKI ]n..!SSL/SSLContext/npn_select_cb-i.rinu[U:RDoc::Attr[iI"npn_select_cb:ETI"+OpenSSL::SSL::SSLContext#npn_select_cb;TI"RW;T: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"KA callback invoked on the client side when the client needs to select ;TI"Ma protocol from the list sent by the server. Supported in OpenSSL 1.0.1 ;TI"Jand higher. The client MUST select a protocol of those advertised by ;TI"Ithe server. If none is acceptable, raising an error in the callback ;TI"Lwill cause the handshake to fail. Not setting this callback explicitly ;TI"Jmeans not supporting the NPN extension on the client - any protocols ;TI".advertised by the server will be ignored.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;T@o:RDoc::Markup::Verbatim; [ I"/ctx.npn_select_cb = lambda do |protocols| ;TI". # inspect the protocols and select one ;TI" protocols.first ;TI"end;T: @format0: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]O|| SSL/SSLContext/verify_depth-i.rinu[U:RDoc::Attr[iI"verify_depth:ETI"*OpenSSL::SSL::SSLContext#verify_depth;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"JNumber of CA certificates to walk when verifying a certificate chain.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]RKKSSL/SSLContext/options%3d-i.rinu[U:RDoc::AnyMethod[iI" options=:ETI"&OpenSSL::SSL::SSLContext#options=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I""Sets various OpenSSL options.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@FI"SSLContext;TcRDoc::NormalClass00PKI ].ySSL/SSLContext/verify_mode-i.rinu[U:RDoc::Attr[iI"verify_mode:ETI")OpenSSL::SSL::SSLContext#verify_mode;TI"RW;T: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"Session verification mode.;To:RDoc::Markup::BlankLineo; ; [I"CValid modes are VERIFY_NONE, VERIFY_PEER, VERIFY_CLIENT_ONCE, ;TI"The path to a file containing a PEM-format CA certificate;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]BiLJSSL/SSLContext/session_add-i.rinu[U:RDoc::AnyMethod[iI"session_add:ETI")OpenSSL::SSL::SSLContext#session_add;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I")Adds _session_ to the session cache.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I".ctx.session_add(session) -> true | false ;T0[I" (p1);T@FI"SSLContext;TcRDoc::NormalClass00PKI ]c577$SSL/SSLContext/extra_chain_cert-i.rinu[U:RDoc::Attr[iI"extra_chain_cert:ETI".OpenSSL::SSL::SSLContext#extra_chain_cert;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HAn Array of extra X509 certificates to be added to the certificate ;TI" chain.;To:RDoc::Markup::BlankLineo; ; [I"JThe _cert_, _key_, and _extra_chain_cert_ attributes are deprecated. ;TI"7It is recommended to use #add_certificate instead.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]q3$"SSL/SSLContext/session_remove-i.rinu[U:RDoc::AnyMethod[iI"session_remove:ETI",OpenSSL::SSL::SSLContext#session_remove;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Removes _session_ from the session cache.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"1ctx.session_remove(session) -> true | false ;T0[I" (p1);T@FI"SSLContext;TcRDoc::NormalClass00PKI ]GO0SSL/SSLContext/ciphers-i.rinu[U:RDoc::AnyMethod[iI" ciphers:ETI"%OpenSSL::SSL::SSLContext#ciphers;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I";The list of cipher suites configured for this context.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I";ctx.ciphers => [[name, version, bits, alg_bits], ...] ;T0[I"();T@FI"SSLContext;TcRDoc::NormalClass00PKI ]>L"SSL/SSLContext/max_version%3d-i.rinu[U:RDoc::AnyMethod[iI"max_version=:ETI"*OpenSSL::SSL::SSLContext#max_version=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"ISets the upper bound of the supported SSL/TLS protocol version. See ;TI"+#min_version= for the possible values.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0I"dctx.max_version = OpenSSL::SSL::TLS1_2_VERSION ctx.max_version = :TLS1_2 ctx.max_version = nil ;T0[I"(version);T@FI"SSLContext;TcRDoc::NormalClass00PKI ]x fSSL/SSLContext/key-i.rinu[U:RDoc::Attr[iI"key:ETI"!OpenSSL::SSL::SSLContext#key;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Context private key;To:RDoc::Markup::BlankLineo; ; [I"JThe _cert_, _key_, and _extra_chain_cert_ attributes are deprecated. ;TI"7It is recommended to use #add_certificate instead.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]=?%SSL/SSLContext/security_level%3d-i.rinu[U:RDoc::AnyMethod[iI"security_level=:ETI"-OpenSSL::SSL::SSLContext#security_level=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"RSets the security level for the context. OpenSSL limits parameters according ;TI"Nto the level. The "parameters" include: ciphersuites, curves, key sizes, ;TI"Pcertificate signature algorithms, protocol version and so on. For example, ;TI"Llevel 1 rejects parameters offering below 80 bits of security, such as ;TI"Kciphersuites using MD5 for the MAC or RSA keys shorter than 1024 bits.;To:RDoc::Markup::BlankLineo; ; [I"NNote that attempts to set such parameters with insufficient security are ;TI"5also blocked. You need to lower the level first.;T@o; ; [I"PThis feature is not supported in OpenSSL < 1.1.0, and setting the level to ;TI"Nother than 0 will raise NotImplementedError. Level 0 means everything is ;TI"Bpermitted, the same behavior as previous versions of OpenSSL.;T@o; ; [I"BSee the manpage of SSL_CTX_set_security_level(3) for details.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I""ctx.security_level = integer ;T0[I" (p1);T@FI"SSLContext;TcRDoc::NormalClass00PKI ]㣱"SSL/SSLContext/flush_sessions-i.rinu[U:RDoc::AnyMethod[iI"flush_sessions:ETI",OpenSSL::SSL::SSLContext#flush_sessions;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HRemoves sessions in the internal cache that have expired at _time_.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"&ctx.flush_sessions(time) -> self ;T0[I"(p1 = v1);T@FI"SSLContext;TcRDoc::NormalClass00PKI ]'SSL/SSLContext/ca_path-i.rinu[U:RDoc::Attr[iI" ca_path:ETI"%OpenSSL::SSL::SSLContext#ca_path;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"FThe path to a directory containing CA certificates in PEM format.;To:RDoc::Markup::BlankLineo; ; [I"=Files are looked up by subject's X509 name's hash value.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]U>>#SSL/SSLContext/verify_hostname-i.rinu[U:RDoc::Attr[iI"verify_hostname:ETI"-OpenSSL::SSL::SSLContext#verify_hostname;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GWhether to check the server certificate is valid for the hostname.;To:RDoc::Markup::BlankLineo; ; [I"LIn order to make this work, verify_mode must be set to VERIFY_PEER and ;TI"Lthe server hostname must be given by OpenSSL::SSL::SSLSocket#hostname=.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]A%ϭ(SSL/SSLContext/enable_fallback_scsv-i.rinu[U:RDoc::AnyMethod[iI"enable_fallback_scsv:ETI"2OpenSSL::SSL::SSLContext#enable_fallback_scsv;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"2Activate TLS_FALLBACK_SCSV for this context. ;TI"See RFC 7507.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"'ctx.enable_fallback_scsv() => nil ;T0[I"();T@FI"SSLContext;TcRDoc::NormalClass00PKI ]€$SSL/SSLContext/renegotiation_cb-i.rinu[U:RDoc::Attr[iI"renegotiation_cb:ETI".OpenSSL::SSL::SSLContext#renegotiation_cb;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DA callback invoked whenever a new handshake is initiated on an ;TI"Kestablished connection. May be used to disable renegotiation entirely.;To:RDoc::Markup::BlankLineo; ; [ I"GThe callback is invoked with the active SSLSocket. The callback's ;TI"Jreturn value is ignored. A normal return indicates "approval" of the ;TI"Jrenegotiation and will continue the process. To forbid renegotiation ;TI"Gand to cancel the process, raise an exception within the callback.;T@S:RDoc::Markup::Heading: leveli: textI"!Disable client renegotiation;T@o; ; [I"DWhen running a server, it is often desirable to disable client ;TI"Lrenegotiation entirely. You may use a callback as follows to implement ;TI"this feature:;T@o:RDoc::Markup::Verbatim; [I",ctx.renegotiation_cb = lambda do |ssl| ;TI"; raise RuntimeError, "Client renegotiation disabled" ;TI"end;T: @format0: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0F@#I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]9 SSL/SSLContext/ciphers%3d-i.rinu[U:RDoc::AnyMethod[iI" ciphers=:ETI"&OpenSSL::SSL::SSLContext#ciphers=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RSets the list of available cipher suites for this context. Note in a server ;TI"Qcontext some ciphers require the appropriate certificates. For example, an ;TI"NRSA cipher suite can only be chosen when an RSA certificate is available.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"xctx.ciphers = "cipher1:cipher2:..." ctx.ciphers = [name, ...] ctx.ciphers = [[name, version, bits, alg_bits], ...] ;T0[I" (p1);T@FI"SSLContext;TcRDoc::NormalClass00PKI ]Q"SSL/SSLContext/min_version%3d-i.rinu[U:RDoc::AnyMethod[iI"min_version=:ETI"*OpenSSL::SSL::SSLContext#min_version=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"ISets the lower bound on the supported SSL/TLS protocol version. The ;TI";version may be specified by an integer constant named ;TI"KOpenSSL::SSL::*_VERSION, a Symbol, or +nil+ which means "any version".;To:RDoc::Markup::BlankLineo; ; [I"IBe careful that you don't overwrite OpenSSL::SSL::OP_NO_{SSL,TLS}v* ;TI"@options by #options= once you have called #min_version= or ;TI"#max_version=.;T@S:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I"(ctx = OpenSSL::SSL::SSLContext.new ;TI"4ctx.min_version = OpenSSL::SSL::TLS1_1_VERSION ;TI"4ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION ;TI" ;TI"7sock = OpenSSL::SSL::SSLSocket.new(tcp_sock, ctx) ;TI"Jsock.connect # Initiates a connection using either TLS 1.1 or TLS 1.2;T: @format0: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0I"dctx.min_version = OpenSSL::SSL::TLS1_2_VERSION ctx.min_version = :TLS1_2 ctx.min_version = nil ;T0[I"(version);T@ FI"SSLContext;TcRDoc::NormalClass00PKI ]Zea#SSL/SSLContext/tmp_dh_callback-i.rinu[U:RDoc::Attr[iI"tmp_dh_callback:ETI"-OpenSSL::SSL::SSLContext#tmp_dh_callback;TI"RW;T: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"MA callback invoked when DH parameters are required for ephemeral DH key ;TI"exchange.;To:RDoc::Markup::BlankLineo; ; [I"3The callback is invoked with the SSLSocket, a ;TI"Cflag indicating the use of an export cipher and the keylength ;TI"required.;T@o; ; [I"KThe callback must return an OpenSSL::PKey::DH instance of the correct ;TI"key length.;T@o; ; [I"<Deprecated in version 3.0. Use #tmp_dh= instead.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLContext;TcRDoc::NormalClass0PKI ]f{x,SSL/SSLContext/set_minmax_proto_version-i.rinu[U:RDoc::AnyMethod[iI"set_minmax_proto_version:ETI"6OpenSSL::SSL::SSLContext#set_minmax_proto_version;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QSets the minimum and maximum supported protocol versions. See #min_version= ;TI"and #max_version=.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"3ctx.set_minmax_proto_version(min, max) -> nil ;T0[I" (p1, p2);T@FI"SSLContext;TcRDoc::NormalClass00PKI ]>  6SSL/SSLErrorWaitReadable/cdesc-SSLErrorWaitReadable.rinu[U:RDoc::NormalClass[iI"SSLErrorWaitReadable:ETI"'OpenSSL::SSL::SSLErrorWaitReadable;TI"OpenSSL::SSL::SSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[I"IO::WaitReadable;To;;[; @; 0I"ext/openssl/ossl_ssl.c;T[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_ssl.c;TI"OpenSSL::SSL;TcRDoc::NormalModulePKI ]y,.SSL/Session/SessionError/cdesc-SessionError.rinu[U:RDoc::NormalClass[iI"SessionError:ETI"(OpenSSL::SSL::Session::SessionError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"#ext/openssl/ossl_ssl_session.c;TI"OpenSSL::SSL::Session;TcRDoc::NormalClassPKI ]^)SSL/Session/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::SSL::Session::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"SCreates a new Session object from an instance of SSLSocket or DER/PEM encoded ;TI" String.;T: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below0I"GSession.new(ssl_socket) -> Session Session.new(string) -> Session ;T0[I" (p1);T@FI" Session;TcRDoc::NormalClass00PKI ]kTTSSL/Session/id-i.rinu[U:RDoc::AnyMethod[iI"id:ETI"OpenSSL::SSL::Session#id;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Returns the Session ID.;T: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below0I"session.id -> String ;T0[I"();T@FI" Session;TcRDoc::NormalClass00PKI ]]gSSL/Session/timeout-i.rinu[U:RDoc::AnyMethod[iI" timeout:ETI""OpenSSL::SSL::Session#timeout;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HReturns the timeout value set for the session, in seconds from the ;TI"established time.;T: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below0I" session.timeout -> Integer ;T0[I"();T@FI" Session;TcRDoc::NormalClass00PKI ]χSSL/Session/to_pem-i.rinu[U:RDoc::AnyMethod[iI" to_pem:ETI"!OpenSSL::SSL::Session#to_pem;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"CReturns a PEM encoded String that contains the Session object.;T: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below0I"session.to_pem -> String ;T0[I"();T@FI" Session;TcRDoc::NormalClass00PKI ]dSSL/Session/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"!OpenSSL::SSL::Session#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"EReturns an ASN1 encoded String that contains the Session object.;T: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below0I"session.to_der -> String ;T0[I"();T@FI" Session;TcRDoc::NormalClass00PKI ]BSSL/Session/cdesc-Session.rinu[U:RDoc::NormalClass[iI" Session:ETI"OpenSSL::SSL::Session;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"#ext/openssl/ossl_ssl_session.c;T[I" instance;T[[; [[; [[; [[I"==;T@[I"id;T@[I"initialize_copy;T@[I" time;T@[I" time=;T@[I" timeout;T@[I" timeout=;T@[I" to_der;T@[I" to_pem;T@[I" to_text;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_ssl.c;TI"OpenSSL::SSL;TcRDoc::NormalModulePKI ]< SSL/Session/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"*OpenSSL::SSL::Session#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Session;TcRDoc::NormalClass00PKI ]wwwSSL/Session/time-i.rinu[U:RDoc::AnyMethod[iI" time:ETI"OpenSSL::SSL::Session#time;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I";Returns the time at which the session was established.;T: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below0I"session.time -> Time ;T0[I"();T@FI" Session;TcRDoc::NormalClass00PKI ]DSSL/Session/to_text-i.rinu[U:RDoc::AnyMethod[iI" to_text:ETI""OpenSSL::SSL::Session#to_text;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MShows everything in the Session object. This is for diagnostic purposes.;T: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below0I"session.to_text -> String ;T0[I"();T@FI" Session;TcRDoc::NormalClass00PKI ]P`SSL/Session/%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI"OpenSSL::SSL::Session#==;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"CReturns +true+ if the two Session is the same, +false+ if not.;T: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below0I"%session1 == session2 -> boolean ;T0[I" (p1);T@FI" Session;TcRDoc::NormalClass00PKI ]ExxSSL/Session/time%3d-i.rinu[U:RDoc::AnyMethod[iI" time=:ETI" OpenSSL::SSL::Session#time=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"CSets start time of the session. Time resolution is in seconds.;T: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below0I"0session.time = time session.time = integer ;T0[I" (p1);T@FI" Session;TcRDoc::NormalClass00PKI ]1V}SSL/Session/timeout%3d-i.rinu[U:RDoc::AnyMethod[iI" timeout=:ETI"#OpenSSL::SSL::Session#timeout=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"8Sets how long until the session expires in seconds.;T: @fileI"#ext/openssl/ossl_ssl_session.c;T:0@omit_headings_from_table_of_contents_below0I"session.timeout = integer ;T0[I" (p1);T@FI" Session;TcRDoc::NormalClass00PKI ].11$SSL/verify_certificate_identity-c.rinu[U:RDoc::AnyMethod[iI" verify_certificate_identity:ETI".OpenSSL::SSL::verify_certificate_identity;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I"(cert, hostname);T@ FI"SSL;TcRDoc::NormalModule00PKI ]X]h}}SSL/cdesc-SSL.rinu[U:RDoc::NormalModule[iI"SSL:ETI"OpenSSL::SSL;T0o:RDoc::Markup::Document: @parts[o;;[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0o;;[o:RDoc::Markup::Paragraph;[ I"DUse SSLContext to set up the parameters for a TLS (former SSL) ;TI"Gconnection. Both client and server TLS connections are supported, ;TI"ISSLSocket and SSLServer may be used in conjunction with an instance ;TI")of SSLContext to set up connections.;T; I"ext/openssl/ossl_ssl.c;T; 0o;;[; I"#ext/openssl/ossl_ssl_session.c;T; 0; 0; 0[[?U:RDoc::Constant[iI"VERIFY_NONE;TI"OpenSSL::SSL::VERIFY_NONE;T: public0o;;[; @; 0@@cRDoc::NormalModule0U; [iI"VERIFY_PEER;TI"OpenSSL::SSL::VERIFY_PEER;T; 0o;;[; @; 0@@@"0U; [iI" VERIFY_FAIL_IF_NO_PEER_CERT;TI".OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT;T; 0o;;[; @; 0@@@"0U; [iI"VERIFY_CLIENT_ONCE;TI"%OpenSSL::SSL::VERIFY_CLIENT_ONCE;T; 0o;;[; @; 0@@@"0U; [iI" OP_ALL;TI"OpenSSL::SSL::OP_ALL;T; 0o;;[; @; 0@@@"0U; [iI"OP_CLEANSE_PLAINTEXT;TI"'OpenSSL::SSL::OP_CLEANSE_PLAINTEXT;T; 0o;;[; @; 0@@@"0U; [iI"OP_LEGACY_SERVER_CONNECT;TI"+OpenSSL::SSL::OP_LEGACY_SERVER_CONNECT;T; 0o;;[; @; 0@@@"0U; [iI"OP_ENABLE_KTLS;TI"!OpenSSL::SSL::OP_ENABLE_KTLS;T; 0o;;[; @; 0@@@"0U; [iI"OP_TLSEXT_PADDING;TI"$OpenSSL::SSL::OP_TLSEXT_PADDING;T; 0o;;[; @; 0@@@"0U; [iI"OP_SAFARI_ECDHE_ECDSA_BUG;TI",OpenSSL::SSL::OP_SAFARI_ECDHE_ECDSA_BUG;T; 0o;;[; @; 0@@@"0U; [iI"OP_IGNORE_UNEXPECTED_EOF;TI"+OpenSSL::SSL::OP_IGNORE_UNEXPECTED_EOF;T; 0o;;[; @; 0@@@"0U; [iI""OP_ALLOW_CLIENT_RENEGOTIATION;TI"0OpenSSL::SSL::OP_ALLOW_CLIENT_RENEGOTIATION;T; 0o;;[; @; 0@@@"0U; [iI"OP_DISABLE_TLSEXT_CA_NAMES;TI"-OpenSSL::SSL::OP_DISABLE_TLSEXT_CA_NAMES;T; 0o;;[; @; 0@@@"0U; [iI"OP_ALLOW_NO_DHE_KEX;TI"&OpenSSL::SSL::OP_ALLOW_NO_DHE_KEX;T; 0o;;[; @; 0@@@"0U; [iI"#OP_DONT_INSERT_EMPTY_FRAGMENTS;TI"1OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS;T; 0o;;[; @; 0@@@"0U; [iI"OP_NO_TICKET;TI"OpenSSL::SSL::OP_NO_TICKET;T; 0o;;[; @; 0@@@"0U; [iI".OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION;TI" nil ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]V+)) SSL/SSLSocket/cdesc-SSLSocket.rinu[U:RDoc::NormalClass[iI"SSLSocket:ETI"OpenSSL::SSL::SSLSocket;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0o;;[; I"ext/openssl/ossl_ssl.c;T; 0; 0; 0[ [ I" context;TI"R;T: privateFI"#ext/openssl/lib/openssl/ssl.rb;T[ I" hostname;T@; F@[ I"io;T@; F@[ I"sync_close;TI"RW;T; F@[ I" to_io;T@; F@[[[I"Buffering;To;;[; @; 0@[I"SocketForwarder;To;;[; @; 0@[[I" class;T[[: public[[:protected[[; [[I"new;TI"ext/openssl/ossl_ssl.c;T[I" open;T@[I" instance;T[[; [[; [[; ['[I" accept;T@6[I"accept_nonblock;T@6[I"alpn_protocol;T@6[I" cert;T@6[I" cipher;T@6[I"client_ca;T@6[I"client_cert_cb;T@[I" connect;T@6[I"connect_nonblock;T@6[I"finished_message;T@6[I"hostname=;T@6[I"npn_protocol;T@6[I"peer_cert;T@6[I"peer_cert_chain;T@6[I"peer_finished_message;T@6[I" pending;T@6[I"post_connection_check;T@[I" session;T@[I" session=;T@6[I"session_get_cb;T@[I"session_new_cb;T@[I"session_reused?;T@6[I"ssl_version;T@6[I" state;T@6[I" stop;T@6[I" sysclose;T@[I" sysread;T@6[I"sysread_nonblock;T@6[I" syswrite;T@6[I"syswrite_nonblock;T@6[I"tmp_dh_callback;T@[I" tmp_key;T@6[I"using_anon_cipher?;T@[I"verify_result;T@6[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"#ext/openssl/lib/openssl/ssl.rb;TI"ext/openssl/ossl_ssl.c;TI"OpenSSL::SSL;TcRDoc::NormalModulePKI ]r0SSL/SSLSocket/hostname%3d-i.rinu[U:RDoc::AnyMethod[iI"hostname=:ETI"&OpenSSL::SSL::SSLSocket#hostname=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HSets the server hostname used for SNI. This needs to be set before ;TI"SSLSocket#connect.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I")ssl.hostname = hostname -> hostname ;T0[I" (p1);T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]cSSL/SSLSocket/pending-i.rinu[U:RDoc::AnyMethod[iI" pending:ETI"$OpenSSL::SSL::SSLSocket#pending;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DThe number of bytes that are immediately available for reading.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"ssl.pending => Integer ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]1[9SSL/SSLSocket/session-i.rinu[U:RDoc::AnyMethod[iI" session:ETI"$OpenSSL::SSL::SSLSocket#session;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LReturns the SSLSession object currently used, or nil if the session is ;TI"not established.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0I"ssl.session -> aSession ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]9#SSL/SSLSocket/connect_nonblock-i.rinu[U:RDoc::AnyMethod[iI"connect_nonblock:ETI"-OpenSSL::SSL::SSLSocket#connect_nonblock;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"HInitiates the SSL/TLS handshake as a client in non-blocking manner.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"!# emulates blocking connect ;TI" begin ;TI" ssl.connect_nonblock ;TI"rescue IO::WaitReadable ;TI" IO.select([s2]) ;TI" retry ;TI"rescue IO::WaitWritable ;TI" IO.select(nil, [s2]) ;TI" retry ;TI" end ;T: @format0o; ; [ I"OBy specifying a keyword argument _exception_ to +false+, you can indicate ;TI"Cthat connect_nonblock should not raise an IO::WaitReadable or ;TI"KIO::WaitWritable exception, but return the symbol +:wait_readable+ or ;TI"+:wait_writable+ instead.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"-ssl.connect_nonblock([options]) => self ;T0[I"(p1 = {});T@!FI"SSLSocket;TcRDoc::NormalClass00PKI ]J/X<``SSL/SSLSocket/context-i.rinu[U:RDoc::Attr[iI" context:ETI"$OpenSSL::SSL::SSLSocket#context;TI"R;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"3The SSLContext object used in this connection.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLSocket;TcRDoc::NormalClass0PKI ] SSL/SSLSocket/cipher-i.rinu[U:RDoc::AnyMethod[iI" cipher:ETI"#OpenSSL::SSL::SSLSocket#cipher;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NReturns the cipher suite actually used in the current session, or nil if ;TI"%no session has been established.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I":ssl.cipher -> nil or [name, version, bits, alg_bits] ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]`P!SSL/SSLSocket/session_new_cb-i.rinu[U:RDoc::AnyMethod[iI"session_new_cb:ETI"+OpenSSL::SSL::SSLSocket#session_new_cb;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"SSLSocket;TcRDoc::NormalClass00PKI ]7__SSL/SSLSocket/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"!OpenSSL::SSL::SSLSocket::new;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"OCreates a new SSL socket from _io_ which must be a real IO object (not an ;TI"1IO-like object that responds to read/write).;To:RDoc::Markup::BlankLineo; ; [I"LIf _ctx_ is provided the SSL Sockets initial params will be taken from ;TI"the context.;T@o; ; [I"BThe OpenSSL::Buffering module provides additional IO methods.;T@o; ; [I"@This method will freeze the SSLContext if one is provided; ;TI"Khowever, session management is still allowed in the frozen SSLContext.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"JSSLSocket.new(io) => aSSLSocket SSLSocket.new(io, ctx) => aSSLSocket ;T0[I"(p1, p2 = v2);T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]GAASSL/SSLSocket/io-i.rinu[U:RDoc::Attr[iI"io:ETI"OpenSSL::SSL::SSLSocket#io;TI"R;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"The underlying IO object.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLSocket;TcRDoc::NormalClass0PKI ]줢SSL/SSLSocket/hostname-i.rinu[U:RDoc::Attr[iI" hostname:ETI"%OpenSSL::SSL::SSLSocket#hostname;TI"R;T: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0F@ I"OpenSSL::SSL::SSLSocket;TcRDoc::NormalClass0PKI ]SkSSL/SSLSocket/tmp_key-i.rinu[U:RDoc::AnyMethod[iI" tmp_key:ETI"$OpenSSL::SSL::SSLSocket#tmp_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"FReturns the ephemeral key used in case of forward secrecy cipher.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I" ssl.tmp_key => PKey or nil ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]QnnSSL/SSLSocket/cert-i.rinu[U:RDoc::AnyMethod[iI" cert:ETI"!OpenSSL::SSL::SSLSocket#cert;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"3The X509 certificate for this socket endpoint.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"ssl.cert => cert or nil ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]gSSL/SSLSocket/client_ca-i.rinu[U:RDoc::AnyMethod[iI"client_ca:ETI"&OpenSSL::SSL::SSLSocket#client_ca;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"EReturns the list of client CAs. Please note that in contrast to ;TI"ISSLContext#client_ca= no array of X509::Certificate is returned but ;TI"AX509::Name instances of the CA's subject distinguished name.;To:RDoc::Markup::BlankLineo; ; [I"DIn server mode, returns the list set by SSLContext#client_ca=. ;TI"IIn client mode, returns the list of client CAs sent from the server.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"&ssl.client_ca => [x509name, ...] ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]sSSL/SSLSocket/session%3d-i.rinu[U:RDoc::AnyMethod[iI" session=:ETI"%OpenSSL::SSL::SSLSocket#session=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DSets the Session to be used when the connection is established.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"&ssl.session = session -> session ;T0[I" (p1);T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]M:SSL/SSLSocket/ssl_version-i.rinu[U:RDoc::AnyMethod[iI"ssl_version:ETI"(OpenSSL::SSL::SSLSocket#ssl_version;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KReturns a String representing the SSL/TLS version that was negotiated ;TI"/for the connection, for example "TLSv1.2".;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"ssl.ssl_version => String ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]`rrSSL/SSLSocket/accept-i.rinu[U:RDoc::AnyMethod[iI" accept:ETI"#OpenSSL::SSL::SSLSocket#accept;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"8Waits for a SSL/TLS client to initiate a handshake.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"ssl.accept => self ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]3 :!SSL/SSLSocket/session_get_cb-i.rinu[U:RDoc::AnyMethod[iI"session_get_cb:ETI"+OpenSSL::SSL::SSLSocket#session_get_cb;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"SSLSocket;TcRDoc::NormalClass00PKI ]d*$SSL/SSLSocket/syswrite_nonblock-i.rinu[U:RDoc::AnyMethod[iI"syswrite_nonblock:ETI".OpenSSL::SSL::SSLSocket#syswrite_nonblock;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PWrites _string_ to the SSL connection in a non-blocking manner. Raises an ;TI"%SSLError if writing would block.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I".ssl.syswrite_nonblock(string) => Integer ;T0[I"(p1, p2 = {});T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]?`SSL/SSLSocket/npn_protocol-i.rinu[U:RDoc::AnyMethod[iI"npn_protocol:ETI")OpenSSL::SSL::SSLSocket#npn_protocol;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"IReturns the protocol string that was finally selected by the client ;TI"during the handshake.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"&ssl.npn_protocol => String | nil ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]3SSL/SSLSocket/sysread-i.rinu[U:RDoc::AnyMethod[iI" sysread:ETI"$OpenSSL::SSL::SSLSocket#sysread;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PReads _length_ bytes from the SSL connection. If a pre-allocated _buffer_ ;TI"2is provided the data will be written into it.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"Issl.sysread(length) => string ssl.sysread(length, buffer) => buffer ;T0[I" (*args);T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]7V  'SSL/SSLSocket/using_anon_cipher%3f-i.rinu[U:RDoc::AnyMethod[iI"using_anon_cipher?:ETI"/OpenSSL::SSL::SSLSocket#using_anon_cipher?;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"SSLSocket;TcRDoc::NormalClass00PKI ]:p.. SSL/SSLSocket/verify_result-i.rinu[U:RDoc::AnyMethod[iI"verify_result:ETI"*OpenSSL::SSL::SSLSocket#verify_result;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NReturns the result of the peer certificates verification. See verify(1) ;TI"'for error values and descriptions.;To:RDoc::Markup::BlankLineo; ; [I"@If no peer certificate was presented X509_V_OK is returned.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I""ssl.verify_result => Integer ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]]GGSSL/SSLSocket/to_io-i.rinu[U:RDoc::Attr[iI" to_io:ETI""OpenSSL::SSL::SSLSocket#to_io;TI"R;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"The underlying IO object.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLSocket;TcRDoc::NormalClass0PKI ]m6 SSL/SSLSocket/alpn_protocol-i.rinu[U:RDoc::AnyMethod[iI"alpn_protocol:ETI"*OpenSSL::SSL::SSLSocket#alpn_protocol;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NReturns the ALPN protocol string that was finally selected by the server ;TI"during the handshake.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"'ssl.alpn_protocol => String | nil ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]28֖SSL/SSLSocket/open-c.rinu[U:RDoc::AnyMethod[iI" open:ETI""OpenSSL::SSL::SSLSocket::open;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"*Creates a new instance of SSLSocket. ;TI"C_remote\_host_ and _remote\_port_ are used to open TCPSocket. ;TI"7If _local\_host_ and _local\_port_ are specified, ;TI"Rthen those parameters are used on the local end to establish the connection. ;TI"If _context_ is provided, ;TI"Cthe SSL Sockets initial params will be taken from the context.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Examples;T@o:RDoc::Markup::Verbatim; [I";sock = OpenSSL::SSL::SSLSocket.open('localhost', 443) ;TI" true | false ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]e#SSL/SSLSocket/finished_message-i.rinu[U:RDoc::AnyMethod[iI"finished_message:ETI"-OpenSSL::SSL::SSLSocket#finished_message;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"-Returns the last *Finished* message sent;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"0ssl.finished_message => "finished message" ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]N@ogg#SSL/SSLSocket/sysread_nonblock-i.rinu[U:RDoc::AnyMethod[iI"sysread_nonblock:ETI"-OpenSSL::SSL::SSLSocket#sysread_nonblock;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NA non-blocking version of #sysread. Raises an SSLError if reading would ;TI"Nblock. If "exception: false" is passed, this method returns a symbol of ;TI"N:wait_readable, :wait_writable, or nil, rather than raising an exception.;To:RDoc::Markup::BlankLineo; ; [I"PReads _length_ bytes from the SSL connection. If a pre-allocated _buffer_ ;TI"2is provided the data will be written into it.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"ssl.sysread_nonblock(length) => string ssl.sysread_nonblock(length, buffer) => buffer ssl.sysread_nonblock(length[, buffer [, opts]) => buffer ;T0[I" (*args);T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]DRxxSSL/SSLSocket/syswrite-i.rinu[U:RDoc::AnyMethod[iI" syswrite:ETI"%OpenSSL::SSL::SSLSocket#syswrite;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"+Writes _string_ to the SSL connection.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"%ssl.syswrite(string) => Integer ;T0[I" (p1);T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]'ooSSL/SSLSocket/connect-i.rinu[U:RDoc::AnyMethod[iI" connect:ETI"$OpenSSL::SSL::SSLSocket#connect;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"2Initiates an SSL/TLS handshake with a server.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"ssl.connect => self ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]KO"SSL/SSLSocket/peer_cert_chain-i.rinu[U:RDoc::AnyMethod[iI"peer_cert_chain:ETI",OpenSSL::SSL::SSLSocket#peer_cert_chain;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"7The X509 certificate chain for this socket's peer.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"/ssl.peer_cert_chain => [cert, ...] or nil ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]?s{{SSL/SSLSocket/peer_cert-i.rinu[U:RDoc::AnyMethod[iI"peer_cert:ETI"&OpenSSL::SSL::SSLSocket#peer_cert;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"1The X509 certificate for this socket's peer.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I""ssl.peer_cert => cert or nil ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]yKYY(SSL/SSLSocket/post_connection_check-i.rinu[U:RDoc::AnyMethod[iI"post_connection_check:ETI"2OpenSSL::SSL::SSLSocket#post_connection_check;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"6Perform hostname verification following RFC 6125.;To:RDoc::Markup::BlankLineo; ; [I"JThis method MUST be called after calling #connect to ensure that the ;TI"1hostname of a remote peer has been verified.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0I"1ssl.post_connection_check(hostname) -> true ;T0[I"(hostname);T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]32L(SSL/SSLSocket/peer_finished_message-i.rinu[U:RDoc::AnyMethod[iI"peer_finished_message:ETI"2OpenSSL::SSL::SSLSocket#peer_finished_message;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"1Returns the last *Finished* message received;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I":ssl.peer_finished_message => "peer finished message" ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]@SSL/SSLSocket/state-i.rinu[U:RDoc::AnyMethod[iI" state:ETI""OpenSSL::SSL::SSLSocket#state;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KA description of the current connection state. This is for diagnostic ;TI"purposes only.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"ssl.state => string ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]!?y"SSL/SSLSocket/accept_nonblock-i.rinu[U:RDoc::AnyMethod[iI"accept_nonblock:ETI",OpenSSL::SSL::SSLSocket#accept_nonblock;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"HInitiates the SSL/TLS handshake as a server in non-blocking manner.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I" # emulates blocking accept ;TI" begin ;TI" ssl.accept_nonblock ;TI"rescue IO::WaitReadable ;TI" IO.select([s2]) ;TI" retry ;TI"rescue IO::WaitWritable ;TI" IO.select(nil, [s2]) ;TI" retry ;TI" end ;T: @format0o; ; [ I"OBy specifying a keyword argument _exception_ to +false+, you can indicate ;TI"Bthat accept_nonblock should not raise an IO::WaitReadable or ;TI"KIO::WaitWritable exception, but return the symbol +:wait_readable+ or ;TI"+:wait_writable+ instead.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I",ssl.accept_nonblock([options]) => self ;T0[I"(p1 = {});T@!FI"SSLSocket;TcRDoc::NormalClass00PKI ] dSSL/SSLSocket/sync_close-i.rinu[U:RDoc::Attr[iI"sync_close:ETI"'OpenSSL::SSL::SSLSocket#sync_close;TI"RW;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"FWhether to close the underlying socket as well, when the SSL/TLS ;TI"7connection is shut down. This defaults to +false+.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::SSL::SSLSocket;TcRDoc::NormalClass0PKI ]Qpx"SSL/SSLSocket/tmp_dh_callback-i.rinu[U:RDoc::AnyMethod[iI"tmp_dh_callback:ETI",OpenSSL::SSL::SSLSocket#tmp_dh_callback;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"SSLSocket;TcRDoc::NormalClass00PKI ]ٳSSL/SSLSocket/stop-i.rinu[U:RDoc::AnyMethod[iI" stop:ETI"!OpenSSL::SSL::SSLSocket#stop;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PSends "close notify" to the peer and tries to shut down the SSL connection ;TI"gracefully.;T: @fileI"ext/openssl/ossl_ssl.c;T:0@omit_headings_from_table_of_contents_below0I"ssl.stop => nil ;T0[I"();T@FI"SSLSocket;TcRDoc::NormalClass00PKI ]fSSL/SocketForwarder/addr-i.rinu[U:RDoc::AnyMethod[iI" addr:ETI"'OpenSSL::SSL::SocketForwarder#addr;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"SocketForwarder;TcRDoc::NormalModule00PKI ]H2SSL/SocketForwarder/fcntl-i.rinu[U:RDoc::AnyMethod[iI" fcntl:ETI"(OpenSSL::SSL::SocketForwarder#fcntl;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@ FI"SocketForwarder;TcRDoc::NormalModule00PKI ] ,991SSL/SocketForwarder/do_not_reverse_lookup%3d-i.rinu[U:RDoc::AnyMethod[iI"do_not_reverse_lookup=:ETI"9OpenSSL::SSL::SocketForwarder#do_not_reverse_lookup=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I" (flag);T@ FI"SocketForwarder;TcRDoc::NormalModule00PKI ]L'!SSL/SocketForwarder/peeraddr-i.rinu[U:RDoc::AnyMethod[iI" peeraddr:ETI"+OpenSSL::SSL::SocketForwarder#peeraddr;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"SocketForwarder;TcRDoc::NormalModule00PKI ]݉m^^SSL/SocketForwarder/fileno-i.rinu[U:RDoc::AnyMethod[iI" fileno:ETI")OpenSSL::SSL::SocketForwarder#fileno;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"(The file descriptor for the socket.;T: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"SocketForwarder;TcRDoc::NormalModule00PKI ]#"SSL/SocketForwarder/closed%3f-i.rinu[U:RDoc::AnyMethod[iI" closed?:ETI"*OpenSSL::SSL::SocketForwarder#closed?;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"SocketForwarder;TcRDoc::NormalModule00PKI ]/33#SSL/SocketForwarder/setsockopt-i.rinu[U:RDoc::AnyMethod[iI"setsockopt:ETI"-OpenSSL::SSL::SocketForwarder#setsockopt;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I"(level, optname, optval);T@ FI"SocketForwarder;TcRDoc::NormalModule00PKI ]Ld++#SSL/SocketForwarder/getsockopt-i.rinu[U:RDoc::AnyMethod[iI"getsockopt:ETI"-OpenSSL::SSL::SocketForwarder#getsockopt;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below000[I"(level, optname);T@ FI"SocketForwarder;TcRDoc::NormalModule00PKI ]b,SSL/SocketForwarder/cdesc-SocketForwarder.rinu[U:RDoc::NormalModule[iI"SocketForwarder:ETI""OpenSSL::SSL::SocketForwarder;T0o:RDoc::Markup::Document: @parts[o;;[: @fileI"#ext/openssl/lib/openssl/ssl.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [ [I" addr;TI"#ext/openssl/lib/openssl/ssl.rb;T[I" closed?;T@&[I"do_not_reverse_lookup=;T@&[I" fcntl;T@&[I" fileno;T@&[I"getsockopt;T@&[I" peeraddr;T@&[I"setsockopt;T@&[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"#ext/openssl/lib/openssl/ssl.rb;TI"OpenSSL::SSL;TcRDoc::NormalModulePKI ]a SSL/SSLError/cdesc-SSLError.rinu[U:RDoc::NormalClass[iI" SSLError:ETI"OpenSSL::SSL::SSLError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I" string ;T0[I"();T@FI" Engine;TcRDoc::NormalClass00PKI ]k[v$$Engine/load_public_key-i.rinu[U:RDoc::AnyMethod[iI"load_public_key:ETI"$OpenSSL::Engine#load_public_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I">Loads the given public key identified by _id_ and _data_.;To:RDoc::Markup::BlankLineo; ; [I"BAn EngineError is raised of the OpenSSL::PKey is unavailable.;T: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I"Cengine.load_public_key(id = nil, data = nil) -> OpenSSL::PKey ;T0[I"(p1 = v1, p2 = v2);T@FI" Engine;TcRDoc::NormalClass00PKI ]CEngine/cipher-i.rinu[U:RDoc::AnyMethod[iI" cipher:ETI"OpenSSL::Engine#cipher;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"PReturns a new instance of OpenSSL::Cipher by _name_, if it is available in ;TI"this engine.;To:RDoc::Markup::BlankLineo; ; [I"@An EngineError will be raised if the cipher is unavailable.;T@o:RDoc::Markup::Verbatim; [ I"*e = OpenSSL::Engine.by_id("openssl") ;TI"H => # ;TI"e.cipher("RC4") ;TI", => #;T: @format0: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I",engine.cipher(name) -> OpenSSL::Cipher ;T0[I" (p1);T@FI" Engine;TcRDoc::NormalClass00PKI ]Ff$$Engine/id-i.rinu[U:RDoc::AnyMethod[iI"id:ETI"OpenSSL::Engine#id;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"!Gets the id for this engine.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"OpenSSL::Engine.load ;TI" [#, ...] ;TI"&OpenSSL::Engine.engines.first.id ;TI" #=> "rsax";T: @format0: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I"engine.id -> string ;T0[I"();T@FI" Engine;TcRDoc::NormalClass00PKI ]K۔00Engine/set_default-i.rinu[U:RDoc::AnyMethod[iI"set_default:ETI" OpenSSL::Engine#set_default;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I";T: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I"engine.set_default(flag) ;T0[I" (p1);T@)FI" Engine;TcRDoc::NormalClass00PKI ]B+55Engine/cleanup-c.rinu[U:RDoc::AnyMethod[iI" cleanup:ETI"OpenSSL::Engine::cleanup;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"EIt is only necessary to run cleanup when engines are loaded via ;TI"OOpenSSL::Engine.load. However, running cleanup before exit is recommended.;To:RDoc::Markup::BlankLineo; ; [I"@Note that this is needed and works only in OpenSSL < 1.1.0.;T: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I"OpenSSL::Engine.cleanup ;T0[I"();T@FI" Engine;TcRDoc::NormalClass00PKI ]x((Engine/load_private_key-i.rinu[U:RDoc::AnyMethod[iI"load_private_key:ETI"%OpenSSL::Engine#load_private_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"?Loads the given private key identified by _id_ and _data_.;To:RDoc::Markup::BlankLineo; ; [I"BAn EngineError is raised of the OpenSSL::PKey is unavailable.;T: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I"Dengine.load_private_key(id = nil, data = nil) -> OpenSSL::PKey ;T0[I"(p1 = v1, p2 = v2);T@FI" Engine;TcRDoc::NormalClass00PKI ]BBEngine/load-c.rinu[U:RDoc::AnyMethod[iI" load:ETI"OpenSSL::Engine::load;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"OThis method loads engines. If _name_ is nil, then all builtin engines are ;TI"Rloaded. Otherwise, the given _name_, as a String, is loaded if available to ;TI"Iyour runtime, and returns true. If _name_ is not found, then nil is ;TI"returned.;T: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I"&OpenSSL::Engine.load(name = nil) ;T0[I"(p1 = v1);T@FI" Engine;TcRDoc::NormalClass00PKI ]^KEngine/cmds-i.rinu[U:RDoc::AnyMethod[iI" cmds:ETI"OpenSSL::Engine#cmds;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"CReturns an array of command definitions for the current engine;T: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I" [["name", "description", "flags"], ...] ;T0[I"();T@FI" Engine;TcRDoc::NormalClass00PKI ]05HHHEngine/name-i.rinu[U:RDoc::AnyMethod[iI" name:ETI"OpenSSL::Engine#name;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Get the descriptive name for this engine.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"OpenSSL::Engine.load ;TI" [#, ...] ;TI"(OpenSSL::Engine.engines.first.name ;TI" #=> "RSAX engine support";T: @format0: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I"engine.name -> string ;T0[I"();T@FI" Engine;TcRDoc::NormalClass00PKI ][Engine/finish-i.rinu[U:RDoc::AnyMethod[iI" finish:ETI"OpenSSL::Engine#finish;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"AReleases all internal structural references for this engine.;To:RDoc::Markup::BlankLineo; ; [I":May raise an EngineError if the engine is unavailable;T: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I"engine.finish -> nil ;T0[I"();T@FI" Engine;TcRDoc::NormalClass00PKI ]}}Engine/cdesc-Engine.rinu[U:RDoc::NormalClass[iI" Engine:ETI"OpenSSL::Engine;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"GThis class is the access to openssl's ENGINE cryptographic module ;TI"implementation.;To:RDoc::Markup::BlankLineo; ;[I">See also, https://www.openssl.org/docs/crypto/engine.html;T: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[ [I" by_id;TI"ext/openssl/ossl_engine.c;T[I" cleanup;T@&[I" engines;T@&[I" load;T@&[I" instance;T[[; [[;[[;[[I" cipher;T@&[I" cmds;T@&[I" ctrl_cmd;T@&[I" digest;T@&[I" finish;T@&[I"id;T@&[I" inspect;T@&[I"load_private_key;T@&[I"load_public_key;T@&[I" name;T@&[I"set_default;T@&[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]fҾ>>Engine/digest-i.rinu[U:RDoc::AnyMethod[iI" digest:ETI"OpenSSL::Engine#digest;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"9Returns a new instance of OpenSSL::Digest by _name_.;To:RDoc::Markup::BlankLineo; ; [I" # ;TI"e.digest("SHA1") ;TI"H #=> # ;TI"e.digest("zomg") ;TI"> #=> OpenSSL::Engine::EngineError: no such digest `zomg';T: @format0: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I",engine.digest(name) -> OpenSSL::Digest ;T0[I" (p1);T@FI" Engine;TcRDoc::NormalClass00PKI ]]Engine/by_id-c.rinu[U:RDoc::AnyMethod[iI" by_id:ETI"OpenSSL::Engine::by_id;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"8Fetches the engine as specified by the _id_ String.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"&OpenSSL::Engine.by_id("openssl") ;TI"H => # ;T: @format0o; ; [I"BSee OpenSSL::Engine.engines for the currently loaded engines.;T: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I"+OpenSSL::Engine.by_id(name) -> engine ;T0[I" (p1);T@FI" Engine;TcRDoc::NormalClass00PKI ] Engine/ctrl_cmd-i.rinu[U:RDoc::AnyMethod[iI" ctrl_cmd:ETI"OpenSSL::Engine#ctrl_cmd;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Sends the given _command_ to this engine.;To:RDoc::Markup::BlankLineo; ; [I"0Raises an EngineError if the command fails.;T: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I"5engine.ctrl_cmd(command, value = nil) -> engine ;T0[I"(p1, p2 = v2);T@FI" Engine;TcRDoc::NormalClass00PKI ]6Yu}}Engine/engines-c.rinu[U:RDoc::AnyMethod[iI" engines:ETI"OpenSSL::Engine::engines;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"2Returns an array of currently loaded engines.;T: @fileI"ext/openssl/ossl_engine.c;T:0@omit_headings_from_table_of_contents_below0I".OpenSSL::Engine.engines -> [engine, ...] ;T0[I"();T@FI" Engine;TcRDoc::NormalClass00PKI ]E??$OCSP/SingleResponse/this_update-i.rinu[U:RDoc::AnyMethod[iI"this_update:ETI".OpenSSL::OCSP::SingleResponse#this_update;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"(single_response.this_update -> Time;T0[I"();T@ FI"SingleResponse;TcRDoc::NormalClass00PKI ]V2ԛOCSP/SingleResponse/certid-i.rinu[U:RDoc::AnyMethod[iI" certid:ETI")OpenSSL::OCSP::SingleResponse#certid;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"@Returns the CertificateId for which this SingleResponse is.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"-single_response.certid -> CertificateId ;T0[I"();T@FI"SingleResponse;TcRDoc::NormalClass00PKI ]&OCSP/SingleResponse/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"'OpenSSL::OCSP::SingleResponse::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"4Creates a new SingleResponse from _der_string_.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"EOpenSSL::OCSP::SingleResponse.new(der_string) -> SingleResponse ;T0[I" (p1);T@FI"SingleResponse;TcRDoc::NormalClass00PKI ]^ZZ*OCSP/SingleResponse/revocation_reason-i.rinu[U:RDoc::AnyMethod[iI"revocation_reason:ETI"4OpenSSL::OCSP::SingleResponse#revocation_reason;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"7single_response.revocation_reason -> Integer | nil;T0[I"();T@ FI"SingleResponse;TcRDoc::NormalClass00PKI ]w/EE$OCSP/SingleResponse/next_update-i.rinu[U:RDoc::AnyMethod[iI"next_update:ETI".OpenSSL::OCSP::SingleResponse#next_update;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I".single_response.next_update -> Time | nil;T0[I"();T@ FI"SingleResponse;TcRDoc::NormalClass00PKI ] 0+OCSP/SingleResponse/cdesc-SingleResponse.rinu[U:RDoc::NormalClass[iI"SingleResponse:ETI""OpenSSL::OCSP::SingleResponse;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"HAn OpenSSL::OCSP::SingleResponse represents an OCSP SingleResponse ;TI"Jstructure, which contains the basic information of the status of the ;TI"certificate.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_ocsp.c;T[I" instance;T[[; [[; [[;[[I"cert_status;T@#[I" certid;T@#[I"check_validity;T@#[I"extensions;T@#[I"initialize_copy;T@#[I"next_update;T@#[I"revocation_reason;T@#[I"revocation_time;T@#[I"this_update;T@#[I" to_der;T@#[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_ocsp.c;TI"OpenSSL::OCSP;TcRDoc::NormalModulePKI ]Ɠ__$OCSP/SingleResponse/cert_status-i.rinu[U:RDoc::AnyMethod[iI"cert_status:ETI".OpenSSL::OCSP::SingleResponse#cert_status;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"EReturns the status of the certificate identified by the certid. ;TI"3The return value may be one of these constant:;To:RDoc::Markup::BlankLineo:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"V_CERTSTATUS_GOOD;To;;0; [o; ; [I"V_CERTSTATUS_REVOKED;To;;0; [o; ; [I"V_CERTSTATUS_UNKNOWN;T@o; ; [I"PWhen the status is V_CERTSTATUS_REVOKED, the time at which the certificate ;TI"6was revoked can be retrieved by #revocation_time.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I",single_response.cert_status -> Integer ;T0[I"();T@%FI"SingleResponse;TcRDoc::NormalClass00PKI ]-HQQ(OCSP/SingleResponse/revocation_time-i.rinu[U:RDoc::AnyMethod[iI"revocation_time:ETI"2OpenSSL::OCSP::SingleResponse#revocation_time;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"2single_response.revocation_time -> Time | nil;T0[I"();T@ FI"SingleResponse;TcRDoc::NormalClass00PKI ]g OCSP/SingleResponse/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI")OpenSSL::OCSP::SingleResponse#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I";Encodes this SingleResponse into a DER-encoded string.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"&single_response.to_der -> String ;T0[I"();T@FI"SingleResponse;TcRDoc::NormalClass00PKI ]'OCSP/SingleResponse/check_validity-i.rinu[U:RDoc::AnyMethod[iI"check_validity:ETI"1OpenSSL::OCSP::SingleResponse#check_validity;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"EChecks the validity of thisUpdate and nextUpdate fields of this ;TI"QSingleResponse. This checks the current time is within the range thisUpdate ;TI"to nextUpdate.;To:RDoc::Markup::BlankLineo; ; [I"QIt is possible that the OCSP request takes a few seconds or the time is not ;TI"Qaccurate. To avoid rejecting a valid response, this method allows the times ;TI"5to be within _nsec_ seconds of the current time.;T@o; ; [I"OSome responders don't set the nextUpdate field. This may cause a very old ;TI"Rresponse to be considered valid. The _maxsec_ parameter can be used to limit ;TI"the age of responses.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"Ksingle_response.check_validity(nsec = 0, maxsec = -1) -> true | false ;T0[I"(p1 = v1, p2 = v2);T@FI"SingleResponse;TcRDoc::NormalClass00PKI ]2  (OCSP/SingleResponse/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"2OpenSSL::OCSP::SingleResponse#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"SingleResponse;TcRDoc::NormalClass00PKI ]ޮPP#OCSP/SingleResponse/extensions-i.rinu[U:RDoc::AnyMethod[iI"extensions:ETI"-OpenSSL::OCSP::SingleResponse#extensions;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I";single_response.extensions -> Array of X509::Extension;T0[I"();T@ FI"SingleResponse;TcRDoc::NormalClass00PKI ]0'OCSP/CertificateId/issuer_key_hash-i.rinu[U:RDoc::AnyMethod[iI"issuer_key_hash:ETI"1OpenSSL::OCSP::CertificateId#issuer_key_hash;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PReturns the issuerKeyHash of this certificate ID, the hash of the issuer's ;TI"public key.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I".certificate_id.issuer_key_hash -> String ;T0[I"();T@FI"CertificateId;TcRDoc::NormalClass00PKI ]wiyOCSP/CertificateId/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"&OpenSSL::OCSP::CertificateId::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LCreates a new OpenSSL::OCSP::CertificateId for the given _subject_ and ;TI"R_issuer_ X509 certificates. The _digest_ is a digest algorithm that is used ;TI"8to compute the hash values. This defaults to SHA-1.;To:RDoc::Markup::BlankLineo; ; [I"JIf only one argument is given, decodes it as DER representation of a ;TI"Qcertificate ID or generates certificate ID from the object that responds to ;TI"the to_der method.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"OpenSSL::OCSP::CertificateId.new(subject, issuer, digest = nil) -> certificate_id OpenSSL::OCSP::CertificateId.new(der_string) -> certificate_id OpenSSL::OCSP::CertificateId.new(obj) -> certificate_id ;T0[I"(p1, p2 = v2, p3 = v3);T@FI"CertificateId;TcRDoc::NormalClass00PKI ]E "OCSP/CertificateId/cmp_issuer-i.rinu[U:RDoc::AnyMethod[iI"cmp_issuer:ETI",OpenSSL::OCSP::CertificateId#cmp_issuer;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NCompares this certificate id's issuer with _other_ and returns +true+ if ;TI"they are the same.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"7certificate_id.cmp_issuer(other) -> true or false ;T0[I" (p1);T@FI"CertificateId;TcRDoc::NormalClass00PKI ]OCSP/CertificateId/cmp-i.rinu[U:RDoc::AnyMethod[iI"cmp:ETI"%OpenSSL::OCSP::CertificateId#cmp;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RCompares this certificate id with _other_ and returns +true+ if they are the ;TI" same.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"0certificate_id.cmp(other) -> true or false ;T0[I" (p1);T@FI"CertificateId;TcRDoc::NormalClass00PKI ]Fƙw(OCSP/CertificateId/issuer_name_hash-i.rinu[U:RDoc::AnyMethod[iI"issuer_name_hash:ETI"2OpenSSL::OCSP::CertificateId#issuer_name_hash;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HReturns the issuerNameHash of this certificate ID, the hash of the ;TI"Cissuer's distinguished name calculated with the hashAlgorithm.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"/certificate_id.issuer_name_hash -> String ;T0[I"();T@FI"CertificateId;TcRDoc::NormalClass00PKI ]500)OCSP/CertificateId/cdesc-CertificateId.rinu[U:RDoc::NormalClass[iI"CertificateId:ETI"!OpenSSL::OCSP::CertificateId;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"KAn OpenSSL::OCSP::CertificateId identifies a certificate to the CA so ;TI"*that a status check can be performed.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_ocsp.c;T[I" instance;T[[; [[; [[;[ [I"cmp;T@"[I"cmp_issuer;T@"[I"hash_algorithm;T@"[I"initialize_copy;T@"[I"issuer_key_hash;T@"[I"issuer_name_hash;T@"[I" serial;T@"[I" to_der;T@"[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_ocsp.c;TI"OpenSSL::OCSP;TcRDoc::NormalModulePKI ]`OCSP/CertificateId/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"(OpenSSL::OCSP::CertificateId#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"CEncodes this certificate identifier into a DER-encoded string.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"%certificate_id.to_der -> String ;T0[I"();T@FI"CertificateId;TcRDoc::NormalClass00PKI ]LOCSP/CertificateId/serial-i.rinu[U:RDoc::AnyMethod[iI" serial:ETI"(OpenSSL::OCSP::CertificateId#serial;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LReturns the serial number of the certificate for which status is being ;TI"requested.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"&certificate_id.serial -> Integer ;T0[I"();T@FI"CertificateId;TcRDoc::NormalClass00PKI ]C+'OCSP/CertificateId/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"1OpenSSL::OCSP::CertificateId#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"CertificateId;TcRDoc::NormalClass00PKI ]P&OCSP/CertificateId/hash_algorithm-i.rinu[U:RDoc::AnyMethod[iI"hash_algorithm:ETI"0OpenSSL::OCSP::CertificateId#hash_algorithm;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GReturns the ln (long name) of the hash algorithm used to generate ;TI"5the issuerNameHash and the issuerKeyHash values.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"-certificate_id.hash_algorithm -> String ;T0[I"();T@FI"CertificateId;TcRDoc::NormalClass00PKI ] EEOCSP/Request/check_nonce-i.rinu[U:RDoc::AnyMethod[iI"check_nonce:ETI"'OpenSSL::OCSP::Request#check_nonce;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"?Checks the nonce validity for this request and _response_.;To:RDoc::Markup::BlankLineo; ; [I".The return value is one of the following:;T@o:RDoc::Markup::List: @type: NOTE: @items[ o:RDoc::Markup::ListItem: @label[I"-1 ;T; [o; ; [I"nonce in request only.;To;;[I"0 ;T; [o; ; [I"'nonces both present and not equal.;To;;[I"1 ;T; [o; ; [I"nonces present and equal.;To;;[I"2 ;T; [o; ; [I"nonces both absent.;To;;[I"3 ;T; [o; ; [I"$nonce present in response only.;T@o; ; [I"QFor most responses, clients can check _result_ > 0. If a responder doesn't ;TI"Ohandle nonces result.nonzero? may be necessary. A result of ;TI"'0 is always an error.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"-request.check_nonce(response) -> result ;T0[I" (p1);T@ [certificate_id, ...] ;T0[I"();T@FI" Request;TcRDoc::NormalClass00PKI ]?OCSP/Request/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI" OpenSSL::OCSP::Request::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PCreates a new OpenSSL::OCSP::Request. The request may be created empty or ;TI"!from a _request_der_ string.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"kOpenSSL::OCSP::Request.new -> request OpenSSL::OCSP::Request.new(request_der) -> request ;T0[I"(p1 = v1);T@FI" Request;TcRDoc::NormalClass00PKI ]mOCSP/Request/add_certid-i.rinu[U:RDoc::AnyMethod[iI"add_certid:ETI"&OpenSSL::OCSP::Request#add_certid;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"*Adds _certificate_id_ to the request.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"3request.add_certid(certificate_id) -> request ;T0[I" (p1);T@FI" Request;TcRDoc::NormalClass00PKI ]R PPOCSP/Request/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI""OpenSSL::OCSP::Request#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"1Returns this request as a DER-encoded string;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" Request;TcRDoc::NormalClass00PKI ]eWWOCSP/Request/sign-i.rinu[U:RDoc::AnyMethod[iI" sign:ETI" OpenSSL::OCSP::Request#sign;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [ I"KSigns this OCSP request using _cert_, _key_ and optional _digest_. If ;TI"O_digest_ is not specified, SHA-1 is used. _certs_ is an optional Array of ;TI"Nadditional certificates which are included in the request in addition to ;TI"Nthe signer certificate. Note that if _certs_ is +nil+ or not given, flag ;TI"POpenSSL::OCSP::NOCERTS is enabled. Pass an empty array to include only the ;TI"signer certificate.;To:RDoc::Markup::BlankLineo; ; [I"8_flags_ is a bitwise OR of the following constants:;T@o:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I"OpenSSL::OCSP::NOCERTS;T; [o; ; [I"LDon't include any certificates in the request. _certs_ will be ignored.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"Krequest.sign(cert, key, certs = nil, flags = 0, digest = nil) -> self ;T0[I"((p1, p2, p3 = v3, p4 = v4, p5 = v5);T@ FI" Request;TcRDoc::NormalClass00PKI ]"OCSP/Request/verify-i.rinu[U:RDoc::AnyMethod[iI" verify:ETI""OpenSSL::OCSP::Request#verify;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GVerifies this request using the given _certificates_ and _store_. ;TI"M_certificates_ is an array of OpenSSL::X509::Certificate, _store_ is an ;TI"OpenSSL::X509::Store.;To:RDoc::Markup::BlankLineo; ; [I"MNote that +false+ is returned if the request does not have a signature. ;TI"@Use #signed? to check whether the request is signed or not.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"Erequest.verify(certificates, store, flags = 0) -> true or false ;T0[I"(p1, p2, p3 = v3);T@FI" Request;TcRDoc::NormalClass00PKI ]|*AAOCSP/Request/add_nonce-i.rinu[U:RDoc::AnyMethod[iI"add_nonce:ETI"%OpenSSL::OCSP::Request#add_nonce;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QAdds a _nonce_ to the OCSP request. If no nonce is given a random one will ;TI"be generated.;To:RDoc::Markup::BlankLineo; ; [I"QThe nonce is used to prevent replay attacks but some servers do not support ;TI"it.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"/request.add_nonce(nonce = nil) -> request ;T0[I"(p1 = v1);T@FI" Request;TcRDoc::NormalClass00PKI ]ʈ!OCSP/Request/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"+OpenSSL::OCSP::Request#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Request;TcRDoc::NormalClass00PKI ]dOCSP/Request/cdesc-Request.rinu[U:RDoc::NormalClass[iI" Request:ETI"OpenSSL::OCSP::Request;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[ I"HAn OpenSSL::OCSP::Request contains the certificate information for ;TI"Mdetermining if a certificate has been revoked or not. A Request can be ;TI"Ecreated for a certificate or from a DER-encoded request created ;TI"elsewhere.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_ocsp.c;T[I" instance;T[[; [[; [[;[[I"add_certid;T@$[I"add_nonce;T@$[I" certid;T@$[I"check_nonce;T@$[I"initialize_copy;T@$[I" sign;T@$[I" signed?;T@$[I" to_der;T@$[I" verify;T@$[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_ocsp.c;TI"OpenSSL::OCSP;TcRDoc::NormalModulePKI ] OCSP/Request/signed%3f-i.rinu[U:RDoc::AnyMethod[iI" signed?:ETI"#OpenSSL::OCSP::Request#signed?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OReturns +true+ if the request is signed, +false+ otherwise. Note that the ;TI"Lvalidity of the signature is *not* checked. Use #verify to verify that.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"&request.signed? -> true or false ;T0[I"();T@FI" Request;TcRDoc::NormalClass00PKI ]_FgOCSP/Response/create-c.rinu[U:RDoc::AnyMethod[iI" create:ETI"$OpenSSL::OCSP::Response::create;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KCreates an OpenSSL::OCSP::Response from _status_ and _basic_response_.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"NOpenSSL::OCSP::Response.create(status, basic_response = nil) -> response ;T0[I" (p1, p2);T@FI" Response;TcRDoc::NormalClass00PKI ],'  OCSP/Response/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"!OpenSSL::OCSP::Response::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RCreates a new OpenSSL::OCSP::Response. The response may be created empty or ;TI""from a _response_der_ string.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"qOpenSSL::OCSP::Response.new -> response OpenSSL::OCSP::Response.new(response_der) -> response ;T0[I"(p1 = v1);T@FI" Response;TcRDoc::NormalClass00PKI ]7d6OCSP/Response/cdesc-Response.rinu[U:RDoc::NormalClass[iI" Response:ETI"OpenSSL::OCSP::Response;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"KAn OpenSSL::OCSP::Response contains the status of a certificate check ;TI"5which is created from an OpenSSL::OCSP::Request.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" create;TI"ext/openssl/ossl_ocsp.c;T[I"new;T@"[I" instance;T[[; [[; [[;[ [I" basic;T@"[I"initialize_copy;T@"[I" status;T@"[I"status_string;T@"[I" to_der;T@"[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_ocsp.c;TI"OpenSSL::OCSP;TcRDoc::NormalModulePKI ]jFQjjOCSP/Response/status-i.rinu[U:RDoc::AnyMethod[iI" status:ETI"#OpenSSL::OCSP::Response#status;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"(Returns the status of the response.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I" response.status -> Integer ;T0[I"();T@FI" Response;TcRDoc::NormalClass00PKI ]}1ttOCSP/Response/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"#OpenSSL::OCSP::Response#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"3Returns this response as a DER-encoded string.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"response.to_der -> String ;T0[I"();T@FI" Response;TcRDoc::NormalClass00PKI ]2bbOCSP/Response/basic-i.rinu[U:RDoc::AnyMethod[iI" basic:ETI""OpenSSL::OCSP::Response#basic;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Returns a BasicResponse for this response;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"response.basic ;T0[I"();T@FI" Response;TcRDoc::NormalClass00PKI ]Ow"OCSP/Response/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI",OpenSSL::OCSP::Response#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Response;TcRDoc::NormalClass00PKI ]m OCSP/Response/status_string-i.rinu[U:RDoc::AnyMethod[iI"status_string:ETI"*OpenSSL::OCSP::Response#status_string;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Returns a status string for the response.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"&response.status_string -> String ;T0[I"();T@FI" Response;TcRDoc::NormalClass00PKI ]<ă  %OCSP/BasicResponse/find_response-i.rinu[U:RDoc::AnyMethod[iI"find_response:ETI"/OpenSSL::OCSP::BasicResponse#find_response;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"SReturns a SingleResponse whose CertId matches with _certificate_id_, or +nil+ ;TI"/if this BasicResponse does not contain it.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"Jbasic_response.find_response(certificate_id) -> SingleResponse | nil ;T0[I" (p1);T@FI"BasicResponse;TcRDoc::NormalClass00PKI ]_)OCSP/BasicResponse/cdesc-BasicResponse.rinu[U:RDoc::NormalClass[iI"BasicResponse:ETI"!OpenSSL::OCSP::BasicResponse;TI" Object;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"JAn OpenSSL::OCSP::BasicResponse contains the status of a certificate ;TI"?check which is created from an OpenSSL::OCSP::Request. A ;TI"4BasicResponse is more detailed than a Response.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_ocsp.c;T[I" instance;T[[; [[; [[;[[I"add_nonce;T@#[I"add_status;T@#[I"copy_nonce;T@#[I"find_response;T@#[I"initialize_copy;T@#[I"responses;T@#[I" sign;T@#[I" status;T@#[I" to_der;T@#[I" verify;T@#[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_ocsp.c;TI"OpenSSL::OCSP;TcRDoc::NormalModulePKI ]2h,OCSP/BasicResponse/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"&OpenSSL::OCSP::BasicResponse::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QCreates a new BasicResponse. If _der_string_ is given, decodes _der_string_ ;TI" as DER.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"JOpenSSL::OCSP::BasicResponse.new(der_string = nil) -> basic_response ;T0[I"(p1 = v1);T@FI"BasicResponse;TcRDoc::NormalClass00PKI ]Il!OCSP/BasicResponse/responses-i.rinu[U:RDoc::AnyMethod[iI"responses:ETI"+OpenSSL::OCSP::BasicResponse#responses;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"?Returns an Array of SingleResponse for this BasicResponse.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"9basic_response.responses -> Array of SingleResponse ;T0[I"();T@FI"BasicResponse;TcRDoc::NormalClass00PKI ]6r"OCSP/BasicResponse/add_status-i.rinu[U:RDoc::AnyMethod[iI"add_status:ETI",OpenSSL::OCSP::BasicResponse#add_status;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QAdds a certificate status for _certificate_id_. _status_ is the status, and ;TI"must be one of these:;To:RDoc::Markup::BlankLineo:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"%OpenSSL::OCSP::V_CERTSTATUS_GOOD;To;;0; [o; ; [I"(OpenSSL::OCSP::V_CERTSTATUS_REVOKED;To;;0; [o; ; [I"(OpenSSL::OCSP::V_CERTSTATUS_UNKNOWN;T@o; ; [ I"G_reason_ and _revocation_time_ can be given only when _status_ is ;TI"POpenSSL::OCSP::V_CERTSTATUS_REVOKED. _reason_ describes the reason for the ;TI"Orevocation, and must be one of OpenSSL::OCSP::REVOKED_STATUS_* constants. ;TI"C_revocation_time_ is the time when the certificate is revoked.;T@o; ; [I"N_this_update_ and _next_update_ indicate the time at which the status is ;TI"Nverified to be correct and the time at or before which newer information ;TI"@will be available, respectively. _next_update_ is optional.;T@o; ; [I"P_extensions_ is an Array of OpenSSL::X509::Extension to be included in the ;TI"+SingleResponse. This is also optional.;T@o; ; [I"MNote that the times, _revocation_time_, _this_update_ and _next_update_ ;TI"Scan be specified in either of Integer or Time object. If they are Integer, it ;TI">is treated as the relative seconds from the current time.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"basic_response.add_status(certificate_id, status, reason, revocation_time, this_update, next_update, extensions) -> basic_response ;T0[I"!(p1, p2, p3, p4, p5, p6, p7);T@5FI"BasicResponse;TcRDoc::NormalClass00PKI ]UDլOCSP/BasicResponse/status-i.rinu[U:RDoc::AnyMethod[iI" status:ETI"(OpenSSL::OCSP::BasicResponse#status;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"MReturns an Array of statuses for this response. Each status contains a ;TI"OCertificateId, the status (0 for good, 1 for revoked, 2 for unknown), the ;TI"Sreason for the status, the revocation time, the time of this update, the time ;TI"@for the next update and a list of OpenSSL::X509::Extension.;To:RDoc::Markup::BlankLineo; ; [I"RThis should be superseded by BasicResponse#responses and #find_response that ;TI"return SingleResponse.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"'basic_response.status -> statuses ;T0[I"();T@FI"BasicResponse;TcRDoc::NormalClass00PKI ]OCSP/BasicResponse/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"(OpenSSL::OCSP::BasicResponse#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I";Encodes this basic response into a DER-encoded string.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"%basic_response.to_der -> String ;T0[I"();T@FI"BasicResponse;TcRDoc::NormalClass00PKI ]=QŸOCSP/BasicResponse/sign-i.rinu[U:RDoc::AnyMethod[iI" sign:ETI"&OpenSSL::OCSP::BasicResponse#sign;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"RSigns this OCSP response using the _cert_, _key_ and optional _digest_. This ;TI"?behaves in the similar way as OpenSSL::OCSP::Request#sign.;To:RDoc::Markup::BlankLineo; ; [I"_flags_ can include:;To:RDoc::Markup::List: @type: NOTE: @items[o:RDoc::Markup::ListItem: @label[I"OpenSSL::OCSP::NOCERTS;T; [o; ; [I"don't include certificates;To;;[I"OpenSSL::OCSP::NOTIME;T; [o; ; [I"don't set producedAt;To;;[I"OpenSSL::OCSP::RESPID_KEY;T; [o; ; [I"0use signer's public key hash as responderID;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"Rbasic_response.sign(cert, key, certs = nil, flags = 0, digest = nil) -> self ;T0[I"((p1, p2, p3 = v3, p4 = v4, p5 = v5);T@*FI"BasicResponse;TcRDoc::NormalClass00PKI ]t%%OCSP/BasicResponse/verify-i.rinu[U:RDoc::AnyMethod[iI" verify:ETI"(OpenSSL::OCSP::BasicResponse#verify;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OVerifies the signature of the response using the given _certificates_ and ;TI"M_store_. This works in the similar way as OpenSSL::OCSP::Request#verify.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"Lbasic_response.verify(certificates, store, flags = 0) -> true or false ;T0[I"(p1, p2, p3 = v3);T@FI"BasicResponse;TcRDoc::NormalClass00PKI ]Z!OCSP/BasicResponse/add_nonce-i.rinu[U:RDoc::AnyMethod[iI"add_nonce:ETI"+OpenSSL::OCSP::BasicResponse#add_nonce;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MAdds _nonce_ to this response. If no nonce was provided a random nonce ;TI"will be added.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"+basic_response.add_nonce(nonce = nil) ;T0[I"(p1 = v1);T@FI"BasicResponse;TcRDoc::NormalClass00PKI ]N'OCSP/BasicResponse/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"1OpenSSL::OCSP::BasicResponse#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"BasicResponse;TcRDoc::NormalClass00PKI ];"OCSP/BasicResponse/copy_nonce-i.rinu[U:RDoc::AnyMethod[iI"copy_nonce:ETI",OpenSSL::OCSP::BasicResponse#copy_nonce;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OCopies the nonce from _request_ into this response. Returns 1 on success ;TI"and 0 on failure.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0I"3basic_response.copy_nonce(request) -> Integer ;T0[I" (p1);T@FI"BasicResponse;TcRDoc::NormalClass00PKI ]1!OCSP/OCSPError/cdesc-OCSPError.rinu[U:RDoc::NormalClass[iI"OCSPError:ETI"OpenSSL::OCSP::OCSPError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[o:RDoc::Markup::Paragraph;[I"OCSP error class.;T: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"ext/openssl/ossl_ocsp.c;TI"OpenSSL::OCSP;TcRDoc::NormalModulePKI ]fX&X&OCSP/cdesc-OCSP.rinu[U:RDoc::NormalModule[iI" OCSP:ETI"OpenSSL::OCSP;T0o:RDoc::Markup::Document: @parts[o;;[(o:RDoc::Markup::Paragraph;[I"JOpenSSL::OCSP implements Online Certificate Status Protocol requests ;TI"and responses.;To:RDoc::Markup::BlankLineo; ;[ I"ICreating and sending an OCSP request requires a subject certificate ;TI"Kthat contains an OCSP URL in an authorityInfoAccess extension and the ;TI"Missuer certificate for the subject certificate. First, load the issuer ;TI"and subject certificates:;T@o:RDoc::Markup::Verbatim;[I":subject = OpenSSL::X509::Certificate.new subject_pem ;TI"9issuer = OpenSSL::X509::Certificate.new issuer_pem ;T: @format0o; ;[I"FTo create the request we need to create a certificate ID for the ;TI"Isubject certificate so the CA knows which certificate we are asking ;TI" about:;T@o; ;[I"*digest = OpenSSL::Digest.new('SHA1') ;TI"certificate_id = ;TI"@ OpenSSL::OCSP::CertificateId.new subject, issuer, digest ;T; 0o; ;[I" Net::HTTP.start ocsp_uri.hostname, ocsp.port do |http| ;TI"2 http.post ocsp_uri.path, request.to_der, ;TI"@ 'content-type' => 'application/ocsp-request' ;TI" end ;TI" ;TI"?response = OpenSSL::OCSP::Response.new http_response.body ;TI"%response_basic = response.basic ;T; 0o; ;[ I"LFirst we check if the response has a valid signature. Without a valid ;TI"Isignature we cannot trust it. If you get a failure here you may be ;TI"Kmissing a system certificate store or may be missing the intermediate ;TI"certificates.;T@o; ;[ I"&store = OpenSSL::X509::Store.new ;TI"store.set_default_paths ;TI" ;TI"1unless response_basic.verify [], store then ;TI"? raise 'response is not signed by a trusted certificate' ;TI" end ;T; 0o; ;[I"JThe response contains the status information (success/fail). We can ;TI"$display the status as a string:;T@o; ;[I"0puts response.status_string #=> successful ;T; 0o; ;[ I"LNext we need to know the response details to determine if the response ;TI"Imatches our request. First we check the nonce. Again, not all CAs ;TI"Gsupport a nonce. See Request#check_nonce for the meanings of the ;TI"return values.;T@o; ;[I"Ap request.check_nonce basic_response #=> value from -1 to 3 ;T; 0o; ;[I"LThen extract the status information for the certificate from the basic ;TI"response.;T@o; ;[ I"Dsingle_response = basic_response.find_response(certificate_id) ;TI" ;TI"unless single_response ;TI"K raise 'basic_response does not have the status for the certificate' ;TI" end ;T; 0o; ;[I"MThen check the validity. A status issued in the future must be rejected.;T@o; ;[I"+unless single_response.check_validity ;TI"K raise 'this_update is in the future or next_update time has passed' ;TI" end ;TI" ;TI"&case single_response.cert_status ;TI"+when OpenSSL::OCSP::V_CERTSTATUS_GOOD ;TI") puts 'certificate is still valid' ;TI".when OpenSSL::OCSP::V_CERTSTATUS_REVOKED ;TI"Q puts "certificate has been revoked at #{single_response.revocation_time}" ;TI".when OpenSSL::OCSP::V_CERTSTATUS_UNKNOWN ;TI"; puts 'responder doesn't know about the certificate' ;TI"end;T; 0: @fileI"ext/openssl/ossl_ocsp.c;T:0@omit_headings_from_table_of_contents_below0; 0;0[[%U:RDoc::Constant[iI""RESPONSE_STATUS_INTERNALERROR;TI"1OpenSSL::OCSP::RESPONSE_STATUS_INTERNALERROR;T: public0o;;[o; ;[I"Internal error in issuer;T@; @;0@@cRDoc::NormalModule0U;[iI"%RESPONSE_STATUS_MALFORMEDREQUEST;TI"4OpenSSL::OCSP::RESPONSE_STATUS_MALFORMEDREQUEST;T;0o;;[o; ;[I"!Illegal confirmation request;T@; @;0@@@0U;[iI"REVOKED_STATUS_NOSTATUS;TI"+OpenSSL::OCSP::REVOKED_STATUS_NOSTATUS;T;0o;;[o; ;[I"6The certificate was revoked for an unknown reason;T@; @;0@@@0U;[iI" RESPONSE_STATUS_SIGREQUIRED;TI"/OpenSSL::OCSP::RESPONSE_STATUS_SIGREQUIRED;T;0o;;[o; ;[I"+You must sign the request and resubmit;T@; @;0@@@0U;[iI"RESPONSE_STATUS_SUCCESSFUL;TI".OpenSSL::OCSP::RESPONSE_STATUS_SUCCESSFUL;T;0o;;[o; ;[I"%Response has valid confirmations;T@; @;0@@@0U;[iI"RESPONSE_STATUS_TRYLATER;TI",OpenSSL::OCSP::RESPONSE_STATUS_TRYLATER;T;0o;;[o; ;[I"Try again later;T@; @;0@@@0U;[iI"&REVOKED_STATUS_AFFILIATIONCHANGED;TI"5OpenSSL::OCSP::REVOKED_STATUS_AFFILIATIONCHANGED;T;0o;;[o; ;[I"@The certificate subject's name or other information changed;T@; @;0@@@0U;[iI" REVOKED_STATUS_CACOMPROMISE;TI"/OpenSSL::OCSP::REVOKED_STATUS_CACOMPROMISE;T;0o;;[o; ;[I" store ;T0[I" (*args);T@FI" Store;TcRDoc::NormalClass00PKI ]VH^^"X509/Store/verify_callback%3d-i.rinu[U:RDoc::AnyMethod[iI"verify_callback=:ETI"*OpenSSL::X509::Store#verify_callback=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"(General callback for OpenSSL verify;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@FI" Store;TcRDoc::NormalClass00PKI ]IX509/Store/add_path-i.rinu[U:RDoc::AnyMethod[iI" add_path:ETI""OpenSSL::X509::Store#add_path;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I">Adds _path_ as the hash dir to be looked up by the store.;To:RDoc::Markup::BlankLineo; ; [I"3See also the man page X509_LOOKUP_hash_dir(3).;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I""store.add_path(path) -> self ;T0[I" (p1);T@FI" Store;TcRDoc::NormalClass00PKI ]X509/Store/purpose%3d-i.rinu[U:RDoc::AnyMethod[iI" purpose=:ETI""OpenSSL::X509::Store#purpose=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"BSets the store's default verification purpose. If specified, ;TI"Rthe verifications on the store will check every certificate's extensions are ;TI"Hconsistent with the purpose. The purpose is specified by constants:;To:RDoc::Markup::BlankLineo:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"X509::PURPOSE_SSL_CLIENT;To;;0; [o; ; [I"X509::PURPOSE_SSL_SERVER;To;;0; [o; ; [I" X509::PURPOSE_NS_SSL_SERVER;To;;0; [o; ; [I"X509::PURPOSE_SMIME_SIGN;To;;0; [o; ; [I" X509::PURPOSE_SMIME_ENCRYPT;To;;0; [o; ; [I"X509::PURPOSE_CRL_SIGN;To;;0; [o; ; [I"X509::PURPOSE_ANY;To;;0; [o; ; [I"X509::PURPOSE_OCSP_HELPER;To;;0; [o; ; [I"!X509::PURPOSE_TIMESTAMP_SIGN;T@o; ; [I"POpenSSL::X509::StoreContext#purpose= can be used to change the value for a ;TI"#single verification operation.;T@o; ; [I" self ;T0[I" (p1);T@FI" Store;TcRDoc::NormalClass00PKI ]2mmX509/Store/verify-i.rinu[U:RDoc::AnyMethod[iI" verify:ETI" OpenSSL::X509::Store#verify;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"RPerforms a certificate verification on the OpenSSL::X509::Certificate _cert_.;To:RDoc::Markup::BlankLineo; ; [I"K_chain_ can be an array of OpenSSL::X509::Certificate that is used to ;TI"%construct the certificate chain.;T@o; ; [I"MIf a block is given, it overrides the callback set by #verify_callback=.;T@o; ; [I"QAfter finishing the verification, the error information can be retrieved by ;TI"P#error, #error_string, and the resulting complete certificate chain can be ;TI"retrieved by #chain.;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I"5store.verify(cert, chain = nil) -> true | false ;T0[I"(p1, p2 = v2);T@FI" Store;TcRDoc::NormalClass00PKI ]X509/Store/chain-i.rinu[U:RDoc::Attr[iI" chain:ETI"OpenSSL::X509::Store#chain;TI"R;T: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"CThe certificate chain constructed by the last call of #verify.;To:RDoc::Markup::BlankLineo; ; [I"!See also StoreContext#chain.;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0F@I"OpenSSL::X509::Store;TcRDoc::NormalClass0PKI ]FgꩨX509/Store/time%3d-i.rinu[U:RDoc::AnyMethod[iI" time=:ETI"OpenSSL::X509::Store#time=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"OSets the time to be used in the certificate verifications with the store. ;TI"CBy default, if not specified, the current system time is used.;To:RDoc::Markup::BlankLineo; ; [I"MOpenSSL::X509::StoreContext#time= can be used to change the value for a ;TI"#single verification operation.;T@o; ; [I"9See also the man page X509_VERIFY_PARAM_set_time(3).;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I"store.time = time ;T0[I" (p1);T@FI" Store;TcRDoc::NormalClass00PKI ](5X509/Store/add_cert-i.rinu[U:RDoc::AnyMethod[iI" add_cert:ETI""OpenSSL::X509::Store#add_cert;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"IAdds the OpenSSL::X509::Certificate _cert_ to the certificate store.;To:RDoc::Markup::BlankLineo; ; [I"2See also the man page X509_STORE_add_cert(3).;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I""store.add_cert(cert) -> self ;T0[I" (p1);T@FI" Store;TcRDoc::NormalClass00PKI ]7X509/Store/add_crl-i.rinu[U:RDoc::AnyMethod[iI" add_crl:ETI"!OpenSSL::X509::Store#add_crl;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"4Adds the OpenSSL::X509::CRL _crl_ to the store.;To:RDoc::Markup::BlankLineo; ; [I"1See also the man page X509_STORE_add_crl(3).;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I" store.add_crl(crl) -> self ;T0[I" (p1);T@FI" Store;TcRDoc::NormalClass00PKI ]X509/Extension/value%3d-i.rinu[U:RDoc::AnyMethod[iI" value=:ETI"$OpenSSL::X509::Extension#value=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"Extension;TcRDoc::NormalClass00PKI ]F֤  X509/Extension/critical%3f-i.rinu[U:RDoc::AnyMethod[iI"critical?:ETI"'OpenSSL::X509::Extension#critical?;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"Extension;TcRDoc::NormalClass00PKI ]X509/Extension/to_a-i.rinu[U:RDoc::AnyMethod[iI" to_a:ETI""OpenSSL::X509::Extension#to_a;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"Extension;TcRDoc::NormalClass00PKI ]DOOAX509/Extension/SubjectKeyIdentifier/cdesc-SubjectKeyIdentifier.rinu[U:RDoc::NormalModule[iI"SubjectKeyIdentifier:ETI"3OpenSSL::X509::Extension::SubjectKeyIdentifier;T0o:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[I" Helpers;To;;[; @ ; 0I"$ext/openssl/lib/openssl/x509.rb;T[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[I"subject_key_identifier;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI"OpenSSL::X509::Extension;TcRDoc::NormalClassPKI ]h4m_gg?X509/Extension/SubjectKeyIdentifier/subject_key_identifier-i.rinu[U:RDoc::AnyMethod[iI"subject_key_identifier:ETI"JOpenSSL::X509::Extension::SubjectKeyIdentifier#subject_key_identifier;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DGet the subject's key identifier from the subjectKeyIdentifier ;TI"9exteension, as described in RFC5280 Section 4.2.1.2.;To:RDoc::Markup::BlankLineo; ; [I"?Returns the binary String key identifier or nil or raises ;TI"ASN1::ASN1Error.;T: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"SubjectKeyIdentifier;TcRDoc::NormalModule00PKI ]BzX509/Extension/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI""OpenSSL::X509::Extension::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Creates an X509 extension.;To:RDoc::Markup::BlankLineo; ; [I"MThe extension may be created from _der_ data or from an extension _oid_ ;TI"Land _value_. The _oid_ may be either an OID or an extension name. If ;TI";_critical_ is +true+ the extension is marked critical.;T: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below0I"~OpenSSL::X509::Extension.new(der) OpenSSL::X509::Extension.new(oid, value) OpenSSL::X509::Extension.new(oid, value, critical) ;T0[I"(p1, p2 = v2, p3 = v3);T@FI"Extension;TcRDoc::NormalClass00PKI ]X509/Extension/oid%3d-i.rinu[U:RDoc::AnyMethod[iI" oid=:ETI""OpenSSL::X509::Extension#oid=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"Extension;TcRDoc::NormalClass00PKI ]TX509/Extension/oid-i.rinu[U:RDoc::AnyMethod[iI"oid:ETI"!OpenSSL::X509::Extension#oid;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"Extension;TcRDoc::NormalClass00PKI ]`&X509/Extension/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI""OpenSSL::X509::Extension#to_s;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"Extension;TcRDoc::NormalClass00PKI ]C  X509/Extension/critical%3d-i.rinu[U:RDoc::AnyMethod[iI"critical=:ETI"'OpenSSL::X509::Extension#critical=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"Extension;TcRDoc::NormalClass00PKI ]| X509/Extension/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"$OpenSSL::X509::Extension#to_der;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"Extension;TcRDoc::NormalClass00PKI ]oss!X509/Extension/cdesc-Extension.rinu[U:RDoc::NormalClass[iI"Extension:ETI"OpenSSL::X509::Extension;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0o;;[; I"ext/openssl/ossl_x509ext.c;T; 0; 0; 0[[[[I"OpenSSL::Marshal;To;;[; @; 0I"$ext/openssl/lib/openssl/x509.rb;T[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_x509ext.c;T[I" instance;T[[; [[; [[; [[I"==;T@[I"critical=;T@&[I"critical?;T@&[I"initialize_copy;T@&[I"oid;T@&[I" oid=;T@&[I" to_a;T@[I" to_der;T@&[I" to_h;T@[I" to_s;T@[I" value;T@&[I" value=;T@&[I"value_der;T@&[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ] [  'X509/Extension/Helpers/cdesc-Helpers.rinu[U:RDoc::NormalModule[iI" Helpers:ETI"&OpenSSL::X509::Extension::Helpers;T0o:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[I"find_extension;TI"$ext/openssl/lib/openssl/x509.rb;T[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI"OpenSSL::X509::Extension;TcRDoc::NormalClassPKI ] s%%*X509/Extension/Helpers/find_extension-i.rinu[U:RDoc::AnyMethod[iI"find_extension:ETI"5OpenSSL::X509::Extension::Helpers#find_extension;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (oid);T@ FI" Helpers;TcRDoc::NormalModule00PKI ]AVV2X509/Extension/CRLDistributionPoints/crl_uris-i.rinu[U:RDoc::AnyMethod[iI" crl_uris:ETI"=OpenSSL::X509::Extension::CRLDistributionPoints#crl_uris;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"GGet the distributionPoint fullName URI from the certificate's CRL ;TI"Ddistribution points extension, as described in RFC5280 Section ;TI" 4.2.1.13;To:RDoc::Markup::BlankLineo; ; [I"BReturns an array of strings or nil or raises ASN1::ASN1Error.;T: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"CRLDistributionPoints;TcRDoc::NormalModule00PKI ]CCCX509/Extension/CRLDistributionPoints/cdesc-CRLDistributionPoints.rinu[U:RDoc::NormalModule[iI"CRLDistributionPoints:ETI"4OpenSSL::X509::Extension::CRLDistributionPoints;T0o:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[I" Helpers;To;;[; @ ; 0I"$ext/openssl/lib/openssl/x509.rb;T[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[I" crl_uris;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI"OpenSSL::X509::Extension;TcRDoc::NormalClassPKI ]CUUEX509/Extension/AuthorityKeyIdentifier/cdesc-AuthorityKeyIdentifier.rinu[U:RDoc::NormalModule[iI"AuthorityKeyIdentifier:ETI"5OpenSSL::X509::Extension::AuthorityKeyIdentifier;T0o:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[I" Helpers;To;;[; @ ; 0I"$ext/openssl/lib/openssl/x509.rb;T[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[I"authority_key_identifier;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI"OpenSSL::X509::Extension;TcRDoc::NormalClassPKI ]>CX509/Extension/AuthorityKeyIdentifier/authority_key_identifier-i.rinu[U:RDoc::AnyMethod[iI"authority_key_identifier:ETI"NOpenSSL::X509::Extension::AuthorityKeyIdentifier#authority_key_identifier;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I";Get the issuing certificate's key identifier from the ;TI"?authorityKeyIdentifier extension, as described in RFC5280 ;TI"Section 4.2.1.1;To:RDoc::Markup::BlankLineo; ; [I">Returns the binary String keyIdentifier or nil or raises ;TI"ASN1::ASN1Error.;T: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"AuthorityKeyIdentifier;TcRDoc::NormalModule00PKI ]^}B#X509/Extension/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"-OpenSSL::X509::Extension#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"Extension;TcRDoc::NormalClass00PKI ]9X509/Extension/to_h-i.rinu[U:RDoc::AnyMethod[iI" to_h:ETI""OpenSSL::X509::Extension#to_h;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"Extension;TcRDoc::NormalClass00PKI ])uww6X509/Extension/AuthorityInfoAccess/ca_issuer_uris-i.rinu[U:RDoc::AnyMethod[iI"ca_issuer_uris:ETI"AOpenSSL::X509::Extension::AuthorityInfoAccess#ca_issuer_uris;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LGet the information and services for the issuer from the certificate's ;TI"Pauthority information access extension exteension, as described in RFC5280 ;TI"Section 4.2.2.1.;To:RDoc::Markup::BlankLineo; ; [I"BReturns an array of strings or nil or raises ASN1::ASN1Error.;T: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"AuthorityInfoAccess;TcRDoc::NormalModule00PKI ]%<LL1X509/Extension/AuthorityInfoAccess/ocsp_uris-i.rinu[U:RDoc::AnyMethod[iI"ocsp_uris:ETI"X509/Extension/%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI" OpenSSL::X509::Extension#==;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (other);T@ FI"Extension;TcRDoc::NormalClass00PKI ]|  X509/Extension/value_der-i.rinu[U:RDoc::AnyMethod[iI"value_der:ETI"'OpenSSL::X509::Extension#value_der;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"Extension;TcRDoc::NormalClass00PKI ]X509/Extension/value-i.rinu[U:RDoc::AnyMethod[iI" value:ETI"#OpenSSL::X509::Extension#value;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"Extension;TcRDoc::NormalClass00PKI ]U_~~X509/cdesc-X509.rinu[U:RDoc::NormalModule[iI" X509:ETI"OpenSSL::X509;T0o:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0o;;[; I"ext/openssl/ossl_x509.c;T; 0o;;[; I" ext/openssl/ossl_x509attr.c;T; 0o;;[; I" ext/openssl/ossl_x509cert.c;T; 0o;;[; I"ext/openssl/ossl_x509crl.c;T; 0o;;[; I"ext/openssl/ossl_x509ext.c;T; 0o;;[; I" ext/openssl/ossl_x509name.c;T; 0o;;[; I"ext/openssl/ossl_x509req.c;T; 0o;;[; I"#ext/openssl/ossl_x509revoked.c;T; 0o;;[; I"!ext/openssl/ossl_x509store.c;T; 0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI"ext/openssl/ossl.c;TI"lib/drb/ssl.rb;TI"lib/open-uri.rb;TI"*lib/rubygems/commands/cert_command.rb;TI"lib/rubygems/request.rb;TI"lib/rubygems/security.rb;TI"$lib/rubygems/security/policy.rb;TI"$lib/rubygems/security/signer.rb;TI"'lib/rubygems/security/trust_dir.rb;TI"lib/un.rb;TI" OpenSSL;TcRDoc::NormalModulePKI ]K"X509/StoreContext/current_crl-i.rinu[U:RDoc::AnyMethod[iI"current_crl:ETI",OpenSSL::X509::StoreContext#current_crl;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I",Returns the CRL which caused the error.;To:RDoc::Markup::BlankLineo; ; [I"=See also the man page X509_STORE_CTX_get_current_crl(3).;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I"$stctx.current_crl -> X509::CRL ;T0[I"();T@FI"StoreContext;TcRDoc::NormalClass00PKI ]WX509/StoreContext/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"%OpenSSL::X509::StoreContext::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OSets up a StoreContext for a verification of the X.509 certificate _cert_.;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I":StoreContext.new(store, cert = nil, untrusted = nil) ;T0[I"(p1, p2 = v2, p3 = v3);T@FI"StoreContext;TcRDoc::NormalClass00PKI ]E!X509/StoreContext/purpose%3d-i.rinu[U:RDoc::AnyMethod[iI" purpose=:ETI")OpenSSL::X509::StoreContext#purpose=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NSets the purpose of the context. This overrides the default value set by ;TI"Store#purpose=.;To:RDoc::Markup::BlankLineo; ; [I" Integer ;T0[I"();T@FI"StoreContext;TcRDoc::NormalClass00PKI ]@s&&#X509/StoreContext/error_string-i.rinu[U:RDoc::AnyMethod[iI"error_string:ETI"-OpenSSL::X509::StoreContext#error_string;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MReturns the human readable error string corresponding to the error code ;TI"retrieved by #error.;To:RDoc::Markup::BlankLineo; ; [I" String ;T0[I"();T@FI"StoreContext;TcRDoc::NormalClass00PKI ]CX509/StoreContext/trust%3d-i.rinu[U:RDoc::AnyMethod[iI" trust=:ETI"'OpenSSL::X509::StoreContext#trust=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RSets the trust settings of the context. This overrides the default value set ;TI"by Store#trust=.;To:RDoc::Markup::BlankLineo; ; [I":See also the man page X509_VERIFY_PARAM_set_trust(3).;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I"stctx.trust = trust ;T0[I" (p1);T@FI"StoreContext;TcRDoc::NormalClass00PKI ]1#X509/StoreContext/current_cert-i.rinu[U:RDoc::AnyMethod[iI"current_cert:ETI"-OpenSSL::X509::StoreContext#current_cert;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"4Returns the certificate which caused the error.;To:RDoc::Markup::BlankLineo; ; [I">See also the man page X509_STORE_CTX_get_current_cert(3).;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I"-stctx.current_cert -> X509::Certificate ;T0[I"();T@FI"StoreContext;TcRDoc::NormalClass00PKI ]AO4O'X509/StoreContext/cdesc-StoreContext.rinu[U:RDoc::NormalClass[iI"StoreContext:ETI" OpenSSL::X509::StoreContext;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0o;;[o:RDoc::Markup::Paragraph;[I"LA StoreContext is used while validating a single certificate and holds ;TI"the status involved.;T; I"!ext/openssl/ossl_x509store.c;T; 0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"!ext/openssl/ossl_x509store.c;T[I" instance;T[[; [[; [[;[[I" chain;T@%[I" cleanup;TI"$ext/openssl/lib/openssl/x509.rb;T[I"current_cert;T@%[I"current_crl;T@%[I" error;T@%[I" error=;T@%[I"error_depth;T@%[I"error_string;T@%[I" flags=;T@%[I" purpose=;T@%[I" time=;T@%[I" trust=;T@%[I" verify;T@%[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ]*X509/StoreContext/cleanup-i.rinu[U:RDoc::AnyMethod[iI" cleanup:ETI"(OpenSSL::X509::StoreContext#cleanup;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"StoreContext;TcRDoc::NormalClass00PKI ]vX509/StoreContext/verify-i.rinu[U:RDoc::AnyMethod[iI" verify:ETI"'OpenSSL::X509::StoreContext#verify;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OPerforms the certificate verification using the parameters set to _stctx_.;To:RDoc::Markup::BlankLineo; ; [I"/See also the man page X509_verify_cert(3).;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I""stctx.verify -> true | false ;T0[I"();T@FI"StoreContext;TcRDoc::NormalClass00PKI ]'po..X509/StoreContext/error%3d-i.rinu[U:RDoc::AnyMethod[iI" error=:ETI"'OpenSSL::X509::StoreContext#error=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OSets the error code of _stctx_. This is used by the verification callback ;TI"2set to OpenSSL::X509::Store#verify_callback=.;To:RDoc::Markup::BlankLineo; ; [I"7See also the man page X509_STORE_CTX_set_error(3).;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I"stctx.error = error_code ;T0[I" (p1);T@FI"StoreContext;TcRDoc::NormalClass00PKI ]nKPX509/StoreContext/chain-i.rinu[U:RDoc::AnyMethod[iI" chain:ETI"&OpenSSL::X509::StoreContext#chain;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I" Returns the verified chain.;To:RDoc::Markup::BlankLineo; ; [I"ASee also the man page X509_STORE_CTX_set0_verified_chain(3).;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I"5stctx.chain -> nil | Array of X509::Certificate ;T0[I"();T@FI"StoreContext;TcRDoc::NormalClass00PKI ]  "X509/StoreContext/error_depth-i.rinu[U:RDoc::AnyMethod[iI"error_depth:ETI",OpenSSL::X509::StoreContext#error_depth;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MReturns the depth of the chain. This is used in combination with #error.;To:RDoc::Markup::BlankLineo; ; [I"=See also the man page X509_STORE_CTX_get_error_depth(3).;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I""stctx.error_depth -> Integer ;T0[I"();T@FI"StoreContext;TcRDoc::NormalClass00PKI ]GX509/StoreContext/time%3d-i.rinu[U:RDoc::AnyMethod[iI" time=:ETI"&OpenSSL::X509::StoreContext#time=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RSets the time used in the verification. If not set, the current time is used.;To:RDoc::Markup::BlankLineo; ; [I"9See also the man page X509_VERIFY_PARAM_set_time(3).;T: @fileI"!ext/openssl/ossl_x509store.c;T:0@omit_headings_from_table_of_contents_below0I"stctx.time = time ;T0[I" (p1);T@FI"StoreContext;TcRDoc::NormalClass00PKI ]1  X509/Request/public_key%3d-i.rinu[U:RDoc::AnyMethod[iI"public_key=:ETI"'OpenSSL::X509::Request#public_key=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Request;TcRDoc::NormalClass00PKI ]  X509/Request/attributes-i.rinu[U:RDoc::AnyMethod[iI"attributes:ETI"&OpenSSL::X509::Request#attributes;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" Request;TcRDoc::NormalClass00PKI ]~ SX509/Request/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI" OpenSSL::X509::Request::new;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I"(p1 = v1);T@ FI" Request;TcRDoc::NormalClass00PKI ]b(X509/Request/subject-i.rinu[U:RDoc::AnyMethod[iI" subject:ETI"#OpenSSL::X509::Request#subject;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" Request;TcRDoc::NormalClass00PKI ]贓X509/Request/version%3d-i.rinu[U:RDoc::AnyMethod[iI" version=:ETI"$OpenSSL::X509::Request#version=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Request;TcRDoc::NormalClass00PKI ]c  X509/Request/attributes%3d-i.rinu[U:RDoc::AnyMethod[iI"attributes=:ETI"'OpenSSL::X509::Request#attributes=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Request;TcRDoc::NormalClass00PKI ]eX509/Request/add_attribute-i.rinu[U:RDoc::AnyMethod[iI"add_attribute:ETI")OpenSSL::X509::Request#add_attribute;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Request;TcRDoc::NormalClass00PKI ]))X509/Request/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI" OpenSSL::X509::Request#to_s;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" Request;TcRDoc::NormalClass0[I"OpenSSL::X509::Request;TFI" to_pem;TPKI ] cy  X509/Request/public_key-i.rinu[U:RDoc::AnyMethod[iI"public_key:ETI"&OpenSSL::X509::Request#public_key;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" Request;TcRDoc::NormalClass00PKI ]'RX509/Request/to_pem-i.rinu[U:RDoc::AnyMethod[iI" to_pem:ETI""OpenSSL::X509::Request#to_pem;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[[I" to_s;T@ I"();T@ FI" Request;TcRDoc::NormalClass00PKI ]ƃRX509/Request/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI""OpenSSL::X509::Request#to_der;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" Request;TcRDoc::NormalClass00PKI ]J X509/Request/version-i.rinu[U:RDoc::AnyMethod[iI" version:ETI"#OpenSSL::X509::Request#version;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" Request;TcRDoc::NormalClass00PKI ] X509/Request/sign-i.rinu[U:RDoc::AnyMethod[iI" sign:ETI" OpenSSL::X509::Request#sign;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1, p2);T@ FI" Request;TcRDoc::NormalClass00PKI ]XqqX509/Request/verify-i.rinu[U:RDoc::AnyMethod[iI" verify:ETI""OpenSSL::X509::Request#verify;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MChecks that cert signature is made with PRIVversion of this PUBLIC 'key';T: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@FI" Request;TcRDoc::NormalClass00PKI ]dpX509/Request/subject%3d-i.rinu[U:RDoc::AnyMethod[iI" subject=:ETI"$OpenSSL::X509::Request#subject=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Request;TcRDoc::NormalClass00PKI ]43!X509/Request/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"+OpenSSL::X509::Request#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Request;TcRDoc::NormalClass00PKI ] 7X509/Request/cdesc-Request.rinu[U:RDoc::NormalClass[iI" Request:ETI"OpenSSL::X509::Request;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0o;;[; I"ext/openssl/ossl_x509req.c;T; 0; 0; 0[[[[I"OpenSSL::Marshal;To;;[; @; 0I"$ext/openssl/lib/openssl/x509.rb;T[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_x509req.c;T[I" instance;T[[; [[; [[; [[I"==;T@[I"add_attribute;T@&[I"attributes;T@&[I"attributes=;T@&[I"initialize_copy;T@&[I"public_key;T@&[I"public_key=;T@&[I" sign;T@&[I"signature_algorithm;T@&[I" subject;T@&[I" subject=;T@&[I" to_der;T@&[I" to_pem;T@&[I" to_s;T@&[I" to_text;T@&[I" verify;T@&[I" version;T@&[I" version=;T@&[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ]JX509/Request/to_text-i.rinu[U:RDoc::AnyMethod[iI" to_text:ETI"#OpenSSL::X509::Request#to_text;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" Request;TcRDoc::NormalClass00PKI ]y X509/Request/%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI"OpenSSL::X509::Request#==;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (other);T@ FI" Request;TcRDoc::NormalClass00PKI ]k@^%X509/Request/signature_algorithm-i.rinu[U:RDoc::AnyMethod[iI"signature_algorithm:ETI"/OpenSSL::X509::Request#signature_algorithm;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" Request;TcRDoc::NormalClass00PKI ][X509/ExtensionFactory/crl-i.rinu[U:RDoc::Attr[iI"crl:ETI"(OpenSSL::X509::ExtensionFactory#crl;TI"R;T: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below0F@ I"$OpenSSL::X509::ExtensionFactory;TcRDoc::NormalClass0PKI ]'i/X509/ExtensionFactory/cdesc-ExtensionFactory.rinu[U:RDoc::NormalClass[iI"ExtensionFactory:ETI"$OpenSSL::X509::ExtensionFactory;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0o;;[; I"ext/openssl/ossl_x509ext.c;T; 0; 0; 0[ [ I" config;TI"RW;T: privateFI"ext/openssl/ossl_x509ext.c;T[ I"crl;TI"R;T; F@[ I"issuer_certificate;TI"R;T; F@[ I"subject_certificate;TI"R;T; F@[ I"subject_request;TI"R;T; F@[[[[I" class;T[[: public[[:protected[[; [[I"new;T@[I" instance;T[[; [[; [[; [[I"create_ext;T@[I"create_ext_from_array;TI"$ext/openssl/lib/openssl/x509.rb;T[I"create_ext_from_hash;T@>[I"create_ext_from_string;T@>[I"create_extension;T@>[I" crl=;T@[I"issuer_certificate=;T@[I"subject_certificate=;T@[I"subject_request=;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ]| //0X509/ExtensionFactory/issuer_certificate%3d-i.rinu[U:RDoc::AnyMethod[iI"issuer_certificate=:ETI"8OpenSSL::X509::ExtensionFactory#issuer_certificate=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"ExtensionFactory;TcRDoc::NormalClass00PKI ] t!X509/ExtensionFactory/crl%3d-i.rinu[U:RDoc::AnyMethod[iI" crl=:ETI")OpenSSL::X509::ExtensionFactory#crl=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"ExtensionFactory;TcRDoc::NormalClass00PKI ]#111X509/ExtensionFactory/subject_certificate%3d-i.rinu[U:RDoc::AnyMethod[iI"subject_certificate=:ETI"9OpenSSL::X509::ExtensionFactory#subject_certificate=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"ExtensionFactory;TcRDoc::NormalClass00PKI ]eu..-X509/ExtensionFactory/issuer_certificate-i.rinu[U:RDoc::Attr[iI"issuer_certificate:ETI"7OpenSSL::X509::ExtensionFactory#issuer_certificate;TI"R;T: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below0F@ I"$OpenSSL::X509::ExtensionFactory;TcRDoc::NormalClass0PKI ]n00X509/ExtensionFactory/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI")OpenSSL::X509::ExtensionFactory::new;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I")(p1 = v1, p2 = v2, p3 = v3, p4 = v4);T@ FI"ExtensionFactory;TcRDoc::NormalClass00PKI ]v//%X509/ExtensionFactory/create_ext-i.rinu[U:RDoc::AnyMethod[iI"create_ext:ETI"/OpenSSL::X509::ExtensionFactory#create_ext;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QCreates a new X509::Extension with passed values. See also x509v3_config(5).;T: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below0I"ef.create_ext(ln_or_sn, "value", critical = false) -> X509::Extension ef.create_ext(ln_or_sn, "critical,value") -> X509::Extension ;T0[I"(p1, p2, p3 = v3);T@FI"ExtensionFactory;TcRDoc::NormalClass00PKI ]!X509/ExtensionFactory/config-i.rinu[U:RDoc::Attr[iI" config:ETI"+OpenSSL::X509::ExtensionFactory#config;TI"RW;T: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below0F@ I"$OpenSSL::X509::ExtensionFactory;TcRDoc::NormalClass0PKI ] 00.X509/ExtensionFactory/subject_certificate-i.rinu[U:RDoc::Attr[iI"subject_certificate:ETI"8OpenSSL::X509::ExtensionFactory#subject_certificate;TI"R;T: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below0F@ I"$OpenSSL::X509::ExtensionFactory;TcRDoc::NormalClass0PKI ] D;;1X509/ExtensionFactory/create_ext_from_string-i.rinu[U:RDoc::AnyMethod[iI"create_ext_from_string:ETI";OpenSSL::X509::ExtensionFactory#create_ext_from_string;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (str);T@ FI"ExtensionFactory;TcRDoc::NormalClass00PKI ]jw))-X509/ExtensionFactory/subject_request%3d-i.rinu[U:RDoc::AnyMethod[iI"subject_request=:ETI"5OpenSSL::X509::ExtensionFactory#subject_request=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"ExtensionFactory;TcRDoc::NormalClass00PKI ]990X509/ExtensionFactory/create_ext_from_array-i.rinu[U:RDoc::AnyMethod[iI"create_ext_from_array:ETI":OpenSSL::X509::ExtensionFactory#create_ext_from_array;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (ary);T@ FI"ExtensionFactory;TcRDoc::NormalClass00PKI ]Ĩ((*X509/ExtensionFactory/subject_request-i.rinu[U:RDoc::Attr[iI"subject_request:ETI"4OpenSSL::X509::ExtensionFactory#subject_request;TI"R;T: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509ext.c;T:0@omit_headings_from_table_of_contents_below0F@ I"$OpenSSL::X509::ExtensionFactory;TcRDoc::NormalClass0PKI ]|00+X509/ExtensionFactory/create_extension-i.rinu[U:RDoc::AnyMethod[iI"create_extension:ETI"5OpenSSL::X509::ExtensionFactory#create_extension;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (*arg);T@ FI"ExtensionFactory;TcRDoc::NormalClass00PKI ]R!88/X509/ExtensionFactory/create_ext_from_hash-i.rinu[U:RDoc::AnyMethod[iI"create_ext_from_hash:ETI"9OpenSSL::X509::ExtensionFactory#create_ext_from_hash;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (hash);T@ FI"ExtensionFactory;TcRDoc::NormalClass00PKI ]ǁ+X509/AttributeError/cdesc-AttributeError.rinu[U:RDoc::NormalClass[iI"AttributeError:ETI""OpenSSL::X509::AttributeError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI" ext/openssl/ossl_x509attr.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ]6f'X509/RequestError/cdesc-RequestError.rinu[U:RDoc::NormalClass[iI"RequestError:ETI" OpenSSL::X509::RequestError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI"ext/openssl/ossl_x509req.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ]NJ$''X509/Attribute/value%3d-i.rinu[U:RDoc::AnyMethod[iI" value=:ETI"$OpenSSL::X509::Attribute#value=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509attr.c;T:0@omit_headings_from_table_of_contents_below0I"attr.value = asn1 => asn1;T0[I" (p1);T@ FI"Attribute;TcRDoc::NormalClass00PKI ] attr;T0[I"(p1, p2 = v2);T@ FI"Attribute;TcRDoc::NormalClass00PKI ]>%%X509/Attribute/oid%3d-i.rinu[U:RDoc::AnyMethod[iI" oid=:ETI""OpenSSL::X509::Attribute#oid=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509attr.c;T:0@omit_headings_from_table_of_contents_below0I" attr.oid = string => string;T0[I" (p1);T@ FI"Attribute;TcRDoc::NormalClass00PKI ]eX509/Attribute/oid-i.rinu[U:RDoc::AnyMethod[iI"oid:ETI"!OpenSSL::X509::Attribute#oid;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509attr.c;T:0@omit_headings_from_table_of_contents_below0I"attr.oid => string;T0[I"();T@ FI"Attribute;TcRDoc::NormalClass00PKI ]Z!!X509/Attribute/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"$OpenSSL::X509::Attribute#to_der;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509attr.c;T:0@omit_headings_from_table_of_contents_below0I"attr.to_der => string;T0[I"();T@ FI"Attribute;TcRDoc::NormalClass00PKI ]?(  !X509/Attribute/cdesc-Attribute.rinu[U:RDoc::NormalClass[iI"Attribute:ETI"OpenSSL::X509::Attribute;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0o;;[; I" ext/openssl/ossl_x509attr.c;T; 0; 0; 0[[[[I"OpenSSL::Marshal;To;;[; @; 0I"$ext/openssl/lib/openssl/x509.rb;T[[I" class;T[[: public[[:protected[[: private[[I"new;TI" ext/openssl/ossl_x509attr.c;T[I" instance;T[[; [[; [[; [ [I"==;T@[I"initialize_copy;T@&[I"oid;T@&[I" oid=;T@&[I" to_der;T@&[I" value;T@&[I" value=;T@&[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ]#X509/Attribute/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"-OpenSSL::X509::Attribute#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509attr.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"Attribute;TcRDoc::NormalClass00PKI ]7iX509/Attribute/%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI" OpenSSL::X509::Attribute#==;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (other);T@ FI"Attribute;TcRDoc::NormalClass00PKI ]ՐX509/Attribute/value-i.rinu[U:RDoc::AnyMethod[iI" value:ETI"#OpenSSL::X509::Attribute#value;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509attr.c;T:0@omit_headings_from_table_of_contents_below0I"attr.value => asn1;T0[I"();T@ FI"Attribute;TcRDoc::NormalClass00PKI ]@PyX509/Revoked/add_extension-i.rinu[U:RDoc::AnyMethod[iI"add_extension:ETI")OpenSSL::X509::Revoked#add_extension;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/ossl_x509revoked.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Revoked;TcRDoc::NormalClass00PKI ]0eEKKX509/Revoked/extensions%3d-i.rinu[U:RDoc::AnyMethod[iI"extensions=:ETI"'OpenSSL::X509::Revoked#extensions=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Sets X509_EXTENSIONs;T: @fileI"#ext/openssl/ossl_x509revoked.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@FI" Revoked;TcRDoc::NormalClass00PKI ]ywX509/Revoked/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI" OpenSSL::X509::Revoked::new;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/ossl_x509revoked.c;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@ FI" Revoked;TcRDoc::NormalClass00PKI ]eG  X509/Revoked/serial%3d-i.rinu[U:RDoc::AnyMethod[iI" serial=:ETI"#OpenSSL::X509::Revoked#serial=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/ossl_x509revoked.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Revoked;TcRDoc::NormalClass00PKI ] X509/Revoked/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI""OpenSSL::X509::Revoked#to_der;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/ossl_x509revoked.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" Revoked;TcRDoc::NormalClass00PKI ] ++X509/Revoked/cdesc-Revoked.rinu[U:RDoc::NormalClass[iI" Revoked:ETI"OpenSSL::X509::Revoked;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0o;;[; I"#ext/openssl/ossl_x509revoked.c;T; 0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I"new;TI"#ext/openssl/ossl_x509revoked.c;T[I" instance;T[[; [[; [[; [[I"==;TI"$ext/openssl/lib/openssl/x509.rb;T[I"add_extension;T@![I"extensions;T@![I"extensions=;T@![I"initialize_copy;T@![I" serial;T@![I" serial=;T@![I" time;T@![I" time=;T@![I" to_der;T@![[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ]x2X509/Revoked/serial-i.rinu[U:RDoc::AnyMethod[iI" serial:ETI""OpenSSL::X509::Revoked#serial;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/ossl_x509revoked.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" Revoked;TcRDoc::NormalClass00PKI ]*5I!X509/Revoked/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"+OpenSSL::X509::Revoked#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/ossl_x509revoked.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Revoked;TcRDoc::NormalClass00PKI ]E±eeX509/Revoked/extensions-i.rinu[U:RDoc::AnyMethod[iI"extensions:ETI"&OpenSSL::X509::Revoked#extensions;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"7Gets X509v3 extensions as array of X509Ext objects;T: @fileI"#ext/openssl/ossl_x509revoked.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" Revoked;TcRDoc::NormalClass00PKI ],SX509/Revoked/time-i.rinu[U:RDoc::AnyMethod[iI" time:ETI" OpenSSL::X509::Revoked#time;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/ossl_x509revoked.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" Revoked;TcRDoc::NormalClass00PKI ]X509/Revoked/%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI"OpenSSL::X509::Revoked#==;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (other);T@ FI" Revoked;TcRDoc::NormalClass00PKI ]ǀX509/Revoked/time%3d-i.rinu[U:RDoc::AnyMethod[iI" time=:ETI"!OpenSSL::X509::Revoked#time=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"#ext/openssl/ossl_x509revoked.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Revoked;TcRDoc::NormalClass00PKI ]6x>'X509/RevokedError/cdesc-RevokedError.rinu[U:RDoc::NormalClass[iI"RevokedError:ETI" OpenSSL::X509::RevokedError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI"#ext/openssl/ossl_x509revoked.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ]$'@!X509/NameError/cdesc-NameError.rinu[U:RDoc::NormalClass[iI"NameError:ETI"OpenSSL::X509::NameError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI" ext/openssl/ossl_x509name.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ] B/X509/CertificateError/cdesc-CertificateError.rinu[U:RDoc::NormalClass[iI"CertificateError:ETI"$OpenSSL::X509::CertificateError;TI"OpenSSL::OpenSSLError;To:RDoc::Markup::Document: @parts[o;;[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[[I" instance;T[[; [[; [[; [[[U:RDoc::Context::Section[i0o;;[; 0; 0[I" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ]bX509/CRL/last_update%3d-i.rinu[U:RDoc::AnyMethod[iI"last_update=:ETI"$OpenSSL::X509::CRL#last_update=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"CRL;TcRDoc::NormalClass00PKI ]崋X509/CRL/cdesc-CRL.rinu[U:RDoc::NormalClass[iI"CRL:ETI"OpenSSL::X509::CRL;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0o;;[; I"ext/openssl/ossl_x509crl.c;T; 0; 0; 0[[[[I"OpenSSL::Marshal;To;;[; @; 0I"$ext/openssl/lib/openssl/x509.rb;T[I"&Extension::AuthorityKeyIdentifier;To;;[; @; 0@[[I" class;T[[: public[[:protected[[: private[[I"new;TI"ext/openssl/ossl_x509crl.c;T[I" instance;T[[; [[; [[; [[I"==;T@[I"add_extension;T@*[I"add_revoked;T@*[I"extensions;T@*[I"extensions=;T@*[I"initialize_copy;T@*[I" issuer;T@*[I" issuer=;T@*[I"last_update;T@*[I"last_update=;T@*[I"next_update;T@*[I"next_update=;T@*[I" revoked;T@*[I" revoked=;T@*[I" sign;T@*[I"signature_algorithm;T@*[I" to_der;T@*[I" to_pem;T@*[I" to_s;T@*[I" to_text;T@*[I" verify;T@*[I" version;T@*[I" version=;T@*[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ]P 3  X509/CRL/add_extension-i.rinu[U:RDoc::AnyMethod[iI"add_extension:ETI"%OpenSSL::X509::CRL#add_extension;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"CRL;TcRDoc::NormalClass00PKI ]U??X509/CRL/extensions%3d-i.rinu[U:RDoc::AnyMethod[iI"extensions=:ETI"#OpenSSL::X509::CRL#extensions=;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Sets X509_EXTENSIONs;T: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@FI"CRL;TcRDoc::NormalClass00PKI ]X509/CRL/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::X509::CRL::new;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I"(p1 = v1);T@ FI"CRL;TcRDoc::NormalClass00PKI ]0X509/CRL/add_revoked-i.rinu[U:RDoc::AnyMethod[iI"add_revoked:ETI"#OpenSSL::X509::CRL#add_revoked;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"CRL;TcRDoc::NormalClass00PKI ]0X509/CRL/next_update-i.rinu[U:RDoc::AnyMethod[iI"next_update:ETI"#OpenSSL::X509::CRL#next_update;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"CRL;TcRDoc::NormalClass00PKI ]-@ X509/CRL/revoked-i.rinu[U:RDoc::AnyMethod[iI" revoked:ETI"OpenSSL::X509::CRL#revoked;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"CRL;TcRDoc::NormalClass00PKI ]X509/CRL/version%3d-i.rinu[U:RDoc::AnyMethod[iI" version=:ETI" OpenSSL::X509::CRL#version=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"CRL;TcRDoc::NormalClass00PKI ]sX509/CRL/issuer-i.rinu[U:RDoc::AnyMethod[iI" issuer:ETI"OpenSSL::X509::CRL#issuer;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"CRL;TcRDoc::NormalClass00PKI ]``WX509/CRL/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI"OpenSSL::X509::CRL#to_s;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"CRL;TcRDoc::NormalClass0[I"OpenSSL::X509::CRL;TFI" to_pem;TPKI ]3X509/CRL/to_pem-i.rinu[U:RDoc::AnyMethod[iI" to_pem:ETI"OpenSSL::X509::CRL#to_pem;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[[I" to_s;T@ I"();T@ FI"CRL;TcRDoc::NormalClass00PKI ]cX509/CRL/next_update%3d-i.rinu[U:RDoc::AnyMethod[iI"next_update=:ETI"$OpenSSL::X509::CRL#next_update=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"CRL;TcRDoc::NormalClass00PKI ]FԎX509/CRL/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"OpenSSL::X509::CRL#to_der;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"CRL;TcRDoc::NormalClass00PKI ]K{zX509/CRL/version-i.rinu[U:RDoc::AnyMethod[iI" version:ETI"OpenSSL::X509::CRL#version;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"CRL;TcRDoc::NormalClass00PKI ]]MX509/CRL/sign-i.rinu[U:RDoc::AnyMethod[iI" sign:ETI"OpenSSL::X509::CRL#sign;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1, p2);T@ FI"CRL;TcRDoc::NormalClass00PKI ]X509/CRL/issuer%3d-i.rinu[U:RDoc::AnyMethod[iI" issuer=:ETI"OpenSSL::X509::CRL#issuer=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"CRL;TcRDoc::NormalClass00PKI ]U߉X509/CRL/verify-i.rinu[U:RDoc::AnyMethod[iI" verify:ETI"OpenSSL::X509::CRL#verify;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"CRL;TcRDoc::NormalClass00PKI ]X509/CRL/revoked%3d-i.rinu[U:RDoc::AnyMethod[iI" revoked=:ETI" OpenSSL::X509::CRL#revoked=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"CRL;TcRDoc::NormalClass00PKI ]X509/CRL/last_update-i.rinu[U:RDoc::AnyMethod[iI"last_update:ETI"#OpenSSL::X509::CRL#last_update;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"CRL;TcRDoc::NormalClass00PKI ]^  X509/CRL/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"'OpenSSL::X509::CRL#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"CRL;TcRDoc::NormalClass00PKI ]:]YYX509/CRL/extensions-i.rinu[U:RDoc::AnyMethod[iI"extensions:ETI""OpenSSL::X509::CRL#extensions;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"7Gets X509v3 extensions as array of X509Ext objects;T: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI"CRL;TcRDoc::NormalClass00PKI ]5X509/CRL/to_text-i.rinu[U:RDoc::AnyMethod[iI" to_text:ETI"OpenSSL::X509::CRL#to_text;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"CRL;TcRDoc::NormalClass00PKI ]X509/CRL/%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI"OpenSSL::X509::CRL#==;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (other);T@ FI"CRL;TcRDoc::NormalClass00PKI ]lC!X509/CRL/signature_algorithm-i.rinu[U:RDoc::AnyMethod[iI"signature_algorithm:ETI"+OpenSSL::X509::CRL#signature_algorithm;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_x509crl.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"CRL;TcRDoc::NormalClass00PKI ]}!uuX509/Name/hash_old-i.rinu[U:RDoc::AnyMethod[iI" hash_old:ETI"!OpenSSL::X509::Name#hash_old;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"5Returns an MD5 based hash used in OpenSSL 0.9.X.;T: @fileI" ext/openssl/ossl_x509name.c;T:0@omit_headings_from_table_of_contents_below0I"name.hash_old => integer ;T0[I"();T@FI" Name;TcRDoc::NormalClass00PKI ]X509/Name/to_a-i.rinu[U:RDoc::AnyMethod[iI" to_a:ETI"OpenSSL::X509::Name#to_a;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"LReturns an Array representation of the distinguished name suitable for ;TI"passing to ::new;T: @fileI" ext/openssl/ossl_x509name.c;T:0@omit_headings_from_table_of_contents_below0I",name.to_a => [[name, data, type], ...] ;T0[I"();T@FI" Name;TcRDoc::NormalClass00PKI ]C@X509/Name/eql%3f-i.rinu[U:RDoc::AnyMethod[iI" eql?:ETI"OpenSSL::X509::Name#eql?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"CReturns true if _name_ and _other_ refer to the same hash key.;T: @fileI" ext/openssl/ossl_x509name.c;T:0@omit_headings_from_table_of_contents_below0I"&name.eql?(other) -> true | false ;T0[I" (p1);T@FI" Name;TcRDoc::NormalClass00PKI ] --%X509/Name/RFC2253DN/expand_value-i.rinu[U:RDoc::AnyMethod[iI"expand_value:ETI"0OpenSSL::X509::Name::RFC2253DN#expand_value;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I"(str1, str2, str3);T@ FI"RFC2253DN;TcRDoc::NormalModule00PKI ]"EP$X509/Name/RFC2253DN/expand_pair-i.rinu[U:RDoc::AnyMethod[iI"expand_pair:ETI"/OpenSSL::X509::Name::RFC2253DN#expand_pair;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (str);T@ FI"RFC2253DN;TcRDoc::NormalModule00PKI ][Y*((&X509/Name/RFC2253DN/cdesc-RFC2253DN.rinu[U:RDoc::NormalModule[iI"RFC2253DN:ETI"#OpenSSL::X509::Name::RFC2253DN;T0o:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0; 0; 0[[U:RDoc::Constant[iI" Special;TI",OpenSSL::X509::Name::RFC2253DN::Special;T: public0o;;[; @ ; 0@ @cRDoc::NormalModule0U; [iI" HexChar;TI",OpenSSL::X509::Name::RFC2253DN::HexChar;T; 0o;;[; @ ; 0@ @@0U; [iI" HexPair;TI",OpenSSL::X509::Name::RFC2253DN::HexPair;T; 0o;;[; @ ; 0@ @@0U; [iI"HexString;TI".OpenSSL::X509::Name::RFC2253DN::HexString;T; 0o;;[; @ ; 0@ @@0U; [iI" Pair;TI")OpenSSL::X509::Name::RFC2253DN::Pair;T; 0o;;[; @ ; 0@ @@0U; [iI"StringChar;TI"/OpenSSL::X509::Name::RFC2253DN::StringChar;T; 0o;;[; @ ; 0@ @@0U; [iI"QuoteChar;TI".OpenSSL::X509::Name::RFC2253DN::QuoteChar;T; 0o;;[; @ ; 0@ @@0U; [iI"AttributeType;TI"2OpenSSL::X509::Name::RFC2253DN::AttributeType;T; 0o;;[; @ ; 0@ @@0U; [iI"AttributeValue;TI"3OpenSSL::X509::Name::RFC2253DN::AttributeValue;T; 0o;;[; @ ; 0@ @@0U; [iI"TypeAndValue;TI"1OpenSSL::X509::Name::RFC2253DN::TypeAndValue;T; 0o;;[; @ ; 0@ @@0[[[I" class;T[[; [[:protected[[: private[[I" instance;T[[; [[; [[;[ [I"expand_hexstring;TI"$ext/openssl/lib/openssl/x509.rb;T[I"expand_pair;T@c[I"expand_value;T@c[I" scan;T@c[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI"OpenSSL::X509::Name;TcRDoc::NormalClassPKI ]oX509/Name/RFC2253DN/scan-i.rinu[U:RDoc::AnyMethod[iI" scan:ETI"(OpenSSL::X509::Name::RFC2253DN#scan;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (dn);T@ FI"RFC2253DN;TcRDoc::NormalModule00PKI ]H2(()X509/Name/RFC2253DN/expand_hexstring-i.rinu[U:RDoc::AnyMethod[iI"expand_hexstring:ETI"4OpenSSL::X509::Name::RFC2253DN#expand_hexstring;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (str);T@ FI"RFC2253DN;TcRDoc::NormalModule00PKI ]^ X509/Name/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::X509::Name::new;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"Creates a new Name.;To:RDoc::Markup::BlankLineo; ; [I"EA name may be created from a DER encoded string _der_, an Array ;TI"Prepresenting a _distinguished_name_ or a _distinguished_name_ along with a ;TI"_template_.;T@o:RDoc::Markup::Verbatim; [I"Jname = OpenSSL::X509::Name.new [['CN', 'nobody'], ['DC', 'example']] ;TI" ;TI"0name = OpenSSL::X509::Name.new name.to_der ;T: @format0o; ; [I"ISee add_entry for a description of the _distinguished_name_ Array's ;TI" contents;T: @fileI" ext/openssl/ossl_x509name.c;T:0@omit_headings_from_table_of_contents_below0I"X509::Name.new => name X509::Name.new(der) => name X509::Name.new(distinguished_name) => name X509::Name.new(distinguished_name, template) => name ;T0[I"(p1 = v1, p2 = v2);T@FI" Name;TcRDoc::NormalClass00PKI ]g]0QQX509/Name/parse-c.rinu[U:RDoc::AnyMethod[iI" parse:ETI"OpenSSL::X509::Name::parse;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I")(str, template=OBJECT_TYPE_TEMPLATE);T@ FI" Name;TcRDoc::NormalClass0[I"OpenSSL::X509::Name;TTI"parse_openssl;TPKI ]v X509/Name/parse_openssl-c.rinu[U:RDoc::AnyMethod[iI"parse_openssl:ETI"'OpenSSL::X509::Name::parse_openssl;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"CParses the string representation of a distinguished name. Two ;TI"#different forms are supported:;To:RDoc::Markup::BlankLineo:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"<\OpenSSL format (X509_NAME_oneline()) used by ;TI"G#to_s. For example: /DC=com/DC=example/CN=nobody;To;;0; [o; ; [I"2\OpenSSL format (X509_NAME_print()) ;TI"Gused by #to_s(OpenSSL::X509::Name::COMPAT). For example: ;TI"+DC=com, DC=example, CN=nobody;T@o; ; [I"HNeither of them is standardized and has quirks and inconsistencies ;TI" -1 | 0 | 1 | nil name <=> other -> -1 | 0 | 1 | nil ;T0[[I"<=>;T@ I" (p1);T@FI" Name;TcRDoc::NormalClass00PKI ]7X509/Name/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI"OpenSSL::X509::Name#to_s;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"LReturns a String representation of the Distinguished Name. _format_ is ;TI" one of:;To:RDoc::Markup::BlankLineo:RDoc::Markup::List: @type: BULLET: @items[ o:RDoc::Markup::ListItem: @label0; [o; ; [I" OpenSSL::X509::Name::COMPAT;To;;0; [o; ; [I"!OpenSSL::X509::Name::RFC2253;To;;0; [o; ; [I"!OpenSSL::X509::Name::ONELINE;To;;0; [o; ; [I"#OpenSSL::X509::Name::MULTILINE;T@o; ; [I"OIf _format_ is omitted, the largely broken and traditional OpenSSL format ;TI"5(X509_NAME_oneline() format) is chosen.;T@o; ; [I"NUse of this method is discouraged. None of the formats other than ;TI"OOpenSSL::X509::Name::RFC2253 is standardized and may show an inconsistent ;TI"(behavior through \OpenSSL versions.;T@o; ; [I"OIt is recommended to use #to_utf8 instead, which is equivalent to calling ;TI"Nname.to_s(OpenSSL::X509::Name::RFC2253).force_encoding("UTF-8").;T: @fileI" ext/openssl/ossl_x509name.c;T:0@omit_headings_from_table_of_contents_below0I"=name.to_s -> string name.to_s(format) -> string ;T0[I" (*args);T@3FI" Name;TcRDoc::NormalClass00PKI ]__X509/Name/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"OpenSSL::X509::Name#to_der;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"&Converts the name to DER encoding;T: @fileI" ext/openssl/ossl_x509name.c;T:0@omit_headings_from_table_of_contents_below0I"name.to_der => string ;T0[I"();T@FI" Name;TcRDoc::NormalClass00PKI ]y  X509/Name/parse_rfc2253-c.rinu[U:RDoc::AnyMethod[iI"parse_rfc2253:ETI"'OpenSSL::X509::Name::parse_rfc2253;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"EParses the UTF-8 string representation of a distinguished name, ;TI"according to RFC 2253.;To:RDoc::Markup::BlankLineo; ; [I"2See also #to_utf8 for the opposite operation.;T: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I")(str, template=OBJECT_TYPE_TEMPLATE);T@FI" Name;TcRDoc::NormalClass00PKI ]X߱  X509/Name/pretty_print-i.rinu[U:RDoc::AnyMethod[iI"pretty_print:ETI"%OpenSSL::X509::Name#pretty_print;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I"(q);T@ FI" Name;TcRDoc::NormalClass00PKI ]9X509/Name/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"(OpenSSL::X509::Name#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509name.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" Name;TcRDoc::NormalClass00PKI ]X509/Name/to_utf8-i.rinu[U:RDoc::AnyMethod[iI" to_utf8:ETI" OpenSSL::X509::Name#to_utf8;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MReturns an UTF-8 representation of the distinguished name, as specified ;TI"9in {RFC 2253}[https://www.ietf.org/rfc/rfc2253.txt].;T: @fileI" ext/openssl/ossl_x509name.c;T:0@omit_headings_from_table_of_contents_below0I"name.to_utf8 -> string ;T0[I"();T@FI" Name;TcRDoc::NormalClass00PKI ]qk X509/Name/cdesc-Name.rinu[U:RDoc::NormalClass[iI" Name:ETI"OpenSSL::X509::Name;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0o;;[ o:RDoc::Markup::Paragraph;[I"HAn X.509 name represents a hostname, email address or other entity ;TI""associated with a public key.;To:RDoc::Markup::BlankLineo; ;[I"HYou can create a Name by parsing a distinguished name String or by ;TI"2supplying the distinguished name as an Array.;T@o:RDoc::Markup::Verbatim;[I"Ename = OpenSSL::X509::Name.parse_rfc2253 'DC=example,CN=nobody' ;TI" ;TI"Iname = OpenSSL::X509::Name.new [['CN', 'nobody'], ['DC', 'example']];T: @format0; I" ext/openssl/ossl_x509name.c;T; 0; 0; 0[[ U:RDoc::Constant[iI"DEFAULT_OBJECT_TYPE;TI"-OpenSSL::X509::Name::DEFAULT_OBJECT_TYPE;T: public0o;;[o; ;[I".The default object type for name entries.;T; @; 0@@cRDoc::NormalClass0U;[iI"OBJECT_TYPE_TEMPLATE;TI".OpenSSL::X509::Name::OBJECT_TYPE_TEMPLATE;T;0o;;[o; ;[I"7The default object type template for name entries.;T; @; 0@@@+0U;[iI" COMPAT;TI" OpenSSL::X509::Name::COMPAT;T;0o;;[o; ;[I"A flag for #to_s.;T@o; ;[I"DBreaks the name returned into multiple lines if longer than 80 ;TI"characters.;T; @; 0@@@+0U;[iI" RFC2253;TI"!OpenSSL::X509::Name::RFC2253;T;0o;;[o; ;[I"A flag for #to_s.;T@o; ;[I"$Returns an RFC2253 format name.;T; @; 0@@@+0U;[iI" ONELINE;TI"!OpenSSL::X509::Name::ONELINE;T;0o;;[o; ;[I"A flag for #to_s.;T@o; ;[I"1Returns a more readable format than RFC2253.;T; @; 0@@@+0U;[iI"MULTILINE;TI"#OpenSSL::X509::Name::MULTILINE;T;0o;;[o; ;[I"A flag for #to_s.;T@o; ;[I" Returns a multiline format.;T; @; 0@@@+0[[I"OpenSSL::Marshal;To;;[; @; 0I"$ext/openssl/lib/openssl/x509.rb;T[I"Comparable;To;;[; @; 0I" ext/openssl/ossl_x509name.c;T[[I" class;T[[;[[:protected[[: private[ [I"new;T@p[I" parse;T@k[I"parse_openssl;T@k[I"parse_rfc2253;T@k[I" instance;T[[;[[;[[;[[I"<=>;T@p[I"add_entry;T@p[I"cmp;T@p[I" eql?;T@p[I" hash;T@p[I" hash_old;T@p[I"initialize_copy;T@p[I"pretty_print;T@k[I" to_a;T@p[I" to_der;T@p[I" to_s;T@p[I" to_utf8;T@p[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ]zd""X509/Name/%3c%3d%3e-i.rinu[U:RDoc::AnyMethod[iI"<=>:ETI"OpenSSL::X509::Name#<=>;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"SCompares this Name with _other_ and returns +0+ if they are the same and +-1+ ;TI"Gor ++1+ if they are greater or less than each other respectively. ;TI"EReturns +nil+ if they are not comparable (i.e. different types).;T: @fileI" ext/openssl/ossl_x509name.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@FI" Name;TcRDoc::NormalClass0[I"OpenSSL::X509::Name;TFI"cmp;TPKI ]@ԕX509/Name/hash-i.rinu[U:RDoc::AnyMethod[iI" hash:ETI"OpenSSL::X509::Name#hash;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PThe hash value returned is suitable for use as a certificate's filename in ;TI"a CA path.;T: @fileI" ext/openssl/ossl_x509name.c;T:0@omit_headings_from_table_of_contents_below0I"name.hash => integer ;T0[I"();T@FI" Name;TcRDoc::NormalClass00PKI ]X509/Name/add_entry-i.rinu[U:RDoc::AnyMethod[iI"add_entry:ETI""OpenSSL::X509::Name#add_entry;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"PAdds a new entry with the given _oid_ and _value_ to this name. The _oid_ ;TI"Eis an object identifier defined in ASN.1. Some common OIDs are:;To:RDoc::Markup::BlankLineo:RDoc::Markup::List: @type: NOTE: @items[ o:RDoc::Markup::ListItem: @label[I"C;T; [o; ; [I"Country Name;To;;[I"CN;T; [o; ; [I"Common Name;To;;[I"DC;T; [o; ; [I"Domain Component;To;;[I"O;T; [o; ; [I"Organization Name;To;;[I"OU;T; [o; ; [I"Organizational Unit Name;To;;[I"ST;T; [o; ; [I"State or Province Name;T@o; ; [ I"QThe optional keyword parameters _loc_ and _set_ specify where to insert the ;TI"Pnew attribute. Refer to the manpage of X509_NAME_add_entry(3) for details. ;TI"P_loc_ defaults to -1 and _set_ defaults to 0. This appends a single-valued ;TI"RDN to the end.;T: @fileI" ext/openssl/ossl_x509name.c;T:0@omit_headings_from_table_of_contents_below0I"Bname.add_entry(oid, value [, type], loc: -1, set: 0) => self ;T0[I"(p1, p2, p3 = v3, p4 = {});T@BFI" Name;TcRDoc::NormalClass00PKI ]::#X509/Certificate/not_before%3d-i.rinu[U:RDoc::AnyMethod[iI"not_before=:ETI"+OpenSSL::X509::Certificate#not_before=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"#cert.not_before = time => time;T0[I" (p1);T@ FI"Certificate;TcRDoc::NormalClass00PKI ]// X509/Certificate/not_before-i.rinu[U:RDoc::AnyMethod[iI"not_before:ETI"*OpenSSL::X509::Certificate#not_before;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"cert.not_before => time;T0[I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ]911#X509/Certificate/public_key%3d-i.rinu[U:RDoc::AnyMethod[iI"public_key=:ETI"+OpenSSL::X509::Certificate#public_key=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"cert.public_key = key;T0[I" (p1);T@ FI"Certificate;TcRDoc::NormalClass00PKI ]Si  X509/Certificate/inspect-i.rinu[U:RDoc::AnyMethod[iI" inspect:ETI"'OpenSSL::X509::Certificate#inspect;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ]JJ#X509/Certificate/add_extension-i.rinu[U:RDoc::AnyMethod[iI"add_extension:ETI"-OpenSSL::X509::Certificate#add_extension;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"/cert.add_extension(extension) => extension;T0[I" (p1);T@ FI"Certificate;TcRDoc::NormalClass00PKI ].)n77"X509/Certificate/not_after%3d-i.rinu[U:RDoc::AnyMethod[iI"not_after=:ETI"*OpenSSL::X509::Certificate#not_after=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I""cert.not_after = time => time;T0[I" (p1);T@ FI"Certificate;TcRDoc::NormalClass00PKI ]%c=BB#X509/Certificate/extensions%3d-i.rinu[U:RDoc::AnyMethod[iI"extensions=:ETI"+OpenSSL::X509::Certificate#extensions=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"+cert.extensions = [ext...] => [ext...];T0[I" (p1);T@ FI"Certificate;TcRDoc::NormalClass00PKI ]$eIIX509/Certificate/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"$OpenSSL::X509::Certificate::new;TT: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I" cert Certificate.new(string) => cert;T0[I"(p1 = v1);T@ FI"Certificate;TcRDoc::NormalClass00PKI ]HXT&&X509/Certificate/subject-i.rinu[U:RDoc::AnyMethod[iI" subject:ETI"'OpenSSL::X509::Certificate#subject;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"cert.subject => name;T0[I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ].77 X509/Certificate/version%3d-i.rinu[U:RDoc::AnyMethod[iI" version=:ETI"(OpenSSL::X509::Certificate#version=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"&cert.version = integer => integer;T0[I" (p1);T@ FI"Certificate;TcRDoc::NormalClass00PKI ]6O##X509/Certificate/issuer-i.rinu[U:RDoc::AnyMethod[iI" issuer:ETI"&OpenSSL::X509::Certificate#issuer;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"cert.issuer => name;T0[I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ]@l'X509/Certificate/check_private_key-i.rinu[U:RDoc::AnyMethod[iI"check_private_key:ETI"1OpenSSL::X509::Certificate#check_private_key;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MReturns +true+ if _key_ is the corresponding private key to the Subject ;TI"/Public Key Information, +false+ otherwise.;T: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"1cert.check_private_key(key) -> true | false ;T0[I" (p1);T@FI"Certificate;TcRDoc::NormalClass00PKI ]יN  %X509/Certificate/cdesc-Certificate.rinu[U:RDoc::NormalClass[iI"Certificate:ETI"OpenSSL::X509::Certificate;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below0o;;["o:RDoc::Markup::Paragraph;[ I"FImplementation of an X.509 certificate as specified in RFC 5280. ;TI"KProvides access to a certificate's attributes and allows certificates ;TI"Eto be read from a string, but also supports the creation of new ;TI"certificates from scratch.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"&Reading a certificate from a file;T@o; ;[I"ECertificate is capable of handling DER-encoded certificates and ;TI"2certificates encoded in OpenSSL's PEM format.;T@o:RDoc::Markup::Verbatim;[I"9raw = File.binread "cert.cer" # DER- or PEM-encoded ;TI"6certificate = OpenSSL::X509::Certificate.new raw ;T: @format0S; ;i;I"#Saving a certificate to a file;T@o; ;[I"/A certificate may be encoded in DER format;T@o;;[I"cert = ... ;TI"=File.open("cert.cer", "wb") { |f| f.print cert.to_der } ;T;0o; ;[I"or in PEM format;T@o;;[I"cert = ... ;TI"=File.open("cert.pem", "wb") { |f| f.print cert.to_pem } ;T;0o; ;[ I"GX.509 certificates are associated with a private/public key pair, ;TI"Ctypically a RSA, DSA or ECC key (see also OpenSSL::PKey::RSA, ;TI"IOpenSSL::PKey::DSA and OpenSSL::PKey::EC), the public key itself is ;TI"Estored within the certificate and can be accessed in form of an ;TI"LOpenSSL::PKey. Certificates are typically used to be able to associate ;TI"Lsome form of identity with a key pair, for example web servers serving ;TI"Npages over HTTPs use certificates to authenticate themselves to the user.;T@o; ;[ I"MThe public key infrastructure (PKI) model relies on trusted certificate ;TI"Iauthorities ("root CAs") that issue these certificates, so that end ;TI"Gusers need to base their trust just on a selected few authorities ;TI"Cthat themselves again vouch for subordinate CAs issuing their ;TI"certificates to end users.;T@o; ;[I"JThe OpenSSL::X509 module provides the tools to set up an independent ;TI"HPKI, similar to scenarios where the 'openssl' command line tool is ;TI"4used for issuing certificates in a private PKI.;T@S; ;i;I"ACreating a root CA certificate and an end-entity certificate;T@o; ;[ I"JFirst, we need to create a "self-signed" root certificate. To do so, ;TI"Iwe need to generate a key first. Please note that the choice of "1" ;TI"Mas a serial number is considered a security flaw for real certificates. ;TI"ISecure choices are integers in the two-digit byte range and ideally ;TI"Jnot sequential but secure random numbers, steps omitted here to keep ;TI"the example concise.;T@o;;[I"Jroot_key = OpenSSL::PKey::RSA.new 2048 # the CA's public/private key ;TI".root_ca = OpenSSL::X509::Certificate.new ;TI"Hroot_ca.version = 2 # cf. RFC 5280 - to make it a "v3" certificate ;TI"root_ca.serial = 1 ;TI"Sroot_ca.subject = OpenSSL::X509::Name.parse "/DC=org/DC=ruby-lang/CN=Ruby CA" ;TI"Droot_ca.issuer = root_ca.subject # root CA's are "self-signed" ;TI".root_ca.public_key = root_key.public_key ;TI"#root_ca.not_before = Time.now ;TI"Xroot_ca.not_after = root_ca.not_before + 2 * 365 * 24 * 60 * 60 # 2 years validity ;TI".ef = OpenSSL::X509::ExtensionFactory.new ;TI"&ef.subject_certificate = root_ca ;TI"%ef.issuer_certificate = root_ca ;TI"Sroot_ca.add_extension(ef.create_extension("basicConstraints","CA:TRUE",true)) ;TI"Yroot_ca.add_extension(ef.create_extension("keyUsage","keyCertSign, cRLSign", true)) ;TI"Uroot_ca.add_extension(ef.create_extension("subjectKeyIdentifier","hash",false)) ;TI"_root_ca.add_extension(ef.create_extension("authorityKeyIdentifier","keyid:always",false)) ;TI";root_ca.sign(root_key, OpenSSL::Digest.new('SHA256')) ;T;0o; ;[I"MThe next step is to create the end-entity certificate using the root CA ;TI"certificate.;T@o;;[I"'key = OpenSSL::PKey::RSA.new 2048 ;TI"+cert = OpenSSL::X509::Certificate.new ;TI"cert.version = 2 ;TI"cert.serial = 2 ;TI"Ycert.subject = OpenSSL::X509::Name.parse "/DC=org/DC=ruby-lang/CN=Ruby certificate" ;TI";cert.issuer = root_ca.subject # root CA is the issuer ;TI"&cert.public_key = key.public_key ;TI" cert.not_before = Time.now ;TI"Rcert.not_after = cert.not_before + 1 * 365 * 24 * 60 * 60 # 1 years validity ;TI".ef = OpenSSL::X509::ExtensionFactory.new ;TI"#ef.subject_certificate = cert ;TI"%ef.issuer_certificate = root_ca ;TI"Rcert.add_extension(ef.create_extension("keyUsage","digitalSignature", true)) ;TI"Rcert.add_extension(ef.create_extension("subjectKeyIdentifier","hash",false)) ;TI"7cert.sign(root_key, OpenSSL::Digest.new('SHA256'));T;0; I" ext/openssl/ossl_x509cert.c;T; 0; 0; 0[[[ [I"OpenSSL::Marshal;To;;[; @; 0I"$ext/openssl/lib/openssl/x509.rb;T[I"$Extension::SubjectKeyIdentifier;To;;[; @; 0@|[I"&Extension::AuthorityKeyIdentifier;To;;[; @; 0@|[I"%Extension::CRLDistributionPoints;To;;[; @; 0@|[I"#Extension::AuthorityInfoAccess;To;;[; @; 0@|[[I" class;T[[: public[[:protected[[: private[[I" load;TI" ext/openssl/ossl_x509cert.c;T[I"load_file;T@|[I"new;T@[I" instance;T[[;[[;[[;["[I"==;T@[I"add_extension;T@[I"check_private_key;T@[I"extensions;T@[I"extensions=;T@[I"initialize_copy;T@[I" inspect;T@[I" issuer;T@[I" issuer=;T@[I"not_after;T@[I"not_after=;T@[I"not_before;T@[I"not_before=;T@[I"pretty_print;T@|[I"public_key;T@[I"public_key=;T@[I" serial;T@[I" serial=;T@[I" sign;T@[I"signature_algorithm;T@[I" subject;T@[I" subject=;T@[I" to_der;T@[I" to_pem;T@[I" to_s;T@[I" to_text;T@[I" verify;T@[I" version;T@[I" version=;T@[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/x509.rb;TI" ext/openssl/ossl_x509attr.c;TI"OpenSSL::X509;TcRDoc::NormalModulePKI ]5 FFX509/Certificate/load-c.rinu[U:RDoc::AnyMethod[iI" load:ETI"%OpenSSL::X509::Certificate::load;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"KRead the chained certificates from the given input. Supports both PEM ;TI""and DER encoded certificates.;To:RDoc::Markup::BlankLineo; ; [I"APEM is a text format and supports more than one certificate.;T@o; ; [I">DER is a binary format and only supports one certificate.;T@o; ; [I"?If the file is empty, or contains only unrelated data, an ;TI"@+OpenSSL::X509::CertificateError+ exception will be raised.;T: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"oOpenSSL::X509::Certificate.load(string) -> [certs...] OpenSSL::X509::Certificate.load(file) -> [certs...] ;T0[I" (p1);T@FI"Certificate;TcRDoc::NormalClass00PKI ]444X509/Certificate/serial%3d-i.rinu[U:RDoc::AnyMethod[iI" serial=:ETI"'OpenSSL::X509::Certificate#serial=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"%cert.serial = integer => integer;T0[I" (p1);T@ FI"Certificate;TcRDoc::NormalClass00PKI ]66X509/Certificate/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI"$OpenSSL::X509::Certificate#to_s;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI"Certificate;TcRDoc::NormalClass0[I"OpenSSL::X509::Certificate;TFI" to_pem;TPKI ]~.. X509/Certificate/public_key-i.rinu[U:RDoc::AnyMethod[iI"public_key:ETI"*OpenSSL::X509::Certificate#public_key;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"cert.public_key => key;T0[I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ]i)r44X509/Certificate/to_pem-i.rinu[U:RDoc::AnyMethod[iI" to_pem:ETI"&OpenSSL::X509::Certificate#to_pem;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"cert.to_pem => string;T0[[I" to_s;T@ I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ]qk%%X509/Certificate/to_der-i.rinu[U:RDoc::AnyMethod[iI" to_der:ETI"&OpenSSL::X509::Certificate#to_der;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"cert.to_der => string;T0[I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ]K#))X509/Certificate/version-i.rinu[U:RDoc::AnyMethod[iI" version:ETI"'OpenSSL::X509::Certificate#version;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"cert.version => integer;T0[I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ]ۖ00X509/Certificate/sign-i.rinu[U:RDoc::AnyMethod[iI" sign:ETI"$OpenSSL::X509::Certificate#sign;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"#cert.sign(key, digest) => self;T0[I" (p1, p2);T@ FI"Certificate;TcRDoc::NormalClass00PKI ]@I..X509/Certificate/issuer%3d-i.rinu[U:RDoc::AnyMethod[iI" issuer=:ETI"'OpenSSL::X509::Certificate#issuer=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"cert.issuer = name => name;T0[I" (p1);T@ FI"Certificate;TcRDoc::NormalClass00PKI ]2X509/Certificate/verify-i.rinu[U:RDoc::AnyMethod[iI" verify:ETI"&OpenSSL::X509::Certificate#verify;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"QVerifies the signature of the certificate, with the public key _key_. _key_ ;TI"*must be an instance of OpenSSL::PKey.;T: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"&cert.verify(key) => true | false ;T0[I" (p1);T@FI"Certificate;TcRDoc::NormalClass00PKI ]۫&&X509/Certificate/serial-i.rinu[U:RDoc::AnyMethod[iI" serial:ETI"&OpenSSL::X509::Certificate#serial;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"cert.serial => integer;T0[I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ] @X,,X509/Certificate/not_after-i.rinu[U:RDoc::AnyMethod[iI"not_after:ETI")OpenSSL::X509::Certificate#not_after;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"cert.not_after => time;T0[I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ]j"X509/Certificate/pretty_print-i.rinu[U:RDoc::AnyMethod[iI"pretty_print:ETI",OpenSSL::X509::Certificate#pretty_print;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I"(q);T@ FI"Certificate;TcRDoc::NormalClass00PKI ]z)11 X509/Certificate/subject%3d-i.rinu[U:RDoc::AnyMethod[iI" subject=:ETI"(OpenSSL::X509::Certificate#subject=;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I" cert.subject = name => name;T0[I" (p1);T@ FI"Certificate;TcRDoc::NormalClass00PKI ]j X509/Certificate/load_file-c.rinu[U:RDoc::AnyMethod[iI"load_file:ETI"*OpenSSL::X509::Certificate::load_file;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"$ext/openssl/lib/openssl/x509.rb;T:0@omit_headings_from_table_of_contents_below000[I" (path);T@ FI"Certificate;TcRDoc::NormalClass00PKI ]"%X509/Certificate/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI"/OpenSSL::X509::Certificate#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI"Certificate;TcRDoc::NormalClass00PKI ][gQ99 X509/Certificate/extensions-i.rinu[U:RDoc::AnyMethod[iI"extensions:ETI"*OpenSSL::X509::Certificate#extensions;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"&cert.extensions => [extension...];T0[I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ]P,'~((X509/Certificate/to_text-i.rinu[U:RDoc::AnyMethod[iI" to_text:ETI"'OpenSSL::X509::Certificate#to_text;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"cert.to_text => string;T0[I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ]]X509/Certificate/%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI""OpenSSL::X509::Certificate#==;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RCompares the two certificates. Note that this takes into account all fields, ;TI"4not just the issuer name and the serial number.;T: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"$cert1 == cert2 -> true | false ;T0[I" (p1);T@FI"Certificate;TcRDoc::NormalClass00PKI ] FLL)X509/Certificate/signature_algorithm-i.rinu[U:RDoc::AnyMethod[iI"signature_algorithm:ETI"3OpenSSL::X509::Certificate#signature_algorithm;TF: privateo:RDoc::Markup::Document: @parts[: @fileI" ext/openssl/ossl_x509cert.c;T:0@omit_headings_from_table_of_contents_below0I"'cert.signature_algorithm => string;T0[I"();T@ FI"Certificate;TcRDoc::NormalClass00PKI ]ª5 fixed_length_secure_compare-c.rinu[U:RDoc::AnyMethod[iI" fixed_length_secure_compare:ETI")OpenSSL::fixed_length_secure_compare;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OConstant time memory comparison for fixed length strings, such as results ;TI"of HMAC calculations.;To:RDoc::Markup::BlankLineo; ; [I"RReturns +true+ if the strings are identical, +false+ if they are of the same ;TI"Nlength but not identical. If the length is different, +ArgumentError+ is ;TI" raised.;T: @fileI"ext/openssl/ossl.c;T:0@omit_headings_from_table_of_contents_below0I"DOpenSSL.fixed_length_secure_compare(string, string) -> boolean ;T0[I" (p1, p2);T@FI" OpenSSL;TcRDoc::NormalModule00PKI ]krVVHMAC/reset-i.rinu[U:RDoc::AnyMethod[iI" reset:ETI"OpenSSL::HMAC#reset;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"PReturns _hmac_ as it was when it was first initialized, with all processed ;TI"data cleared from it.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;T@o:RDoc::Markup::Verbatim; [ I":data = "The quick brown fox jumps over the lazy dog" ;TI"1instance = OpenSSL::HMAC.new('key', 'SHA1') ;TI"2#=> f42bb0eeb018ebbd4597ae7213711ec60760843f ;TI" ;TI"instance.update(data) ;TI"2#=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9 ;TI"instance.reset ;TI"1#=> f42bb0eeb018ebbd4597ae7213711ec60760843f;T: @format0: @fileI"ext/openssl/ossl_hmac.c;T:0@omit_headings_from_table_of_contents_below0I"hmac.reset -> self ;T0[I"();T@FI" HMAC;TcRDoc::NormalClass00PKI ]|~~HMAC/inspect-i.rinu[U:RDoc::AnyMethod[iI" inspect:ETI"OpenSSL::HMAC#inspect;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"KReturns the authentication code as a hex-encoded string. The _digest_ ;TI"Kparameter specifies the digest algorithm to use. This may be a String ;TI"Grepresenting the algorithm name or an instance of OpenSSL::Digest.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I"key = 'key' ;TI":data = 'The quick brown fox jumps over the lazy dog' ;TI" ;TI"7hmac = OpenSSL::HMAC.hexdigest('SHA1', key, data) ;TI"3#=> "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9";T: @format0: @fileI"$ext/openssl/lib/openssl/hmac.rb;T:0@omit_headings_from_table_of_contents_below000[I"();TI"ext/openssl/ossl_hmac.c;TFI" HMAC;TcRDoc::NormalClass0[I"OpenSSL::HMAC;TFI"hexdigest;TPKI ]Ԯ.HMAC/hexdigest-i.rinu[U:RDoc::AnyMethod[iI"hexdigest:ETI"OpenSSL::HMAC#hexdigest;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"MReturns the authentication code an instance represents as a hex-encoded ;TI" string.;T: @fileI"ext/openssl/ossl_hmac.c;T:0@omit_headings_from_table_of_contents_below0I"hmac.hexdigest -> string ;T0[[I" inspect;To;; [ o; ; [I"KReturns the authentication code as a hex-encoded string. The _digest_ ;TI"Kparameter specifies the digest algorithm to use. This may be a String ;TI"Grepresenting the algorithm name or an instance of OpenSSL::Digest.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I"key = 'key' ;TI":data = 'The quick brown fox jumps over the lazy dog' ;TI" ;TI"7hmac = OpenSSL::HMAC.hexdigest('SHA1', key, data) ;TI"3#=> "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9";T: @format0; I"$ext/openssl/lib/openssl/hmac.rb;T; 0[I" to_s;T@I"();T@FI" HMAC;TcRDoc::NormalClass00PKI ]9 HMAC/new-c.rinu[U:RDoc::AnyMethod[iI"new:ETI"OpenSSL::HMAC::new;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"FReturns an instance of OpenSSL::HMAC set with the key and digest ;TI"Halgorithm to be used. The instance represents the initial state of ;TI"Ithe message authentication code before any data has been processed. ;TI"HTo process data with it, use the instance method #update with your ;TI"data as an argument.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;T@o:RDoc::Markup::Verbatim; [ I"key = 'key' ;TI"/instance = OpenSSL::HMAC.new(key, 'SHA1') ;TI"2#=> f42bb0eeb018ebbd4597ae7213711ec60760843f ;TI"instance.class ;TI"#=> OpenSSL::HMAC ;T: @format0S; ; i;I"A note about comparisons;T@o; ; [I"FTwo instances can be securely compared with #== in constant time:;T@o;; [ I"; other_instance = OpenSSL::HMAC.new('key', 'SHA1') ;TI"2#=> f42bb0eeb018ebbd4597ae7213711ec60760843f ;TI" instance == other_instance ;TI" #=> true;T;0: @fileI"ext/openssl/ossl_hmac.c;T:0@omit_headings_from_table_of_contents_below0I"#HMAC.new(key, digest) -> hmac ;T0[I" (p1, p2);T@'FI" HMAC;TcRDoc::NormalClass00PKI ]_0PPHMAC/update-i.rinu[U:RDoc::AnyMethod[iI" update:ETI"OpenSSL::HMAC#update;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"BReturns _hmac_ updated with the message to be authenticated. ;TI"9Can be called repeatedly with chunks of the message.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;T@o:RDoc::Markup::Verbatim; [ I"0first_chunk = 'The quick brown fox jumps ' ;TI"(second_chunk = 'over the lazy dog' ;TI" ;TI""instance.update(first_chunk) ;TI"2#=> 5b9a8038a65d571076d97fe783989e52278a492a ;TI"#instance.update(second_chunk) ;TI"1#=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9;T: @format0: @fileI"ext/openssl/ossl_hmac.c;T:0@omit_headings_from_table_of_contents_below0I"!hmac.update(string) -> self ;T0[[I"<<;T@ I" (p1);T@FI" HMAC;TcRDoc::NormalClass00PKI ]{HMAC/digest-c.rinu[U:RDoc::AnyMethod[iI" digest:ETI"OpenSSL::HMAC::digest;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"PReturns the authentication code as a binary string. The _digest_ parameter ;TI"Nspecifies the digest algorithm to use. This may be a String representing ;TI":the algorithm name or an instance of OpenSSL::Digest.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I"key = 'key' ;TI":data = 'The quick brown fox jumps over the lazy dog' ;TI" ;TI"4hmac = OpenSSL::HMAC.digest('SHA1', key, data) ;TI"M#=> "\xDE|\x9B\x85\xB8\xB7\x8A\xA6\xBC\x8Az6\xF7\n\x90p\x1C\x9D\xB4\xD9";T: @format0: @fileI"$ext/openssl/lib/openssl/hmac.rb;T:0@omit_headings_from_table_of_contents_below0I"/HMAC.digest(digest, key, data) -> aString ;T0[I"(digest, key, data);T@FI" HMAC;TcRDoc::NormalClass00PKI ]11HMAC/cdesc-HMAC.rinu[U:RDoc::NormalClass[iI" HMAC:ETI"OpenSSL::HMAC;TI" Object;To:RDoc::Markup::Document: @parts[o;;[: @fileI"$ext/openssl/lib/openssl/hmac.rb;T:0@omit_headings_from_table_of_contents_below0o;;[o:RDoc::Markup::Paragraph;[ I"KOpenSSL::HMAC allows computing Hash-based Message Authentication Code ;TI"K(HMAC). It is a type of message authentication code (MAC) involving a ;TI"Mhash function in combination with a key. HMAC can be used to verify the ;TI"8integrity of a message as well as the authenticity.;To:RDoc::Markup::BlankLineo; ;[I">OpenSSL::HMAC has a similar interface to OpenSSL::Digest.;T@S:RDoc::Markup::Heading: leveli: textI")HMAC-SHA256 using one-shot interface;T@o:RDoc::Markup::Verbatim;[ I"key = "key" ;TI"*data = "message-to-be-authenticated" ;TI"8mac = OpenSSL::HMAC.hexdigest("SHA256", key, data) ;TI"L#=> "cddb0db23f469c8bf072b21fd837149bd6ace9ab771cceef14c9e517cc93282e" ;T: @format0S; ;i;I",HMAC-SHA256 using incremental interface;T@o;;[ I"#data1 = File.binread("file1") ;TI"#data2 = File.binread("file2") ;TI"key = "key" ;TI"-hmac = OpenSSL::HMAC.new(key, 'SHA256') ;TI"hmac << data1 ;TI"hmac << data2 ;TI"mac = hmac.digest;T;0; I"ext/openssl/ossl_hmac.c;T; 0; 0; 0[[[[[I" class;T[[: public[[:protected[[: private[ [I"base64digest;TI"$ext/openssl/lib/openssl/hmac.rb;T[I" digest;T@>[I"hexdigest;T@>[I"new;TI"ext/openssl/ossl_hmac.c;T[I" instance;T[[;[[;[[;[[I"<<;T@E[I"==;T@>[I"base64digest;T@>[I" digest;T@E[I"hexdigest;T@E[I"initialize_copy;T@E[I" inspect;T@E[I" reset;T@E[I" to_s;T@E[I" update;T@E[[U:RDoc::Context::Section[i0o;;[; 0; 0[I"$ext/openssl/lib/openssl/hmac.rb;TI"ext/openssl/ossl.c;TI" OpenSSL;TcRDoc::NormalModulePKI ]9͉HMAC/base64digest-i.rinu[U:RDoc::AnyMethod[iI"base64digest:ETI"OpenSSL::HMAC#base64digest;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"@Returns the authentication code an a Base64-encoded string.;T: @fileI"$ext/openssl/lib/openssl/hmac.rb;T:0@omit_headings_from_table_of_contents_below0I"!hmac.base64digest -> string ;T0[I"();T@FI" HMAC;TcRDoc::NormalClass00PKI ]Z+xxHMAC/to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI"OpenSSL::HMAC#to_s;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"KReturns the authentication code as a hex-encoded string. The _digest_ ;TI"Kparameter specifies the digest algorithm to use. This may be a String ;TI"Grepresenting the algorithm name or an instance of OpenSSL::Digest.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I"key = 'key' ;TI":data = 'The quick brown fox jumps over the lazy dog' ;TI" ;TI"7hmac = OpenSSL::HMAC.hexdigest('SHA1', key, data) ;TI"3#=> "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9";T: @format0: @fileI"$ext/openssl/lib/openssl/hmac.rb;T:0@omit_headings_from_table_of_contents_below000[I"();TI"ext/openssl/ossl_hmac.c;TFI" HMAC;TcRDoc::NormalClass0[I"OpenSSL::HMAC;TFI"hexdigest;TPKI ]y0HMAC/base64digest-c.rinu[U:RDoc::AnyMethod[iI"base64digest:ETI" OpenSSL::HMAC::base64digest;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"NReturns the authentication code as a Base64-encoded string. The _digest_ ;TI"Kparameter specifies the digest algorithm to use. This may be a String ;TI"Grepresenting the algorithm name or an instance of OpenSSL::Digest.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I"key = 'key' ;TI":data = 'The quick brown fox jumps over the lazy dog' ;TI" ;TI":hmac = OpenSSL::HMAC.base64digest('SHA1', key, data) ;TI"'#=> "3nybhbi3iqa8ino29wqQcBydtNk=";T: @format0: @fileI"$ext/openssl/lib/openssl/hmac.rb;T:0@omit_headings_from_table_of_contents_below0I"5HMAC.base64digest(digest, key, data) -> aString ;T0[I"(digest, key, data);T@FI" HMAC;TcRDoc::NormalClass00PKI ]KPHMAC/digest-i.rinu[U:RDoc::AnyMethod[iI" digest:ETI"OpenSSL::HMAC#digest;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"OReturns the authentication code an instance represents as a binary string.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I"1instance = OpenSSL::HMAC.new('key', 'SHA1') ;TI"2#=> f42bb0eeb018ebbd4597ae7213711ec60760843f ;TI"instance.digest ;TI"G#=> "\xF4+\xB0\xEE\xB0\x18\xEB\xBDE\x97\xAEr\x13q\x1E\xC6\a`\x84?";T: @format0: @fileI"ext/openssl/ossl_hmac.c;T:0@omit_headings_from_table_of_contents_below0I"hmac.digest -> string ;T0[I"();T@FI" HMAC;TcRDoc::NormalClass00PKI ]!YمHMAC/hexdigest-c.rinu[U:RDoc::AnyMethod[iI"hexdigest:ETI"OpenSSL::HMAC::hexdigest;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"KReturns the authentication code as a hex-encoded string. The _digest_ ;TI"Kparameter specifies the digest algorithm to use. This may be a String ;TI"Grepresenting the algorithm name or an instance of OpenSSL::Digest.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I"key = 'key' ;TI":data = 'The quick brown fox jumps over the lazy dog' ;TI" ;TI"7hmac = OpenSSL::HMAC.hexdigest('SHA1', key, data) ;TI"3#=> "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9";T: @format0: @fileI"$ext/openssl/lib/openssl/hmac.rb;T:0@omit_headings_from_table_of_contents_below0I"2HMAC.hexdigest(digest, key, data) -> aString ;T0[I"(digest, key, data);T@FI" HMAC;TcRDoc::NormalClass00PKI ]9_$HMAC/initialize_copy-i.rinu[U:RDoc::AnyMethod[iI"initialize_copy:ETI""OpenSSL::HMAC#initialize_copy;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl_hmac.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@ FI" HMAC;TcRDoc::NormalClass00PKI ]P<<HMAC/%3c%3c-i.rinu[U:RDoc::AnyMethod[iI"<<:ETI"OpenSSL::HMAC#<<;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"BReturns _hmac_ updated with the message to be authenticated. ;TI"9Can be called repeatedly with chunks of the message.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI" Example;T@o:RDoc::Markup::Verbatim; [ I"0first_chunk = 'The quick brown fox jumps ' ;TI"(second_chunk = 'over the lazy dog' ;TI" ;TI""instance.update(first_chunk) ;TI"2#=> 5b9a8038a65d571076d97fe783989e52278a492a ;TI"#instance.update(second_chunk) ;TI"1#=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9;T: @format0: @fileI"ext/openssl/ossl_hmac.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@FI" HMAC;TcRDoc::NormalClass0[I"OpenSSL::HMAC;TFI" update;TPKI ]掛3ZZHMAC/%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI"OpenSSL::HMAC#==;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"BSecurely compare with another HMAC instance in constant time.;T: @fileI"$ext/openssl/lib/openssl/hmac.rb;T:0@omit_headings_from_table_of_contents_below000[I" (other);T@FI" HMAC;TcRDoc::NormalClass00PKI ]Ofips_mode-c.rinu[U:RDoc::AnyMethod[iI"fips_mode:ETI"OpenSSL::fips_mode;TT: privateo:RDoc::Markup::Document: @parts[: @fileI"ext/openssl/ossl.c;T:0@omit_headings_from_table_of_contents_below0I"&OpenSSL.fips_mode -> true | false;T0[I"();T@ FI" OpenSSL;TcRDoc::NormalModule00PKI ]"zr&&print_mem_leaks-c.rinu[U:RDoc::AnyMethod[iI"print_mem_leaks:ETI"OpenSSL::print_mem_leaks;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"PFor debugging the Ruby/OpenSSL library. Calls CRYPTO_mem_leaks_fp(stderr). ;TI"RPrints detected memory leaks to standard error. This cleans the global state ;TI"Jup thus you cannot use any methods of the library after calling this.;To:RDoc::Markup::BlankLineo; ; [I"9Returns +true+ if leaks detected, +false+ otherwise.;T@o; ; [I"QThis is available only when built with a capable OpenSSL and --enable-debug ;TI"configure option.;T@S:RDoc::Markup::Heading: leveli: textI" Example;To:RDoc::Markup::Verbatim; [ I"OpenSSL.mem_check_start ;TI",NOT_GCED = OpenSSL::PKey::RSA.new(256) ;TI" ;TI" END { ;TI" GC.start ;TI"8 OpenSSL.print_mem_leaks # will print the leakage ;TI"};T: @format0: @fileI"ext/openssl/ossl.c;T:0@omit_headings_from_table_of_contents_below0I"-OpenSSL.print_mem_leaks -> true | false ;T0[I"();T@#FI" OpenSSL;TcRDoc::NormalModule00PK}S]debug.pynu[PK}S]κy_y_'Q__pycache__/crypto.cpython-36.opt-1.pycnu[PK}S]jH/H/!d__pycache__/SSL.cpython-36.pycnu[PK}S] 4__pycache__/rand.cpython-36.pycnu[PK}S],7&ޘ__pycache__/tsafe.cpython-36.opt-1.pycnu[PK}S]33 __pycache__/_util.cpython-36.pycnu[PK}S]Xӎ#d__pycache__/__init__.cpython-36.pycnu[PK}S]%J//$ű__pycache__/SSL.cpython-36.opt-1.pycnu[PK}S] 4%__pycache__/rand.cpython-36.opt-1.pycnu[PK}S]Mgg"J__pycache__/version.cpython-36.pycnu[PK}S]#cSS&__pycache__/debug.cpython-36.opt-1.pycnu[PK}S]Xӎ)__pycache__/__init__.cpython-36.opt-1.pycnu[PK}S]C__!__pycache__/crypto.cpython-36.pycnu[PK}S]33&P__pycache__/_util.cpython-36.opt-1.pycnu[PK}S]#cSS `__pycache__/debug.cpython-36.pycnu[PK}S]Mgg(De__pycache__/version.cpython-36.opt-1.pycnu[PK}S],7 h__pycache__/tsafe.cpython-36.pycnu[PK}S]*mNNntsafe.pynu[PK}S]{M rcrypto.pynu[PK}S]rkSrand.pynu[PK}S]<0-[[SSL.pynu[PK}S]}Srr Y[version.pynu[PK}S]F[NN^_util.pynu[PK}S]+\ n__init__.pynu[PKI ]mu11pKDF/KDFError/cdesc-KDFError.rinu[PKI ] $fff sKDF/hkdf-c.rinu[PKI ] ::yKDF/scrypt-c.rinu[PKI ]8  KDF/cdesc-KDF.rinu[PKI ]~"KDF/pbkdf2_hmac-c.rinu[PKI ];y)   debug-c.rinu[PKI ]չ**bBuffering/eof-i.rinu[PKI ] @qΕBuffering/read_nonblock-i.rinu[PKI ]("Buffering/readchar-i.rinu[PKI ];=kkBuffering/consume_rbuff-i.rinu[PKI ])Buffering/readline-i.rinu[PKI ]Ja$wwBuffering/each_byte-i.rinu[PKI ]/j=UUqBuffering/flush-i.rinu[PKI ]! Buffering/print-i.rinu[PKI ]5a}˯Buffering/do_write-i.rinu[PKI ]aa۩Buffering/new-c.rinu[PKI ]HA~Buffering/puts-i.rinu[PKI ]/ءsBuffering/eof%3f-i.rinu[PKI ]өVJJYBuffering/write_nonblock-i.rinu[PKI ]=ffBuffering/fill_rbuff-i.rinu[PKI ]9dG8Buffering/getbyte-i.rinu[PKI ]pbbgBuffering/close-i.rinu[PKI ]( Buffering/printf-i.rinu[PKI ]P۸BBuffering/cdesc-Buffering.rinu[PKI ]Buffering/sync-i.rinu[PKI ]0VBuffering/write-i.rinu[PKI ]D  \Buffering/Buffer/new-c.rinu[PKI ] Buffering/Buffer/cdesc-Buffer.rinu[PKI ]r"@@Buffering/Buffer/concat-i.rinu[PKI ]**|Buffering/Buffer/%3c%3c-i.rinu[PKI ]h8QQBuffering/ungetc-i.rinu[PKI ]_Buffering/read-i.rinu[PKI ]=iBuffering/gets-i.rinu[PKI ]aBlBuffering/readlines-i.rinu[PKI ] Buffering/each-i.rinu[PKI ]~~Buffering/getc-i.rinu[PKI ]s Buffering/%3c%3c-i.rinu[PKI ]ﲺBuffering/readpartial-i.rinu[PKI ]3<<Buffering/each_line-i.rinu[PKI ]$D"qOpenSSLError/cdesc-OpenSSLError.rinu[PKI ]gCBBN/rand_range-c.rinu[PKI ]rQ nBN/%25-i.rinu[PKI ]]$  BN/num_bits-i.rinu[PKI ]u7xBN/bit_set%3f-i.rinu[PKI ]?QBN/generate_prime-c.rinu[PKI ]M\BN/rshift%21-i.rinu[PKI ]~ BN/sqr-i.rinu[PKI ],BN/cdesc-BN.rinu[PKI ]  BN/gcd-i.rinu[PKI ]';? FBN/copy-i.rinu[PKI ]س BN/eql%3f-i.rinu[PKI ]{L  BN/to_bn-i.rinu[PKI ] 8ff  BN/new-c.rinu[PKI ]?V BN/coerce-i.rinu[PKI ]  BN/to_i-i.rinu[PKI ]GHBUU BN/get_flags-i.rinu[PKI ]w BN/%2b%40-i.rinu[PKI ]|?  BN/%2a-i.rinu[PKI ]$  BN/ucmp-i.rinu[PKI ]~iF BN/%3e%3e-i.rinu[PKI ]*Y  BN/rand-c.rinu[PKI ]iI  BN/cmp-i.rinu[PKI ]}& BN/clear_bit%21-i.rinu[PKI ]}B BN/one%3f-i.rinu[PKI ]@1P BN/%2a%2a-i.rinu[PKI ][RR  BN/%2f-i.rinu[PKI ]hL BN/num_bytes-i.rinu[PKI ]e BN/mod_mul-i.rinu[PKI ]^A l   BN/prime%3f-i.rinu[PKI ]QG== :! BN/to_s-i.rinu[PKI ]մ  % BN/to_int-i.rinu[PKI ]& BN/lshift%21-i.rinu[PKI ]K( BN/mod_sub-i.rinu[PKI ]rjR) BN/mod_exp-i.rinu[PKI ]Fc|L* BN/set_bit%21-i.rinu[PKI ]E}E, BN/odd%3f-i.rinu[PKI ]g!N- BN/%3d%3d%3d-i.rinu[PKI ]]۴~/ BN/%2d%40-i.rinu[PKI ] 0 BN/%2b-i.rinu[PKI ]wi1 BN/set_flags-i.rinu[PKI ]l3 BN/negative%3f-i.rinu[PKI ]N+5 BN/pretty_print-i.rinu[PKI ]mrp6 BN/initialize_copy-i.rinu[PKI ]ww 7 BN/abs-i.rinu[PKI ],( 9 BN/%2d-i.rinu[PKI ]e;: BN/%3c%3c-i.rinu[PKI ]{HIXv; BN/prime_fasttest%3f-i.rinu[PKI ]Ϊa`> BN/mod_add-i.rinu[PKI ]a? BN/%3d%3d-i.rinu[PKI ]OA BN/zero%3f-i.rinu[PKI ]ZBB BN/%3c%3d%3e-i.rinu[PKI ]m ފ ED BN/hash-i.rinu[PKI ]N( F BN/mod_inverse-i.rinu[PKI ]Xp  fG BN/mod_sqr-i.rinu[PKI ]R55H PKey/DH/export-i.rinu[PKI ]Ӷ)K PKey/DH/private%3f-i.rinu[PKI ]h PKey/RSA/public_encrypt-i.rinu[PKI ] =o# PKey/RSA/cdesc-RSA.rinu[PKI ]e+ PKey/RSA/export-i.rinu[PKI ]oox. PKey/RSA/private%3f-i.rinu[PKI ]/0 PKey/RSA/public%3f-i.rinu[PKI ]7}ww2 PKey/RSA/set_key-i.rinu[PKI ]223 PKey/RSA/verify_pss-i.rinu[PKI ]7E **>9 PKey/RSA/new-c.rinu[PKI ].4n> PKey/RSA/set_crt_params-i.rinu[PKI ]b~A PKey/RSA/sign_pss-i.rinu[PKI ]J1wwQH PKey/RSA/set_factors-i.rinu[PKI ],AJ PKey/RSA/generate-c.rinu[PKI ];|(CCM PKey/RSA/params-i.rinu[PKI ]+2!!$O PKey/RSA/translate_padding_mode-i.rinu[PKI ]9!Q PKey/RSA/to_s-i.rinu[PKI ]e~>PS PKey/RSA/public_key-i.rinu[PKI ]E@V PKey/RSA/to_pem-i.rinu[PKI ] PKey/EC/Group/to_text-i.rinu[PKI ]" PKey/EC/Group/%3d%3d-i.rinu[PKI ]"ldbEE+ PKey/EC/Group/point_conversion_form%3d-i.rinu[PKI ]J}} PKey/EC/Group/seed%3d-i.rinu[PKI ]L:q PKey/EC/Group/cofactor-i.rinu[PKI ]TDPP PKey/EC/Group/cdesc-Group.rinu[PKI ] 2 PKey/EC/generate-c.rinu[PKI ]ZHVV PKey/EC/Point/eql%3f-i.rinu[PKI ]c6 PKey/EC/Point/to_bn-i.rinu[PKI ]S'  PKey/EC/Point/new-c.rinu[PKI ]"^ " PKey/EC/Point/Error/cdesc-Error.rinu[PKI ])R PKey/EC/Point/group-i.rinu[PKI ]l^ PKey/EC/Point/mul-i.rinu[PKI ]ì PKey/EC/Point/invert%21-i.rinu[PKI ]Ͱ["# PKey/EC/Point/to_octet_string-i.rinu[PKI ]؝q!a PKey/EC/Point/make_affine%21-i.rinu[PKI ]#C#jjH PKey/EC/Point/add-i.rinu[PKI ]I$Shh PKey/EC/Point/cdesc-Point.rinu[PKI ]F9m" PKey/EC/Point/initialize_copy-i.rinu[PKI ]5`99% PKey/EC/Point/set_to_infinity%21-i.rinu[PKI ]Ǵ'' PKey/EC/Point/%3d%3d-i.rinu[PKI ]&,, PKey/EC/Point/on_curve%3f-i.rinu[PKI ],, PKey/EC/Point/infinity%3f-i.rinu[PKI ]Sj   PKey/EC/builtin_curves-c.rinu[PKI ]"Ifp PKey/EC/generate_key-i.rinu[PKI ]/ PKey/EC/public_key-i.rinu[PKI ]7žx PKey/EC/cdesc-EC.rinu[PKI ] ttppb PKey/EC/to_pem-i.rinu[PKI ]bW\rr PKey/EC/to_der-i.rinu[PKI ]@݉ PKey/EC/private_key-i.rinu[PKI ]=. PKey/EC/private_key%3d-i.rinu[PKI ]Bn PKey/EC/public_key%3f-i.rinu[PKI ]-2 PKey/EC/generate_key%21-i.rinu[PKI ]&c   PKey/EC/initialize_copy-i.rinu[PKI ]zw PKey/EC/group%3d-i.rinu[PKI ]/ PKey/EC/dsa_verify_asn1-i.rinu[PKI ][ PKey/EC/dsa_sign_asn1-i.rinu[PKI ]o PKey/EC/check_key-i.rinu[PKI ] 55 y Digest-i.rinu[PKI ]ןKK  ConfigError/cdesc-ConfigError.rinu[PKI ]mOXX cdesc-OpenSSL.rinu[PKI ]XLn<dQ ASN1/decode-c.rinu[PKI ]1e/zT ASN1/ASN1Data/new-c.rinu[PKI ];;;"X ASN1/ASN1Data/infinite_length-i.rinu[PKI ]roo'^ ASN1/ASN1Data/cdesc-ASN1Data.rinu[PKI ] %nnp ASN1/ASN1Data/to_der-i.rinu[PKI ]ps ASN1/ASN1Data/tag_class-i.rinu[PKI ]!5iiu ASN1/ASN1Data/tag-i.rinu[PKI ]??$2w ASN1/ASN1Data/indefinite_length-i.rinu[PKI ]| ASN1/ASN1Data/value-i.rinu[PKI ]Rw~ ASN1/ObjectId/cdesc-ObjectId.rinu[PKI ]Ɂ ASN1/ObjectId/long_name-i.rinu[PKI ] ASN1/ObjectId/short_name-i.rinu[PKI ]~ ASN1/ObjectId/oid-i.rinu[PKI ]ܻ>o ASN1/ObjectId/register-c.rinu[PKI ]}X ASN1/ObjectId/ln-i.rinu[PKI ]r~zz? ASN1/ObjectId/%3d%3d-i.rinu[PKI ]{ ASN1/ObjectId/sn-i.rinu[PKI ]9`CC ASN1/cdesc-ASN1.rinu[PKI ] q ASN1/traverse-c.rinu[PKI ]g9??б ASN1/Primitive/new-c.rinu[PKI ]q$V ASN1/Primitive/tagging-i.rinu[PKI ]ѡ5pp ASN1/Primitive/to_der-i.rinu[PKI ] !q ASN1/Primitive/cdesc-Primitive.rinu[PKI ]+LRLL! ASN1/ASN1Error/cdesc-ASN1Error.rinu[PKI ]5}o&&v ASN1/decode_all-c.rinu[PKI ]Uͬ__' ASN1/Constructive/cdesc-Constructive.rinu[PKI ]DEE ASN1/Constructive/new-c.rinu[PKI ]+% ASN1/Constructive/tagging-i.rinu[PKI ]avv ASN1/Constructive/to_der-i.rinu[PKI ] ͵R ASN1/Constructive/each-i.rinu[PKI ]{y=ttR Random/seed-c.rinu[PKI ] ? Random/status%3f-c.rinu[PKI ]>$OYY Random/cdesc-Random.rinu[PKI ]׶##v Random/egd_bytes-c.rinu[PKI ]Y' Random/RandomError/cdesc-RandomError.rinu[PKI ]%_ Random/load_random_file-c.rinu[PKI ]7kk Random/egd-c.rinu[PKI ](H Random/write_random_file-c.rinu[PKI ]!cc Random/random_bytes-c.rinu[PKI ]cF2   Random/random_add-c.rinu[PKI ] Digest/reset-i.rinu[PKI ]HH Digest/new-c.rinu[PKI ]lYTT'z Digest/DigestError/cdesc-DigestError.rinu[PKI ]%XX% Digest/update-i.rinu[PKI ]] Digest/digest_length-i.rinu[PKI ] zz Digest/cdesc-Digest.rinu[PKI ]"vQ Digest/digest-c.rinu[PKI ]-n((W" Digest/name-i.rinu[PKI ]YB#$ Digest/finish-i.rinu[PKI ]& Digest/block_length-i.rinu[PKI ]n  x) Digest/initialize_copy-i.rinu[PKI ]}pAA* Digest/%3c%3c-i.rinu[PKI ]UqDOOR. mem_check_start-c.rinu[PKI ]C66 0 Digest-c.rinu[PKI ]V3 Cipher/block_size-i.rinu[PKI ].@@.5 Cipher/reset-i.rinu[PKI ]z7 Cipher/random_iv-i.rinu[PKI ]j: : Cipher/iv%3d-i.rinu[PKI ]ua= Cipher/ccm_data_len%3d-i.rinu[PKI ]U9@ Cipher/key%3d-i.rinu[PKI ]r SC Cipher/auth_tag-i.rinu[PKI ]BEG Cipher/decrypt-i.rinu[PKI ]RJ Cipher/pkcs5_keyivgen-i.rinu[PKI ],9u' P Cipher/CipherError/cdesc-CipherError.rinu[PKI ] 6R Cipher/new-c.rinu[PKI ]rcT Cipher/update-i.rinu[PKI ]f  W Cipher/iv_len%3d-i.rinu[PKI ]<%||Z Cipher/iv_len-i.rinu[PKI ]K4[ Cipher/auth_tag_len%3d-i.rinu[PKI ]!ς^ Cipher/Cipher/cdesc-Cipher.rinu[PKI ])ua Cipher/auth_data%3d-i.rinu[PKI ]|Ȗf Cipher/name-i.rinu[PKI ]eannh Cipher/key_len-i.rinu[PKI ]w4Cj Cipher/key_len%3d-i.rinu[PKI ]⢠&&Wm Cipher/cdesc-Cipher.rinu[PKI ]= Cipher/encrypt-i.rinu[PKI ] ϊy Cipher/ciphers-c.rinu[PKI ]  F Cipher/initialize_copy-i.rinu[PKI ]G  Cipher/random_key-i.rinu[PKI ]U/55 Cipher/auth_tag%3d-i.rinu[PKI ]J} Cipher/authenticated%3f-i.rinu[PKI ]UH?w Cipher/final-i.rinu[PKI ]VS Cipher/padding%3d-i.rinu[PKI ]&6a HMACError/cdesc-HMACError.rinu[PKI ]lKȤϯ Config/inspect-i.rinu[PKI ]:C Config/cdesc-Config.rinu[PKI ]}ZMEݶ Config/new-c.rinu[PKI ]O੗ Config/parse-c.rinu[PKI ]*I Config/sections-i.rinu[PKI ]ՃCC Config/%5b%5d-i.rinu[PKI ]}\yy2 Config/to_s-i.rinu[PKI ]pO Config/parse_config-c.rinu[PKI ]A.tt Config/get_value-i.rinu[PKI ]O\ Config/each-i.rinu[PKI ]nEP   Config/initialize_copy-i.rinu[PKI ] 0%$B PKCS7/PKCS7Error/cdesc-PKCS7Error.rinu[PKI ]a<c PKCS7/add_signer-i.rinu[PKI ]_# PKCS7/detached-i.rinu[PKI ]U\ PKCS7/data-i.rinu[PKI ]   PKCS7/decrypt-i.rinu[PKI ]  ] PKCS7/add_certificate-i.rinu[PKI ]Y@ PKCS7/signers-i.rinu[PKI ]Rm( PKCS7/type-i.rinu[PKI ]tM~~: PKCS7/new-c.rinu[PKI ]5OO PKCS7/encrypt-c.rinu[PKI ]FӉ PKCS7/cdesc-PKCS7.rinu[PKI ] pT PKCS7/detached%3d-i.rinu[PKI ]2t   PKCS7/add_data-i.rinu[PKI ]L$0 PKCS7/crls-i.rinu[PKI ]W PKCS7/to_s-i.rinu[PKI ]+i PKCS7/error_string-i.rinu[PKI ]47 PKCS7/to_pem-i.rinu[PKI ]>#Y PKCS7/data%3d-i.rinu[PKI ]nLQ PKCS7/to_der-i.rinu[PKI ]1f6 PKCS7/certificates%3d-i.rinu[PKI ] PKCS7/crls%3d-i.rinu[PKI ] PKCS7/recipients-i.rinu[PKI ]}3O PKCS7/add_recipient-i.rinu[PKI ]o8   PKCS7/SignerInfo/new-c.rinu[PKI ]1Gb PKCS7/SignerInfo/issuer-i.rinu[PKI ]-j!!$B PKCS7/SignerInfo/cdesc-SignerInfo.rinu[PKI ]"t! PKCS7/SignerInfo/signed_time-i.rinu[PKI ]7 PKCS7/SignerInfo/serial-i.rinu[PKI ]AIj PKCS7/type%3d-i.rinu[PKI ]]   PKCS7/verify-i.rinu[PKI ]C'!OO PKCS7/write_smime-c.rinu[PKI ]{GE\   PKCS7/initialize_copy-i.rinu[PKI ]n9   PKCS7/RecipientInfo/new-c.rinu[PKI ]b  K PKCS7/RecipientInfo/issuer-i.rinu[PKI ]B   PKCS7/RecipientInfo/serial-i.rinu[PKI ]H04##* PKCS7/RecipientInfo/cdesc-RecipientInfo.rinu[PKI ]_  ~ PKCS7/RecipientInfo/enc_key-i.rinu[PKI ].H PKCS7/cipher%3d-i.rinu[PKI ]2 PKCS7/certificates-i.rinu[PKI ]Ә^a PKCS7/detached%3f-i.rinu[PKI ]e PKCS7/add_crl-i.rinu[PKI ]nGMM PKCS7/sign-c.rinu[PKI ]Mj''i PKCS7/read_smime-c.rinu[PKI ]޺'  Netscape/SPKI/public_key%3d-i.rinu[PKI ]c; Netscape/SPKI/new-c.rinu[PKI ]ttz Netscape/SPKI/to_s-i.rinu[PKI ]Q[Pn5 Netscape/SPKI/challenge-i.rinu[PKI ]χ} Netscape/SPKI/public_key-i.rinu[PKI ]  Netscape/SPKI/to_pem-i.rinu[PKI ]$p ss Netscape/SPKI/to_der-i.rinu[PKI ]?Clv Netscape/SPKI/sign-i.rinu[PKI ]QJ! Netscape/SPKI/verify-i.rinu[PKI ]±f$ Netscape/SPKI/to_text-i.rinu[PKI ]'w¬H& Netscape/SPKI/challenge%3d-i.rinu[PKI ]55H) Netscape/SPKI/cdesc-SPKI.rinu[PKI ]%{{%1 Netscape/SPKIError/cdesc-SPKIError.rinu[PKI ]k6w4 Netscape/cdesc-Netscape.rinu[PKI ]7 ExtConfig/cdesc-ExtConfig.rinu[PKI ]n2; Marshal/_dump-i.rinu[PKI ]&7  *= Marshal/included-c.rinu[PKI ](VQ|> Marshal/cdesc-Marshal.rinu[PKI ]i@!@ Marshal/ClassMethods/_load-i.rinu[PKI ]*,B Marshal/ClassMethods/cdesc-ClassMethods.rinu[PKI ]l%B(D Timestamp/Request/cert_requested%3f-i.rinu[PKI ]n&F Timestamp/Request/message_imprint-i.rinu[PKI ]r(PPH Timestamp/Request/new-c.rinu[PKI ]S!KK Timestamp/Request/version%3d-i.rinu[PKI ]' VOM Timestamp/Request/nonce-i.rinu[PKI ] z =O Timestamp/Request/policy_id-i.rinu[PKI ] >$(uQ Timestamp/Request/cert_requested%3d-i.rinu[PKI ]JS Timestamp/Request/nonce%3d-i.rinu[PKI ]X) V Timestamp/Request/message_imprint%3d-i.rinu[PKI ]iAmmW Timestamp/Request/to_der-i.rinu[PKI ];$Y Timestamp/Request/version-i.rinu[PKI ]- #[ Timestamp/Request/algorithm%3d-i.rinu[PKI ]j;"W^ Timestamp/Request/cdesc-Request.rinu[PKI ]jn c Timestamp/Request/algorithm-i.rinu[PKI ]]:#e Timestamp/Request/policy_id%3d-i.rinu[PKI ]##0i Timestamp/TimestampError/cdesc-TimestampError.rinu[PKI ]$'.]$k Timestamp/Response/failure_info-i.rinu[PKI ]Ar Timestamp/Response/new-c.rinu[PKI ]Cu Timestamp/Response/token-i.rinu[PKI ]*$w Timestamp/Response/cdesc-Response.rinu[PKI ])/.. Timestamp/Response/status-i.rinu[PKI ]rUqq4 Timestamp/Response/to_der-i.rinu[PKI ]^5# Timestamp/Response/status_text-i.rinu[PKI ]Y"! Timestamp/Response/token_info-i.rinu[PKI ]- `` Timestamp/Response/verify-i.rinu[PKI ]W))' Timestamp/Response/tsa_certificate-i.rinu[PKI ]ΐ'< Timestamp/Factory/create_timestamp-i.rinu[PKI ]&t:&z Timestamp/Factory/allowed_digests-i.rinu[PKI ]10 Timestamp/Factory/gen_time-i.rinu[PKI ]P  (I Timestamp/Factory/default_policy_id-i.rinu[PKI ]Y$ Timestamp/Factory/serial_number-i.rinu[PKI ]+"- Timestamp/Factory/cdesc-Factory.rinu[PKI ]c'g Timestamp/Factory/additional_certs-i.rinu[PKI ]`!ܲ Timestamp/TokenInfo/gen_time-i.rinu[PKI ]!0oAoo! Timestamp/TokenInfo/ordering-i.rinu[PKI ]zc( Timestamp/TokenInfo/message_imprint-i.rinu[PKI ],Q Timestamp/TokenInfo/new-c.rinu[PKI ]  Timestamp/TokenInfo/nonce-i.rinu[PKI ]V" Timestamp/TokenInfo/policy_id-i.rinu[PKI ]%Bvv< Timestamp/TokenInfo/to_der-i.rinu[PKI ]=`FF& Timestamp/TokenInfo/serial_number-i.rinu[PKI ]  Timestamp/TokenInfo/version-i.rinu[PKI ]0s& Timestamp/TokenInfo/cdesc-TokenInfo.rinu[PKI ] KK"U Timestamp/TokenInfo/algorithm-i.rinu[PKI ]  Timestamp/cdesc-Timestamp.rinu[PKI ]b\ fips_mode%3d-c.rinu[PKI ]A  debug%3d-c.rinu[PKI ]Z secure_compare-c.rinu[PKI ]MA BNError/cdesc-BNError.rinu[PKI ]U  errors-c.rinu[PKI ] PKCS5/pbkdf2_hmac-i.rinu[PKI ]G_** PKCS5/pbkdf2_hmac_sha1-i.rinu[PKI ]I_77 PKCS5/cdesc-PKCS5.rinu[PKI ]fn} PKCS12/create-c.rinu[PKI ]Bbb PKCS12/new-c.rinu[PKI ]V'L PKCS12/PKCS12Error/cdesc-PKCS12Error.rinu[PKI ]k`ح++v PKCS12/cdesc-PKCS12.rinu[PKI ] PKCS12/to_der-i.rinu[PKI ]om! PKCS12/certificate-i.rinu[PKI ]%gPKCS12/key-i.rinu[PKI ]qF  PKCS12/initialize_copy-i.rinu[PKI ]haPKCS12/ca_certs-i.rinu[PKI ]v3))SSL/SSLContext/session_cache_mode%3d-i.rinu[PKI ]]N  SSL/SSLContext/set_params-i.rinu[PKI ]`]" SSL/SSLContext/client_cert_cb-i.rinu[PKI ]5>> SSL/SSLContext/setup-i.rinu[PKI ]&j "hSSL/SSLContext/ecdh_curves%3d-i.rinu[PKI ]_mmSSL/SSLContext/cert_store-i.rinu[PKI ]T&ESSL/SSLContext/session_id_context-i.rinu[PKI ]\ySSL/SSLContext/tmp_dh%3d-i.rinu[PKI ]/;)SSL/SSLContext/session_cache_size%3d-i.rinu[PKI ]SH]~~#SSL/SSLContext/add_certificate-i.rinu[PKI ]qd%&SSL/SSLContext/session_remove_cb-i.rinu[PKI ]pp.G")SSL/SSLContext/session_new_cb-i.rinu[PKI ]5Stt#b,SSL/SSLContext/verify_callback-i.rinu[PKI ][')0SSL/SSLContext/new-c.rinu[PKI ]|:8& 3SSL/SSLContext/session_cache_size-i.rinu[PKI ]o-5SSL/SSLContext/freeze-i.rinu[PKI ]|9 &7SSL/SSLContext/session_cache_mode-i.rinu[PKI ]&Sl9SSL/SSLContext/cert-i.rinu[PKI ]2";SSL/SSLContext/ssl_version%3d-i.rinu[PKI ]y"?SSL/SSLContext/security_level-i.rinu[PKI ]@DxxBSSL/SSLContext/client_ca-i.rinu[PKI ]44"CSSL/SSLContext/alpn_select_cb-i.rinu[PKI ]RII!RHSSL/SSLContext/servername_cb-i.rinu[PKI ]bGGJSSL/SSLContext/options-i.rinu[PKI ]z+%#rr"~LSSL/SSLContext/session_get_cb-i.rinu[PKI ]Y]"BOSSL/SSLContext/cdesc-SSLContext.rinu[PKI ]M_M22!CaSSL/SSLContext/npn_protocols-i.rinu[PKI ]yqYYdSSL/SSLContext/ssl_timeout-i.rinu[PKI ] QQnfSSL/SSLContext/timeout-i.rinu[PKI ]vs' hSSL/SSLContext/session_cache_stats-i.rinu[PKI ]n..!>oSSL/SSLContext/npn_select_cb-i.rinu[PKI ]O|| sSSL/SSLContext/verify_depth-i.rinu[PKI ]RKKuSSL/SSLContext/options%3d-i.rinu[PKI ].y"wSSL/SSLContext/verify_mode-i.rinu[PKI ]Pod??"zSSL/SSLContext/alpn_protocols-i.rinu[PKI ]L ff}SSL/SSLContext/ca_file-i.rinu[PKI ]BiLJGSSL/SSLContext/session_add-i.rinu[PKI ]c577$SSL/SSLContext/extra_chain_cert-i.rinu[PKI ]q3$"SSL/SSLContext/session_remove-i.rinu[PKI ]GO0SSL/SSLContext/ciphers-i.rinu[PKI ]>L"vSSL/SSLContext/max_version%3d-i.rinu[PKI ]x fSSL/SSLContext/key-i.rinu[PKI ]=?%SSL/SSLContext/security_level%3d-i.rinu[PKI ]㣱".SSL/SSLContext/flush_sessions-i.rinu[PKI ]')SSL/SSLContext/ca_path-i.rinu[PKI ]U>>#DSSL/SSLContext/verify_hostname-i.rinu[PKI ]A%ϭ(՗SSL/SSLContext/enable_fallback_scsv-i.rinu[PKI ]€$ڙSSL/SSLContext/renegotiation_cb-i.rinu[PKI ]9 SSL/SSLContext/ciphers%3d-i.rinu[PKI ]Q"ɡSSL/SSLContext/min_version%3d-i.rinu[PKI ]Zea#٦SSL/SSLContext/tmp_dh_callback-i.rinu[PKI ]f{x,'SSL/SSLContext/set_minmax_proto_version-i.rinu[PKI ]>  6nSSL/SSLErrorWaitReadable/cdesc-SSLErrorWaitReadable.rinu[PKI ]y,.SSL/Session/SessionError/cdesc-SessionError.rinu[PKI ]^)=SSL/Session/new-c.rinu[PKI ]kTTLSSL/Session/id-i.rinu[PKI ]]gSSL/Session/timeout-i.rinu[PKI ]χӶSSL/Session/to_pem-i.rinu[PKI ]dSSL/Session/to_der-i.rinu[PKI ]BqSSL/Session/cdesc-Session.rinu[PKI ]< SSSL/Session/initialize_copy-i.rinu[PKI ]wwwSSL/Session/time-i.rinu[PKI ]DwSSL/Session/to_text-i.rinu[PKI ]P`SSSL/Session/%3d%3d-i.rinu[PKI ]Exx"SSL/Session/time%3d-i.rinu[PKI ]1V}SSL/Session/timeout%3d-i.rinu[PKI ].11$SSL/verify_certificate_identity-c.rinu[PKI ]X]h}}VSSL/cdesc-SSL.rinu[PKI ]EXN!SSL/SSLSocket/client_cert_cb-i.rinu[PKI ]D<|SSL/SSLSocket/sysclose-i.rinu[PKI ]V+)) SSL/SSLSocket/cdesc-SSLSocket.rinu[PKI ]r0TSSL/SSLSocket/hostname%3d-i.rinu[PKI ]cVSSL/SSLSocket/pending-i.rinu[PKI ]1[9$SSL/SSLSocket/session-i.rinu[PKI ]9#SSL/SSLSocket/connect_nonblock-i.rinu[PKI ]J/X<``YSSL/SSLSocket/context-i.rinu[PKI ] SSL/SSLSocket/cipher-i.rinu[PKI ]`P!SSL/SSLSocket/session_new_cb-i.rinu[PKI ]7__SSL/SSLSocket/new-c.rinu[PKI ]GAA+SSL/SSLSocket/io-i.rinu[PKI ]줢SSL/SSLSocket/hostname-i.rinu[PKI ]Sk SSL/SSLSocket/tmp_key-i.rinu[PKI ]Qnn SSL/SSLSocket/cert-i.rinu[PKI ]g SSL/SSLSocket/client_ca-i.rinu[PKI ]sSSL/SSLSocket/session%3d-i.rinu[PKI ]M:SSL/SSLSocket/ssl_version-i.rinu[PKI ]`rrSSL/SSLSocket/accept-i.rinu[PKI ]3 :!cSSL/SSLSocket/session_get_cb-i.rinu[PKI ]d*$SSL/SSLSocket/syswrite_nonblock-i.rinu[PKI ]?`SSL/SSLSocket/npn_protocol-i.rinu[PKI ]3SSL/SSLSocket/sysread-i.rinu[PKI ]7V  'PSSL/SSLSocket/using_anon_cipher%3f-i.rinu[PKI ]:p.. SSL/SSLSocket/verify_result-i.rinu[PKI ]]GGE SSL/SSLSocket/to_io-i.rinu[PKI ]m6 !SSL/SSLSocket/alpn_protocol-i.rinu[PKI ]28֖#SSL/SSLSocket/open-c.rinu[PKI ]Y2ͩ$2)SSL/SSLSocket/session_reused%3f-i.rinu[PKI ]e#/+SSL/SSLSocket/finished_message-i.rinu[PKI ]N@ogg#-SSL/SSLSocket/sysread_nonblock-i.rinu[PKI ]DRxx0SSL/SSLSocket/syswrite-i.rinu[PKI ]'oo2SSL/SSLSocket/connect-i.rinu[PKI ]KO"K4SSL/SSLSocket/peer_cert_chain-i.rinu[PKI ]?s{{76SSL/SSLSocket/peer_cert-i.rinu[PKI ]yKYY(7SSL/SSLSocket/post_connection_check-i.rinu[PKI ]32L(:SSL/SSLSocket/peer_finished_message-i.rinu[PKI ]@<SSL/SSLSocket/state-i.rinu[PKI ]!?y">SSL/SSLSocket/accept_nonblock-i.rinu[PKI ] dBSSL/SSLSocket/sync_close-i.rinu[PKI ]Qpx"DSSL/SSLSocket/tmp_dh_callback-i.rinu[PKI ]ٳ7FSSL/SSLSocket/stop-i.rinu[PKI ]fHSSL/SocketForwarder/addr-i.rinu[PKI ]H2qISSL/SocketForwarder/fcntl-i.rinu[PKI ] ,991JSSL/SocketForwarder/do_not_reverse_lookup%3d-i.rinu[PKI ]L'!qLSSL/SocketForwarder/peeraddr-i.rinu[PKI ]݉m^^MSSL/SocketForwarder/fileno-i.rinu[PKI ]#"OSSL/SocketForwarder/closed%3f-i.rinu[PKI ]/33#PSSL/SocketForwarder/setsockopt-i.rinu[PKI ]Ld++#wRSSL/SocketForwarder/getsockopt-i.rinu[PKI ]b,SSSL/SocketForwarder/cdesc-SocketForwarder.rinu[PKI ]a VSSL/SSLError/cdesc-SSLError.rinu[PKI ]XM  6GYSSL/SSLErrorWaitWritable/cdesc-SSLErrorWaitWritable.rinu[PKI ]_ 00$[SSL/verify_certificate_identity-i.rinu[PKI ]6$Q]SSL/SSLServer/start_immediately-i.rinu[PKI ]U''-_SSL/SSLServer/new-c.rinu[PKI ] A  aSSL/SSLServer/cdesc-SSLServer.rinu[PKI ]PPdSSL/SSLServer/accept-i.rinu[PKI ]/7EEfSSL/SSLServer/close-i.rinu[PKI ]p@}llhSSL/SSLServer/shutdown-i.rinu[PKI ]`hhiSSL/SSLServer/listen-i.rinu[PKI ]*kkkSSL/SSLServer/to_io-i.rinu[PKI ]wU99'3mEngine/EngineError/cdesc-EngineError.rinu[PKI ]SOeYYoEngine/inspect-i.rinu[PKI ]k[v$$_qEngine/load_public_key-i.rinu[PKI ]CsEngine/cipher-i.rinu[PKI ]Ff$$wEngine/id-i.rinu[PKI ]K۔00gyEngine/set_default-i.rinu[PKI ]B+55|Engine/cleanup-c.rinu[PKI ]x((VEngine/load_private_key-i.rinu[PKI ]BBʁEngine/load-c.rinu[PKI ]^KLEngine/cmds-i.rinu[PKI ]05HHH!Engine/name-i.rinu[PKI ][Engine/finish-i.rinu[PKI ]}}Engine/cdesc-Engine.rinu[PKI ]fҾ>>Engine/digest-i.rinu[PKI ]]9Engine/by_id-c.rinu[PKI ] Engine/ctrl_cmd-i.rinu[PKI ]6Yu}}Engine/engines-c.rinu[PKI ]E??$ޘOCSP/SingleResponse/this_update-i.rinu[PKI ]V2ԛqOCSP/SingleResponse/certid-i.rinu[PKI ]&[OCSP/SingleResponse/new-c.rinu[PKI ]^ZZ*KOCSP/SingleResponse/revocation_reason-i.rinu[PKI ]w/EE$OCSP/SingleResponse/next_update-i.rinu[PKI ] 0+OCSP/SingleResponse/cdesc-SingleResponse.rinu[PKI ]Ɠ__$OCSP/SingleResponse/cert_status-i.rinu[PKI ]-HQQ(=OCSP/SingleResponse/revocation_time-i.rinu[PKI ]g OCSP/SingleResponse/to_der-i.rinu[PKI ]'ĬOCSP/SingleResponse/check_validity-i.rinu[PKI ]2  (,OCSP/SingleResponse/initialize_copy-i.rinu[PKI ]ޮPP#OCSP/SingleResponse/extensions-i.rinu[PKI ]0'GOCSP/CertificateId/issuer_key_hash-i.rinu[PKI ]wiylOCSP/CertificateId/new-c.rinu[PKI ]E "OCSP/CertificateId/cmp_issuer-i.rinu[PKI ]ɼOCSP/CertificateId/cmp-i.rinu[PKI ]Fƙw(ʾOCSP/CertificateId/issuer_name_hash-i.rinu[PKI ]500)OCSP/CertificateId/cdesc-CertificateId.rinu[PKI ]`OCSP/CertificateId/to_der-i.rinu[PKI ]LOCSP/CertificateId/serial-i.rinu[PKI ]C+'OCSP/CertificateId/initialize_copy-i.rinu[PKI ]P&OCSP/CertificateId/hash_algorithm-i.rinu[PKI ] EE8OCSP/Request/check_nonce-i.rinu[PKI ]=~~OCSP/Request/certid-i.rinu[PKI ]?OCSP/Request/new-c.rinu[PKI ]mOCSP/Request/add_certid-i.rinu[PKI ]R PPOCSP/Request/to_der-i.rinu[PKI ]eWW@OCSP/Request/sign-i.rinu[PKI ]"OCSP/Request/verify-i.rinu[PKI ]|*AAOCSP/Request/add_nonce-i.rinu[PKI ]ʈ!OCSP/Request/initialize_copy-i.rinu[PKI ]dOCSP/Request/cdesc-Request.rinu[PKI ] OCSP/Request/signed%3f-i.rinu[PKI ]_FgOCSP/Response/create-c.rinu[PKI ],'  OCSP/Response/new-c.rinu[PKI ]7d6cOCSP/Response/cdesc-Response.rinu[PKI ]jFQjjOCSP/Response/status-i.rinu[PKI ]}1tt^OCSP/Response/to_der-i.rinu[PKI ]2bbOCSP/Response/basic-i.rinu[PKI ]Ow"OCSP/Response/initialize_copy-i.rinu[PKI ]m +OCSP/Response/status_string-i.rinu[PKI ]<ă  %OCSP/BasicResponse/find_response-i.rinu[PKI ]_)^OCSP/BasicResponse/cdesc-BasicResponse.rinu[PKI ]2h,JOCSP/BasicResponse/new-c.rinu[PKI ]Il!lOCSP/BasicResponse/responses-i.rinu[PKI ]6r"gOCSP/BasicResponse/add_status-i.rinu[PKI ]UDլ OCSP/BasicResponse/status-i.rinu[PKI ]OCSP/BasicResponse/to_der-i.rinu[PKI ]=QŸOCSP/BasicResponse/sign-i.rinu[PKI ]t%%OCSP/BasicResponse/verify-i.rinu[PKI ]Z!pOCSP/BasicResponse/add_nonce-i.rinu[PKI ]N'OCSP/BasicResponse/initialize_copy-i.rinu[PKI ];"OCSP/BasicResponse/copy_nonce-i.rinu[PKI ]1!OCSP/OCSPError/cdesc-OCSPError.rinu[PKI ]fX&X&nOCSP/cdesc-OCSP.rinu[PKI ]=p.+FX509/ExtensionError/cdesc-ExtensionError.rinu[PKI ]PCX509/Extension/AuthorityKeyIdentifier/authority_key_identifier-i.rinu[PKI ]^}B#X509/Extension/initialize_copy-i.rinu[PKI ]9X509/Extension/to_h-i.rinu[PKI ])uww6dX509/Extension/AuthorityInfoAccess/ca_issuer_uris-i.rinu[PKI ]%<LL1AX509/Extension/AuthorityInfoAccess/ocsp_uris-i.rinu[PKI ]Frr?X509/Extension/AuthorityInfoAccess/cdesc-AuthorityInfoAccess.rinu[PKI ]R"::6ϲX509/Extension/AuthorityInfoAccess/parse_aia_asn1-i.rinu[PKI ] >oX509/Extension/%3d%3d-i.rinu[PKI ]|  X509/Extension/value_der-i.rinu[PKI ]X509/Extension/value-i.rinu[PKI ]U_~~dX509/cdesc-X509.rinu[PKI ]K"$X509/StoreContext/current_crl-i.rinu[PKI ]WaX509/StoreContext/new-c.rinu[PKI ]E!rX509/StoreContext/purpose%3d-i.rinu[PKI ]flX509/StoreContext/flags%3d-i.rinu[PKI ]2ZZ?X509/StoreContext/error-i.rinu[PKI ]@s&&#X509/StoreContext/error_string-i.rinu[PKI ]C^X509/StoreContext/trust%3d-i.rinu[PKI ]1#X509/StoreContext/current_cert-i.rinu[PKI ]AO4O'X509/StoreContext/cdesc-StoreContext.rinu[PKI ]*WX509/StoreContext/cleanup-i.rinu[PKI ]vX509/StoreContext/verify-i.rinu[PKI ]'po..X509/StoreContext/error%3d-i.rinu[PKI ]nKPuX509/StoreContext/chain-i.rinu[PKI ]  "X509/StoreContext/error_depth-i.rinu[PKI ]GX509/StoreContext/time%3d-i.rinu[PKI ]1  IX509/Request/public_key%3d-i.rinu[PKI ]  X509/Request/attributes-i.rinu[PKI ]~ SX509/Request/new-c.rinu[PKI ]b(BX509/Request/subject-i.rinu[PKI ]贓X509/Request/version%3d-i.rinu[PKI ]c  X509/Request/attributes%3d-i.rinu[PKI ]e=X509/Request/add_attribute-i.rinu[PKI ]))X509/Request/to_s-i.rinu[PKI ] cy   X509/Request/public_key-i.rinu[PKI ]'RaX509/Request/to_pem-i.rinu[PKI ]ƃRX509/Request/to_der-i.rinu[PKI ]J X509/Request/version-i.rinu[PKI ] NX509/Request/sign-i.rinu[PKI ]XqqX509/Request/verify-i.rinu[PKI ]dpPX509/Request/subject%3d-i.rinu[PKI ]43!X509/Request/initialize_copy-i.rinu[PKI ] 7 X509/Request/cdesc-Request.rinu[PKI ]JFX509/Request/to_text-i.rinu[PKI ]y X509/Request/%3d%3d-i.rinu[PKI ]k@^%X509/Request/signature_algorithm-i.rinu[PKI ][MX509/ExtensionFactory/crl-i.rinu[PKI ]'i/X509/ExtensionFactory/cdesc-ExtensionFactory.rinu[PKI ]| //0%X509/ExtensionFactory/issuer_certificate%3d-i.rinu[PKI ] t!X509/ExtensionFactory/crl%3d-i.rinu[PKI ]#111X509/ExtensionFactory/subject_certificate%3d-i.rinu[PKI ]eu..- X509/ExtensionFactory/issuer_certificate-i.rinu[PKI ]n003 X509/ExtensionFactory/new-c.rinu[PKI ]v//% X509/ExtensionFactory/create_ext-i.rinu[PKI ]!5X509/ExtensionFactory/config-i.rinu[PKI ] 00.X509/ExtensionFactory/subject_certificate-i.rinu[PKI ] D;;1+X509/ExtensionFactory/create_ext_from_string-i.rinu[PKI ]jw))-X509/ExtensionFactory/subject_request%3d-i.rinu[PKI ]990MX509/ExtensionFactory/create_ext_from_array-i.rinu[PKI ]Ĩ((*X509/ExtensionFactory/subject_request-i.rinu[PKI ]|00+hX509/ExtensionFactory/create_extension-i.rinu[PKI ]R!88/X509/ExtensionFactory/create_ext_from_hash-i.rinu[PKI ]ǁ+X509/AttributeError/cdesc-AttributeError.rinu[PKI ]6f'X509/RequestError/cdesc-RequestError.rinu[PKI ]NJ$''X509/Attribute/value%3d-i.rinu[PKI ]%%"X509/Attribute/oid%3d-i.rinu[PKI ]eJ$X509/Attribute/oid-i.rinu[PKI ]Z!!%X509/Attribute/to_der-i.rinu[PKI ]?(  !'X509/Attribute/cdesc-Attribute.rinu[PKI ]#q*X509/Attribute/initialize_copy-i.rinu[PKI ]7i+X509/Attribute/%3d%3d-i.rinu[PKI ]Ր/-X509/Attribute/value-i.rinu[PKI ]@Py.X509/Revoked/add_extension-i.rinu[PKI ]0eEKK/X509/Revoked/extensions%3d-i.rinu[PKI ]yw1X509/Revoked/new-c.rinu[PKI ]eG  2X509/Revoked/serial%3d-i.rinu[PKI ] 04X509/Revoked/to_der-i.rinu[PKI ] ++}5X509/Revoked/cdesc-Revoked.rinu[PKI ]x28X509/Revoked/serial-i.rinu[PKI ]*5I!B:X509/Revoked/initialize_copy-i.rinu[PKI ]E±ee;X509/Revoked/extensions-i.rinu[PKI ],S]=X509/Revoked/time-i.rinu[PKI ]>X509/Revoked/%3d%3d-i.rinu[PKI ]ǀ?X509/Revoked/time%3d-i.rinu[PKI ]6x>'=AX509/RevokedError/cdesc-RevokedError.rinu[PKI ]$'@!mCX509/NameError/cdesc-NameError.rinu[PKI ] B/EX509/CertificateError/cdesc-CertificateError.rinu[PKI ]bGX509/CRL/last_update%3d-i.rinu[PKI ]崋IX509/CRL/cdesc-CRL.rinu[PKI ]P 3  MX509/CRL/add_extension-i.rinu[PKI ]U??BOX509/CRL/extensions%3d-i.rinu[PKI ]PX509/CRL/new-c.rinu[PKI ]0RX509/CRL/add_revoked-i.rinu[PKI ]0VSX509/CRL/next_update-i.rinu[PKI ]-@ TX509/CRL/revoked-i.rinu[PKI ]UX509/CRL/version%3d-i.rinu[PKI ]s)WX509/CRL/issuer-i.rinu[PKI ]``WfXX509/CRL/to_s-i.rinu[PKI ]3YX509/CRL/to_pem-i.rinu[PKI ]c[X509/CRL/next_update%3d-i.rinu[PKI ]FԎd\X509/CRL/to_der-i.rinu[PKI ]K{z]X509/CRL/version-i.rinu[PKI ]]M^X509/CRL/sign-i.rinu[PKI ]`X509/CRL/issuer%3d-i.rinu[PKI ]U߉baX509/CRL/verify-i.rinu[PKI ]bX509/CRL/revoked%3d-i.rinu[PKI ]cX509/CRL/last_update-i.rinu[PKI ]^  4eX509/CRL/initialize_copy-i.rinu[PKI ]:]YYfX509/CRL/extensions-i.rinu[PKI ]5/hX509/CRL/to_text-i.rinu[PKI ]oiX509/CRL/%3d%3d-i.rinu[PKI ]lC!jX509/CRL/signature_algorithm-i.rinu[PKI ]}!uulX509/Name/hash_old-i.rinu[PKI ]mX509/Name/to_a-i.rinu[PKI ]C@oX509/Name/eql%3f-i.rinu[PKI ] --%qX509/Name/RFC2253DN/expand_value-i.rinu[PKI ]"EP$sX509/Name/RFC2253DN/expand_pair-i.rinu[PKI ][Y*((&xtX509/Name/RFC2253DN/cdesc-RFC2253DN.rinu[PKI ]ozX509/Name/RFC2253DN/scan-i.rinu[PKI ]H2(()R|X509/Name/RFC2253DN/expand_hexstring-i.rinu[PKI ]^ }X509/Name/new-c.rinu[PKI ]g]0QQX509/Name/parse-c.rinu[PKI ]v X509/Name/parse_openssl-c.rinu[PKI ]XXX509/Name/cmp-i.rinu[PKI ]78X509/Name/to_s-i.rinu[PKI ]__X509/Name/to_der-i.rinu[PKI ]y  &X509/Name/parse_rfc2253-c.rinu[PKI ]X߱  }X509/Name/pretty_print-i.rinu[PKI ]9ՕX509/Name/initialize_copy-i.rinu[PKI ]3X509/Name/to_utf8-i.rinu[PKI ]qk =X509/Name/cdesc-Name.rinu[PKI ]zd""fX509/Name/%3c%3d%3e-i.rinu[PKI ]@ԕХX509/Name/hash-i.rinu[PKI ]X509/Name/add_entry-i.rinu[PKI ]::#X509/Certificate/not_before%3d-i.rinu[PKI ]// IX509/Certificate/not_before-i.rinu[PKI ]911#ȯX509/Certificate/public_key%3d-i.rinu[PKI ]Si  LX509/Certificate/inspect-i.rinu[PKI ]JJ#X509/Certificate/add_extension-i.rinu[PKI ].)n77"BX509/Certificate/not_after%3d-i.rinu[PKI ]%c=BB#˵X509/Certificate/extensions%3d-i.rinu[PKI ]$eII`X509/Certificate/new-c.rinu[PKI ]HXT&&X509/Certificate/subject-i.rinu[PKI ].77 eX509/Certificate/version%3d-i.rinu[PKI ]6O##X509/Certificate/issuer-i.rinu[PKI ]@l'[X509/Certificate/check_private_key-i.rinu[PKI ]יN  %X509/Certificate/cdesc-Certificate.rinu[PKI ]5 FFX509/Certificate/load-c.rinu[PKI ]444X509/Certificate/serial%3d-i.rinu[PKI ]66X509/Certificate/to_s-i.rinu[PKI ]~.. X509/Certificate/public_key-i.rinu[PKI ]i)r44X509/Certificate/to_pem-i.rinu[PKI ]qk%%X509/Certificate/to_der-i.rinu[PKI ]K#))X509/Certificate/version-i.rinu[PKI ]ۖ00}X509/Certificate/sign-i.rinu[PKI ]@I..X509/Certificate/issuer%3d-i.rinu[PKI ]2tX509/Certificate/verify-i.rinu[PKI ]۫&&X509/Certificate/serial-i.rinu[PKI ] @X,,X509/Certificate/not_after-i.rinu[PKI ]j"~X509/Certificate/pretty_print-i.rinu[PKI ]z)11 X509/Certificate/subject%3d-i.rinu[PKI ]j lX509/Certificate/load_file-c.rinu[PKI ]"%X509/Certificate/initialize_copy-i.rinu[PKI ][gQ99 GX509/Certificate/extensions-i.rinu[PKI ]P,'~((X509/Certificate/to_text-i.rinu[PKI ]]EX509/Certificate/%3d%3d-i.rinu[PKI ] FLL)cX509/Certificate/signature_algorithm-i.rinu[PKI ]ª5 fixed_length_secure_compare-c.rinu[PKI ]krVVHMAC/reset-i.rinu[PKI ]|~~HMAC/inspect-i.rinu[PKI ]Ԯ.nHMAC/hexdigest-i.rinu[PKI ]9 HMAC/new-c.rinu[PKI ]_0PP HMAC/update-i.rinu[PKI ]{PHMAC/digest-c.rinu[PKI ]11HMAC/cdesc-HMAC.rinu[PKI ]9͉HMAC/base64digest-i.rinu[PKI ]Z+xx`HMAC/to_s-i.rinu[PKI ]y0!HMAC/base64digest-c.rinu[PKI ]KP$HMAC/digest-i.rinu[PKI ]!Yم'HMAC/hexdigest-c.rinu[PKI ]9_$+HMAC/initialize_copy-i.rinu[PKI ]P<<,HMAC/%3c%3c-i.rinu[PKI ]掛3ZZu0HMAC/%3d%3d-i.rinu[PKI ]O2fips_mode-c.rinu[PKI ]"zr&&f3print_mem_leaks-c.rinu[PK8B7