1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

パスフレーズ無しのプラットフォームキーを出力する

Posted at

目的

APKファイルの署名にはJKS形式のキーストア(.keystore)を使用するが,Androidプラットフォームのビルド時にAPKファイルへ署名するには,PKCS#8形式の秘密鍵(.pk8)とPEM形式のx509証明書(.x509.pem)を使用する.
ここではデフォルトの設定で署名されるキーストア(debug.keystore)を用いてプラットフォームキーを作成する.

筆者の環境

Windows10 64bit
JDK 1.8.0 (8u171)
OpenSSL

出力方法

JKS形式(.keystore) からPKCS#12形式(.p12) へ変換する.
keytool -importkeystore -srckeystore debug.keystore -destkeystore keystore.p12 -srcstoretype jks -deststoretype pkcs12

PKCS#12形式(.p12)からPEM形式(pem)に変換する.
openssl pkcs12 -in keystore.p12 -out keystore.pem

PEM形式(.pem)からPCKS#8形式(.pk8)を出力する.
openssl pkcs8 -in keystore.pem -outform DER -out private.pk8 -topk8 -nocrypt

PEM形式(.pem)からPEM形式のx509証明書(.x509.pem)を出力する.
openssl x509 -inform PEM -in keystore.pem -outform PEM -out cert.x509.pem

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?