3 \�me � @ sr d Z ddlZddlZddlmZ eje�ZdddddgZd d � Z dd� Z ddd�Zddd�Zdd� Z ddd�ZdS )z0gpg.py - Collection of gpg key related functions� N)�subp�gpgz--with-fingerprintz--no-default-keyringz--list-keysz --keyringc C sZ yt j ddd| gdd�\}}W n6 t jk rT } ztjd| |� d}W Y dd}~X nX |S )z*Export gpg key, armoured key gets returnedr z--exportz--armourT)�capturez&Failed to export armoured key "%s": %sN)r �ProcessExecutionError�LOG�debug)�key�armour�_�error� r �/usr/lib/python3.6/gpg.py� export_armour s r c C s t j ddg| dd�jS )z~Dearmor gpg key, dearmored key gets returned note: man gpg(1) makes no mention of an --armour spelling, only --armor r z --dearmorF)�data�decode)r �stdout)r r r r �dearmor'