
    	                     6    S r SSKrSSKJr  SSKJr  SSKrS rg)z,Helpers for parsing key files in pem format.    N)
exceptions)filesc                    [         R                  " U 5      nSU;   a  UR                  SSS5      nUR                  SSS5      nSU;   a&  [        R                  " SSR                  U 5      5      e UR                  SS5      R                  SS5      n[        R                  " [        R                  " U5      5      n[        R                  " U5      nXB:w  a  [        S	5      e SR                  UR                  S5      R                  5       5      S-   $ [        R                  " SS5      e! [         a+  n[        R                  " SS
R                  X5      5      eSnAff = f)zReads, validates, and returns the public key in PEM encoding within a file.

Args:
  public_key_file: A public key file handle that contains a PEM encoded public
    key.

Returns:
  The public key in PEM encoding.
s   -----BEGIN PUBLIC KEY-----       s   -----END PUBLIC KEY-----public_key_filez7Cannot place multiple public keys in the same file : {}      
zNon-base64 digit found.zIRecognized {} as a PEM encoded public key, but failed during parsing : {}N
asciiz%Missing PEM public key header in file)r   ReadBinaryFileContentsreplacer   BadArgumentExceptionformatbase64	b64decodesixensure_binary	b64encode
ValueError	Exceptionjoindecode
splitlines)r   datapublickeyb64decodedencodedes         *lib/googlecloudsdk/command_lib/kms/pems.pyGetPemPublicKeyr!      sQ    
	%	%o	6$"d*<< =sAFL''(CS!LL$4++

C
J
J !))%5==eSIl  !2!2<!@Ag  )g		 233 
! 99T[[)4467$>>

)
)B   ++
 &4 s   0A2D+ +
E 5&EE )__doc__r   googlecloudsdk.callioper   googlecloudsdk.core.utilr   r   r!    r   r    <module>r&      s    3  . * 
&r   