File: test_keyformailbox.cpp

package info (click to toggle)
libkf5libkleo 4%3A22.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,156 kB
  • sloc: cpp: 23,523; ansic: 279; makefile: 14; sh: 3
file content (34 lines) | stat: -rw-r--r-- 869 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
    test_keyformailbox.cpp

    This file is part of libkleopatra's test suite.
    SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik
    SPDX-FileContributor: Intevation GmbH

    SPDX-License-Identifier: GPL-2.0-only
*/

#include <qgpgme/keyformailboxjob.h>
#include <qgpgme/protocol.h>

#include <gpgme++/key.h>
#include <gpgme++/keylistresult.h>

#include <QDebug>

int main(int argc, char **argv)
{
    QString mailbox;
    if (argc == 2) {
        mailbox = QString::fromLocal8Bit(argv[1]);
    }

    const auto proto = QGpgME::openpgp();
    auto *job = proto->keyForMailboxJob();
    GpgME::Key k;
    GpgME::UserID uid;
    job->exec(mailbox, true, k, uid);
    qDebug() << "UID Name: " << uid.name() << " Mail: " << uid.email() << " id: " << uid.id();
    qDebug() << "Key fpr: " << k.primaryFingerprint();
    return 0;
}