MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //opt/alt/python38/lib/python3.8/site-packages/asn1crypto/__pycache__/keys.cpython-38.pyc
U

���W��@s�dZddlmZmZmZmZddlZddlZddlm	Z	m
Z
mZmZm
Z
mZmZddlmZddlmZmZmZddlmZmZmZdd	lmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)dd
l*m+Z+m,Z,Gdd�de'�Z-Gd
d�de(�Z.Gdd�de�Z/Gdd�de'�Z0Gdd�de'�Z1Gdd�de'�Z2Gdd�d�Z3Gdd�de$e3�Z4Gdd�de#e3�Z5Gdd�de�Z6Gdd �d e"�Z7Gd!d"�d"e"�Z8Gd#d$�d$e'�Z9Gd%d&�d&e'�Z:Gd'd(�d(e'�Z;Gd)d*�d*e'�Z<Gd+d,�d,e'�Z=Gd-d.�d.e"�Z>Gd/d0�d0e�Z?Gd1d2�d2e�Z@Gd3d4�d4e'�ZAGd5d6�d6e'�ZBGd7d8�d8e'�ZCGd9d:�d:e)�ZDGd;d<�d<e"�ZEGd=d>�d>ee'�ZFGd?d@�d@e'�ZGGdAdB�dBe'�ZHGdCdD�dDe'�ZIGdEdF�dFe'�ZJGdGdH�dHe"�ZKGdIdJ�dJee'�ZLGdKdL�dLe'�ZMdS)Ma'
ASN.1 type classes for public and private keys. Exports the following items:

 - DSAPrivateKey()
 - ECPrivateKey()
 - EncryptedPrivateKeyInfo()
 - PrivateKeyInfo()
 - PublicKeyInfo()
 - RSAPrivateKey()
 - RSAPublicKey()

Other type classes are defined that help compose the types listed above.
�)�unicode_literals�division�absolute_import�print_functionN�)�SECP192R1_BASE_POINT�SECP224R1_BASE_POINT�SECP256R1_BASE_POINT�SECP384R1_BASE_POINT�SECP521R1_BASE_POINT�
PrimeCurve�
PrimePoint)�unwrap)�	type_name�str_cls�byte_cls)�_ForceNullParameters�DigestAlgorithm�EncryptionAlgorithm)�Any�	Asn1Value�	BitString�Choice�Integer�IntegerOctetString�Null�ObjectIdentifier�OctetBitString�OctetString�ParsableOctetString�ParsableOctetBitString�Sequence�
SequenceOf�SetOf)�int_from_bytes�int_to_bytesc@s&eZdZdZdefdefdefgZdS)�OtherPrimeInfo�=
    Source: https://tools.ietf.org/html/rfc3447#page-46
    �primeZexponent�coefficientN��__name__�
__module__�__qualname__�__doc__r�_fields�r0r0�/keys.pyr&6s
�r&c@seZdZdZeZdS)�OtherPrimeInfosr'N)r+r,r-r.r&�_child_specr0r0r0r1r2Bsr2c@seZdZdZddd�ZdS)�RSAPrivateKeyVersionzX
    Original Name: Version
    Source: https://tools.ietf.org/html/rfc3447#page-45
    z	two-primeZmulti)rrN�r+r,r-r.�_mapr0r0r0r1r4Js�r4c
@sVeZdZdZdefdefdefdefdefdefdefd	efd
efdedd
ifg
ZdS)�
RSAPrivateKeyz=
    Source: https://tools.ietf.org/html/rfc3447#page-45
    �version�modulus�public_exponentZprivate_exponentZprime1Zprime2Z	exponent1Z	exponent2r)Zother_prime_infos�optionalTN)r+r,r-r.r4rr2r/r0r0r0r1r7Vs�r7c@s eZdZdZdefdefgZdS)�RSAPublicKeyz=
    Source: https://tools.ietf.org/html/rfc3447#page-44
    r9r:Nr*r0r0r0r1r<is�r<c@s8eZdZdZdefdefdefdefdefdefgZdS)	�
DSAPrivateKeya&
    The ASN.1 structure that OpenSSL uses to store a DSA private key that is
    not part of a PKCS#8 structure. Reversed engineered from english-language
    description on linked OpenSSL documentation page.

    Original Name: None
    Source: https://www.openssl.org/docs/apps/dsa.html
    r8�p�q�g�
public_key�private_keyNr*r0r0r0r1r=ts
�r=c@s$eZdZdZedd��Zdd�ZdS)�_ECPointa

    In both PublicKeyInfo and PrivateKeyInfo, the EC public key is a byte
    string that is encoded as a bit string. This class adds convenience
    methods for converting to and from the byte string to a pair of integers
    that are the X and Y coordinates.
    cCsjtt�t�|d�d��}tt�t�|d�d��}t||�}d}|t||d�7}|t||d�7}||�S)a
        Creates an ECPoint object from the X and Y integer coordinates of the
        point

        :param x:
            The X coordinate, as an integer

        :param y:
            The Y coordinate, as an integer

        :return:
            An ECPoint object
        �g @�)�width)�int�math�ceil�log�maxr%)�cls�x�yZx_bytesZy_bytesZ	num_bytesZbyte_stringr0r0r1�from_coords�s
z_ECPoint.from_coordscCs�|j}|dd�}|dkrZ|dd�}t|�d}t|d|��}t||d��}||fS|tddg�krvttd���ttd	���dS)
z�
        Returns the X and Y coordinates for this EC point, as native Python
        integers

        :return:
            A 2-element tuple containing integers (X, Y)
        rrrENrD��zQ
                Invalid EC public key - first byte is incorrect
                z|
            Compressed representations of EC public keys are not supported due
            to patent US6252960
            )�native�lenr$�set�
ValueErrorr)�self�dataZ
first_byteZ	remainingZ	field_lenrMrNr0r0r1�	to_coords�s	��z_ECPoint.to_coordsN)r+r,r-r.�classmethodrOrXr0r0r0r1rC�s
rCc@seZdZdS)�ECPointN�r+r,r-r0r0r0r1rZ�srZc@seZdZdS)�ECPointBitStringNr[r0r0r0r1r\�sr\c@seZdZdZdddd�ZdS)�SpecifiedECDomainVersion�:
    Source: http://www.secg.org/sec1-v2.pdf page 104
    ZecdpVer1ZecdpVer2ZecdpVer3)rrD�Nr5r0r0r0r1r]�s
�r]c@seZdZdZddd�ZdS)�	FieldTypezR
    Original Name: None
    Source: http://www.secg.org/sec1-v2.pdf page 101
    �prime_field�characteristic_two_field)z1.2.840.10045.1.1z1.2.840.10045.1.2Nr5r0r0r0r1r`�s�r`c@seZdZdZdddd�ZdS)�CharacteristicTwoBasiszR
    Original Name: None
    Source: http://www.secg.org/sec1-v2.pdf page 102
    �gn_basis�tp_basis�pp_basis)z1.2.840.10045.1.2.1.1z1.2.840.10045.1.2.1.2z1.2.840.10045.1.2.1.3Nr5r0r0r0r1rc�s
�rcc@s&eZdZdZdefdefdefgZdS)�Pentanomial�:
    Source: http://www.secg.org/sec1-v2.pdf page 102
    Zk1Zk2Zk3Nr*r0r0r0r1rg�s
�rgc@s6eZdZdZdefdefdefgZdZe	ee
d�ZdS)�CharacteristicTwoz`
    Original Name: Characteristic-two
    Source: http://www.secg.org/sec1-v2.pdf page 101
    �m�basis�
parameters)rkrl)rdrerfN)r+r,r-r.rrcrr/�	_oid_pairrrg�
_oid_specsr0r0r0r1ris��ric@s.eZdZdZdefdefgZdZee	d�Z
dS)�FieldIDz:
    Source: http://www.secg.org/sec1-v2.pdf page 100
    �
field_typerl)rprl)rarbN)r+r,r-r.r`rr/rmrrirnr0r0r0r1ros��roc@s,eZdZdZdefdefdeddifgZdS)�Curver^�a�b�seedr;TN)r+r,r-r.rrr/r0r0r0r1rq-s
�rqc
@sJeZdZdZdefdefdefdefdefdedd	ifd
e	dd	ifgZ
dS)�SpecifiedECDomainz:
    Source: http://www.secg.org/sec1-v2.pdf page 103
    r8�field_id�curve�base�orderZcofactorr;T�hashN)r+r,r-r.r]rorqrZrrr/r0r0r0r1ru9s�ruc)@sfeZdZdZdddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*�(Zd+S),�
NamedCurvez�
    Various named curves

    Original Name: None
    Source: https://tools.ietf.org/html/rfc3279#page-23,
            https://tools.ietf.org/html/rfc5480#page-5
    Z
c2pnb163v1Z
c2pnb163v2Z
c2pnb163v3Z
c2pnb176w1Z
c2tnb191v1Z
c2tnb191v2Z
c2tnb191v3Z
c2onb191v4Z
c2onb191v5Z
c2pnb208w1Z
c2tnb239v1Z
c2tnb239v2Z
c2tnb239v3Z
c2onb239v4Z
c2onb239v5Z
c2pnb272w1Z
c2pnb304w1Z
c2tnb359v1Z
c2pnb368w1Z
c2tnb431r1Z
prime192v2Z
prime192v3Z
prime239v1Z
prime239v2Z
prime239v3Z	sect163k1Z	sect163r2�	secp192r1�	secp224r1Z	sect233k1�	secp256r1Z	sect233r1Z	sect283k1Z	sect283r1�	secp384r1Z	sect409k1Z	sect409r1�	secp521r1Z	sect571k1Z	sect571r1)(z1.2.840.10045.3.0.1z1.2.840.10045.3.0.2z1.2.840.10045.3.0.3z1.2.840.10045.3.0.4z1.2.840.10045.3.0.5z1.2.840.10045.3.0.6z1.2.840.10045.3.0.7z1.2.840.10045.3.0.8z1.2.840.10045.3.0.9z1.2.840.10045.3.0.10z1.2.840.10045.3.0.11z1.2.840.10045.3.0.12z1.2.840.10045.3.0.13z1.2.840.10045.3.0.14z1.2.840.10045.3.0.15z1.2.840.10045.3.0.16z1.2.840.10045.3.0.17z1.2.840.10045.3.0.18z1.2.840.10045.3.0.19z1.2.840.10045.3.0.20z1.2.840.10045.3.1.2z1.2.840.10045.3.1.3z1.2.840.10045.3.1.4z1.2.840.10045.3.1.5z1.2.840.10045.3.1.6z1.3.132.0.1z1.3.132.0.15z1.2.840.10045.3.1.1z1.3.132.0.33z1.3.132.0.26z1.2.840.10045.3.1.7z1.3.132.0.27z1.3.132.0.16z1.3.132.0.17z1.3.132.0.34z1.3.132.0.36z1.3.132.0.37z1.3.132.0.35z1.3.132.0.38z1.3.132.0.39Nr5r0r0r0r1r{IsT
�r{c@s&eZdZdZdefdefdefgZdS)�ECDomainParametersrh�	specified�named�implicit_caN)r+r,r-r.rur{rZ
_alternativesr0r0r0r1r��s
�r�c@seZdZdZddiZdS)�ECPrivateKeyVersionzR
    Original Name: None
    Source: http://www.secg.org/sec1-v2.pdf page 108
    rZ
ecPrivkeyVer1Nr5r0r0r0r1r��s�r�c	@s@eZdZdZdefdefdedddd�fd	edd
dd�fgZdS)�ECPrivateKeyz:
    Source: http://www.secg.org/sec1-v2.pdf page 108
    r8rBrlZexplicitrT�Ztag_type�tagr;rArN)	r+r,r-r.r�rr�r\r/r0r0r0r1r��s�r�c@s&eZdZdZdefdefdefgZdS)�	DSAParamsz�
    Parameters for a DSA public or private key

    Original Name: Dss-Parms
    Source: https://tools.ietf.org/html/rfc3279#page-9
    r>r?r@Nr*r0r0r0r1r��s
�r�c@s&eZdZdZdefdedeifgZdS)�	Attributezq
    Source: https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-X.501-198811-S!!PDF-E&type=items page 8
    �type�values�specN)r+r,r-r.rr#rr/r0r0r0r1r��s�r�c@seZdZdZeZdS)�
Attributes�<
    Source: https://tools.ietf.org/html/rfc5208#page-3
    N)r+r,r-r.r�r3r0r0r0r1r��sr�c@seZdZdZdddd�ZdS)�PrivateKeyAlgorithmIdz�
    These OIDs for various public keys are reused when storing private keys
    inside of a PKCS#8 structure

    Original Name: None
    Source: https://tools.ietf.org/html/rfc3279
    �rsa�dsa�ec)�1.2.840.113549.1.1.1�1.2.840.10040.4.1�1.2.840.10045.2.1Nr5r0r0r0r1r��s

�r�c@s4eZdZdZdefdeddifgZdZee	d�Z
dS)	�PrivateKeyAlgorithmzm
    Original Name: PrivateKeyAlgorithmIdentifier
    Source: https://tools.ietf.org/html/rfc5208#page-3
    �	algorithmrlr;T�r�rl)r�r�N)r+r,r-r.r�rr/rmr�r�rnr0r0r0r1r��s��r�c	@s�eZdZdZdefdefdefdedddd	�fgZd
d�Z	de	iZ
dZdZdZ
dZed
d��Zdd�Zdd�Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��ZdS)#�PrivateKeyInfor�r8�private_key_algorithmrBZ
attributesZimplicitrTr�cCs|ddj}tttd�|S)Nr�r�)r�r�r�)rRr7rr��rVr�r0r0r1�_private_key_spec�s��z PrivateKeyInfo._private_key_specNcCs@t|t�s&t|t�s&ttdt|����|dkrJt|t�sBt�|�}t�}n�|dkr�t|t	�sft	�|�}t
�}|d|d<|d|d<|d|d<|d}|d}nH|d	kr�t|t�s�t�|�}n|��}|d
}|d
=nt
tdt|����t�}t|�|d<||d
<|�}||_td
�|d<||d<||d<|dk�r<||_|S)a'
        Wraps a private key in a PrivateKeyInfo structure

        :param private_key:
            A byte string or Asn1Value object of the private key

        :param algorithm:
            A unicode string of "rsa", "dsa" or "ec"

        :return:
            A PrivateKeyInfo object
        zX
                private_key must be a byte string or Asn1Value, not %s
                r�r�r>r?r@rArBr�rlzU
                algorithm must be one of "rsa", "dsa", "ec", not %s
                r�rr8r�)�
isinstancerr�	TypeErrorrrr7�loadrr=r�r��copyrU�reprr�r��
_algorithmr�_public_key)rLrBr��paramsrAZprivate_key_algo�	containerr0r0r1�wrapsN�





�
zPrivateKeyInfo.wrapc
Csf|jdkr:|dd}tt|dj|djj|dj��S|jdkrd|dj}t|d|d	d
��S|jdk�rb|j\}}|dkr�ttd
���|dk�r|dddkr�ttd���t	|ddt
|dd�t
|dd��}|ddjd��\}}t
|||�}n6|dk�r>|dk�r*ttd|���tttttd�|}||djdj}	t�|	j|	j�SdS)z�
        Computes the public key corresponding to the current private key.

        :return:
            For RSA keys, an RSAPublicKey object. For DSA keys, an Integer
            object. For EC keys, an ECPointBitString.
        r�r�rlr@rBr>r�r9r:)r9r:r�r�z�
                    Unable to compute public key for EC key using Implicit CA
                    parameters
                    r�rvrprbz�
                        Unable to compute public key for EC key over a
                        characteristic two field
                        rwrrrsrxr�)r|r}r~rr�z�
                        Unable to compute public key for EC named curve %s,
                        parameters not currently included
                        N)r�r�powrR�parsedr<rwrUrrr$�chosenrXr
rrr	r
rr\rOrMrN)
rVr��keyZ
curve_typeZdetailsrwZbase_xZbase_yZ
base_pointZpublic_pointr0r0r1�_compute_public_keyLs^	

�

�
�
�
�

�	��z"PrivateKeyInfo._compute_public_keycCs�|jdkr|djS|jdkrT|dd}td|d|d|d	|j|djd
��S|jdkr�|dj}|dd|d<|j|d<|Sd
S)z�
        Unwraps the private key into an RSAPrivateKey, DSAPrivateKey or
        ECPrivateKey object

        :return:
            An RSAPrivateKey, DSAPrivateKey or ECPrivateKey object
        r�rBr�r�rlrr>r?r@)r8r>r?r@rArBr�rAN)r�r�r=rA)rVr��outputr0r0r1r�s"	


�	


zPrivateKeyInfo.unwrapcCsP|jdkrttd|j�����|dd}|j}|jdkr@d}n|j}|j|fS)�#
        Returns information about the curve used for an EC key

        :raises:
            ValueError - when the key is not an EC key

        :return:
            A two-element tuple, with the first element being a unicode string
            of "implicit_ca", "specified" or "named". If the first element is
            "implicit_ca", the second is None. If "specified", the second is
            an OrderedDict that is the native version of SpecifiedECDomain. If
            "named", the second is a unicode string of the curve name.
        r��K
                Only EC keys have a curve, this key is %s
                r�rlr�N�r�rUr�upperr��namerR�rVr�r��valuer0r0r1rw�s
�
zPrivateKeyInfo.curvecCsL|jdkrttd|j�����t�|dddjd�d}|dkrHd	Sd
S)z�
        Returns the name of the family of hash algorithms used to generate a
        DSA key

        :raises:
            ValueError - when the key is not a DSA key

        :return:
            A unicode string of "sha1" or "sha2"
        r��t
                Only DSA keys are generated using a hash algorithm, this key is
                %s
                r�rlr?rD���sha1�sha2)r�rUrr�rHrJrR)rV�byte_lenr0r0r1�	hash_algo�s
�zPrivateKeyInfo.hash_algocCs |jdkr|ddj|_|jS)�O
        :return:
            A unicode string of "rsa", "dsa" or "ec"
        Nr�r��r�rR�rVr0r0r1r��s
zPrivateKeyInfo.algorithmcCs�|jdkr�|jdkr&|djdj}n8|jdkrD|dddj}n|jd	kr^|djdj}tt�t�|d
���|_|jd}|dkr�|jd|7_|jS)
zU
        :return:
            The bit size of the private key, as an integer
        Nr�rBr9r�r�rlr>r�rDr�r)�	_bit_sizer�r�rRrGrHrIrJ�rVr(r9r0r0r1�bit_size�s




zPrivateKeyInfo.bit_sizecCstt�|jd��S)zV
        :return:
            The byte size of the private key, as an integer
        r��rGrHrIr�r�r0r0r1�	byte_size
szPrivateKeyInfo.byte_sizecCsR|jdkrL|jdkrB|dj}|dr6|d��|_qL|��|_n
|��|_|jS)z�
        :return:
            If an RSA key, an RSAPublicKey object. If a DSA key, an Integer
            object. If an EC key, an ECPointBitString object.
        Nr�rBrA)r�r�r��untagr�)rVr�r0r0r1rAs



zPrivateKeyInfo.public_keycCs t|j|ddd�|jd��S)z\
        :return:
            A PublicKeyInfo object derived from this private key.
        r�rlr�)r�rA)�
PublicKeyInfor�rAr�r0r0r1�public_key_info*s
��zPrivateKeyInfo.public_key_infocCsj|jdk�rd|dd}|dj}|jdkrFd|dj|djf}n�|jd	kr||j}d
|dj|dj|d
j|jf}n�|jdk�r>|dj}|dkr�|jj}|jdkr�d|jj}|�d�}||7}nr|jdkr�|}nb|jdk�r>d|jddj}|�d�}|d|jddj7}|d|jddj7}||7}t|t	��rT|�d�}t
�|���|_|jS)aZ
        Creates a fingerprint that can be compared with a public key to see if
        the two form a pair.

        This fingerprint is not compatiable with fingerprints generated by any
        other software.

        :return:
            A byte string that is a sha256 hash of selected components (based
            on the key type)
        Nr�rlrBr��%d:%dr9r:r��%d:%d:%d:%dr>r?r@r�rAr��%s:�utf-8r�r�rv�:rwrrrs)
�_fingerprintr�r�rRrAr�r��encoder�r�hashlib�sha256�digest)rVr�r��to_hashrAr0r0r1�fingerprint9sH

�
�






zPrivateKeyInfo.fingerprint)r+r,r-r.rr�rr�r/r��_spec_callbacksr�r�r�r�rYr�r�r�propertyrwr�r�r�r�rAr�r�r0r0r0r1r��sD�	�
CI
!






r�c@s eZdZdZdefdefgZdS)�EncryptedPrivateKeyInfoz<
    Source: https://tools.ietf.org/html/rfc5208#page-4
    Zencryption_algorithmZencrypted_dataN)r+r,r-r.rrr/r0r0r0r1r�vs�r�c@s eZdZdZdefdefgZdS)�ValidationParms�=
    Source: https://tools.ietf.org/html/rfc3279#page-10
    rtZpgen_counterN)r+r,r-r.rrr/r0r0r0r1r��s�r�c@s>eZdZdZdefdefdefdeddifdeddifgZd	S)
�DomainParametersr�r>r@r?�jr;TZvalidation_paramsN)r+r,r-r.rr�r/r0r0r0r1r��s�r�c@seZdZdZddddd�ZdS)�PublicKeyAlgorithmIdzM
    Original Name: None
    Source: https://tools.ietf.org/html/rfc3279
    r�r�r��dh)r�r�r�z1.2.840.10046.2.1Nr5r0r0r0r1r��s�r�c@s6eZdZdZdefdeddifgZdZee	e
d�ZdS)	�PublicKeyAlgorithmzd
    Original Name: AlgorithmIdentifier
    Source: https://tools.ietf.org/html/rfc5280#page-18
    r�rlr;Tr�)r�r�r�N)r+r,r-r.r�rr/rmr�r�r�rnr0r0r0r1r��s��r�c@s�eZdZdZdefdefgZdd�ZdeiZdZ	dZ
dZdZdZ
edd��Zd	d
�Zedd��Zed
d��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��ZdS)r�ze
    Original Name: SubjectPublicKeyInfo
    Source: https://tools.ietf.org/html/rfc5280#page-17
    r�rAcCs$|ddj}tttdftd�|S)Nr�)r�r�r�r�)rRr<rr\r�r0r0r1�_public_key_spec�s��zPublicKeyInfo._public_key_specNcCs�t|t�s&t|t�s&ttdt|����|dkr@ttdt|����t�}t	|�|d<t
�|d<|�}||d<t|t�r�|����}t
|�|d<|S)a
        Wraps a public key in a PublicKeyInfo structure

        :param public_key:
            A byte string or Asn1Value object of the public key

        :param algorithm:
            A unicode string of "rsa"

        :return:
            A PublicKeyInfo object
        zW
                public_key must be a byte string or Asn1Value, not %s
                r�z>
                algorithm must "rsa", not %s
                r�rlrA)r�rrr�rrrUr�r�r�rr��dumpr )rLrAr�Zalgor�r0r0r1r��s&��

zPublicKeyInfo.wrapcCsB|jdkr|djS|j��}|dkr*dnd}ttd||���dS)z�
        Unwraps an RSA public key into an RSAPublicKey object. Does not support
        DSA or EC public keys since they do not have an unwrapped form.

        :return:
            An RSAPublicKey object
        r�rAZECZanrrzj
            Only RSA public keys may be unwrapped - this key is %s %s public
            key
            N)r�r�r�rUr)rV�key_typeZa_anr0r0r1rs	


�zPublicKeyInfo.unwrapcCsP|jdkrttd|j�����|dd}|j}|jdkr@d}n|j}|j|fS)r�r�r�r�rlr�Nr�r�r0r0r1rw#s
�
zPublicKeyInfo.curvecCs^|jdkrttd|j�����|dd}|jdkr8dSt�|djd�d}|d	krZd
SdS)a#
        Returns the name of the family of hash algorithms used to generate a
        DSA key

        :raises:
            ValueError - when the key is not a DSA key

        :return:
            A unicode string of "sha1" or "sha2" or None if no parameters are
            present
        r�r�r�rlNr?rDr�r�r�r�)r�rUrr�rRrHrJ)rVrlr�r0r0r1r�Es
�
zPublicKeyInfo.hash_algocCs |jdkr|ddj|_|jS)r�Nr�r�r�r0r0r1r�ds
zPublicKeyInfo.algorithmcCs�|jdkr�|jdkr2t|dj�ddd|_nt|jdkrN|djdj}n|jd	krj|d
ddj}tt�t�|d���|_|jd}|d
kr�|jd|7_|jS)zT
        :return:
            The bit size of the public key, as an integer
        Nr�rArrDr�r�r9r�r�rlr>r)	r�r�rSrRr�rGrHrIrJr�r0r0r1r�os




zPublicKeyInfo.bit_sizecCstt�|jd��S)zU
        :return:
            The byte size of the public key, as an integer
        r�r�r�r0r0r1r��szPublicKeyInfo.byte_sizecCs(|jdkr"t�t|d����|_|jS)ze
        :return:
            The SHA1 hash of the DER-encoded bytes of this public key info
        NrA)�_sha1r�r�rr�r�r0r0r1r��s
zPublicKeyInfo.sha1cCs(|jdkr"t�t|d����|_|jS)zh
        :return:
            The SHA-256 hash of the DER-encoded bytes of this public key info
        NrA)�_sha256r�r�rr�r�r0r0r1r��s
zPublicKeyInfo.sha256cCsj|jdk�rd|ddj}|dd}|dkrR|dj}d|dj|djf}n�|d	kr�|dj}d
|dj|dj|d
j|jf}n�|dk�r>|d}|jdkr�d|jj}|�d�}||j7}nv|jdkr�|j}nd|jdk�r>d|jddj}|�d�}|d|jddj7}|d|jddj7}||j7}t|t��rT|�d�}t�	|��
�|_|jS)a[
        Creates a fingerprint that can be compared with a private key to see if
        the two form a pair.

        This fingerprint is not compatiable with fingerprints generated by any
        other software.

        :return:
            A byte string that is a sha256 hash of selected components (based
            on the key type)
        Nr�rlr�rAr�r9r:r�r�r>r?r@r�r�r�r�r�r�rvr�rwrrrs)r�rRr�r�r�r�r�rr�r�r�)rVr�r�r�r�r0r0r1r��sF
�
�






zPublicKeyInfo.fingerprint)r+r,r-r.r�r r/r�r�r�r�r�r�r�rYr�rr�rwr�r�r�r�r�r�r�r0r0r0r1r��s@��
*
!








r�)Nr.Z
__future__rrrrr�rHZ_elliptic_curverrr	r
rrr
Z_errorsrZ_typesrrrZalgosrrrZcorerrrrrrrrrrrr r!r"r#�utilr$r%r&r2r4r7r<r=rCrZr\r]r`rcrgrirorqrur{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r0r0r0r1�<module>sZ$	DF
7