| 43 | |
| 44 | [[br]] |
| 45 | == generate keys chain to sign `apk` by `apkmanager` |
| 46 | [https://roostertech.wordpress.com/2013/10/31/exporting-private-key-pk8-jks/ original] |
| 47 | {{{#!bash |
| 48 | keytool \ |
| 49 | -genkey -v \ |
| 50 | -keystore android.keystore \ |
| 51 | -storepass android \ |
| 52 | -alias androiddebugkey \ |
| 53 | -keypass android \ |
| 54 | -keyalg RSA \ |
| 55 | -keysize 2048 \ |
| 56 | -validity 10000 \ |
| 57 | -dname "C=US, O=Android, CN=Android" |
| 58 | keytool \ |
| 59 | -importkeystore \ |
| 60 | -srckeystore android.keystore \ |
| 61 | -srcstoretype JKS \ |
| 62 | -srcstorepass android \ |
| 63 | -destkeystore android.p12 \ |
| 64 | -deststoretype PKCS12 \ |
| 65 | -storepass android |
| 66 | openssl pkcs12 \ |
| 67 | -nodes \ |
| 68 | -in android.p12 \ |
| 69 | -out android.crt |
| 70 | openssl pkcs8 \ |
| 71 | -topk8 \ |
| 72 | -outform DER \ |
| 73 | -in android.crt \ |
| 74 | -inform PEM \ |
| 75 | -out android-private.pk8 \ |
| 76 | -nocrypt |
| 77 | }}} |