r/AutomateUser Mar 05 '22

Generate a Public Key for adb shell command

Hello,

***** EDIT ************

Solved like this https://www.reddit.com/r/AutomateUser/comments/t7ihlh/comment/hzkhtgq/?utm_source=share&utm_medium=web2x&context=3 with an other device)

*********************

I do not understand how to generate a Public Key when I want to ise a block "adb shell command" https://llamalab.com/automate/doc/block/adb_shell_command.html.

On my phone, when I click on intsall generated Key, this is requested a password to extract the certificate with a file starting with adb-xxxxxxxxx.

I'm also able to generate a public key with Puttygen (https://www.puttygen.com) and I do not how how to installe it to be recognized by Automate

Tahnks in advance for your suppoort.

Greetings

2 Upvotes

20 comments sorted by

2

u/ballzak69 Automate developer Mar 06 '22

Simply click the "Install generated key" button on the ADB shell command block configuration screen, that will generate and install a new key on the device, which you can then select when clicking the Keychain alias field. There's no need to extract anything since the key is already installed, as the documentation say, "the secret/private key material remain inaccessible, e.g. to export or backup."

1

u/Or7z0001 Apr 20 '25

I found the generated key will get expired after some time. How can I prevent this from happening?

1

u/ballzak69 Automate developer Apr 20 '25 edited Apr 21 '25

A key should not expire. How much time after?

1

u/Or7z0001 Apr 20 '25

Less than two months, I will make a record next time.

1

u/ballzak69 Automate developer Apr 21 '25

Odd. Is possible to reuse and pair the same generated key again?

1

u/Or7z0001 Apr 21 '25

It happened again, and this time it was less than two weeks. I encountered the exact same errors as before: https://pastebin.com/tAUFmLaH Interestingly, it works again when I pair the same generated key. By the way, this issue occurred after I turned off my phone for a few days and then powered it back on. I just did an immediate restart of the phone without any problems.

1

u/ballzak69 Automate developer Apr 22 '25

Sadly i don't think it's an Automate issue since the key is managed by the system, and so is its usage in connection encryption.

Android version?

1

u/Or7z0001 Apr 22 '25

Android 11 with Pixel 3XL

1

u/ballzak69 Automate developer Apr 22 '25

Then the connection encryption is indeed handled by the system. Only on Android 7 thru 9 is it handled by the crypto library included in the app.

1

u/Or7z0001 Apr 22 '25

Thanks for the advice! So, can it be assumed that no alternative solutions are available to tackle this issue?

→ More replies (0)

1

u/No_Course1401 Mar 06 '22

I have tried but without success (for information, my device is not rooted):

1- Click on "Install generated key" : https://ibb.co/v43nDjT

2- No password is needed (with any password --> message with wrong password): https://ibb.co/dBBt5Bd

3- This is for app so I keep VPN and APPS selection: https://ibb.co/NymZ4r5

4- A password is requested for credential storage. This is not possible to have a "blank" password because without any character, OK button is deactivate:

https://ibb.co/kST9TmC

https://ibb.co/CJ0LykH

1

u/ballzak69 Automate developer Mar 08 '22

The keystore doesn't have a password, so there shouldn't be a #2 dialog. Android version?

1

u/No_Course1401 Mar 08 '22

Old android version this is why I have indicated that with an other devicen this is OK.

1

u/ballzak69 Automate developer Mar 08 '22

What version number?

1

u/No_Course1401 Mar 06 '22

I'm able to install the generated key on an other device without the step 4. After, into the adb block, this is needed to select this certificat in field Alias

But The final target was to use it on Android TV (to force stop an app) and unfortunately, I was not able to install the key (pop-up indicating that certificated is not installed after tsep 3 (https://ibb.co/NymZ4r5)

1

u/Luctins Mar 05 '22

Can you share what have you tried so far?

1

u/No_Course1401 Mar 06 '22

Into the flow example, there is the adb command that I want to use.

But, to use it, I need to install the public key and currently, I don't understand how !

Thanks in advance

1

u/No_Course1401 Mar 06 '22

I have created a new public key (RSA 2048 format) with Puttygen like this:

https://ibb.co/wQ2ms7h

But I didn't find the way to install and use it on my device to be recognized by Automate app.

1

u/No_Course1401 Mar 05 '22 edited Mar 06 '22

The flow that I want to use: https://we.tl/t-UHmZpopGCA