Skip to content

Provide way to sign package/bundle with custom keyfile without writing passphrase to log #3513

@mungojam

Description

@mungojam

When I run msbuild with /t:SignAndroidPackage and provide a custom keystore, the keystore and key passwords end up being written out to the build log because it logs the call made to jarsigner / apksigner.

I wanted to prevent the passwords being written to the log, so I have ended up doing the signing as a separate step. In this step I make use of the :env the suffix in jarsigner or the env: prefix in apksigner before I switched to bundles.

Below is what my build looks like now. AndroidSigning_StorePass is an environment variable that I populate in a pre-build step with the password:

    commands:
       - msbuild MyProj/MyProj.csproj /restore
         /p:Configuration=Release
         /p:AndroidSdkDirectory=/android/sdk
         /t:Package
       - jarsigner -sigalg SHA256withRSA -digestalg SHA-256
         -keystore ../my.keystore
         -keypass:env AndroidSigning_StorePass
         -storepass:env AndroidSigning_StorePass
         -signedjar ./MyProj/bin/Release/com.me.myapp-Signed.aab
         ./MyProj/obj/Release/android/bin/com.me.myapp.aab $AndroidSigning_KeyAlias

The above seems to work fine, but it took a lot of effort to get there. It would be better if I could use the standard build target but still keep the sensitive data out of the log. Then I wouldn't need to do the custom signing and could benefit from any future tweaks that you put in the standard build target.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions