
    Wwg                     V   d dl Z d dlmZ d dlmZmZ d dlmZ d dlm	Z	 ddl
mZmZ dd	lmZmZmZmZmZ g d
Ze j(                   G d de j*                               Z ed       G d d             Z ed       G d d             Z G d de      Z G d de      Z G d de      Zy)    N)	dataclass)IterableOptional)cms)TimeStamper   )CMSAttributeProviderTSTProvider   )CertifiedAttributeChoicesCommitmentTypeIdentifierCommitmentTypeIndicationSignaturePolicyIdentifierSignerAttributesV2)GenericCommitmentCAdESSignedAttrSpecSignerAttrSpecc                       e Zd Z ej                         Z ej                         Z ej                         Z ej                         Z ej                         Z	 ej                         Z
edefd       Zy)r   returnc                 ^    t        dt        | j                  j                               i      S )Ncommitment_type_id)r   r   namelower)selfs    L/var/www/horilla/myenv/lib/python3.12/site-packages/pyhanko/sign/ades/api.pyasn1zGenericCommitment.asn1!   s(    '!#;DIIOO<M#NO
 	
    N)__name__
__module____qualname__enumautoPROOF_OF_ORIGINPROOF_OF_RECEIPTPROOF_OF_DELIVERYPROOF_OF_SENDERPROOF_OF_APPROVALPROOF_OF_CREATIONpropertyr   r    r   r   r   r      sn    diikO tyy{!		diikO!		!		
. 
 
r   r   T)frozenc                   \    e Zd ZU dZeej                     ed<   	 eej                     ed<   y)r   aO  
    Class that controls the ``signer-attributes-v2`` signed CAdES attribute.

    These represent attributes of the signing entity, not the signature or
    signed content.

    .. note::
        Out of the box, only basic claimed attributes and certified attributes
        through V2 X.509 attribute certificates are supported.
    claimed_attrscertified_attrsN)	r   r   r    __doc__r   r   AttCertAttribute__annotations__AttributeCertificateV2r*   r   r   r   r   (   s7    	 C0011 c8899r   r   c                   z    e Zd ZU dZdZee   ed<   	 dZe	ed<   	 dZ
ee   ed<   	 dZee   ed<   	 	 d
dee   fd	Zy)r   zI
    Class that controls signed CAdES attributes on a PDF signature.
    Ncommitment_typeFtimestamp_contentsignature_policy_identifiersigner_attributestimestamperc              #      K   | j                   r|t        |||dd       | j                  t        | j                         | j                  t        | j                         | j                  t        | j                         y y w)Ncontent_time_stampT)digest_algorithm
data_to_tsr8   	attr_type	prehashed)r5   r
   r6   SigPolicyIDProviderr4   CommitmentTypeProviderr7   SignerAttributesProvider)r   message_digestmd_algorithmr8   s       r   prepare_providersz%CAdESSignedAttrSpec.prepare_providersi   s      !!k&=!-)'.  ++7%d&F&FGG+()=)=>>!!-*4+A+ABB .s   BBN)r   r   r    r/   r4   r   r   r1   r5   boolr6   r   r7   r   r   rD   r*   r   r   r   r   @   s|     ;?OX67>
 $t# HL*C!DK	 37x/6 .2	C k*	Cr   r   c                   *    e Zd ZdZdefdZddefdZy)r@   r4   c                     || _         y rE   r4   )r   r4   s     r   __init__zCommitmentTypeProvider.__init__   s
    .r   r   c                 "   K   | j                   S wrE   rI   r   dry_runs     r   build_attr_valuez'CommitmentTypeProvider.build_attr_value   s     ###   NF)r   r   r    attribute_typer   rJ   rN   r*   r   r   r@   r@      s!    &N/(@ /$7O $r   r@   c                   ,    e Zd ZdZdefdZ	 ddefdZy)r?   r6   	policy_idc                     || _         y rE   rS   )r   rS   s     r   rJ   zSigPolicyIDProvider.__init__   s	    "r   r   c                 "   K   | j                   S wrE   rU   rL   s     r   rN   z$SigPolicyIDProvider.build_attr_value   s      ~~rO   NrP   )r   r   r    rQ   r   rJ   rN   r*   r   r   r?   r?      s&    2N#"; # 	"r   r?   c                   *    e Zd ZdZdefdZddefdZy)rA   signer_attributes_v2signer_attr_specc                     || _         y rE   )rY   )r   rY   s     r   rJ   z!SignerAttributesProvider.__init__   s
     0r   r   c                    K   | j                   }t        |j                        }t        |j                        }i }|r||d<   |r|D cg c]  }t	        d|       c}|d<   t        |      S c c}w w)Nclaimed_attributes	attr_cert)r   valuecertified_attributes_v2)rY   listr-   r.   r   r   )r   rM   specclaimed	certifiedresultr]   s          r   rN   z)SignerAttributesProvider.build_attr_value   s     $$t))*--.	+2F'( "+1 *{)L1F,- "&))	1s   AA2A-A2NrP   )r   r   r    rQ   r   rJ   r   rN   r*   r   r   rA   rA      s     +N1 1*7I *r   rA   )r!   dataclassesr   typingr   r   
asn1cryptor   pyhanko.sign.timestampsr   
attributesr	   r
   
cades_asn1r   r   r   r   r   __all__uniqueEnumr   r   r   r@   r?   rA   r*   r   r   <module>rn      s     ! %  / :  I 
		 
 
 $  . $;C ;C ;C|$1 $	. 	*3 *r   