܍~cH|dZddlZddlmZddlmZejeZgdZ dZ dZ dd Z dd Z d ZddZdS)z0gpg.py - Collection of gpg key related functionsN)log)subp)gpgz--with-fingerprintz--no-default-keyringz --list-keysz --keyringc tjddd|gd\}}n:#tj$r(}td||d}Yd}~nd}~wwxYw|S)z*Export gpg key, armoured key gets returnedrz--exportz--armourTcapture&Failed to export armoured key "%s": %sN)rProcessExecutionErrorLOGdebug)keyarmour_errors //usr/lib/python3/dist-packages/cloudinit/gpg.py export_armourrsi J C 0$     % :CGGG Ms AAAc>tjddg|djS)z~Dearmor gpg key, dearmored key gets returned note: man gpg(1) makes no mention of an --armour spelling, only --armor rz --dearmorF)datadecode)rstdout)r s rdearmorr's# 9e[)E B B B IIFcg}|t|s|d||tj|d\}}|rtd|||S)zList keys from a keyring with fingerprints. Default to a stable machine parseable format. @param key_file: a string containing a filepath to a key @param human_output: return output intended for human parsing z --with-colonsTrr )extendGPG_LISTappendrr warning)key_file human_outputcmdrstderrs rlistr"/s CJJx $ ?###JJxyd333VV P  Iw =t        %>>> 0#u=========>sAAAkeyserver.ubuntu.comc t|}|sq t||t|}n*#t$rtd|wxYw t |n#t |wxYw|S)zget gpg keyid from keyserver)r-zFailed to obtain gpg key %s)rr3r,r exceptionr5)keyidr-rs r getkeybyidr:}s 5 ! !F    Ui 0 0 0 0"5))FF    MM7 ? ? ?    u    Ju     Ms 4A/'AA//B)F)r#)r6)__doc__r) cloudinitrloggingr getLogger__name__r rrrr"r3r5r:rrrAs76 $$$$$$g!!      JJJ&....b>>>r