+
      xi9  c            
      s   R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
HtHtHt ^ RIt^ RIt^ RIHtHtHtHt RP-                  4       t]P0                  ! ]P2                  R]R7      t]P7                  R	R
RRR7       ]P7                  RR]R7       ]P7                  RRRRR7       ]P7                  RRRRR7       ]P7                  RR]^RR7       ]P7                  RRRR R! R"R#R$7       ]P7                  R%R&R'R(R)R7       ]P7                  R*R+R,R-R7       R.]	R/]P:                  R0]P<                  /t]P7                  R1R2] ! ]PC                  4       4      R3R.R47       R5 R6 lt"R7 R8 lt#R9 R: lt$R# );z%Script to convert a CSV file to PSKC.)annotationsN)a2b_hex)AnyIteratorTextIO)
OutputFileVersionActionget_keyget_passworda  
supported columns:
  id, serial, secret, counter, time_offset, time_interval, interval,
  time_drift, issuer, manufacturer, response_length, algorithm
And any other properties of pskc.key.Key instances.

Report bugs to <python-pskc-users@lists.arthurdejong.org>.
Convert a CSV file to PSKC.)Zformatter_classZdescriptionepiloginputZ?ZFILEzthe CSV file to read)Znargsmetavarhelpz-Vz	--version)actionz-oz--outputz$write PSKC to file instead of stdout)r   r   z-cz	--columnszCOL|COL:LABEL,..z4list of columns or label to column mapping to importz--skip-rowsZNz9the number of rows before rows with key information start)r   typedefaultr   z-xz--setz	COL=VALUEZappendc                s&    V P                  R ^4      # )Z=split)xs   &:/usr/lib/python3.14/site-packages/pskc/scripts/csv2pskc.py<lambda>r   C   s    1773?    extra_columnsz6add an extra value that is added to all key containers)r   r   r   Zdestr   z-pz
--passwordz--passwdz	PASS/FILEz-password to use for encrypting the PSKC file)z-sz--secretzKEY/FILEz>hex encoded encryption key or a file containing the binary keyZhexZbase32base64z-ez--secret-encodingz&encoding used for reading key material)Zchoicesr   r   c               s(    V ^8  d   QhRRRRRRRR/# )   keyZstrvaluesecret_encodingreturnzbytes | str | datetime.datetime Zformat   "r   __annotate__r!   V   s)      S  s ?^ r   c                s    V R8X  d   \         V,          ! V4      # V P                  R4      '       d    \        P                  P	                  V4      # V# )z>Convert a key value read from a CSV file in a format for PSKC.secretZ_date)	encodingsZendswithdateutilparserZparse)r   r   r   s   &&&r   from_columnr&   V   sD     h)%00
||G$$U++Lr   c               s     V ^8  d   QhRRRR/# )r   	inputfiler   r   zIterator[Any]r   r   r    r   r!   r!   a   s     * *F *} *r   c                s$   Rp V P                  ^ 4        \        P                  ! 4       P                  V P	                  R4      4      pV P                  ^ 4       \        P                  ! W4      #   \
         d     L4i ; i  \         d     L4i ; i)z0Open the CSV file, trying to detect the dialect.Zexceli   )ZseekcsvZSnifferZsniffZreadZ	ExceptionZIOErrorZreader)r'   Zdialect   & r   open_csvfiler*   a   s     (/G	q	kkm)))..*>?G 	q ::i))  		  s4   B 3A0 	B 0A>;B =A>>B BBc               s    V ^8  d   QhRR/# )r   r   ZNoner   r   r    r   r!   r!   r   s     ( (d (r   c                 s   \         P                  4       p \        V P                  '       d   \	        V P                  R4      M\
        P                  4      p. pV P                  ^ 8  df   \        V4       Uu. uF"  q3P                  4       P                  RR4      NK$  	  pp\        V P                  ^,
          4       F  p\        V4       K  	  V P                  '       d   RV P                  9   dS   \        R R V P                  P                  R4       4        4       4      pV Uu. uF  qeP                  Wf4      NK  	  ppM7V P                  P                  R4       Uu. uF  q3P                  4       NK  	  pp\         P"                  ! 4       pV F  p\        V P$                  ;'       g    . 4      p	\'        W(4       FH  w  rjVP                  R4       F.  pV
'       g   K  VR9  g   K  \)        WV P*                  4      W&   K0  	  KJ  	  VP,                  ! R/ V	B  K  	  V P.                  '       d1   VP0                  P3                  \5        V P.                  4      R	7       M@V P6                  '       d/   VP0                  P9                  \;        V P6                  4      4       \=        V P>                  4      ;_uu_ 4       pVPA                  V4       R
R
R
4       R
# u upi u upi u upi   + '       g   i     R
# ; i)r	   Zr _:c              3  s   "   T F7  w  rVP                  4       P                  R R4      VP                  4       3x  K9  	  R# 5i)r+   r,   N)lowerreplace).0Zlabelr   s   &  r   	<genexpr>main.<locals>.<genexpr>   s;      <#;JE &&sC0#))+>#;s   ?Ac              3  sD   "   T F  pVP                  R 4      x  K  	  R# 5i)r-   Nr   )r0   columnr)   r   r1   r2      s#      #;"9 LL%%"9s    Z,Z+)r   N)Z Z-r   )!r%   Z
parse_argsr*   r   ZopensysZstdinZ	skip_rowsZnextr.   r/   ZrangecolumnsZdictr   ZgetpskcZPSKCr   Zzipr&   r   Zadd_keyr"   Z
encryptionZsetup_preshared_keyr   ZpasswordZsetup_pbkdf2r   r   outputZwrite)ZargsZcsvfiler5   r   r,   Zmappingr3   ZpskcfileZrowZdatar   r   r7   s                r   mainr8   r   s7    DDJJJ4

C0CIINGG~~8<WF1779$$S#.Ft~~)*AM +|||$,, <#;"&,,"4"4S"9#;< <G
 BIIv{{62GIG +/,,*<*<S*AB*AQwwy*AGByy{HD&&,,"- .MF||C(5S	1 +C8L8L MDI ) / 	 4   {{{//GDKK4H/I	((dmm)DE	DKK	 	 Fv 
!	 = G J C  
!	 	 s   6(K'K  K%?K**K;	)%Z__doc__Z
__future__r    Zargparser   r(   Zdatetimer4   Zbinasciir   Ztypingr   r   r   Zdateutil.parserr$   r6   Zpskc.scripts.utilr   r   r   r   Zstripr
   ZArgumentParserZRawDescriptionHelpFormatterr%   Zadd_argumentZintZ	b32decodeZ	b64decoder#   ZsortedZkeysr&   r*   r8   r   r   r   <module>r9      s  ( , "   
  
  ( (  6 6
 
EG  
	 	 88-f
>   3-C  E   +m  -   *f	/  1   +1	?  A   3S!	D  F   ';x	"	A  C   ,
K	8  :   *j	I  K 
7ff	
   
vinn.>'?	1  *"(r   