use of org.xwiki.crypto.password.internal.kdf.ScryptKDFParams in project xwiki-commons by xwiki.
the class BcScryptKeyDerivationFunctionFactory method getInstance.
@Override
public KeyDerivationFunction getInstance(ASN1Encodable parameters) {
KeyDerivationFunc kdf = KeyDerivationFunc.getInstance(parameters);
if (!kdf.getAlgorithm().equals(ALG_ID)) {
throw new IllegalArgumentException("Illegal algorithm identifier for Scrypt: " + kdf.getAlgorithm().getId());
}
ScryptKDFParams params = ScryptKDFParams.getInstance(kdf.getParameters());
return getInstance(new ScryptParameters((params.getKeyLength() != null) ? params.getKeyLength().intValue() : -1, params.getCostParameter().intValue(), params.getParallelizationParameter().intValue(), params.getBlockSize().intValue(), params.getSalt()));
}
Aggregations