# Check Which GPG Slots Are In Use

**URL:** <https://onlykey.discourse.group/t/check-which-gpg-slots-are-in-use/537>\
**Category:** SSH, OpenPGP, GPG\
**Created:** [November 5, 2021, 12:14am UTC](https://onlykey.discourse.group/t/check-which-gpg-slots-are-in-use/537 "2021-11-05T00:14:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bettyvschmartz](https://yyz2.discourse-cdn.com/free1/user_avatar/onlykey.discourse.group/bettyvschmartz/32/81_2.png) [@bettyvschmartz](https://onlykey.discourse.group/u/bettyvschmartz)\
**Post date:** [November 5, 2021, 12:14am UTC](https://onlykey.discourse.group/t/check-which-gpg-slots-are-in-use/537/1 "2021-11-05T00:14:21Z")

</div>

Is it possible to use `onlykey-cli` to output which GPG key slots are used?

– bvs

---

<div class="post-metadata">

**Author:** ![t11](https://avatars.discourse-cdn.com/v4/letter/t/8e7dd6/32.png) [@t11](https://onlykey.discourse.group/u/t11)\
**Post date:** [November 5, 2021, 2:52am UTC](https://onlykey.discourse.group/t/check-which-gpg-slots-are-in-use/537/2 "2021-11-05T02:52:43Z")

</div>

No, but there is not a direct command. You can set key labels to describe the keys in each slot manually when setting them. You can also tell if a key is in a slot with this command:

```auto
onlykey-agent identity@myhost -sk ECC2

```

If a public key is returned a key is set in the slot, if not an error stating no key is set is returned.

---

<div class="post-metadata">

**Author:** ![bettyvschmartz](https://yyz2.discourse-cdn.com/free1/user_avatar/onlykey.discourse.group/bettyvschmartz/32/81_2.png) [@bettyvschmartz](https://onlykey.discourse.group/u/bettyvschmartz)\
**Post date:** [December 29, 2021, 12:29pm UTC](https://onlykey.discourse.group/t/check-which-gpg-slots-are-in-use/537/3 "2021-12-29T12:29:07Z")

</div>

In newer versions this causes and error `invalid int value` so it looks like ECC is the default and only the slot number is needed as;

```auto
onlykey-agent identity@myhost -sk 2

```

Unless RSA is used then I guess the `-e` flag is needed.

– bvs

---

<div class="post-metadata">

**Author:** ![bettyvschmartz](https://yyz2.discourse-cdn.com/free1/user_avatar/onlykey.discourse.group/bettyvschmartz/32/81_2.png) [@bettyvschmartz](https://onlykey.discourse.group/u/bettyvschmartz)\
**Post date:** [December 29, 2021, 12:33pm UTC](https://onlykey.discourse.group/t/check-which-gpg-slots-are-in-use/537/4 "2021-12-29T12:33:06Z")

</div>

On reflection this doesn’t work properly. Seems buggy.

As above, if I provide a slot (say 0) I get the pub key then other times I get `Public key curve does not match requested type`. I can also provide another slot and sometimes I get the same pub key returned as in slot 0 and other times I get the error.

– bvs

---

<div class="post-metadata">

**Author:** ![t11](https://avatars.discourse-cdn.com/v4/letter/t/8e7dd6/32.png) [@t11](https://onlykey.discourse.group/u/t11)\
**Post date:** [December 29, 2021, 3:44pm UTC](https://onlykey.discourse.group/t/check-which-gpg-slots-are-in-use/537/5 "2021-12-29T15:44:31Z")

</div>

The syntax has changed so the key name is used (RSA2) instead of number (2). The command would be:

```auto
onlykey-agent user@host -e rsa -sk RSA2

```

---

<div class="post-metadata">

**Author:** ![bettyvschmartz](https://yyz2.discourse-cdn.com/free1/user_avatar/onlykey.discourse.group/bettyvschmartz/32/81_2.png) [@bettyvschmartz](https://onlykey.discourse.group/u/bettyvschmartz)\
**Post date:** [December 29, 2021, 4:01pm UTC](https://onlykey.discourse.group/t/check-which-gpg-slots-are-in-use/537/6 "2021-12-29T16:01:48Z")

</div>

Sorry, I don’t understand your response.

To recap, I have an ECC key and this doesn’t work:

> [@t11](#):
>
> `onlykey-agent identity@myhost -sk ECC2`

The error is `invalid int value`.

– bvs

---

<div class="post-metadata">

**Author:** ![bettyvschmartz](https://yyz2.discourse-cdn.com/free1/user_avatar/onlykey.discourse.group/bettyvschmartz/32/81_2.png) [@bettyvschmartz](https://onlykey.discourse.group/u/bettyvschmartz)\
**Post date:** [December 29, 2021, 4:06pm UTC](https://onlykey.discourse.group/t/check-which-gpg-slots-are-in-use/537/7 "2021-12-29T16:06:06Z")

</div>

OK, pulled the latest `onlykey-agent` and this works now. I obviously wasn’t getting these latest syntax changes.

– bvs
