Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base64: invalid input #17

Open
codingjeremy opened this issue Sep 10, 2019 · 1 comment
Open

base64: invalid input #17

codingjeremy opened this issue Sep 10, 2019 · 1 comment
Labels
migrated googlesamples Migrated from old googlesamples repos

Comments

@codingjeremy
Copy link
Contributor

Issue by Drjacky
Tuesday Jun 25, 2019 at 15:35 GMT
Originally opened as googlearchive/android-credentials#40


When I use iTerm2 terminal and work with the file, it shows:

base64: invalid input

But still generating some part of a wrong certificate in hex and generating a wrong SMS Retriever hash code as well.
But when I use regular Terminal, it works well.

A sample wrong output:

➜  Desktop ./sms_retriever_hash_v9.sh --package com.example.test --keystore /path/keystore.jks

package name: com.example.test
keystore file: /path/keystore.jks

File /path/keystore.jks is found.

Enter keystore password:  password
base64: invalid input

certificate in hex: 328202c5308201ada00362010202043d1336f8300d06092a864486f70d01010b050030133111300f0603550403430853

SHA-256 output in hex: bf0ae40bf16485b2320765f3c824e263dfba8d09ec46307d6b4dd3153cfbc287

First 8 bytes encoded by base64: ywrkS/HkhbI

SMS Retriever hash code:  ywrkS/HkhbI

Machine: Mac OS 10.14.5
iTerm2 version: 3.2.9

@codingjeremy
Copy link
Contributor Author

Comment by Drjacky
Wednesday Jul 03, 2019 at 16:50 GMT


Please add --ignore-garbage to the command:

# Retrieve certificate from keystore file. Decoded with Base64 and converted to hex
cert=$(keytool -list -rfc -keystore $keystore | sed  -e '1,/BEGIN/d' | sed -e '/END/,$d' | tr -d ' \n' | base64 --decode --ignore-garbage | xxd -p | tr -d ' \n')

So it can solve the invalid input error in some terminals, like iTerm2.

https://gitlab.com/gnachman/iterm2/issues/7912

@codingjeremy codingjeremy added the migrated googlesamples Migrated from old googlesamples repos label Sep 18, 2019
@ashnohe ashnohe closed this as completed Mar 28, 2024
@ashnohe ashnohe reopened this Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
migrated googlesamples Migrated from old googlesamples repos
Projects
None yet
Development

No branches or pull requests

2 participants