Spade
Mini Shell
| Directory:~$ /lib/python2.7/site-packages/josepy/ |
| [Home] [System Details] [Kill Me] |
�
�t0^c@sdZyddlmZmZWn'ek
rIddlmZmZnXddlZddlZddlm Z de
fd��YZdefd��YZ
d efd
��YZdefd��YZd
eefd��YZdeefd��YZdS(sJOSE
utilities.i����(tHashabletMappingN(trsatabstractclassmethodcBseZdZeZd�ZRS(s�Descriptor
for an abstract classmethod.
It augments the :mod:`abc` framework with an abstract
classmethod. This is implemented as :class:`abc.abstractclassmethod`
in the standard Python library starting with version 3.2.
This implementation is from a StackOverflow answer that was derived
from
the implementation in the Python 3.3 abc library.
http://stackoverflow.com/questions/11217878/python-2-7-combine-abc-abstractmethod-and-classmethod.
cCs#t|_tt|�j|�dS(N(tTruet__isabstractmethod__tsuperRt__init__(tselfttarget((s//usr/lib/python2.7/site-packages/josepy/util.pyRs (t__name__t
__module__t__doc__RRR(((s//usr/lib/python2.7/site-packages/josepy/util.pyRstComparableX509cBsVeZdZd�Zd�Zejjd�Zd�Z d�Z
d�Zd�ZRS(s�Wrapper for OpenSSL.crypto.X509** objects that
supports __eq__.
:ivar wrapped: Wrapped certificate or certificate request.
:type wrapped: `OpenSSL.crypto.X509` or `OpenSSL.crypto.X509Req`.
cCs
||_dS(N(twrapped(RR((s//usr/lib/python2.7/site-packages/josepy/util.pyR'scCst|j|�S(N(tgetattrR(Rtname((s//usr/lib/python2.7/site-packages/josepy/util.pyt__getattr__,scCsCt|jtjj�r'tjj}ntjj}|||j�S(sLDumps
the object into a buffer with the specified encoding.
:param int filetype: The desired encoding. Should be one of
`OpenSSL.crypto.FILETYPE_ASN1`,
`OpenSSL.crypto.FILETYPE_PEM`, or
`OpenSSL.crypto.FILETYPE_TEXT`.
:returns: Encoded X509 object.
:rtype: str
(t
isinstanceRtOpenSSLtcryptotX509tdump_certificatetdump_certificate_request(Rtfiletypetfunc((s//usr/lib/python2.7/site-packages/josepy/util.pyt_dump/scCs,t||j�stS|j�|j�kS(N(Rt __class__tNotImplementedR(Rtother((s//usr/lib/python2.7/site-packages/josepy/util.pyt__eq__AscCst|j|j�f�S(N(thashRR(R((s//usr/lib/python2.7/site-packages/josepy/util.pyt__hash__GscCs||kS(N((RR((s//usr/lib/python2.7/site-packages/josepy/util.pyt__ne__JscCsdj|jj|j�S(Ns<{0}({1!r})>(tformatRR
R(R((s//usr/lib/python2.7/site-packages/josepy/util.pyt__repr__Ms(
R
RRRRRRt
FILETYPE_ASN1RRR
R!R#(((s//usr/lib/python2.7/site-packages/josepy/util.pyR
s t
ComparableKeycBsJeZdZeZd�Zd�Zd�Zd�Zd�Z d�Z
RS(snComparable wrapper for ``cryptography`` keys.
See https://github.com/pyca/cryptography/issues/2122.
cCs
||_dS(N(t_wrapped(RR((s//usr/lib/python2.7/site-packages/josepy/util.pyRYscCst|j|�S(N(RR&(RR((s//usr/lib/python2.7/site-packages/josepy/util.pyR\scCs�t||j�s+|jj|jjk r/tSt|jd�rW|j�|j�kSt|jd�r|j�|j�kStSdS(Ntprivate_numberstpublic_numbers(RRR&RthasattrR'R((RR((s//usr/lib/python2.7/site-packages/josepy/util.pyR_scCs||kS(N((RR((s//usr/lib/python2.7/site-packages/josepy/util.pyR!kscCsdj|jj|j�S(Ns<{0}({1!r})>(R"RR
R&(R((s//usr/lib/python2.7/site-packages/josepy/util.pyR#nscCs|j|jj��S(sGet
wrapped public key.(RR&t
public_key(R((s//usr/lib/python2.7/site-packages/josepy/util.pyR*qs(R
RRRR
RRRR!R#R*(((s//usr/lib/python2.7/site-packages/josepy/util.pyR%Qs tComparableRSAKeycBseZdZd�ZRS(s�Wrapper
for ``cryptography`` RSA keys.
Wraps around:
- :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey`
- :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey`
c Cs�t|jtj�rd|j�}|j}t|j|j|j |j
|j|j|j
|jf�St|jtj�r�|j�}t|j|j
|jf�SdS(N(RR&RtRSAPrivateKeyWithSerializationR'R(RRtptqtdmp1tdmq1tiqmptntetRSAPublicKeyWithSerialization(Rtprivtpub((s//usr/lib/python2.7/site-packages/josepy/util.pyR
�s (R
RRR
(((s//usr/lib/python2.7/site-packages/josepy/util.pyR+vstImmutableMapcBs\eZdZd Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d�ZRS(
s5Immutable key to value mapping with attribute
access.cKs�t|�t|j�krWtdjdj|j�|rHdj|�nd���nx-|jD]"}tj|||j|��qaWdS(NsA__init__()
takes exactly the following arguments: {0} ({1} given)s,
tnone(tsett __slots__t TypeErrorR"tjointobjectt__setattr__tpop(Rtkwargstslot((s//usr/lib/python2.7/site-packages/josepy/util.pyR�s$cKs)t|�}|j|�t|�|�S(sReturn
updated
map.(tdicttupdatettype(RR@titems((s//usr/lib/python2.7/site-packages/josepy/util.pyRC�s
cCs5yt||�SWntk
r0t|��nXdS(N(RtAttributeErrortKeyError(Rtkey((s//usr/lib/python2.7/site-packages/josepy/util.pyt__getitem__�s
cCs
t|j�S(N(titerR:(R((s//usr/lib/python2.7/site-packages/josepy/util.pyt__iter__�scCs
t|j�S(N(tlenR:(R((s//usr/lib/python2.7/site-packages/josepy/util.pyt__len__�scs#tt�fd��jD���S(Nc3s|]}t�|�VqdS(N(R(t.0RA(R(s//usr/lib/python2.7/site-packages/josepy/util.pys <genexpr>�s(RttupleR:(R((Rs//usr/lib/python2.7/site-packages/josepy/util.pyR
�scCstd��dS(Nscan't set
attribute(RF(RRtvalue((s//usr/lib/python2.7/site-packages/josepy/util.pyR>�scCs2dj|jjdjd�tj|�D���S(Ns{0}({1})s,
css'|]\}}dj||�VqdS(s {0}={1!r}N(R"(RNRHRP((s//usr/lib/python2.7/site-packages/josepy/util.pys <genexpr>�s(R"RR
R<tsixt iteritems(R((s//usr/lib/python2.7/site-packages/josepy/util.pyR#�s((R
RRR:RRCRIRKRMR
R>R#(((s//usr/lib/python2.7/site-packages/josepy/util.pyR7�s t
frozendictcBseeZdZdZd�Zd�Zd�Zd�Zd�Zd�Z d �Z
d
�Zd�ZRS(
sFrozen
dictionary.t_itemst_keysc Os�|r|rt|�}n;t|�dkrNt|dt�rN|d}n t��tj|d|�tj|dttt j
|����dS(NiiRTRU(RBRLRRR;R=R>ROtsortedRQtiterkeys(RtargsR@RE((s//usr/lib/python2.7/site-packages/josepy/util.pyR�s
%
cCs|j|S(N(RT(RRH((s//usr/lib/python2.7/site-packages/josepy/util.pyRI�scCs
t|j�S(N(RJRU(R((s//usr/lib/python2.7/site-packages/josepy/util.pyRK�scCs
t|j�S(N(RLRT(R((s//usr/lib/python2.7/site-packages/josepy/util.pyRM�scst�fd��jD��S(Nc3s|]}|�|fVqdS(N((RNRH(R(s//usr/lib/python2.7/site-packages/josepy/util.pys <genexpr>�s(RORU(R((Rs//usr/lib/python2.7/site-packages/josepy/util.pyt
_sorted_items�scCst|j��S(N(RRY(R((s//usr/lib/python2.7/site-packages/josepy/util.pyR
�scCs3y|j|SWntk
r.t|��nXdS(N(RTRGRF(RR((s//usr/lib/python2.7/site-packages/josepy/util.pyR�s
cCstd��dS(Nscan't
set
attribute(RF(RRRP((s//usr/lib/python2.7/site-packages/josepy/util.pyR>�scCs&djdjd�|j�D���S(Nsfrozendict({0})s,
css'|]\}}dj||�VqdS(s {0}={1!r}N(R"(RNRHRP((s//usr/lib/python2.7/site-packages/josepy/util.pys <genexpr>�s(R"R<RY(R((s//usr/lib/python2.7/site-packages/josepy/util.pyR#�s(s_itemss_keys(
R
RRR:RRIRKRMRYR
RR>R#(((s//usr/lib/python2.7/site-packages/josepy/util.pyRS�s (Rtcollections.abcRRtImportErrortcollectionsRRQt)cryptography.hazmat.primitives.asymmetricRtclassmethodRR=R
R%R+R7RS(((s//usr/lib/python2.7/site-packages/josepy/util.pyt<module>s
1%.