美文网首页
android系统签名导入到android studio

android系统签名导入到android studio

作者: 辉色投像 | 来源:发表于2020-10-12 09:18 被阅读0次

If you sign your app with platform key, you can get system permissions. such as like below.

<!-- Allows applications to call into AccountAuthenticators.

<p>Not for use by third-party applications. -->

<permission android:name="android.permission.ACCOUNT_MANAGER"

    android:protectionLevel="signature" />

Or, you can set your UserId to "android.uid.system" meaning the "android" package. because your app is signed with platform key.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="my.app"

    android:sharedUserId="android.uid.system">

The ways introduced here are only available in the android emulator, not for devices sold in the market.

You need to get 2 files in "build/target/product/security" in AOSP sources.

platform.x509.pem

platform.pk8

You can sign your app with these files or you can generate "jsk" file and use it in Android Studio when you sign it.

1.

If you get platform.pk8, app-debug.apk, then you need to download the tool called Apk Sign. You can download signapk.jar

java -jar signapk.jar platform.x509.pem platform.pk8 app-unsigned.apk app-signed.apk

2. (验证OK)

Generate jks file

Type below commands to created a jks file called platform.jks.

openssl pkcs8 -inform DER -nocrypt -in platform.pk8 -out platform.key

openssl pkcs12 -export -in platform.x509.pem -inkey platform.key -name platform -out platform.pem -password pass:android

第三步有两种写法,后一种是标准的:

keytool -importkeystore -destkeystore platform.jks -deststorepass android -srckeystore platform.pem -srcstoretype PKCS12 -srcstorepass android

keytool -importkeystore -srckeystore platform.jks -destkeystore platform.jks -deststoretype pkcs12 -srckeystore platform.pem -deststorepass android -srcstorepass android

You can register this jks file in Android Studio and use it to sign an app.

In the above commands, key alias, key store password and key password are defined as follows. Of course, you can change these.

key store password: android

key alias: platform

key password: android

相关文章

网友评论

      本文标题:android系统签名导入到android studio

      本文链接:https://www.haomeiwen.com/subject/vnhupktx.html