protected IteratedPasswordAlgorithmSpec engineDecode(final ASN1Decoder decoder) { return new IteratedPasswordAlgorithmSpec(decoder.decodeInteger().intValue()); } }
BSDUnixDESCryptPasswordImpl(final char[] password, final IteratedPasswordAlgorithmSpec spec) throws InvalidKeySpecException, InvalidParameterSpecException { this(password, ThreadLocalRandom.current().nextInt() & 0xffffff, spec.getIterationCount()); }
MaskedPasswordImpl(final String algorithm, final char[] clearPassword, final IteratedPasswordAlgorithmSpec parameterSpec) throws InvalidKeySpecException { this(algorithm, DEFAULT_PBE_KEY, parameterSpec.getIterationCount(), PasswordUtil.generateRandomSalt(DEFAULT_SALT_SIZE), clearPassword); }
final IteratedPasswordAlgorithmSpec generateParameters = new IteratedPasswordAlgorithmSpec( max(minimumIterationCount, min(maximumIterationCount, ScramDigestPassword.DEFAULT_ITERATION_COUNT)) );
protected void engineEncode(final ASN1Encoder encoder, final IteratedPasswordAlgorithmSpec parameterSpec) { encoder.encodeInteger(parameterSpec.getIterationCount()); }
protected IteratedPasswordAlgorithmSpec engineDecode(final ASN1Decoder decoder) { return new IteratedPasswordAlgorithmSpec(decoder.decodeInteger().intValue()); } }
ScramDigestPasswordImpl(final String algorithm, final char[] password, final IteratedPasswordAlgorithmSpec spec) throws InvalidKeySpecException, NoSuchAlgorithmException, InvalidKeyException { this(algorithm, password, PasswordUtil.generateRandomSalt(DEFAULT_SALT_SIZE), spec.getIterationCount()); }
protected IteratedPasswordAlgorithmSpec engineDecode(final ASN1Decoder decoder) { return new IteratedPasswordAlgorithmSpec(decoder.decodeInteger().intValue()); } }
SunUnixMD5CryptPasswordImpl(final String algorithm, final char[] password, final IteratedPasswordAlgorithmSpec spec) throws NoSuchAlgorithmException { this(algorithm, password, PasswordUtil.generateRandomSalt(DEFAULT_SALT_SIZE), spec.getIterationCount()); }
protected IteratedPasswordAlgorithmSpec engineDecode(final ASN1Decoder decoder) { return new IteratedPasswordAlgorithmSpec(decoder.decodeInteger().intValue()); } }
BCryptPasswordImpl(final char[] password, final IteratedPasswordAlgorithmSpec spec) throws InvalidKeySpecException { this.salt = PasswordUtil.generateRandomSalt(BCRYPT_SALT_SIZE); this.iterationCount = spec.getIterationCount(); this.hash = bcrypt(this.iterationCount, this.salt, getNormalizedPasswordBytes(password)); }
final IteratedPasswordAlgorithmSpec generateParameters = new IteratedPasswordAlgorithmSpec( max(minimumIterationCount, min(maximumIterationCount, ScramDigestPassword.DEFAULT_ITERATION_COUNT)) );
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec) { Assert.checkNotNullParam("parameterSpec", parameterSpec); if (parameterSpec instanceof IteratedSaltedPasswordAlgorithmSpec) { final IteratedSaltedPasswordAlgorithmSpec spec = (IteratedSaltedPasswordAlgorithmSpec) parameterSpec; // iteration count has to match exactly since it's not flexible for this algorithm return ITERATION_COUNT == spec.getIterationCount() && Arrays.equals(getSalt(), spec.getSalt()); } else if (parameterSpec instanceof SaltedPasswordAlgorithmSpec) { return Arrays.equals(getSalt(), ((SaltedPasswordAlgorithmSpec) parameterSpec).getSalt()); } else if (parameterSpec instanceof IteratedPasswordAlgorithmSpec) { // iteration count has to match exactly since it's not flexible for this algorithm return ITERATION_COUNT == ((IteratedPasswordAlgorithmSpec) parameterSpec).getIterationCount(); } else { return false; } }
final IteratedPasswordAlgorithmSpec generateParameters = new IteratedPasswordAlgorithmSpec( max(minimumIterationCount, min(maximumIterationCount, ScramDigestPassword.DEFAULT_ITERATION_COUNT)) );
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec) { Assert.checkNotNullParam("parameterSpec", parameterSpec); if (parameterSpec instanceof IteratedSaltedPasswordAlgorithmSpec) { final IteratedSaltedPasswordAlgorithmSpec spec = (IteratedSaltedPasswordAlgorithmSpec) parameterSpec; return getIterationCount() <= spec.getIterationCount() && Arrays.equals(getSalt(), spec.getSalt()); } else if (parameterSpec instanceof SaltedPasswordAlgorithmSpec) { return Arrays.equals(getSalt(), ((SaltedPasswordAlgorithmSpec) parameterSpec).getSalt()); } else if (parameterSpec instanceof IteratedPasswordAlgorithmSpec) { return getIterationCount() <= ((IteratedPasswordAlgorithmSpec) parameterSpec).getIterationCount(); } else { return false; } }
final IteratedPasswordAlgorithmSpec generateParameters = new IteratedPasswordAlgorithmSpec( max(minimumIterationCount, min(maximumIterationCount, ScramDigestPassword.DEFAULT_ITERATION_COUNT)) );
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec) { Assert.checkNotNullParam("parameterSpec", parameterSpec); if (parameterSpec instanceof IteratedSaltedPasswordAlgorithmSpec) { final IteratedSaltedPasswordAlgorithmSpec spec = (IteratedSaltedPasswordAlgorithmSpec) parameterSpec; return getIterationCount() <= spec.getIterationCount() && Arrays.equals(getSalt(), spec.getSalt()); } else if (parameterSpec instanceof SaltedPasswordAlgorithmSpec) { return Arrays.equals(getSalt(), ((SaltedPasswordAlgorithmSpec) parameterSpec).getSalt()); } else if (parameterSpec instanceof IteratedPasswordAlgorithmSpec) { return getIterationCount() <= ((IteratedPasswordAlgorithmSpec) parameterSpec).getIterationCount(); } else { return false; } }
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec) { Assert.checkNotNullParam("parameterSpec", parameterSpec); if (parameterSpec instanceof IteratedSaltedPasswordAlgorithmSpec) { final IteratedSaltedPasswordAlgorithmSpec spec = (IteratedSaltedPasswordAlgorithmSpec) parameterSpec; return getIterationCount() <= spec.getIterationCount() && Arrays.equals(getSalt(), spec.getSalt()); } else if (parameterSpec instanceof SaltedPasswordAlgorithmSpec) { return Arrays.equals(getSalt(), ((SaltedPasswordAlgorithmSpec) parameterSpec).getSalt()); } else if (parameterSpec instanceof IteratedPasswordAlgorithmSpec) { return getIterationCount() <= ((IteratedPasswordAlgorithmSpec) parameterSpec).getIterationCount(); } else { return false; } }
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec) { Assert.checkNotNullParam("parameterSpec", parameterSpec); if (parameterSpec instanceof IteratedSaltedPasswordAlgorithmSpec) { final IteratedSaltedPasswordAlgorithmSpec spec = (IteratedSaltedPasswordAlgorithmSpec) parameterSpec; return getIterationCount() <= spec.getIterationCount() && Arrays.equals(getSalt(), spec.getSalt()); } else if (parameterSpec instanceof SaltedPasswordAlgorithmSpec) { return Arrays.equals(getSalt(), ((SaltedPasswordAlgorithmSpec) parameterSpec).getSalt()); } else if (parameterSpec instanceof IteratedPasswordAlgorithmSpec) { return getIterationCount() <= ((IteratedPasswordAlgorithmSpec) parameterSpec).getIterationCount(); } else { return false; } }
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec) { Assert.checkNotNullParam("parameterSpec", parameterSpec); if (parameterSpec instanceof IteratedSaltedPasswordAlgorithmSpec) { final IteratedSaltedPasswordAlgorithmSpec spec = (IteratedSaltedPasswordAlgorithmSpec) parameterSpec; return getIterationCount() <= spec.getIterationCount() && Arrays.equals(getParameterSpec().getSalt(), spec.getSalt()); } else if (parameterSpec instanceof SaltedPasswordAlgorithmSpec) { return Arrays.equals(getParameterSpec().getSalt(), ((SaltedPasswordAlgorithmSpec) parameterSpec).getSalt()); } else if (parameterSpec instanceof IteratedPasswordAlgorithmSpec) { return getIterationCount() <= ((IteratedPasswordAlgorithmSpec) parameterSpec).getIterationCount(); } else { return false; } }