o
    ʛ\j[                     @  st   d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl	m
Z
 edZedZdddZedkr8ee dS )z5Create the external Ed25519 App Pack signing keypair.    )annotationsN)Path)serialization)Ed25519PrivateKeyz>/var/www/html/.platform-signing/wordpress-app-pack-ed25519.pemzB/var/www/html/.platform-signing/wordpress-app-pack-ed25519.pub.pemreturnintc                  C  sD  t  st rttdtt ttd dS t jjdddd t	
 } | tjjtjjt }|  tjjtjj}tt tjtjB tjB d}t|d}|| W d    n1 scw   Y  tttjtjB tjB d	}t|d}|| W d    n1 sw   Y  ttd
tt ttd dS )Nexists)statusprivate_pathpublic_pathr   i  T)modeparentsexist_oki  wbi  created)PRIVATE_PATHr   PUBLIC_PATHprintjsondumpsstrparentmkdirr   generateprivate_bytesr   EncodingPEMPrivateFormatPKCS8NoEncryption
public_keypublic_bytesPublicFormatSubjectPublicKeyInfoosopenO_WRONLYO_CREATO_EXCLfdopenwrite)keyr   r!   
private_fdstream	public_fd r/   $scripts/init_app_pack_signing_key.pymain   s0   r1   __main__)r   r   )__doc__
__future__r   r   r$   pathlibr   cryptography.hazmat.primitivesr   1cryptography.hazmat.primitives.asymmetric.ed25519r   r   r   r1   __name__
SystemExitr/   r/   r/   r0   <module>   s   

