관리-도구
편집 파일: pkcs12.cpython-36.opt-1.pyc
3 l�_= � @ sb d dl mZmZmZ d dlmZ d dlmZ d dlm Z d dl mZmZm Z ddd�Zd d � ZdS )� )�absolute_import�division�print_function)�x509)�_get_backend)� serialization)�dsa�ec�rsaNc C s t |�}|j| |�S )N)r Z%load_key_and_certificates_from_pkcs12)�dataZpassword�backend� r �/usr/lib64/python3.6/pkcs12.py�load_key_and_certificates s r c C s� |d k r(t |tjtjtjf� r(td��|d k rFt |tj � rFtd��|d k rpt |�}tdd� |D ��sptd��t |tj �s�td��|d kr�|d kr�| r�td��td �}|j| ||||�S )Nz3Key must be RSA, DSA, or EllipticCurve private key.zcert must be a certificatec s s | ]}t |tj�V qd S )N)� isinstancer �Certificate)�.0�valr r r � <genexpr>! s z1serialize_key_and_certificates.<locals>.<genexpr>z&all values in cas must be certificateszFKey encryption algorithm must be a KeySerializationEncryption instancez1You must supply at least one of key, cert, or cas)r r ZRSAPrivateKeyWithSerializationr ZDSAPrivateKeyWithSerializationr Z(EllipticCurvePrivateKeyWithSerialization� TypeErrorr r �list�allr ZKeySerializationEncryption� ValueErrorr Z(serialize_key_and_certificates_to_pkcs12)�name�keyZcertZcasZencryption_algorithmr r r r �serialize_key_and_certificates s* r )N)Z __future__r r r Zcryptographyr Zcryptography.hazmat.backendsr Zcryptography.hazmat.primitivesr Z)cryptography.hazmat.primitives.asymmetricr r r r r r r r r �<module> s