# 'Crypto error: Unsupported key version' error while following tutorial

**URL:** https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237
**Category:** Chef Habitat
**Created:** [June 16, 2016, 4:11pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237 "2016-06-16T16:11:20Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![josqu4red](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@josqu4red](https://discourse.chef.io/u/josqu4red)
#### Post date: [June 16, 2016, 4:11pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/1 "2016-06-16T16:11:20Z")

</div>

Hi,

I have been following the tutorial under Mac OS.

When entering the studio, I get this error, following the docker image pull:

```
$ hab studio enter
   hab-studio: Creating Studio at /hab/studios/src (default)
   hab-studio: Importing amiez secret origin key
» Importing origin key from standard input
✗✗✗
✗✗✗ Crypto error: Unsupported key version: ✗✗✗
✗✗✗

```

I used my name as origin first, tried with ‘myorigin’ too, and using the -k flag with both keys, but I always get that error.  
The hab setup step went without error, I didn’t set up Github creds.

---

<div class="post-metadata">

### Author: ![metadave](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/metadave/32/1136_2.png) [@metadave](https://discourse.chef.io/u/metadave)
#### Post date: [June 17, 2016, 8:01pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/2 "2016-06-17T20:01:42Z")

</div>

Hello -

Which key did you specify when you ran

> hab setup

An easy way to tell is by listing the files in `/hab/cache/keys` or `$HOME/.hab/cache/keys` and looking for something besides `core-*`

Cheers -  
Dave

---

<div class="post-metadata">

### Author: ![josqu4red](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@josqu4red](https://discourse.chef.io/u/josqu4red)
#### Post date: [June 20, 2016, 6:26am UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/3 "2016-06-20T06:26:43Z")

</div>

I created a key named `amiez` (seen in OP’s command output) then tried with one named `myorigin` (set as default with hab setup) then tried to use both of them with -k flag, always with the same outcome.  
Keys in my .hab:

```auto
amiez-20160616154929.pub
amiez-20160616154929.sig.key
myorigin-20160616160311.pub
myorigin-20160616160311.sig.key

```

---

<div class="post-metadata">

### Author: ![metadave](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/metadave/32/1136_2.png) [@metadave](https://discourse.chef.io/u/metadave)
#### Post date: [June 20, 2016, 7:59pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/4 "2016-06-20T19:59:36Z")

</div>

> [@On another topic](https://discourse.chef.io/t/94/3):
>
> y named amiez (seen in OP's command output) then tried with one named myorigin (set as default with hab setup) then tried to use both of them with -k flag, always with the same outcome.Keys in my .hab:

That error occurs when Habitat tries to verify the content of the key that's passed in [0].  
Public signing keys _must_ start with a line containing `SIG-PUB-1`, and secret signing keys must start with a line containing `SIG-SEC-1`.

Can I see the permissions on the keys you listed above? Also, are you using bash or zsh in OSX?

Cheers -  
Dave

[0] [https://github.com/habitat-sh/habitat/blob/db0455d8a56976320b424f359eb045e2fe16dcbb/components/core/src/crypto/keys/sig\_key\_pair.rs#L363](https://github.com/habitat-sh/habitat/blob/db0455d8a56976320b424f359eb045e2fe16dcbb/components/core/src/crypto/keys/sig_key_pair.rs#L363)

---

<div class="post-metadata">

### Author: ![josqu4red](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@josqu4red](https://discourse.chef.io/u/josqu4red)
#### Post date: [June 21, 2016, 7:17am UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/5 "2016-06-21T07:17:10Z")

</div>

All 4 keys have mode 0400, and directories above are 0755.  
Both private keys are starting with `SIG-SEC-1`, and public keys with `SIG-PUB-1`.

I’m using zsh shell.

Thanks!

---

<div class="post-metadata">

### Author: ![metadave](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/metadave/32/1136_2.png) [@metadave](https://discourse.chef.io/u/metadave)
#### Post date: [June 21, 2016, 2:27pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/6 "2016-06-21T14:27:10Z")

</div>

Ok, I’m wondering if zsh is causing issues here. Can you see if this works in bash? I’ll try on my end as well.

Cheers -  
Dave

---

<div class="post-metadata">

### Author: ![josqu4red](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@josqu4red](https://discourse.chef.io/u/josqu4red)
#### Post date: [June 22, 2016, 2:32pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/7 "2016-06-22T14:32:48Z")

</div>

Unfortunately, I get the same error using bash…

---

<div class="post-metadata">

### Author: ![metadave](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/metadave/32/1136_2.png) [@metadave](https://discourse.chef.io/u/metadave)
#### Post date: [June 22, 2016, 2:47pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/8 "2016-06-22T14:47:19Z")

</div>

I didn’t find any issues with zsh vs bash either.

I just noticed that you mention `Keys in my .hab`

The path for keys is `$HOME/.hab/cache/keys` or `/hab/cache/keys` [0].

Cheers -  
Dave

[0] [https://www.habitat.sh/docs/reference/environment-vars/](https://www.habitat.sh/docs/reference/environment-vars/)

---

<div class="post-metadata">

### Author: ![metadave](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/metadave/32/1136_2.png) [@metadave](https://discourse.chef.io/u/metadave)
#### Post date: [June 22, 2016, 2:52pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/9 "2016-06-22T14:52:32Z")

</div>

can you gist the output of?

```auto
RUST_LOG=debug hab studio enter

```

Cheers -  
Dave

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/chef/original/2X/b/b9c6cc2dba194e37f0fa44a13d1ad740b99aae03.png) [@system](https://discourse.chef.io/u/system)
#### Post date: [June 24, 2016, 12:35pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/10 "2016-06-24T12:35:26Z")

</div>

I am also getting same result.  
Using habitat in CentOS 6.8

[root@chef-habitat mytutorialapp]# RUST\_LOG=debug hab studio enter  
DEBUG:hab::config: Loading CLI config from /hab/etc/cli.toml  
DEBUG:hab::command::studio: Setting default origin root via CLI config  
DEBUG:hab::exec: Calling execv: ("/hab/pkgs/core/hab-studio/0.7.0/20160614232531/bin/hab-studio") [“enter”]  
hab-studio: Creating Studio at /hab/studios/root–habitat–plans–mytutorialapp (default)  
hab-studio: Importing root secret origin key  
DEBUG:hab: clap cli args: ["/hab/pkgs/core/hab-studio/0.7.0/20160614232531/libexec/hab", “origin”, “key”, “export”, “–type”, “secret”, “root”]  
DEBUG:hab: remaining cli args: []  
DEBUG:habitat\_core::crypto::keys: checking file: core-20160612031944.pub  
DEBUG:habitat\_core::crypto::keys: valid key suffix  
DEBUG:hab: clap cli args: ["/hab/pkgs/core/hab-studio/0.7.0/20160614232531/libexec/hab", “origin”, “key”, “import”]  
DEBUG:hab: remaining cli args: []  
» Importing origin key from standard input  
✗✗✗  
✗✗✗ Crypto error: Unsupported key version: ✗✗✗  
✗✗✗

---

<div class="post-metadata">

### Author: ![metadave](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/metadave/32/1136_2.png) [@metadave](https://discourse.chef.io/u/metadave)
#### Post date: [June 24, 2016, 2:28pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/11 "2016-06-24T14:28:53Z")

</div>

Hi Vikas -

It looks like the code that’s exporting the key into the studio can’t find your root keys.  
Can you respond with the output of `ls -la` in `/hab/cache/keys` and `$HOME/.hab/cache/keys`?

Additionally, can you paste the “origin” value from `/hab/etc/cli.toml`? Note, this file may contain your Github auth key, so careful with copy/pasting in a public forum.

Cheers -  
Dave

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/chef/original/2X/b/b9c6cc2dba194e37f0fa44a13d1ad740b99aae03.png) [@system](https://discourse.chef.io/u/system)
#### Post date: [June 27, 2016, 11:49am UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/12 "2016-06-27T11:49:03Z")

</div>

Hello Dave.

```ruby
ls -la /hab/cache/keys
total 12
drwxr-xr-x. 2 root root 4096 Jun 24 13:13 .
drwxr-xr-x. 6 root root 4096 Jun 24 13:13 ..
-rw-r--r--. 1 root root 75 Jun 24 13:13 core-20160612031944.pub

```

```ruby
ls -la $HOME/.hab/cache/keys
ls: cannot access /root/.hab/cache/keys: No such file or directory

```

```ruby
cat /hab/etc/cli.toml
origin = "root"

```

I am missing something? I am following [https://www.habitat.sh/tutorials/getting-started-create-plan/](https://www.habitat.sh/tutorials/getting-started-create-plan/)

I ran `"hab setup"` with:  
**Origin name** = root  
**Key for origin** = _nil_  
**Github access token** = _nil_

Thanks,  
Vikas

---

<div class="post-metadata">

### Author: ![metadave](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/metadave/32/1136_2.png) [@metadave](https://discourse.chef.io/u/metadave)
#### Post date: [June 27, 2016, 1:24pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/13 "2016-06-27T13:24:29Z")

</div>

Hello Vikas -

I forgot to ask, can you run those commands in OSX instead of the Linux container?

Cheers -  
Dave

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/chef/original/2X/b/b9c6cc2dba194e37f0fa44a13d1ad740b99aae03.png) [@system](https://discourse.chef.io/u/system)
#### Post date: [June 28, 2016, 2:11pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/14 "2016-06-28T14:11:11Z")

</div>

Sorry Dave, I do not have OSX.

Also, just FYI.

While setting up habitat and before running **make** command I had to install:  
**libsodium**  
**libarchive**

On both ubuntu 14.04 and CentOS 6.8

Will this be a good idea to document it for ease of others? Just asking, it may not be that important or trivial step/understood.

Thanks,  
Vikas

---

<div class="post-metadata">

### Author: ![metadave](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/metadave/32/1136_2.png) [@metadave](https://discourse.chef.io/u/metadave)
#### Post date: [June 28, 2016, 2:32pm UTC](https://discourse.chef.io/t/crypto-error-unsupported-key-version-error-while-following-tutorial/12237/15 "2016-06-28T14:32:53Z")

</div>

Hello Vikas -

The team is using an Ubuntu container in Docker with this configuration [0], which we should add to the README at some point. I’ll make a note to do so, or I’ll happily review a PR if you beat me to it 🙂

Cheers -  
Dave

[0] [https://github.com/habitat-sh/habitat/blob/master/Dockerfile](https://github.com/habitat-sh/habitat/blob/master/Dockerfile)
