Importing secret keys via gpgme-json

Patrick Brunschwig patrick at enigmail.net
Thu May 13 15:58:44 CEST 2021


Werner Koch wrote on 10.05.2021 19:08:
> On Sun,  9 May 2021 11:53, Patrick Brunschwig said:
> 
>> Importing public keys works as expected, but it seems that for secret
>> keys, only the public key part is imported. Is there an option to allow
>> importing secret keys or is importing of secret keys not supported?
> 
> Unless you have specific gpg import options, it should just work.
> If in doubt, build gpgme and test with tests/run-import or run
> 
>  GPGME_DEBUG=7:gpgme.log ./gpgme-json 
> 
> and check the log file.  It might however, be easier to put
> 
>  log-file /some-file
> 
> into gpg.conf to see gpg's diagnostics.  GPGME also has an audit feature
> which can be used to get the gpg diagnostics; I am not sure whether
> gpgme-json supports this, though.

2021-05-13 15:53:58 gpg[2481] DBG: cache_user_id: already in cache
2021-05-13 15:53:58 gpg[2481] error getting the KEK: Forbidden
2021-05-13 15:53:58 gpg[2481] error reading '-&10': Forbidden
2021-05-13 15:53:58 gpg[2481] import from '-&10' failed: Forbidden
2021-05-13 15:53:58 gpg[2481] Total number processed: 0
2021-05-13 15:53:58 gpg[2481]               imported: 1
2021-05-13 15:53:58 gpg[2481]       secret keys read: 1
2021-05-13 15:53:58 gpg[2481] keydb: handles=3 locks=2 parse=2 get=2
2021-05-13 15:53:58 gpg[2481]        build=1 update=0 insert=1 delete=0
2021-05-13 15:53:58 gpg[2481]        reset=1 found=2 not=1 cache=0 not=0

I have attached the complete log, but I think this is the most relevant
part of it. Apparently, reading from -&10 does not seem to work.

-Patrick

-------------- next part --------------
2021-05-13 15:53:58 gpg[2481] enabled debug flags: packet filter cache memstat trust extprog
2021-05-13 15:53:58 gpg[2481] keybox '/tmp/.gnupgTesteoACpC5n/pubring.kbx' created
2021-05-13 15:53:58 gpg[2481] DBG: armor-filter: control: 1
2021-05-13 15:53:58 gpg[2481] DBG: armor-filter: control: 3
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=2): type=5 length=1862 (parse.../../g10/import.c.930)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=2): type=13 length=43 (parse.../../g10/import.c.930)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=2): type=2 length=590 (parse.../../g10/import.c.930)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=2): type=7 length=1862 (parse.../../g10/import.c.930)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=2): type=2 length=566 (parse.../../g10/import.c.930)
2021-05-13 15:53:58 gpg[2481] DBG: armor-filter: control: 3
2021-05-13 15:53:58 gpg[2481] DBG: armor-filter: control: 2
2021-05-13 15:53:58 gpg[2481] DBG: public key 781617319CE311C4: timestamp: 2015-05-04 16:17:31 (1430756251)
2021-05-13 15:53:58 gpg[2481] DBG: user id: anonymous strike <strike.devtest at gmail.com>
2021-05-13 15:53:58 gpg[2481] DBG:   sig: class: 0x13, issuer: 781617319CE311C4, timestamp: 2018-07-23 15:53:35 (1532361215), digest: 56 71
2021-05-13 15:53:58 gpg[2481] DBG:     Good signature over last key or uid!
2021-05-13 15:53:58 gpg[2481] DBG: subkey D535623BB60E9E71: timestamp: 2015-05-04 16:17:31 (1430756251)
2021-05-13 15:53:58 gpg[2481] DBG:   sig: class: 0x18, issuer: 781617319CE311C4, timestamp: 2018-07-23 15:53:56 (1532361236), digest: 40 98
2021-05-13 15:53:58 gpg[2481] DBG:     Good signature over last key or uid!
2021-05-13 15:53:58 gpg[2481] DBG: keydb_search: reset  (hd=0x0000560420e210f0)
2021-05-13 15:53:58 gpg[2481] DBG: keydb: kid_not_found_flush
2021-05-13 15:53:58 gpg[2481] DBG: build_packet() type=6
2021-05-13 15:53:58 gpg[2481] DBG: build_packet() type=13
2021-05-13 15:53:58 gpg[2481] DBG: build_packet() type=2
2021-05-13 15:53:58 gpg[2481] DBG: build_packet() type=14
2021-05-13 15:53:58 gpg[2481] DBG: build_packet() type=2
2021-05-13 15:53:58 gpg[2481] /tmp/.gnupgTesteoACpC5n/trustdb.gpg: trustdb created
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=8): type=6 length=525 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=8): type=12 length=12 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=8): type=13 length=43 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=8): type=12 length=12 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=8): type=2 length=590 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=8): type=12 length=6 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=8): type=14 length=525 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=8): type=2 length=566 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=8): type=12 length=6 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] key 781617319CE311C4: public key "anonymous strike <strike.devtest at gmail.com>" imported
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=9): type=6 length=525 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=9): type=12 length=12 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=9): type=13 length=43 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=9): type=12 length=12 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=9): type=2 length=590 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=9): type=12 length=6 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=9): type=14 length=525 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=9): type=2 length=566 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: parse_packet(iob=9): type=12 length=6 (parse.../../g10/keydb.c.1257)
2021-05-13 15:53:58 gpg[2481] DBG: cache_user_id: already in cache
2021-05-13 15:53:58 gpg[2481] error getting the KEK: Forbidden
2021-05-13 15:53:58 gpg[2481] error reading '-&10': Forbidden
2021-05-13 15:53:58 gpg[2481] import from '-&10' failed: Forbidden
2021-05-13 15:53:58 gpg[2481] Total number processed: 0
2021-05-13 15:53:58 gpg[2481]               imported: 1
2021-05-13 15:53:58 gpg[2481]       secret keys read: 1
2021-05-13 15:53:58 gpg[2481] keydb: handles=3 locks=2 parse=2 get=2
2021-05-13 15:53:58 gpg[2481]        build=1 update=0 insert=1 delete=0
2021-05-13 15:53:58 gpg[2481]        reset=1 found=2 not=1 cache=0 not=0
2021-05-13 15:53:58 gpg[2481] kid_not_found_cache: count=0 peak=0 flushes=0
2021-05-13 15:53:58 gpg[2481] sig_cache: total=8 cached=6 good=6 bad=0
2021-05-13 15:53:58 gpg[2481] random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
              outmix=0 getlvl1=0/0 getlvl2=0/0
2021-05-13 15:53:58 gpg[2481] rndjent stat: collector=0x0000000000000000 calls=0 bytes=0
2021-05-13 15:53:58 gpg[2481] secmem usage: 0/65536 bytes in 0 blocks


More information about the Gnupg-devel mailing list