%PDF- %PDF-
| Direktori : /snap/core18/current/usr/lib/python3/dist-packages/asn1crypto/__pycache__/ |
| Current File : //snap/core18/current/usr/lib/python3/dist-packages/asn1crypto/__pycache__/core.cpython-36.pyc |
3
&\ZLf � @ s� d Z ddlmZmZmZmZ ddlmZmZ ddlZddl Z ddl
Z
ddlZddlZddl
mZ ddlmZ ddlmZ dd lmZmZmZmZmZ dd
lmZmZ ddlmZmZmZm Z ej!d�kr�dd
l"m#Z$ e%Z&dZ'nddl(m$Z$ dZ'ej)� ddddd�Z*ddddddddd�Z+ddd�Z,ej-d�Z.i Z/d�dd�Z0G dd� de1�Z2G d d!� d!�Z3G d"d#� d#e1�Z4G d$d%� d%e1�Z5G d&d'� d'e2�Z6e6� Z7G d(d)� d)e2�Z8G d*d+� d+e2�Z9G d,d-� d-e1�Z:G d.d/� d/e2�Z;G d0d1� d1e5e;�Z<G d2d3� d3e;�Z=G d4d5� d5e;e3�Z>G d6d7� d7e5e4e;e3e1�Z?G d8d9� d9e5e4e;�Z@G d:d;� d;e5e4e;�ZAG d<d=� d=e5e4e;�ZBG d>d?� d?e5e4e;�ZCG d@dA� dAe5e4e;�ZDG dBdC� dCeD�ZEG dDdE� dEe;�ZFG dFdG� dGe;e3�ZGG dHdI� dIe;�ZHG dJdK� dKe;�ZIG dLdM� dMe;�ZJG dNdO� dOe>�ZKG dPdQ� dQe<�ZLG dRdS� dSeG�ZMG dTdU� dUe2�ZNG dVdW� dWe2�ZOG dXdY� dYeN�ZPG dZd[� d[eO�ZQG d\d]� d]eN�ZRG d^d_� d_e<�ZSG d`da� dae<�ZTG dbdc� dce<�ZUG ddde� deeB�ZVG dfdg� dge<�ZWG dhdi� die<�ZXG djdk� dkeX�ZYG dldm� dmeX�ZZG dndo� doe<�Z[G dpdq� dqe<�Z\G drds� dse<�Z]G dtdu� due<�Z^G dvdw� dwe<�Z_G dxdy� dye<�Z`dzd{� Zad|d}� Zbd~d� Zcd�d�� Zde=e>e?eBeFeGeHeIeJeKeReLeMeNePeSeTeUeVeWeYeZe[e\e]e^e_e`d��Zed�d�d��Zfd�d�d��ZgdS )�a
ASN.1 type classes for universal types. Exports the following items:
- load()
- Any()
- Asn1Value()
- BitString()
- BMPString()
- Boolean()
- CharacterString()
- Choice()
- EmbeddedPdv()
- Enumerated()
- GeneralizedTime()
- GeneralString()
- GraphicString()
- IA5String()
- InstanceOf()
- Integer()
- IntegerBitString()
- IntegerOctetString()
- Null()
- NumericString()
- ObjectDescriptor()
- ObjectIdentifier()
- OctetBitString()
- OctetString()
- PrintableString()
- Real()
- RelativeOid()
- Sequence()
- SequenceOf()
- Set()
- SetOf()
- TeletexString()
- UniversalString()
- UTCTime()
- UTF8String()
- VideotexString()
- VisibleString()
- VOID
- Void()
Other type classes are defined that help compose the types listed above.
� )�unicode_literals�division�absolute_import�print_function)�datetime� timedeltaN� )�_teletex_codec)�unwrap)�OrderedDict)� type_name�str_cls�byte_cls� int_types�chr_cls)�_parse�_dump_header)�int_to_bytes�int_from_bytes�timezone�extended_datetime� )�StringIOT)�BytesIOF� universal�application�context�private)r r � r r )r r r r r r r r Z primitiveZconstructed)r r z
^\d+(\.\d+)*$c C s t j| |d�S )a5
Loads a BER/DER-encoded byte string and construct a universal object based
on the tag value:
- 1: Boolean
- 2: Integer
- 3: BitString
- 4: OctetString
- 5: Null
- 6: ObjectIdentifier
- 7: ObjectDescriptor
- 8: InstanceOf
- 9: Real
- 10: Enumerated
- 11: EmbeddedPdv
- 12: UTF8String
- 13: RelativeOid
- 16: Sequence,
- 17: Set
- 18: NumericString
- 19: PrintableString
- 20: TeletexString
- 21: VideotexString
- 22: IA5String
- 23: UTCTime
- 24: GeneralizedTime
- 25: GraphicString
- 26: VisibleString
- 27: GeneralString
- 28: UniversalString
- 29: CharacterString
- 30: BMPString
:param encoded_data:
A byte string of BER or DER-encoded data
:param strict:
A boolean indicating if trailing data should be forbidden - if so, a
ValueError will be raised when trailing data exists
:raises:
ValueError - when strict is True and trailing data is present
ValueError - when the encoded value tag a tag other than listed above
ValueError - when the ASN.1 header length is longer than the data
TypeError - when encoded_data is not a byte string
:return:
An instance of the one of the universal classes
)�strict)� Asn1Value�load)�encoded_datar � r# �1/usr/lib/python3/dist-packages/asn1crypto/core.pyr! r s 3r! c @ s� e Zd ZdZdZdZdZdZdZdZ dZ
dZdZdZ
ed$dd��Zd%dd�Zd d
� Zdd� Zd
d� Zdd� Zdd� Zdd� Zdd� Zdd� Zd&dd�Zdd� Zdd� Zd'd d!�Zd(d"d#�ZdS ))r z'
The basis of all ASN.1 values
NF� c K sD t |t�stdt|� ��d}| jdk r,| }t||||d�\}}|S )a�
Loads a BER/DER-encoded byte string using the current class as the spec
:param encoded_data:
A byte string of BER or DER-encoded data
:param strict:
A boolean indicating if trailing data should be forbidden - if so, a
ValueError will be raised when trailing data exists
:return:
An instance of the current class
z*encoded_data must be a byte string, not %sN)�spec�spec_paramsr )�
isinstancer � TypeErrorr �tag�_parse_build)�clsr"