%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/utils/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/utils/crypt.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZeje	�Z
ddlZddl
ZddlmZyddlZeZWnek
r�eZnXedddd�Zd�Zdddd�ZdS(	u#
Functions dealing with encryption
i(tabsolute_importtprint_functiontunicode_literalsN(tSaltInvocationErrorcC@s�y:|r9||kr9tdj|dj|����nWn8tk
rt}t|t�ra�ntjd|�nX|dkr�|dkr�td��ntj	j
|i�}n|j|�}|dkr�tdj|���n||d|�S(u
    .. versionadded:: 2017.7.0

    Decrypt a data structure using the specified renderer. Written originally
    as a common codebase to handle decryption of encrypted elements within
    Pillar data, but should be flexible enough for other uses as well.

    Returns the decrypted result, but any decryption renderer should be
    recursively decrypting mutable types in-place, so any data structure passed
    should be automagically decrypted using this function. Immutable types
    obviously won't, so it's a good idea to check if ``data`` is hashable in
    the calling function, and replace the original value with the decrypted
    result if that is not the case. For an example of this, see
    salt.pillar.Pillar.decrypt_pillar().

    data
        The data to be decrypted. This can be a string of ciphertext or a data
        structure. If it is a data structure, the items in the data structure
        will be recursively decrypted.

    rend
        The renderer used to decrypt

    translate_newlines : False
        If True, then the renderer will convert a literal backslash followed by
        an 'n' into a newline before performing the decryption.

    renderers
        Optionally pass a loader instance containing loaded renderer functions.
        If not passed, then the ``opts`` will be required and will be used to
        invoke the loader to get the available renderers. Where possible,
        renderers should be passed to avoid the overhead of loading them here.

    opts
        The master/minion configuration opts. Used only if renderers are not
        passed.

    valid_rend
        A list containing valid renderers, used to restrict the renderers which
        this function will be allowed to use. If not passed, no restriction
        will be made.
    u@'{0}' is not a valid decryption renderer. Valid choices are: {1}u, u+Non-iterable value %s passed for valid_renduopts are requiredu*Decryption renderer '{0}' is not availablettranslate_newlinesN(Rtformattjoint	TypeErrort
isinstancetlogterrortNonetsalttloadertrendertget(tdatatrendRt	rendererstoptst
valid_rendtexct	rend_func((s4/usr/lib/python2.7/site-packages/salt/utils/crypt.pytdecrypts$0cC@strtjj�ndS(u�
    When a fork arises, pycrypto needs to reinit
    From its doc::

        Caveat: For the random number generator to work correctly,
        you must call Random.atfork() in both the parent and
        child processes after using os.fork()

    N(t
HAS_CRYPTOtCryptotRandomtatfork(((s4/usr/lib/python2.7/site-packages/salt/utils/crypt.pyt
reinit_cryptogs
usha256c	C@s�|s{tjj|�sdStjjj|d��B}djg|j�D]}|j	�rJ|^qJdd!�}WdQXnt
t|�|�j�}d}xLt
|�D]>\}}|dr�|dj||�7}q�|||7}q�W|jd	�S(
u%
    Pass in either a raw pem string, or the path on disk to the location of a
    pem file, and the type of cryptographic hash to use. The default is SHA256.
    The fingerprint of the pem will be returned.

    If neither a key nor a path are passed in, a blank string will be returned.
    uurbtii����Niu{0}:u:(tostpathtisfileRtutilstfilestfopenRt	readlineststriptgetattrthashlibt	hexdigestt	enumerateRtrstrip(	Rtkeytsum_typetfp_txtpretfingertindt_((s4/usr/lib/python2.7/site-packages/salt/utils/crypt.pyt
pem_fingerusD
(t__doc__t
__future__RRRR'tloggingRt	getLoggert__name__R	tsalt.loaderRtsalt.utils.filestsalt.exceptionsRt
Crypto.RandomRtTrueRtImportErrortFalseRRRR3(((s4/usr/lib/python2.7/site-packages/salt/utils/crypt.pyt<module>s&


G	

Zerion Mini Shell 1.0