File: //usr/share/crypto-policies/python/policygenerators/__pycache__/nss.cpython-312.opt-1.pyc
�
��i�J � �r � d dl Z d dlZd dlZd dlZd dlZd dlmZ ddlmZ dZ G d� d� Z
G d� d e� Zy)
� N)�mkstemp� )�ConfigGeneratorz-
library=p11-kit-proxy.so
name=p11-kit-proxy
c �8 � e Zd ZdZd� Zd� Zed� � Zd� Zd� Z y)�PurposeDeduplicatora Shorten the list of enabled algorithm/purpose pairs.
For example, given a rule set of
* ('pkcs12', 'pkcs12-legacy') -> 'pkcs12'
* ('ssl', 'pkcs12') -> 'all'
it'll shorten
('hmac-md5', 'pkcs12'), ('hmac-md5', 'pkcs12-legacy'), 'hmac-md5', 'ssl')
to just 'hmac-md5'.
The order of the first insertion is preserved.
It was decided to be OK to merge all currently known purposes into '/all',
even though in the future there could be more purposes added, since:
1. the list of purposes doesn't change often, and then we should update c-p
2. this will only result in overenablement for algorithms
that the administrator already trusts for all currently known purposes,
and it's likely that they trust it for the new purpose as well
c �N � t j t � | _ || _ y �N)�collections�defaultdict�list�_alg_purpose_map�_rulemap)�self�rulemaps �9/usr/share/crypto-policies/python/policygenerators/nss.py�__init__zPurposeDeduplicator.__init__F s � � +� 7� 7�� =�����
� c �@ � | j | j |� y r )r
�append)r �alg�purposes r �addzPurposeDeduplicator.addJ s � ����c�"�)�)�'�2r c � � � g }� D ]P }d|v r�||v r�
||v xr t � fd�|D � � }|r||v r�.|j |� �@|j |� �R |S )N�allc 3 �&