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

Hotfix for password checking fail #3027

Merged
merged 2 commits into from
Mar 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import org.json.JSONObject
import java.io.File
import java.net.URI
import java.net.URISyntaxException
import java.util.function.Consumer

/**
* This class sets up environment for ss-local.
Expand All @@ -50,13 +51,15 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
"cipher ${profile.method} is deprecated."
}
// check the key format for aead-2022-cipher
require(profile.method !in setOf(
"2022-blake3-aes-128-gcm",
"2022-blake3-aes-256-gcm",
"2022-blake3-chacha20-poly1305",
) || Base64.decode(profile.password, Base64.DEFAULT).size in arrayOf(16, 32)) {
"The Base64 Key is invalid."
}
profile.password.split(":").forEach(Consumer {
dev4u marked this conversation as resolved.
Show resolved Hide resolved
require(profile.method !in setOf(
"2022-blake3-aes-128-gcm",
"2022-blake3-aes-256-gcm",
"2022-blake3-chacha20-poly1305",
) || Base64.decode(it, Base64.DEFAULT).size in arrayOf(16, 32)) {
"The Base64 Key is invalid."
}
})
}

private var configFile: File? = null
Expand Down