관리-도구
편집 파일: decode_asn1.cpython-36.pyc
3 y�_Y~ � @ s� d dl mZmZmZ d dlZd dlZd dlZd dlmZ d dl m Z mZmZm Z d dlmZ d dlmZ d dlmZmZmZmZ dd � Zd d� Zdd � Zdd� Zdd� Zdd� Zdd� Zdd� ZG dd� de�Z dd� Z!dd� Z"dd� Z#d d!� Z$d"d#� Z%d$d%� Z&d&d'� Z'd(d)� Z(d*d+� Z)d,d-� Z*d.d/� Z+d0d1� Z,d2d3� Z-d4d5� Z.d6d7� Z/d8d9� Z0d:d;� Z1d Z2d<Z3d=d>� Z4ej5j6ej5j7ej5j8ej5j9ej5j:ej5j;ej5j<ej5j=d?�Z>d@dA� Z?dBdC� Z@dDdE� ZAdFdG� ZBdHdI� ZCdJdK� ZDdLdM� ZEdNdO� ZFej5jGej5j6ej5j7ej5j8ej5j9ej5j:ej5j;ej5jHej5j<ej5j=dP� ZIej5jGd ej5j6d<ej5j7dQej5j8dRej5j9dSej5j:dTej5j;dUej5jHdVej5j<dWej5j=dXi ZJdYdZ� ZKd[d\� ZLd]d^� ZMd_d`� ZNdadb� ZOdcdd� ZPdedf� ZQdgdh� ZRdidj� ZSdkdl� ZTdmdn� ZUdodp� ZVejWe#ejXe$ejYe)ejZe+ej[e1ej\e%ej]e'ej^e(ej_e!ej`eAejaeBejbeejceCejde,ejee-ejfe0iZgejheEiZiejjeKejkeLejleMiZmejneejoeej\e%ejde,ej]e'ejpe/ejaeBiZqejreViZsejreViZtejueFiZvdS )q� )�absolute_import�division�print_functionN)�x509)� DERReader�INTEGER�NULL�SEQUENCE)�_TLS_FEATURE_TYPE_TO_ENUM)�_ASN1_TYPE_TO_ENUM)�CRLEntryExtensionOID�CertificatePoliciesOID�ExtensionOID�OCSPExtensionOIDc C s� d}| j jd|�}| jj|||d�}||d krX|d }| j jd|�}| jj|||d�}| j|dk� | j j||�d d � j� S )N�P zchar[]� r )�_ffi�new�_libZOBJ_obj2txt�openssl_assert�buffer�decode)�backend�objZbuf_len�buf�res� r �#/usr/lib64/python3.6/decode_asn1.py�_obj2txt s r c C sn | j j|�}| j|| jjk� | j j|�}| j|| jjk� t| |�}t| |�}t|j }t jt j|�||�S )N) r ZX509_NAME_ENTRY_get_objectr r r ZX509_NAME_ENTRY_get_data�_asn1_string_to_utf8r r �typer Z NameAttribute�ObjectIdentifier)r Zx509_name_entryr �data�value�oidr r r r �_decode_x509_name_entry0 s r% c C s� | j j|�}g }d}x\t|�D ]P}| j j||�}t| |�}| j j|�}||kr\|j|h� n|d j|� |}qW tj dd� |D ��S )Nr c s s | ]}t j|�V qd S )N)r �RelativeDistinguishedName)�.0Zrdnr r r � <genexpr>K s z$_decode_x509_name.<locals>.<genexpr>���r) ) r ZX509_NAME_entry_count�rangeZX509_NAME_get_entryr% Z Cryptography_X509_NAME_ENTRY_set�append�addr �Name) r Z x509_name�count� attributesZprev_set_id�x�entryZ attributeZset_idr r r �_decode_x509_name<