o
    Õl>jn	  ã                   @  sv   d dl mZ d dlmZ d dlmZ d dlmZ ddlm	Z	 ddl
mZmZmZmZmZ e d	¡ZG d
d„ deƒZdS )é    )Úannotations)Úx509)Údefault_backend)Úbytes_eqé   )Úsha256é   )ÚAttestationÚAttestationResultÚAttestationTypeÚInvalidDataÚcatch_builtinsz1.2.840.113635.100.8.2c                   @  s   e Zd ZdZedd„ ƒZdS )ÚAppleAttestationÚapplec           	      C  sb   |d }t || ƒ}t |d tƒ ¡}|j t¡}|j ¡ dd … }t	||ƒs+t
dƒ‚ttj|ƒS )NÚx5cr   é   zNonce does not match!)r   r   Úload_der_x509_certificater   Ú
extensionsÚget_extension_for_oidÚ	OID_APPLEÚvalueÚpublic_bytesr   r   r
   r   ÚANON_CA)	ÚselfÚ	statementÚ	auth_dataÚclient_data_hashr   Úexpected_nonceÚcertÚextÚ	ext_nonce© r!   úL/home/thesage/.local/lib/python3.10/site-packages/fido2/attestation/apple.pyÚverify1   s   
zAppleAttestation.verifyN)Ú__name__Ú
__module__Ú__qualname__ÚFORMATr   r#   r!   r!   r!   r"   r   .   s    r   N)Ú
__future__r   Úcryptographyr   Úcryptography.hazmat.backendsr   Ú,cryptography.hazmat.primitives.constant_timer   Úutilsr   Úbaser	   r
   r   r   r   ÚObjectIdentifierr   r   r!   r!   r!   r"   Ú<module>   s   
