Dedicated class for crypto parameters
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
|
||||
namespace OCA\UserSQL\Crypto;
|
||||
|
||||
use OCA\UserSQL\Model\CryptoParam;
|
||||
use OCP\IL10N;
|
||||
|
||||
/**
|
||||
@@ -106,18 +107,14 @@ class CryptArgon2 extends AbstractAlgorithm
|
||||
public function configuration()
|
||||
{
|
||||
return [
|
||||
[
|
||||
"name" => "memoryCost", "visible_name" => "Memory cost (KiB)",
|
||||
"default" => PASSWORD_ARGON2_DEFAULT_MEMORY_COST, "min" => 1, "max" => 1048576
|
||||
],
|
||||
[
|
||||
"name" => "timeCost", "visible_name" => "Time cost",
|
||||
"default" => PASSWORD_ARGON2_DEFAULT_TIME_COST, "min" => 1, "max" => 1024
|
||||
],
|
||||
[
|
||||
"name" => "threads", "visible_name" => "Threads",
|
||||
"default" => PASSWORD_ARGON2_DEFAULT_THREADS, "min" => 1, "max" => 1024
|
||||
]
|
||||
new CryptoParam(
|
||||
"Memory cost (KiB)", PASSWORD_ARGON2_DEFAULT_MEMORY_COST, 1,
|
||||
1048576
|
||||
),
|
||||
new CryptoParam(
|
||||
"Time cost", PASSWORD_ARGON2_DEFAULT_TIME_COST, 1, 1024
|
||||
),
|
||||
new CryptoParam("Threads", PASSWORD_ARGON2_DEFAULT_THREADS, 1, 1024)
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
namespace OCA\UserSQL\Crypto;
|
||||
|
||||
use OCA\UserSQL\Model\CryptoParam;
|
||||
use OCP\IL10N;
|
||||
|
||||
/**
|
||||
@@ -72,12 +73,7 @@ class CryptBlowfish extends AbstractAlgorithm
|
||||
*/
|
||||
public function configuration()
|
||||
{
|
||||
return [
|
||||
[
|
||||
"name" => "cost", "visible_name" => "Cost", "default" => 10,
|
||||
"min" => 4, "max" => 31
|
||||
]
|
||||
];
|
||||
return [new CryptoParam("Cost", 10, 4, 31)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
namespace OCA\UserSQL\Crypto;
|
||||
|
||||
use OCA\UserSQL\Model\CryptoParam;
|
||||
use OCP\IL10N;
|
||||
|
||||
/**
|
||||
@@ -53,12 +54,7 @@ class CryptExtendedDES extends AbstractCrypt
|
||||
*/
|
||||
public function configuration()
|
||||
{
|
||||
return [
|
||||
[
|
||||
"name" => "iterations", "visible_name" => "Iterations", "default" => 1000,
|
||||
"min" => 0, "max" => 16777215
|
||||
]
|
||||
];
|
||||
return [new CryptoParam("Iterations", 1000, 0, 16777215)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
namespace OCA\UserSQL\Crypto;
|
||||
|
||||
use OCA\UserSQL\Model\CryptoParam;
|
||||
use OCP\IL10N;
|
||||
|
||||
/**
|
||||
@@ -54,12 +55,7 @@ class CryptSHA256 extends AbstractCrypt
|
||||
*/
|
||||
public function configuration()
|
||||
{
|
||||
return [
|
||||
[
|
||||
"name" => "rounds", "visible_name" => "Rounds", "default" => 5000,
|
||||
"min" => 1000, "max" => 999999999
|
||||
]
|
||||
];
|
||||
return [new CryptoParam("Rounds", 5000, 1000, 999999999)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
namespace OCA\UserSQL\Crypto;
|
||||
|
||||
use OCA\UserSQL\Model\CryptoParam;
|
||||
use OCP\IL10N;
|
||||
|
||||
/**
|
||||
@@ -54,12 +55,7 @@ class CryptSHA512 extends AbstractCrypt
|
||||
*/
|
||||
public function configuration()
|
||||
{
|
||||
return [
|
||||
[
|
||||
"name" => "rounds", "visible_name" => "Rounds", "default" => 5000,
|
||||
"min" => 1000, "max" => 999999999
|
||||
]
|
||||
];
|
||||
return [new CryptoParam("Rounds", 5000, 1000, 999999999)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,8 +61,7 @@ interface IPasswordAlgorithm
|
||||
|
||||
/**
|
||||
* Configuration for the algorithm.
|
||||
* The return array should contain entries which define keys:
|
||||
* name, visible_name, default, min, max.
|
||||
* The return array should contain entries of class <code>CryptoParam</code>
|
||||
*
|
||||
* @return array The configuration array.
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
namespace OCA\UserSQL\Crypto;
|
||||
|
||||
use OCA\UserSQL\Model\CryptoParam;
|
||||
use OCP\IL10N;
|
||||
|
||||
/**
|
||||
@@ -160,12 +161,7 @@ class Phpass extends AbstractAlgorithm
|
||||
*/
|
||||
public function configuration()
|
||||
{
|
||||
return [
|
||||
[
|
||||
"name" => "iterations", "visible_name" => "Iterations (log2)",
|
||||
"default" => 8, "min" => 4, "max" => 31
|
||||
]
|
||||
];
|
||||
return [new CryptoParam("Iterations (log2)", 8, 4, 31)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user