Accidentally, I've been signing apps with non-printable characters... Now I was trying to put Android Studio building a signed APK each time to test some things and I realized just that. Though, when I put the characters in a string (bytes \u000D
and \u000A
), it doesn't work and says Password verification failed
:
storePassword '''pass_here ''' keyAlias "alias" keyPassword '''pass_here'''
The ''' in the first and last cases is because there are characters that Gradle doesn't seem to like: $. So I found out it stops complaining if I put it in apostrophes (is it correct to do that?).
Then on the first one, when I copy the key (working key), it pastes itself like that, in a new line. I've also tried putting
storePassword = '''pass_here'''"\r\n"
I can't put \u000D and \u000A because Gradle will complain of not expecting \n there in both cases. But with \r\n it doesn't complain (saw in Google \r\n == 0D0A - that's correct, right?).
I've also tried loading a file, and with = signs (in the examples above I use no =):
android { signingConfigs { 'Non store release' { storeFile = file("C:\\Users\\DADi590\\AndroidStudioProjects\\AndroidOS\\DADOS_PESSOAIS\\keystore") def fileInputStream = new FileInputStream(file('C:\\Users\\DADi590\\AndroidStudioProjects\\AndroidOS\\DADOS_PESSOAIS\\test1.txt')) storePassword = fileInputStream.getText() fileInputStream.close() println("\\\\//"+storePassword+"\\\\//") println("\\\\//"+storePassword.getBytes("utf-8")+"\\\\//") fileInputStream = new FileInputStream(file('C:\\Users\\DADi590\\AndroidStudioProjects\\AndroidOS\\DADOS_PESSOAIS\\test2.txt')) keyAlias = fileInputStream.getText() fileInputStream.close() println("\\\\//"+keyAlias+"\\\\//") fileInputStream = new FileInputStream(file('C:\\Users\\DADi590\\AndroidStudioProjects\\AndroidOS\\DADOS_PESSOAIS\\test3.txt')) keyPassword = fileInputStream.getText() println("\\\\//"+keyPassword+"\\\\//") fileInputStream.close() } } ...........
\\//pass_here \\// \\//[70, 61, 73, 73, 5F, 68, 65, 72, 65, 13, 10]\\// --> [All but the last 2 are "pass_here" converted to bytes by me now on HxD (hex editor) just to say it has the correct bytes, including the last ones] \\//alias\\// \\//pass_here\\//
If I just copy everything and paste into the Generate Signed Bundle/APK, it works. Just it doesn't when I put it to automate the thing. Always Password verification failed
... Is it because this seems like Java and it's not cable of handling that? (????) Or maybe because Gradle is not copying non-printable characters from the strings as I guess it should?
Note: If it helps, I'm not totally familiar with Gradle syntax and I just found out about Groovy and I'm not completely sure about what it is. Will require a bit more reading tomorrow as today is getting late, but I think it probably doesn't have to do with this, it's just in case it's some idiot mistake of mine on the code there.
Please help... I'm really confused on this. I've been trying for about 2 hours now, I think, and I get nothing out of my effort hahaha.
https://stackoverflow.com/questions/65401992/non-printable-characters-in-android-apk-signing-key December 22, 2020 at 09:03AM
没有评论:
发表评论