File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/x509.cpython-310.pyc
o
;j� � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl
Z
ddlZddlm
Z
ddlZddlZddlZddlZddlZddlZddlZddlmZ zddlZddlmZmZmZmZmZmZ dZ W n e!yy dZ Y nw zddl"Z"dZ#W n e!y� dZ#Y nw dZ$e�%e&�Z'e
g d ��Z(d
ddd
d�Z)dd� Z*G dd� dej+�Z,dhdd�Z-didd�Z.dd� Z/dd� Z0dd� Z1dd� Z2d d!� Z3d"d#� Z4d$d%� Z5d&d'� Z6d(d)� Z7d*d+� Z8dhd,d-�Z9d.d/� Z:d0d1� Z;d2d3� Z<d4d5� Z=d6d7� Z>dhd8d9�Z?d:d;� Z@dhd<d=�ZAd>d?� ZBd@dA� ZCdBdC� ZDdDdE� ZEdFdG� ZFdjdHdI�ZGdhdJdK�ZHdkdLdM�ZI N O dldPdQ�ZJ R SdmdTdU�ZKdVdW� ZLdXdY� ZMdndZd[�ZNdjd\d]�ZOdhd^d_�ZP dod`da�ZQdbdc� ZRddde� ZSdfdg� ZTdS )paF
Manage X509 certificates
.. versionadded:: 2015.8.0
:depends: M2Crypto
.. deprecated:: 3006.0
.. warning::
This module has been deprecated and will be removed
in Salt 3009 (Potassium). Please migrate to the replacement
modules. For breaking changes between both versions,
you can refer to the :ref:`x509_v2 execution module docs <x509-setup>`.
They will become the default ``x509`` modules in Salt 3008 (Argon).
You can explicitly switch to the new modules before that release
by setting ``features: {x509_v2: true}`` in your minion configuration.
� N)�OrderedDict)�STATE_INTERNAL_KEYWORDS)�ASN1�BIO�EVP�RSA�X509�m2TF�x509))ZbasicConstraintszX509v3 Basic Constraints)ZkeyUsagezX509v3 Key Usage)ZextendedKeyUsagezX509v3 Extended Key Usage)�subjectKeyIdentifierzX509v3 Subject Key Identifier)�authorityKeyIdentifierzX509v3 Authority Key Identifier)ZissuserAltNamezX509v3 Issuer Alternative Name)ZauthorityInfoAccesszX509v3 Authority Info Access)�subjectAltNamezX509v3 Subject Alternative Name)ZcrlDistributionPointszX509v3 CRL Distribution Points)ZissuingDistributionPointz!X509v3 Issuing Distribution Point)ZcertificatePolicieszX509v3 Certificate Policies)ZpolicyConstraintszX509v3 Policy Constraints)ZinhibitAnyPolicyzX509v3 Inhibit Any Policy)ZnameConstraintszX509v3 Name Constraints)ZnoCheckzX509v3 OCSP No Check)Z nsCommentzNetscape Comment)Z
nsCertTypezNetscape Certificate Typeim � �@ �sha256)�
days_valid�version�serial_bits� algorithmc C s2 t �di ��d�rdS trtjj�dd� tS dS )z8
only load this module if m2crypto is available
ZfeaturesZx509_v2)FzSuperseded, using x509_v2Z Potassiumz�The x509 modules are deprecated. Please migrate to the replacement modules (x509_v2). They are the default from Salt 3008 (Argon) onwards.)Fz0Could not load x509 module, m2crypto unavailable)�__opts__�get�HAS_M2�salt�utilsZversionsZ
warn_until�__virtualname__� r r �E/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/x509.py�__virtual__^ s �r c @ sL e Zd ZdZdejfdejfdejfdejfdejfdejfdejfgZd S )
�_Ctx��
This is part of an ugly hack to fix an ancient bug in M2Crypto
https://bugzilla.osafoundation.org/show_bug.cgi?id=7530#c13
�flags�issuer_cert�subject_cert�subject_req�crlZdb_methZdbN)�__name__�
__module__�__qualname__�__doc__�ctypes�c_int�c_void_p�_fields_r r r r r p s �r c C sH t �t| ��}d|_d|_d|_d|_|du rd|_dS t|j�|_dS )r r N) r �from_address�intr r"