> For the complete documentation index, see [llms.txt](https://docs.aiot.virbox.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aiot.virbox.com/faq/shi-yong-keytool-gong-ju-sheng-cheng-qian-ming.md).

# 使用 Keytool 工具生成签名

**使用 keytool 工具创建 keystore**

keytool 是 jdk 自带的生成 keystore 的工具，可以 $JAVA\_HOME/bin 下找到

```
keytool -genkey -storepass "pass123" -alias "mygame" -keypass "pass123" \
-keystore release.keystore -keyalg RSA -keysize 2048 -validity 10000
```

{% hint style="info" %}
:reminder\_ribbon:**温馨提示**：双引号不可省略！如果省略引号，可能会有下面这个错误
{% endhint %}

```
keytool error: java.security.UnrecoverableKeyException: Cannot recover key
```

根据提示输入相应信息，即可创建 release.keystore 成功。

**创建 debug 用 keystore**

如果使用 eclipse 打包，因为其 custom debug keystore 中的 alias 和 keypass 都需要特定的值才能自动识别。我们需要创建一个debug.keystore，用于eclipse 的打包。

```
keytool -importkeystore -v -srckeystore release.keystore -destkeystore debug.keystore -srcstorepass pass123 -deststorepass android -srcalias mygame -destalias androiddebugkey -srckeypass pass123 -destkeypass android

```
