# Error gen\_key\_pair('secp256k1')

**URL:** <https://community.zymbit.com/t/error-gen-key-pair-secp256k1/1038>\
**Category:** ZYMKEY4\
**Created:** [December 10, 2020, 9:25am UTC](https://community.zymbit.com/t/error-gen-key-pair-secp256k1/1038 "2020-12-10T09:25:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bradders](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@bradders](https://community.zymbit.com/u/bradders)\
**Post date:** [December 10, 2020, 9:25am UTC](https://community.zymbit.com/t/error-gen-key-pair-secp256k1/1038/1 "2020-12-10T09:25:49Z")

</div>

Hi

I am trying to use the gen\_key\_pair method from the python documentation and I am getting an error.

I am using the following code: zymkey.client.gen\_key\_pair(‘secp256k1’)  
The key\_type was found in the codebase as it is not documented so I am not sure if I am using the correct key\_type.

The error is:  
File “/usr/local/lib/python2.7/dist-packages/zymkey/module.py”, line 582, in gen\_key\_pair  
raise AssertionError(‘bad return code %d’ % ret)  
AssertionError: bad return code -1

Can anybody help please?

---

<div class="post-metadata">

**Author:** ![Bob\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@Bob\_of\_Zymbit](https://community.zymbit.com/u/Bob_of_Zymbit)\
**Post date:** [December 10, 2020, 5:29pm UTC](https://community.zymbit.com/t/error-gen-key-pair-secp256k1/1038/2 "2020-12-10T17:29:16Z")

</div>

@bradders -

Unfortunately, that also is not supported in the current product. It will be supported in the HSM6 product early 2021. Apologies that the python api doc needs updating. You can check function/method support in the C or C++ API document(s) for now.

> [@API Documentation](https://community.zymbit.com/t/api-documentation/189):
>
> API DOCUMENTATION Documentation is updated from time to time. Be sure to clear your browser cache so that you get the latest version. The latest API documentation can be found on line at: [https://docs.zymbit.com/](https://docs.zymbit.com/quickstart/api/)play_button Legacy PDF documents

---

<div class="post-metadata">

**Author:** ![sanish](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@sanish](https://community.zymbit.com/u/sanish)\
**Post date:** [February 23, 2021, 10:41am UTC](https://community.zymbit.com/t/error-gen-key-pair-secp256k1/1038/3 "2021-02-23T10:41:52Z")

</div>

Is there no way we can generate a new key pair in Zykey 4i? Which zymbit product has this feature?

---

<div class="post-metadata">

**Author:** ![Bob\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@Bob\_of\_Zymbit](https://community.zymbit.com/u/Bob_of_Zymbit)\
**Post date:** [February 23, 2021, 3:41pm UTC](https://community.zymbit.com/t/error-gen-key-pair-secp256k1/1038/4 "2021-02-23T15:41:26Z")

</div>

@sanish - With the Zymkey, there are three private keys that remain in hardware from which you can generate a public key. The public key can also be saved to a file. This gives you a Public/Private key pair in which there is no way for someone to view the private key, unlike a software key that resides on a filesystem. See get\_public\_key() and create\_public\_key\_file() in our API (python) doc.

We are close to releasing our HSM6 product which provides the same private key store and also allows the user to generate up to 512 of their own Public/Private key pairs. It also has storage for up to 128 foreign key pairs.

Regards,

Bob

---

<div class="post-metadata">

**Author:** ![sanish](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@sanish](https://community.zymbit.com/u/sanish)\
**Post date:** [February 24, 2021, 1:22am UTC](https://community.zymbit.com/t/error-gen-key-pair-secp256k1/1038/5 "2021-02-24T01:22:29Z")

</div>

Hi Bob,

I did not understand what you meant about generating a public key from private key. My requirement from a keystore is to generate a new private and public key pair and replace it with old key pair, once in a day. Please confirm, if zymkey 4i has this capability or not. If not, then the api gen\_key\_pair is misleading, or atleast in documentation it should explicitly be mentioned that it is not supported.

Regards  
Sanish

---

<div class="post-metadata">

**Author:** ![Bob\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@Bob\_of\_Zymbit](https://community.zymbit.com/u/Bob_of_Zymbit)\
**Post date:** [February 24, 2021, 1:48am UTC](https://community.zymbit.com/t/error-gen-key-pair-secp256k1/1038/6 "2021-02-24T01:48:41Z")

</div>

Hello Sanish,

The Zymkey 4i does not have the capability to do what you are asking. There are 3 private keys pre-programmed in manufacturing and you cannot change them. You would need the HSM6 which we are close to making available.

The documentation for gen\_key\_pair() references “(model \>= HSM6)”, meaning it is not supported on the Zymkey or the HSM4; it requires an HSM6 or other future products. Thank you for the input that this is misleading. We will try and make that more clear in the future.

Bob
