+
    :i(  c                   s    ^ RI t ^ RIHtHt ^ RIHtHtHtHtHt ^ RI	H
t
HtHtHtHtHtHtHtHt ] P&                  ! ]4      tR R ltR R ltR	 R
 ltR R ltR R ltR tR R ltR# )    N)datetimetimezone)AIDSW	ApduErrorSmartCardConnectionSmartCardProtocol)	_INVALID_PININSKEY_REFPWAlgorithmAttributesEcAttributesKdfNoneOpenPgpSessionRsaAttributesc                s(    V ^8  d   QhR\         RR/# )   
connectionreturnN)r   Zformat   "2/usr/lib/python3.14/site-packages/ykman/openpgp.py__annotate__r   5   s     < <. <4 <    c                s   \         P                  R4       \        V 4      pVP                  \        P
                  4       \        P                  \        P                  3 FO  p\         P                  RVP                   R24         VP                  ^ \        P                  ^ V\        4       K+  	  \         P                  R4       VP                  ^ \        P$                  ^ ^ 4       VP                  ^ \        P&                  ^ ^ 4       \         P)                  R4       R#   \         d1   pTP                  \         P"                  8X  d    Rp?K   Rp?K  Rp?ii ; i)a#  Performs an OpenPGP factory reset while avoiding any unneccessary commands.

If any data is unreadable preventing the OpenPgpSession from initializing, then
OpenPgpSession.reset() will not be able to be called. This function can instead
be  used to reset the application into a fresh state.
z%Attempting safe OpenPGP factory resetzVerify z( PIN with invalid attempts until blockedNz Sending TERMINATE, then ACTIVATEz(OpenPGP application data reset performed)loggerZdebugr   Zselectr   ZOPENPGPr   ZUSERZADMINnameZ	send_apdur	   ZVERIFYr   r   Zswr   Z SECURITY_CONDITION_NOT_SATISFIEDZ	TERMINATEZACTIVATEinfo)r   ZprotocolZpwZes   &   r   
safe_resetr   5   s     LL89 ,HOOCKK ww!wrwwi'OPQ""1cjj!RF	 " LL34q#--A.q#,,1-
KK:;  442>>>	s   'D##E.EEc                0    V ^8  d   QhR\         R\        /# )r   refr   )r
   strr   r   r   r   r   R   s     	 	W 	 	r   c                 s    V \         P                  8X  d   R # V \         P                  8X  d   R# V \         P                  8X  d   R# V \         P                  8X  d   R# V P
                  # )zSignature keyzDecryption keyzAuthentication keyzAttestation key)r
   ZSIGZDECZAUTATTr   )r      &r   _format_refr"   R   sG    
gkk
gkk
gkk#
gkk 88Or   c                r   )r   fpr   )Zbytesr   r   r   r   r   r   ^   s      E c r   c                 sh   a  R P                  V 3R l\        ^4       4       4      P                  4       # )z  c              3   sp   <a"   T F*  oR P                  VV3R l\        ^4       4       4      x  K,  	  R# 5i)Z c              3   s   <"   T F4  pSS^
,          V^,          ,           R R,          P                  4       x  K6  	  R# 5i)i
   N:Nr   N)Zhex).0Zsr#   hs   & r   	<genexpr>Z0_format_fingerprint.<locals>.<genexpr>.<genexpr>`   s6     BAAFQUN$%b)--//s   <?N)joinrange)r$   r%   r#   s   &@r   r&   Z&_format_fingerprint.<locals>.<genexpr>_   s*      LTqBqBBBHs   26)r'   r(   Zupper)r#   s   fr   _format_fingerprintr)   ^   s-    99 LQRSH egr   c                r   )r   	timestampr   )Zintr   r   r   r   r   r   d   s     G GC GC Gr   c                 sh    \         P                  ! V \        P                  4      P	                  4       # )N)r   Zfromtimestampr   ZutcZ	isoformat)r*   r!   r   _format_dater+   d   s"    !!)X\\:DDFFr   c                r   )r   algr   )r   r   r   r   r   r   r   h   s      . 3 r   c                 s    \        V \        4      '       d   R V P                   2# \        V \        4      '       d   V P                   # R# )ZRSAzUnknown key type)
isinstancer   Zn_lenr   Zoid)r,   r!   r   _format_algorithmr.   h   s<    #}%%SYYK  #|$$''r   c                 s
   V P                  V4      pR \        V4      R\        V P                  V,          4      R\	        V4      RVe   VP
                  MRR\        V P                  V,          4      RV P                  V4      /# )zKey slotFingerprintZ	AlgorithmZOriginZUNKNOWNZCreatedTouch policy)	Zget_algorithm_attributesr"   r)   fingerprintsr.   r   r+   Zgeneration_timesget_uif)discretionaryr   Zstatusr,   s   &&& r   get_key_infor4   p   s|    

0
0
5CK$*=+E+Ec+JK&s+!3&++< > >s CD--c2 r   c                s$    V ^8  d   QhR\         /# )r   session)r   r   r   r   r   r   |   s      n r   c                s   V P                  4       pVP                  pVP                  pRRVP                  P                  ,          RRV P                  ,          RVP
                  RVP                  RVP                  RVP                  R	\        V P                  4       \        4      '       * /pVP                  P                  4        F  w  rVV P                  R8  d2   VP                  V,          '       d   V\        P                   8X  d   KF  M\#        V4      '       g   KZ  R
\%        V4      RVP'                  V4      /V\)        V4      &   K  	  V# )zfGet human readable information about the OpenPGP configuration.

:param session: The OpenPGP session.
zOpenPGP versionz%d.%dzApplication versionz%d.%d.%dzPIN tries remainingzReset code tries remainingzAdmin PIN tries remainingzRequire PIN for signaturezKDF enabledr/   r0   )i   r   r    )Zget_application_related_datar3   Z	pw_statusZaidZversionZattempts_userZattempts_resetZattempts_adminZpin_policy_userr-   Zget_kdfr   r1   ZitemsZkey_informationr
   r    Zanyr)   r2   r"   )r5   Zdatar3   Zretriesr   r   r#   s   &      r   get_openpgp_infor6   |   s$   
 //1D&&M%%G7TXX%5%55zGOO;w44$g&<&<#W%;%;#W%<%<:goo&7AAD !--335??i' 00559K :L r77 .r2M11#6"
[ 6 Kr   )Zloggingr   r   Zyubikit.core.smartcardr   r   r   r   r   Zyubikit.openpgpr   r	   r
   r   r   r   r   r   r   Z	getLoggerZ__name__r   r   r"   r)   r+   r.   r4   r6   ) r   r   <module>r7      s\   8  ' 
 
 
 
		8	$<:	G	r   