mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-09 10:19:39 +02:00
Do not trim passphrases automatically
This commit is contained in:
parent
0ee31b232a
commit
9b0a3cd4c7
1 changed files with 8 additions and 6 deletions
|
@ -11,14 +11,9 @@ import org.bouncycastle.util.Arrays
|
|||
*
|
||||
* @param chars may be null for empty passwords.
|
||||
*/
|
||||
class Passphrase(chars: CharArray?) {
|
||||
class Passphrase(private val chars: CharArray?) {
|
||||
private val lock = Any()
|
||||
private var valid = true
|
||||
private val chars: CharArray?
|
||||
|
||||
init {
|
||||
this.chars = trimWhitespace(chars)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a copy of the underlying char array. A return value of null represents an empty
|
||||
|
@ -67,6 +62,13 @@ class Passphrase(chars: CharArray?) {
|
|||
|
||||
override fun hashCode(): Int = getChars()?.let { String(it) }.hashCode()
|
||||
|
||||
/**
|
||||
* Return a copy of this [Passphrase], but with whitespace characters trimmed off.
|
||||
*
|
||||
* @return copy with trimmed whitespace
|
||||
*/
|
||||
fun withTrimmedWhitespace(): Passphrase = Passphrase(trimWhitespace(chars))
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue