#include "handler.ih"

void Handler::publicKey() const
{
    CinInserter inserter(CinInserter::CLOSE_STD);
    inserter.execute("/usr/bin/gpg --import");

    inserter << cin.rdbuf();

    if (inserter.stop() != 0)
        throw Exception{REPLY} << "`/usr/bin/gpg --import: could not "
                         "import public key (sent by " << d_from << ')';

    log() << "Added public key (sent by " << d_from << ") to the keyring\n";
}
