Date
Dec. 22nd, 2024
 
2024年 11月 22日

Post: Android: 在 Mac 中生成 keystore

Android: 在 Mac 中生成 keystore

Published 12:10 Oct 26, 2015.

Created by @ezra. Categorized in #Programming, and tagged as #Android.

Source format: Markdown

Table of Content

在 Mac 中生成 keystore 其实也很简单, 虽然 Android Studio 中有这个功能, 但不少小伙伴还在用 eclipse 呢。

打开终端进入 Java 安装路径

cd /Library/Java/Home/bin/

生成到指定路径

keytool -genkey -v -keystore android.keystore -alias android -keyalg RSA -validity 20000 -keystore 指定路径/文件名.keystore

例如, 生成到我的桌面, ~/Desktop/demo.keystore:

keytool -genkey -v -keystore android.keystore -alias android -keyalg RSA -validity 20000 -keystore /Users/Meniny/Desktop/demo.keystore

按照提示输入

$ cd /Library/Java/Home/bin/
$ keytool -genkey -v -keystore android.keystore -alias android -keyalg RSA -validity 20000 -keystore /Users/Meniny/Desktop/demo.keystore
Enter keystore password:
Re-enter new password:
What is your first and last name?
  [Unknown]:  Ezra
What is the name of your organizational unit?
  [Unknown]:  meniny.cn
What is the name of your organization?
  [Unknown]:  Meniny Inc
What is the name of your City or Locality?
  [Unknown]:  Beijing
What is the name of your State or Province?
  [Unknown]:  Beijing
What is the two-letter country code for this unit?
  [Unknown]:  86
Is CN=Ezra, OU=meniny.cn, O=Meniny Inc, L=Beijing, ST=Beijing, C=86 correct?
  [no]:  y

Generating 1,024 bit RSA key pair and self-signed certificate (SHA1withRSA) with a validity of 20,000 days
    for: CN=Ezra, OU=meniny.cn, O=Meniny Inc, L=Beijing, ST=Beijing, C=86
Enter key password for <android>
    (RETURN if same as keystore password):
[Storing /Users/Meniny/Desktop/demo.keystore]

至此,我们的 keystore 文件已经生成。

Pinned Message
HOTODOGO
The Founder and CEO of Infeca Technology.
Developer, Designer, Blogger.
Big fan of Apple, Love of colour.
Feel free to contact me.
反曲点科技创始人和首席执行官。
开发、设计与写作皆为所长。
热爱苹果、钟情色彩。
随时恭候 垂询