万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    Androidのキーストア生成(Weex)

    まずは、 platforms/android/app/build.gradleapplicationId "com.weex.app"を修正。

    https://alligator.io/vuejs/getting-started-vue-weex/

    https://docs.oracle.com/cd/E19416-01/820-5959/ggezu/index.html これ見た。

    keytool -genkey -v -keystore my-release-key.jks
    Enter keystore password:
    Re-enter new password:
    They don't match. Try again
    Enter keystore password:
    Re-enter new password:
    What is your first and last name?
      [Unknown]:  Sugita
    What is the name of your organizational unit?
      [Unknown]:  shinriyo
    What is the name of your organization?
      [Unknown]:  shinriyo
    What is the name of your City or Locality?
      [Unknown]:  Tokyo
    What is the name of your State or Province?
      [Unknown]:  Toshima
    What is the two-letter country code for this unit?
      [Unknown]:  JP
    Is CN=Sugita, OU=shinriyo, O=shinriyo, L=Tokyo, ST=Toshima, C=JP correct?
      [no]:  no

    再度

    What is your first and last name?
      [Sugita]:  shinriyo.com
    What is the name of your organizational unit?
      [shinriyo]:  Development
    What is the name of your organization?
      [shinriyo]:  shinriyo
    What is the name of your City or Locality?
      [Tokyo]:  Toshima-ku
    What is the name of your State or Province?
      [Toshima]:  Tokyo
    What is the two-letter country code for this unit?
      [JP]:  JP
    Is CN=shinriyo.com, OU=Development, O=shinriyo, L=Toshima-ku, ST=Tokyo, C=JP correct?
      [no]:  yes
    
    Generating 2,048 bit DSA key pair and self-signed certificate (SHA256withDSA) with a validity of 90 days
        for: CN=shinriyo.com, OU=Development, O=shinriyo, L=Toshima-ku, ST=Tokyo, C=JP
    Enter key password for <mykey>
        (RETURN if same as keystore password):
    Re-enter new password:
    They don't match. Try again
    Enter key password for <mykey>
        (RETURN if same as keystore password):
    Re-enter new password:
    [Storing my-release-key.jks]
    
    Warning:
    The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore my-release-key.jks -destkeystore my-release-key.jks -deststoretype pkcs12".

    警告??

    出たコマンドをそのまま

    keytool -importkeystore -srckeystore my-release-key.jks -destkeystore my-release-key.jks -deststoretype pkcs12

    すると

    Enter source keystore password:
    9Entry for alias mykey successfully imported.
    Import command completed:  1 entries successfully imported, 0 entries failed or cancelled
    
    Warning:
    Migrated "my-release-key.jks" to Non JKS/JCEKS. The JKS keystore is backed up as "my-release-key.jks.old".

    な感じで、my-release-key.jks.oldというバックアップと、新たにmy-release-key.jksが生成される。

    cd release/android この中にapp-release-unsigned.apkがある。

    jarsigner -verbose -keystore my-release-key.jks app-release-unsigned.apk something
    jarsigner: Certificate chain not found for: something.  something must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.

    もしかしてsomethingって書いたのがキーだった?任意ではないのか。

    jarsigner -verbose -keystore .keystore app-release-unsigned.apk my-release-key.jks
    Enter Passphrase for keystore:
    jarsigner error: java.lang.RuntimeException: keystore load: /Users/shinriyo/development/weex_apps/bignumbers/release/android/.keystore (No such file or directory)

    う??違った。

    StatkOverflowを見る https://stackoverflow.com/questions/23750259/certificate-chain-not-found-how-to-fix-and-publish-to-google-play-store

    my-release-key.jksというキーストアに対して、このエイリアス名を確認するこのコマンドを実行してみる。

    keytool -keystore my-release-key.jks -list -v
    Enter keystore password:
    Keystore type: PKCS12
    Keystore provider: SUN
    
    Your keystore contains 1 entry
    
    Alias name: mykey

    ズラズラーーーー

    ってmykeyってなんだよw これがデフォルトのエイリアスの名前か?

    こいつをsomethingの代わりに指定

    jarsigner -verbose -keystore my-release-key.jks app-release-unsigned.apk mykey
    Warning:
    The signer's certificate is self-signed.
    The signer certificate will expire within six months.
    No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2019-02-04) or after any future revocation date.

    警告ーーーー 面倒なので無視。

    最適化。

    zipalign -v 4 app-release-unsigned.apk app-release-optimized-unsigned.apk

    app-release-optimized-unsigned.apkができる。

    が、adb installでインストールするとエラー

    結局こっちが参考 https://terryblog.net/generate-apk-on-cordova-239

    鍵生成、署名、最適化 でほぼそのままw